@automattic/charts 1.8.0 → 1.9.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/index.cjs +541 -84
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.css +122 -34
  5. package/dist/index.d.cts +97 -7
  6. package/dist/index.d.ts +97 -7
  7. package/dist/index.js +539 -87
  8. package/dist/index.js.map +1 -1
  9. package/package.json +8 -8
  10. package/src/charts/area-chart/area-chart.module.scss +3 -1
  11. package/src/charts/area-chart/area-chart.tsx +5 -2
  12. package/src/charts/bar-chart/bar-chart.module.scss +6 -2
  13. package/src/charts/bar-chart/bar-chart.tsx +29 -22
  14. package/src/charts/bar-chart/private/comparison-bars.tsx +7 -0
  15. package/src/charts/bar-chart/private/use-bar-chart-options.ts +4 -1
  16. package/src/charts/bar-chart/test/bar-chart.test.tsx +141 -3
  17. package/src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss +15 -12
  18. package/src/charts/geo-chart/geo-chart.tsx +6 -1
  19. package/src/charts/geo-chart/test/geo-chart.test.tsx +11 -1
  20. package/src/charts/heatmap-chart/heatmap-chart.module.scss +103 -0
  21. package/src/charts/heatmap-chart/heatmap-chart.tsx +422 -0
  22. package/src/charts/heatmap-chart/index.ts +4 -0
  23. package/src/charts/heatmap-chart/private/build-calendar-data.ts +81 -0
  24. package/src/charts/heatmap-chart/private/heatmap-legend.tsx +53 -0
  25. package/src/charts/heatmap-chart/private/index.ts +5 -0
  26. package/src/charts/heatmap-chart/private/use-heatmap-colors.ts +45 -0
  27. package/src/charts/heatmap-chart/test/build-calendar-data.test.ts +88 -0
  28. package/src/charts/heatmap-chart/test/heatmap-chart.test.tsx +301 -0
  29. package/src/charts/heatmap-chart/test/use-heatmap-colors.test.ts +34 -0
  30. package/src/charts/heatmap-chart/types.ts +42 -0
  31. package/src/charts/index.ts +1 -0
  32. package/src/charts/leaderboard-chart/leaderboard-chart.module.scss +18 -6
  33. package/src/charts/line-chart/line-chart.module.scss +6 -4
  34. package/src/charts/line-chart/line-chart.tsx +6 -2
  35. package/src/charts/line-chart/private/line-chart-annotation.tsx +16 -3
  36. package/src/charts/private/grid-control/grid-control.module.scss +1 -4
  37. package/src/charts/private/svg-empty-state/svg-empty-state.module.scss +1 -1
  38. package/src/charts/private/with-responsive/test/with-responsive.test.tsx +14 -0
  39. package/src/charts/private/with-responsive/with-responsive.tsx +12 -0
  40. package/src/charts/private/x-zoom.module.scss +6 -3
  41. package/src/components/legend/private/base-legend.module.scss +3 -1
  42. package/src/components/tooltip/base-tooltip.module.scss +4 -1
  43. package/src/components/trend-indicator/trend-indicator.module.scss +5 -3
  44. package/src/hooks/use-xychart-theme.ts +24 -0
  45. package/src/index.ts +12 -0
  46. package/src/providers/chart-context/themes.ts +29 -16
  47. package/src/types.ts +19 -2
  48. package/src/utils/color-utils.ts +36 -0
  49. package/src/utils/test/color-utils.test.ts +33 -0
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { getStringWidth as getStringWidth$1 } from "./visx/text/index.js";
2
2
  import { formatNumber, formatNumberCompact } from "@automattic/number-formatters";
3
3
  import { AnimatedAreaSeries, AnimatedAreaStack, AreaSeries, Axis, BarGroup, BarSeries, DataContext, Grid, Tooltip, TooltipContext, XYChart, buildChartTheme } from "@visx/xychart";
4
- import { __ } from "@wordpress/i18n";
4
+ import { __, sprintf } from "@wordpress/i18n";
5
5
  import clsx from "clsx";
6
6
  import * as React from "react";
7
7
  import { Children, Fragment, Fragment as Fragment$2, createContext, createContext as createContext$1, createElement, forwardRef, forwardRef as forwardRef$1, forwardRef as forwardRef$2, 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: "#FFFFFF",
709
+ backgroundColor: "var(--wpds-color-bg-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: "#DCDCDE",
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: { stroke: "black" },
726
+ xTickLineStyles: {
727
+ stroke: "var(--wpds-color-stroke-surface-neutral, #dbdbdb)",
728
+ strokeWidth: 1
729
+ },
698
730
  xAxisLineStyles: {
699
- stroke: "#DCDCDE",
731
+ stroke: "var(--wpds-color-stroke-surface-neutral, #dbdbdb)",
700
732
  strokeWidth: 1
701
733
  },
702
734
  legend: {
703
- labelStyles: { color: "var(--jp-gray-80, #2c3338)" },
735
+ labelStyles: { color: "var(--wpds-color-fg-content-neutral, #1e1e1e)" },
704
736
  containerStyles: {},
705
737
  shapeStyles: []
706
738
  },
707
739
  seriesLineStyles: [],
708
740
  glyphs: [],
709
741
  svgLabelSmall: {
710
- fill: "var(--jp-gray-80, #2c3338)",
742
+ fill: "var(--wpds-color-fg-content-neutral, #1e1e1e)",
711
743
  fontFamily: "inherit"
712
744
  },
713
745
  svgLabelBig: { fontFamily: "inherit" },
714
746
  annotationStyles: {
715
747
  label: {
716
- anchorLineStroke: "var(--jp-gray-80, #2c3338)",
717
- backgroundFill: "#fff"
748
+ anchorLineStroke: "var(--wpds-color-fg-content-neutral, #1e1e1e)",
749
+ backgroundFill: "var(--wpds-color-bg-surface-neutral-strong, #fff)"
718
750
  },
719
- connector: { stroke: "var(--jp-gray-80, #2c3338)" },
751
+ connector: { stroke: "var(--wpds-color-fg-content-neutral, #1e1e1e)" },
720
752
  circleSubject: {
721
753
  stroke: "transparent",
722
- fill: "var(--jp-gray-80, #2c3338)",
754
+ fill: "var(--wpds-color-fg-content-neutral, #1e1e1e)",
723
755
  radius: 5
724
756
  }
725
757
  },
726
- geoChart: { featureFillColor: "var(--jp-gray-0, #f6f7f7)" },
758
+ geoChart: { featureFillColor: "var(--wpds-color-bg-surface-neutral-weak, #f4f4f4)" },
727
759
  leaderboardChart: {
728
760
  rowGap: 12,
729
761
  columnGap: 4,
730
762
  labelSpacing: "xs",
731
763
  deltaColors: [
732
- "#FF8C8F",
733
- "#757575",
734
- "#1F9828"
764
+ "var(--wpds-color-fg-content-error-weak, #cc1818)",
765
+ "var(--wpds-color-fg-content-neutral-weak, #707070)",
766
+ "var(--wpds-color-fg-content-success-weak, #008030)"
735
767
  ]
736
768
  },
737
769
  conversionFunnelChart: {
738
- backgroundColor: "#F3F4F6",
739
- positiveChangeColor: "#1F9828",
740
- negativeChangeColor: "#FF8C8F"
770
+ backgroundColor: "var(--wpds-color-bg-surface-neutral-weak, #f4f4f4)",
771
+ positiveChangeColor: "var(--wpds-color-fg-content-success-weak, #008030)",
772
+ negativeChangeColor: "var(--wpds-color-fg-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
  };
@@ -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, { ...styles?.connector }),
3334
- subjectType === "circle" && /* @__PURE__ */ jsx(CircleSubject, { ...styles?.circleSubject }),
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: providerTheme.backgroundColor,
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,
@@ -4470,7 +4540,7 @@ function useBarChartOptions(data, horizontal, options = {}) {
4470
4540
  if (typeof v === "number" && Number.isFinite(v)) allValues.push(v);
4471
4541
  });
4472
4542
  });
4473
- if (allValues.length > 0) valueScaleDomainOverride = { domain: [Math.min(...allValues), Math.max(...allValues)] };
4543
+ if (allValues.length > 0) valueScaleDomainOverride = { domain: [Math.min(0, ...allValues), Math.max(0, ...allValues)] };
4474
4544
  }
4475
4545
  }
4476
4546
  const xScale = {
@@ -4649,6 +4719,7 @@ const ComparisonBars = ({ comparisonEntries, primaryKeys, groupPadding, horizont
4649
4719
  return /* @__PURE__ */ jsx("g", {
4650
4720
  className: "bar-chart__comparison-bars",
4651
4721
  pointerEvents: "none",
4722
+ "aria-hidden": "true",
4652
4723
  children: rects
4653
4724
  });
4654
4725
  };
@@ -4660,6 +4731,10 @@ const validateData$2 = (data) => {
4660
4731
  return null;
4661
4732
  };
4662
4733
  const getPatternId = (chartId, index) => `bar-pattern-${chartId}-${index}`;
4734
+ const renderTooltipRow = (label, value) => /* @__PURE__ */ jsx("div", {
4735
+ className: bar_chart_module_default["bar-chart__tooltip-row"],
4736
+ children: sprintf(__("%1$s: %2$s", "jetpack-charts"), label, value)
4737
+ });
4663
4738
  const BarChartInternal = ({ data, chartId: providedChartId, width, height, className, margin, withTooltips = false, showLegend = false, legend = {}, gridVisibility: gridVisibilityProp, renderTooltip, options = {}, orientation = "vertical", withPatterns = false, showZeroValues = false, animation, children, gap = "md" }) => {
4664
4739
  const legendInteractive = legend.interactive ?? false;
4665
4740
  const horizontal = orientation === "horizontal";
@@ -4713,6 +4788,7 @@ const BarChartInternal = ({ data, chartId: providedChartId, width, height, class
4713
4788
  }, [seriesWithVisibility]);
4714
4789
  const primaryEntries = useMemo(() => seriesWithVisibility.filter(({ isVisible, series }) => isVisible && series.options?.type !== "comparison"), [seriesWithVisibility]);
4715
4790
  const primaryKeys = useMemo(() => primaryEntries.map(({ series }) => series.label), [primaryEntries]);
4791
+ const primarySeries = useMemo(() => primaryEntries.map(({ series }) => series), [primaryEntries]);
4716
4792
  const comparisonEntries = useMemo(() => {
4717
4793
  const primaryByGroup = new Map(primaryEntries.map(({ series, index }) => [series.group, {
4718
4794
  label: series.label,
@@ -4808,26 +4884,8 @@ const BarChartInternal = ({ data, chartId: providedChartId, width, height, class
4808
4884
  className: bar_chart_module_default["bar-chart__tooltip-header"],
4809
4885
  children: categoryLabel
4810
4886
  }),
4811
- /* @__PURE__ */ jsxs("div", {
4812
- className: bar_chart_module_default["bar-chart__tooltip-row"],
4813
- children: [/* @__PURE__ */ jsxs("span", {
4814
- className: bar_chart_module_default["bar-chart__tooltip-label"],
4815
- children: [primaryKey, ":"]
4816
- }), /* @__PURE__ */ jsx("span", {
4817
- className: bar_chart_module_default["bar-chart__tooltip-value"],
4818
- children: formatNumber(nearestDatum.value)
4819
- })]
4820
- }),
4821
- /* @__PURE__ */ jsxs("div", {
4822
- className: bar_chart_module_default["bar-chart__tooltip-row"],
4823
- children: [/* @__PURE__ */ jsxs("span", {
4824
- className: bar_chart_module_default["bar-chart__tooltip-label"],
4825
- children: [comparisonEntry.series.label, ":"]
4826
- }), /* @__PURE__ */ jsx("span", {
4827
- className: bar_chart_module_default["bar-chart__tooltip-value"],
4828
- children: formatNumber(comparisonDatum.value)
4829
- })]
4830
- })
4887
+ renderTooltipRow(primaryKey, formatNumber(nearestDatum.value)),
4888
+ renderTooltipRow(comparisonEntry.series.label, formatNumber(comparisonDatum.value))
4831
4889
  ]
4832
4890
  });
4833
4891
  return /* @__PURE__ */ jsxs("div", {
@@ -4835,16 +4893,7 @@ const BarChartInternal = ({ data, chartId: providedChartId, width, height, class
4835
4893
  children: [/* @__PURE__ */ jsx("div", {
4836
4894
  className: bar_chart_module_default["bar-chart__tooltip-header"],
4837
4895
  children: primaryKey
4838
- }), /* @__PURE__ */ jsxs("div", {
4839
- className: bar_chart_module_default["bar-chart__tooltip-row"],
4840
- children: [/* @__PURE__ */ jsxs("span", {
4841
- className: bar_chart_module_default["bar-chart__tooltip-label"],
4842
- children: [categoryLabel, ":"]
4843
- }), /* @__PURE__ */ jsx("span", {
4844
- className: bar_chart_module_default["bar-chart__tooltip-value"],
4845
- children: formatNumber(nearestDatum.value)
4846
- })]
4847
- })]
4896
+ }), renderTooltipRow(categoryLabel, formatNumber(nearestDatum.value))]
4848
4897
  });
4849
4898
  }, [chartOptions.tooltip, comparisonEntries]);
4850
4899
  const renderPattern = useCallback((index, color) => {
@@ -5037,7 +5086,7 @@ const BarChartInternal = ({ data, chartId: providedChartId, width, height, class
5037
5086
  selectedIndex,
5038
5087
  tooltipRef,
5039
5088
  keyboardFocusedClassName: bar_chart_module_default["bar-chart__tooltip--keyboard-focused"],
5040
- series: data,
5089
+ series: primarySeries,
5041
5090
  mode: "individual"
5042
5091
  })
5043
5092
  ]
@@ -5617,6 +5666,11 @@ var geo_chart_module_default = { "container": "a8ccharts-8hS2IW-container" };
5617
5666
  */
5618
5667
  const DEFAULT_FEATURE_FILL_COLOR = "#ffffff";
5619
5668
  const DEFAULT_BACKGROUND_COLOR = "#ffffff";
5669
+ const GEO_CHART_PACKAGES = [
5670
+ "corechart",
5671
+ "controls",
5672
+ "geochart"
5673
+ ];
5620
5674
  /**
5621
5675
  * Renders a geographical chart using Google Charts GeoChart to visualize data.
5622
5676
  *
@@ -5705,6 +5759,7 @@ const GeoChartInternal = ({ className, data, width, height, region = "world", re
5705
5759
  },
5706
5760
  children: /* @__PURE__ */ jsx(Chart, {
5707
5761
  chartType: "GeoChart",
5762
+ chartPackages: GEO_CHART_PACKAGES,
5708
5763
  width,
5709
5764
  height,
5710
5765
  data: sanitizedData.data,
@@ -5720,10 +5775,407 @@ const GeoChartWithProvider = (props) => {
5720
5775
  GeoChartWithProvider.displayName = "GeoChart";
5721
5776
  const GeoChartResponsive = withResponsive(GeoChartWithProvider);
5722
5777
  //#endregion
5723
- //#region ../../../node_modules/.pnpm/@wordpress+warning@3.48.1/node_modules/@wordpress/warning/build-module/utils.mjs
5778
+ //#region src/charts/heatmap-chart/heatmap-chart.module.scss
5779
+ var heatmap_chart_module_default = {
5780
+ "heatmap-chart": "a8ccharts-O3YMOW-heatmap-chart",
5781
+ "heatmap-chart__cell": "a8ccharts-O3YMOW-heatmap-chart__cell",
5782
+ "heatmap-chart__cell--filled": "a8ccharts-O3YMOW-heatmap-chart__cell--filled",
5783
+ "heatmap-chart__cell--selected": "a8ccharts-O3YMOW-heatmap-chart__cell--selected",
5784
+ "heatmap-chart__cell--strong": "a8ccharts-O3YMOW-heatmap-chart__cell--strong",
5785
+ "heatmap-chart__cell-value": "a8ccharts-O3YMOW-heatmap-chart__cell-value",
5786
+ "heatmap-chart__col-label": "a8ccharts-O3YMOW-heatmap-chart__col-label",
5787
+ "heatmap-chart__empty": "a8ccharts-O3YMOW-heatmap-chart__empty",
5788
+ "heatmap-chart__grid": "a8ccharts-O3YMOW-heatmap-chart__grid",
5789
+ "heatmap-chart__grid--compact": "a8ccharts-O3YMOW-heatmap-chart__grid--compact",
5790
+ "heatmap-chart__legend-swatch": "a8ccharts-O3YMOW-heatmap-chart__legend-swatch",
5791
+ "heatmap-chart__row": "a8ccharts-O3YMOW-heatmap-chart__row",
5792
+ "heatmap-chart__row-label": "a8ccharts-O3YMOW-heatmap-chart__row-label"
5793
+ };
5794
+ //#endregion
5795
+ //#region src/charts/heatmap-chart/private/use-heatmap-colors.ts
5796
+ const isPresent = (value) => value !== null && value !== void 0 && !isNaN(value);
5797
+ /**
5798
+ * Get the min and max values from heatmap data, ignoring null/NaN.
5799
+ * @param data - The heatmap columns
5800
+ * @return Tuple of [min, max] values
5801
+ */
5802
+ const getValueExtent = (data) => {
5803
+ let min = Infinity;
5804
+ let max = -Infinity;
5805
+ for (const column of data) for (const cell of column.data) {
5806
+ if (!isPresent(cell.value)) continue;
5807
+ if (cell.value < min) min = cell.value;
5808
+ if (cell.value > max) max = cell.value;
5809
+ }
5810
+ if (min === Infinity) return [0, 0];
5811
+ return [min, max];
5812
+ };
5813
+ /**
5814
+ * Normalize a value to 0–1 within the extent. A flat extent (min === max) maps to 1.
5815
+ * @param value - The value to normalize
5816
+ * @param extent - Tuple of [min, max] values for the normalization range
5817
+ * @return Normalized value between 0 and 1
5818
+ */
5819
+ const getNormalizedValue = (value, extent) => {
5820
+ const [min, max] = extent;
5821
+ if (min === max) return 1;
5822
+ return Math.min(1, Math.max(0, (value - min) / (max - min)));
5823
+ };
5824
+ //#endregion
5825
+ //#region src/charts/heatmap-chart/private/build-calendar-data.ts
5826
+ /** Rows that get a weekday label (Mon, Wed, Fri with a Monday week start). */
5827
+ const LABELLED_ROWS = [
5828
+ 0,
5829
+ 2,
5830
+ 4
5831
+ ];
5832
+ const toDate = (point) => {
5833
+ if (point.date instanceof Date && !isNaN(point.date.getTime())) return point.date;
5834
+ if (point.dateString) {
5835
+ const parsed = parseISO(point.dateString);
5836
+ if (!isNaN(parsed.getTime())) return parsed;
5837
+ }
5838
+ return null;
5839
+ };
5840
+ const buildCalendarHeatmapData = (series, options = {}) => {
5841
+ const weekStartsOn = options.weekStartsOn ?? 1;
5842
+ const entries = series.map((point) => ({
5843
+ date: toDate(point),
5844
+ value: point.value
5845
+ })).filter((entry) => entry.date !== null);
5846
+ if (!entries.length) return {
5847
+ data: [],
5848
+ rowLabels: []
5849
+ };
5850
+ const valueByDay = /* @__PURE__ */ new Map();
5851
+ let minDate = entries[0].date;
5852
+ let maxDate = entries[0].date;
5853
+ for (const { date, value } of entries) {
5854
+ valueByDay.set(format(date, "yyyy-MM-dd"), value);
5855
+ if (date < minDate) minDate = date;
5856
+ if (date > maxDate) maxDate = date;
5857
+ }
5858
+ const gridStart = startOfWeek(minDate, { weekStartsOn });
5859
+ const weekCount = differenceInCalendarWeeks(maxDate, gridStart, { weekStartsOn }) + 1;
5860
+ const rowLabels = Array.from({ length: 7 }, (_, row) => LABELLED_ROWS.includes(row) ? format(addDays(gridStart, row), "EEE") : "");
5861
+ const data = [];
5862
+ let previousMonth = -1;
5863
+ for (let week = 0; week < weekCount; week++) {
5864
+ const columnStart = addDays(gridStart, week * 7);
5865
+ const month = columnStart.getMonth();
5866
+ const label = month !== previousMonth ? format(columnStart, "MMM") : "";
5867
+ previousMonth = month;
5868
+ const cells = [];
5869
+ for (let row = 0; row < 7; row++) {
5870
+ const day = addDays(gridStart, week * 7 + row);
5871
+ const key = format(day, "yyyy-MM-dd");
5872
+ cells.push({
5873
+ label: format(day, "EEE, MMM d, yyyy"),
5874
+ value: valueByDay.has(key) ? valueByDay.get(key) : null
5875
+ });
5876
+ }
5877
+ data.push({
5878
+ label,
5879
+ data: cells
5880
+ });
5881
+ }
5882
+ return {
5883
+ data,
5884
+ rowLabels
5885
+ };
5886
+ };
5887
+ //#endregion
5888
+ //#region src/charts/heatmap-chart/private/heatmap-legend.tsx
5889
+ const HeatmapLegend = ({ steps = 5, lessLabel, moreLabel }) => {
5890
+ const context = useContext(HeatmapContext);
5891
+ const { legend } = useGlobalChartsTheme();
5892
+ if (!context) return null;
5893
+ const { primaryColorHex } = context;
5894
+ const labelStyle = legend.labelStyles;
5895
+ return /* @__PURE__ */ jsxs(Stack, {
5896
+ direction: "row",
5897
+ gap: "xs",
5898
+ align: "center",
5899
+ children: [
5900
+ /* @__PURE__ */ jsx(Text$1, {
5901
+ variant: "body-sm",
5902
+ style: labelStyle,
5903
+ children: lessLabel ?? __("Less", "jetpack-charts")
5904
+ }),
5905
+ /* @__PURE__ */ jsx(Stack, {
5906
+ direction: "row",
5907
+ gap: "xs",
5908
+ children: Array.from({ length: steps }, (_, index) => {
5909
+ const intensity = steps <= 1 ? 1 : index / (steps - 1);
5910
+ return /* @__PURE__ */ jsx("span", {
5911
+ "aria-hidden": "true",
5912
+ className: heatmap_chart_module_default["heatmap-chart__legend-swatch"],
5913
+ style: {
5914
+ "--heatmap-primary": primaryColorHex,
5915
+ "--intensity": intensity
5916
+ }
5917
+ }, index);
5918
+ })
5919
+ }),
5920
+ /* @__PURE__ */ jsx(Text$1, {
5921
+ variant: "body-sm",
5922
+ style: labelStyle,
5923
+ children: moreLabel ?? __("More", "jetpack-charts")
5924
+ })
5925
+ ]
5926
+ });
5927
+ };
5928
+ //#endregion
5929
+ //#region src/charts/heatmap-chart/heatmap-chart.tsx
5930
+ const HeatmapContext = createContext(null);
5931
+ const CELL_MIX_FLOOR = .15;
5932
+ const HeatmapChartInternal = ({ data, chartId: providedChartId, width = 0, height = 0, className, compact = false, showValues, rowLabels = [], primaryColor, gap = "md", withTooltips = false, renderTooltip, children }) => {
5933
+ const chartId = useChartId(providedChartId);
5934
+ const { getElementStyles, theme } = useGlobalChartsContext();
5935
+ const { heatmapChart: heatmapChartSettings } = theme;
5936
+ const { nonLegendChildren } = useChartChildren(children, "HeatmapChart");
5937
+ const [selectedIndex, setSelectedIndex] = useState();
5938
+ const { tooltipOpen, tooltipLeft, tooltipTop, tooltipData, showTooltip, hideTooltip } = useTooltip();
5939
+ const { containerRef, containerBounds, TooltipInPortal } = useTooltipInPortal({
5940
+ detectBounds: true,
5941
+ scroll: true
5942
+ });
5943
+ const containerBoundsRef = useRef(containerBounds);
5944
+ containerBoundsRef.current = containerBounds;
5945
+ const { color: primaryColorHex } = getElementStyles({
5946
+ index: 0,
5947
+ overrideColor: primaryColor || heatmapChartSettings.primaryColor
5948
+ });
5949
+ const primaryHex = normalizeColorToHex(primaryColorHex);
5950
+ const cellHasLightText = (intensity) => isValidHexColor(primaryHex) && prefersLightText(lightenHexColor(primaryHex, 1 - (CELL_MIX_FLOOR + (1 - CELL_MIX_FLOOR) * intensity)));
5951
+ const extent = useMemo(() => getValueExtent(data), [data]);
5952
+ const heatmapContext = useMemo(() => ({
5953
+ extent,
5954
+ primaryColorHex
5955
+ }), [extent, primaryColorHex]);
5956
+ const columns = data.length;
5957
+ const rows = Math.max(0, ...data.map((column) => column.data.length));
5958
+ const { compactCellGap, compactCellSize } = heatmapChartSettings;
5959
+ const drawValues = showValues ?? !compact;
5960
+ const buildTooltipData = useCallback((columnIndex, rowIndex) => {
5961
+ const cell = data[columnIndex]?.data[rowIndex];
5962
+ return {
5963
+ value: cell?.value ?? null,
5964
+ rowLabel: rowLabels[rowIndex],
5965
+ columnLabel: data[columnIndex]?.label,
5966
+ cellLabel: cell?.label,
5967
+ row: rowIndex,
5968
+ column: columnIndex
5969
+ };
5970
+ }, [data, rowLabels]);
5971
+ const onChartBlur = useCallback(() => {
5972
+ setSelectedIndex(void 0);
5973
+ hideTooltip();
5974
+ }, [hideTooltip]);
5975
+ const onChartKeyDown = useCallback((event) => {
5976
+ if (![
5977
+ "ArrowLeft",
5978
+ "ArrowRight",
5979
+ "ArrowUp",
5980
+ "ArrowDown",
5981
+ "Escape",
5982
+ "Tab"
5983
+ ].includes(event.key)) return;
5984
+ if (event.key === "Tab" || event.key === "Escape") {
5985
+ setSelectedIndex(void 0);
5986
+ hideTooltip();
5987
+ return;
5988
+ }
5989
+ event.preventDefault();
5990
+ if (selectedIndex === void 0) {
5991
+ setSelectedIndex(0);
5992
+ return;
5993
+ }
5994
+ let col = Math.floor(selectedIndex / rows);
5995
+ let row = selectedIndex % rows;
5996
+ if (event.key === "ArrowRight") col = Math.min(col + 1, columns - 1);
5997
+ else if (event.key === "ArrowLeft") col = Math.max(col - 1, 0);
5998
+ else if (event.key === "ArrowDown") row = Math.min(row + 1, rows - 1);
5999
+ else if (event.key === "ArrowUp") row = Math.max(row - 1, 0);
6000
+ setSelectedIndex(col * rows + row);
6001
+ }, [
6002
+ rows,
6003
+ columns,
6004
+ selectedIndex,
6005
+ hideTooltip
6006
+ ]);
6007
+ const handleCellMouseMove = useCallback((event) => {
6008
+ if (!withTooltips) return;
6009
+ const target = event.currentTarget;
6010
+ const columnIndex = Number(target.dataset.column);
6011
+ const rowIndex = Number(target.dataset.row);
6012
+ const bounds = containerBoundsRef.current;
6013
+ showTooltip({
6014
+ tooltipLeft: event.clientX - bounds.left,
6015
+ tooltipTop: event.clientY - bounds.top,
6016
+ tooltipData: buildTooltipData(columnIndex, rowIndex)
6017
+ });
6018
+ }, [
6019
+ withTooltips,
6020
+ showTooltip,
6021
+ buildTooltipData
6022
+ ]);
6023
+ const handleCellMouseLeave = useCallback(() => {
6024
+ if (withTooltips && selectedIndex === void 0) hideTooltip();
6025
+ }, [
6026
+ withTooltips,
6027
+ selectedIndex,
6028
+ hideTooltip
6029
+ ]);
6030
+ useEffect(() => {
6031
+ if (!withTooltips || selectedIndex === void 0) return;
6032
+ const col = Math.floor(selectedIndex / rows);
6033
+ const row = selectedIndex % rows;
6034
+ const rect = (typeof document !== "undefined" ? document.getElementById(`${chartId}-cell-${col}-${row}`) : null)?.getBoundingClientRect();
6035
+ const bounds = containerBoundsRef.current;
6036
+ showTooltip({
6037
+ tooltipLeft: rect ? rect.left + rect.width / 2 - bounds.left : 0,
6038
+ tooltipTop: rect ? rect.top + rect.height / 2 - bounds.top : 0,
6039
+ tooltipData: buildTooltipData(col, row)
6040
+ });
6041
+ }, [
6042
+ selectedIndex,
6043
+ withTooltips,
6044
+ rows,
6045
+ chartId,
6046
+ buildTooltipData,
6047
+ showTooltip
6048
+ ]);
6049
+ 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) })] }), []);
6050
+ if (!columns || !rows) return /* @__PURE__ */ jsx(Center, {
6051
+ className: clsx("heatmap-chart", heatmap_chart_module_default["heatmap-chart"], className),
6052
+ style: {
6053
+ width: width || void 0,
6054
+ height: height || void 0
6055
+ },
6056
+ children: /* @__PURE__ */ jsx("span", {
6057
+ className: heatmap_chart_module_default["heatmap-chart__empty"],
6058
+ children: __("No data available", "jetpack-charts")
6059
+ })
6060
+ });
6061
+ const trackSize = compact ? "var(--heatmap-cell-size)" : "minmax(0, 1fr)";
6062
+ const gridStyle = {
6063
+ "--heatmap-primary": primaryColorHex,
6064
+ gridTemplateColumns: `auto repeat(${columns}, ${trackSize})`,
6065
+ gridTemplateRows: `auto repeat(${rows}, ${trackSize})`
6066
+ };
6067
+ if (compact) {
6068
+ gridStyle["--heatmap-cell-gap"] = `${compactCellGap}px`;
6069
+ gridStyle["--heatmap-cell-size"] = `${compactCellSize}px`;
6070
+ }
6071
+ const activeDescendant = selectedIndex !== void 0 ? `${chartId}-cell-${Math.floor(selectedIndex / rows)}-${selectedIndex % rows}` : void 0;
6072
+ return /* @__PURE__ */ jsx(HeatmapContext.Provider, {
6073
+ value: heatmapContext,
6074
+ children: /* @__PURE__ */ jsx(SingleChartContext.Provider, {
6075
+ value: { chartId },
6076
+ children: /* @__PURE__ */ jsxs(ChartLayout, {
6077
+ legendPosition: "bottom",
6078
+ legendChildren: [],
6079
+ trailingContent: nonLegendChildren,
6080
+ gap,
6081
+ className: clsx("heatmap-chart", heatmap_chart_module_default["heatmap-chart"], className),
6082
+ style: {
6083
+ width: width || void 0,
6084
+ height: height || void 0
6085
+ },
6086
+ "data-chart-id": `heatmap-chart-${chartId}`,
6087
+ children: [/* @__PURE__ */ jsxs("div", {
6088
+ ref: containerRef,
6089
+ role: "grid",
6090
+ "aria-label": __("Heatmap chart", "jetpack-charts"),
6091
+ "aria-rowcount": rows,
6092
+ "aria-colcount": columns,
6093
+ "aria-activedescendant": activeDescendant,
6094
+ tabIndex: 0,
6095
+ onBlur: onChartBlur,
6096
+ onKeyDown: onChartKeyDown,
6097
+ className: clsx(heatmap_chart_module_default["heatmap-chart__grid"], { [heatmap_chart_module_default["heatmap-chart__grid--compact"]]: compact }),
6098
+ style: gridStyle,
6099
+ children: [
6100
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true" }),
6101
+ data.map((column, columnIndex) => /* @__PURE__ */ jsx("span", {
6102
+ "aria-hidden": "true",
6103
+ className: heatmap_chart_module_default["heatmap-chart__col-label"],
6104
+ children: column.label
6105
+ }, `col-${columnIndex}`)),
6106
+ Array.from({ length: rows }).map((_row, rowIndex) => {
6107
+ const labelVisible = !compact || rowIndex % 2 === 0;
6108
+ return /* @__PURE__ */ jsxs("div", {
6109
+ role: "row",
6110
+ "aria-rowindex": rowIndex + 1,
6111
+ className: heatmap_chart_module_default["heatmap-chart__row"],
6112
+ children: [/* @__PURE__ */ jsx("span", {
6113
+ "aria-hidden": "true",
6114
+ className: heatmap_chart_module_default["heatmap-chart__row-label"],
6115
+ children: labelVisible ? rowLabels[rowIndex] ?? "" : ""
6116
+ }), data.map((column, columnIndex) => {
6117
+ const value = column.data[rowIndex]?.value ?? null;
6118
+ const present = isPresent(value);
6119
+ const normalized = present ? getNormalizedValue(value, extent) : 0;
6120
+ const flatIndex = columnIndex * rows + rowIndex;
6121
+ const info = buildTooltipData(columnIndex, rowIndex);
6122
+ const accessibleLabel = `${info.cellLabel || `${info.columnLabel ?? ""} ${info.rowLabel ?? ""}`.trim()}: ${info.value === null ? __("No data", "jetpack-charts") : formatNumber(info.value)}`;
6123
+ return /* @__PURE__ */ jsx("div", {
6124
+ id: `${chartId}-cell-${columnIndex}-${rowIndex}`,
6125
+ role: "gridcell",
6126
+ tabIndex: -1,
6127
+ "aria-colindex": columnIndex + 1,
6128
+ "aria-label": accessibleLabel,
6129
+ "data-column": columnIndex,
6130
+ "data-row": rowIndex,
6131
+ className: clsx(heatmap_chart_module_default["heatmap-chart__cell"], {
6132
+ [heatmap_chart_module_default["heatmap-chart__cell--filled"]]: present,
6133
+ [heatmap_chart_module_default["heatmap-chart__cell--strong"]]: present && cellHasLightText(normalized),
6134
+ [heatmap_chart_module_default["heatmap-chart__cell--selected"]]: selectedIndex === flatIndex
6135
+ }),
6136
+ style: present ? { "--intensity": normalized } : void 0,
6137
+ onMouseMove: handleCellMouseMove,
6138
+ onMouseLeave: handleCellMouseLeave,
6139
+ children: drawValues && present && /* @__PURE__ */ jsx("span", {
6140
+ className: heatmap_chart_module_default["heatmap-chart__cell-value"],
6141
+ children: formatNumberCompact(value)
6142
+ })
6143
+ }, `cell-${columnIndex}-${rowIndex}`);
6144
+ })]
6145
+ }, `row-${rowIndex}`);
6146
+ })
6147
+ ]
6148
+ }), withTooltips && tooltipOpen && tooltipData && /* @__PURE__ */ jsx(TooltipInPortal, {
6149
+ top: tooltipTop,
6150
+ left: tooltipLeft,
6151
+ children: /* @__PURE__ */ jsx("div", {
6152
+ role: "tooltip",
6153
+ tabIndex: -1,
6154
+ children: (renderTooltip ?? defaultRenderTooltip)(tooltipData)
6155
+ })
6156
+ })]
6157
+ })
6158
+ })
6159
+ });
6160
+ };
6161
+ const HeatmapChartWithProvider = (props) => {
6162
+ if (useContext(GlobalChartsContext)) return /* @__PURE__ */ jsx(HeatmapChartInternal, { ...props });
6163
+ return /* @__PURE__ */ jsx(GlobalChartsProvider, { children: /* @__PURE__ */ jsx(HeatmapChartInternal, { ...props }) });
6164
+ };
6165
+ HeatmapChartWithProvider.displayName = "HeatmapChart";
6166
+ const HeatmapChart = attachSubComponents(HeatmapChartWithProvider, { Legend: HeatmapLegend });
6167
+ const HeatmapChartResponsiveInner = (props) => /* @__PURE__ */ jsx(HeatmapChartWithProvider, {
6168
+ ...props,
6169
+ width: void 0,
6170
+ height: void 0
6171
+ });
6172
+ HeatmapChartResponsiveInner.displayName = "HeatmapChart";
6173
+ const HeatmapChartResponsive = attachSubComponents(withResponsive(HeatmapChartResponsiveInner), { Legend: HeatmapLegend });
6174
+ //#endregion
6175
+ //#region ../../../node_modules/.pnpm/@wordpress+warning@3.50.0/node_modules/@wordpress/warning/build-module/utils.mjs
5724
6176
  var logged = /* @__PURE__ */ new Set();
5725
6177
  //#endregion
5726
- //#region ../../../node_modules/.pnpm/@wordpress+warning@3.48.1/node_modules/@wordpress/warning/build-module/index.mjs
6178
+ //#region ../../../node_modules/.pnpm/@wordpress+warning@3.50.0/node_modules/@wordpress/warning/build-module/index.mjs
5727
6179
  function isDev() {
5728
6180
  return globalThis.SCRIPT_DEBUG === true;
5729
6181
  }
@@ -5737,7 +6189,7 @@ function warning(message) {
5737
6189
  logged.add(message);
5738
6190
  }
5739
6191
  //#endregion
5740
- //#region ../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/constants.mjs
6192
+ //#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
5741
6193
  var COMPONENT_NAMESPACE = "data-wp-component";
5742
6194
  var CONNECTED_NAMESPACE = "data-wp-c16t";
5743
6195
  var CONNECT_STATIC_NAMESPACE = "__contextSystemKey__";
@@ -5879,13 +6331,13 @@ function memize(fn, options) {
5879
6331
  return memoized;
5880
6332
  }
5881
6333
  //#endregion
5882
- //#region ../../../node_modules/.pnpm/@wordpress+components@35.0.1_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
6334
+ //#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
5883
6335
  function getStyledClassName(namespace) {
5884
6336
  return `components-${paramCase(namespace)}`;
5885
6337
  }
5886
6338
  var getStyledClassNameFromKey = memize(getStyledClassName);
5887
6339
  //#endregion
5888
- //#region ../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-connect.mjs
6340
+ //#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
5889
6341
  function contextConnect(Component, namespace) {
5890
6342
  return _contextConnect(Component, namespace, { forwardsRef: true });
5891
6343
  }
@@ -5970,7 +6422,7 @@ function isPlainObject(o) {
5970
6422
  return true;
5971
6423
  }
5972
6424
  //#endregion
5973
- //#region ../../../node_modules/.pnpm/@wordpress+components@35.0.1_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
6425
+ //#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
5974
6426
  function useUpdateEffect(effect, deps) {
5975
6427
  const mountedRef = useRef$1(false);
5976
6428
  useEffect$1(() => {
@@ -5983,7 +6435,7 @@ function useUpdateEffect(effect, deps) {
5983
6435
  }
5984
6436
  var use_update_effect_default = useUpdateEffect;
5985
6437
  //#endregion
5986
- //#region ../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-system-provider.mjs
6438
+ //#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
5987
6439
  var import_es6 = /* @__PURE__ */ __toESM(require_es6(), 1);
5988
6440
  var ComponentsContext = createContext$1(
5989
6441
  /** @type {Record<string, any>} */
@@ -6010,7 +6462,7 @@ var BaseContextSystemProvider = ({ children, value }) => {
6010
6462
  };
6011
6463
  memo(BaseContextSystemProvider);
6012
6464
  //#endregion
6013
- //#region ../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/utils.mjs
6465
+ //#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
6014
6466
  function getNamespace(componentName) {
6015
6467
  return { [COMPONENT_NAMESPACE]: componentName };
6016
6468
  }
@@ -7561,7 +8013,7 @@ _createEmotion.css;
7561
8013
  _createEmotion.sheet;
7562
8014
  _createEmotion.cache;
7563
8015
  //#endregion
7564
- //#region ../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.mjs
8016
+ //#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
7565
8017
  var isSerializedStyles = (o) => typeof o !== "undefined" && o !== null && ["name", "styles"].every((p) => typeof o[p] !== "undefined");
7566
8018
  var useCx = () => {
7567
8019
  const cache = __unsafe_useEmotionCache();
@@ -7577,7 +8029,7 @@ var useCx = () => {
7577
8029
  }, [cache]);
7578
8030
  };
7579
8031
  //#endregion
7580
- //#region ../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/use-context-system.mjs
8032
+ //#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
7581
8033
  function useContextSystem(props, namespace) {
7582
8034
  const contextSystemProps = useComponentsContext();
7583
8035
  if (typeof namespace === "undefined") globalThis.SCRIPT_DEBUG === true && warning("useContextSystem: Please provide a namespace");
@@ -7632,7 +8084,7 @@ var Insertion = function Insertion(_ref) {
7632
8084
  return null;
7633
8085
  };
7634
8086
  //#endregion
7635
- //#region ../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/view/component.mjs
8087
+ //#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
7636
8088
  var PolymorphicDiv = /* @__PURE__ */ function createStyled(tag, options) {
7637
8089
  var isReal = tag.__emotion_real === tag;
7638
8090
  var baseTag = isReal && tag.__emotion_base || tag;
@@ -7714,7 +8166,7 @@ function UnforwardedView({ as, ...restProps }, ref) {
7714
8166
  }
7715
8167
  var component_default$1 = Object.assign(forwardRef$1(UnforwardedView), { selector: ".components-view" });
7716
8168
  //#endregion
7717
- //#region ../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/utils.mjs
8169
+ //#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
7718
8170
  var ALIGNMENTS = {
7719
8171
  bottom: {
7720
8172
  alignItems: "flex-end",
@@ -7762,7 +8214,7 @@ function getAlignmentProps(alignment) {
7762
8214
  return alignment ? ALIGNMENTS[alignment] : {};
7763
8215
  }
7764
8216
  //#endregion
7765
- //#region ../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/use-responsive-value.mjs
8217
+ //#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
7766
8218
  var breakpoints = [
7767
8219
  "40em",
7768
8220
  "52em",
@@ -7796,7 +8248,7 @@ function useResponsiveValue(values, options = {}) {
7796
8248
  return array[index >= array.length ? array.length - 1 : index];
7797
8249
  }
7798
8250
  //#endregion
7799
- //#region ../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/colors-values.mjs
8251
+ //#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
7800
8252
  var white = "#fff";
7801
8253
  var GRAY = {
7802
8254
  900: "#1e1e1e",
@@ -7823,21 +8275,21 @@ var THEME = {
7823
8275
  accentDarker10: `var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6))`,
7824
8276
  accentDarker20: `var(--wp-components-color-accent-darker-20, var(--wp-admin-theme-color-darker-20, #183ad6))`,
7825
8277
  /** Used when placing text on the accent color. */
7826
- accentInverted: `var(--wp-components-color-accent-inverted, ${white})`,
7827
- background: `var(--wp-components-color-background, ${white})`,
7828
- foreground: `var(--wp-components-color-foreground, ${GRAY[900]})`,
8278
+ accentInverted: `var(--wp-components-color-accent-inverted, var(--wpds-color-foreground-interactive-brand-strong, #fff))`,
8279
+ background: `var(--wp-components-color-background, var(--wpds-color-background-surface-neutral-strong, #fff))`,
8280
+ foreground: `var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,
7829
8281
  /** Used when placing text on the foreground color. */
7830
- foregroundInverted: `var(--wp-components-color-foreground-inverted, ${white})`,
8282
+ foregroundInverted: `var(--wp-components-color-foreground-inverted, var(--wpds-color-background-surface-neutral, #fcfcfc))`,
7831
8283
  gray: {
7832
8284
  /** @deprecated Use `COLORS.theme.foreground` instead. */
7833
- 900: `var(--wp-components-color-foreground, ${GRAY[900]})`,
7834
- 800: `var(--wp-components-color-gray-800, ${GRAY[800]})`,
7835
- 700: `var(--wp-components-color-gray-700, ${GRAY[700]})`,
7836
- 600: `var(--wp-components-color-gray-600, ${GRAY[600]})`,
7837
- 400: `var(--wp-components-color-gray-400, ${GRAY[400]})`,
7838
- 300: `var(--wp-components-color-gray-300, ${GRAY[300]})`,
7839
- 200: `var(--wp-components-color-gray-200, ${GRAY[200]})`,
7840
- 100: `var(--wp-components-color-gray-100, ${GRAY[100]})`
8285
+ 900: `var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,
8286
+ 800: `var(--wp-components-color-gray-800, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,
8287
+ 700: `var(--wp-components-color-gray-700, var(--wpds-color-foreground-content-neutral-weak, #707070))`,
8288
+ 600: `var(--wp-components-color-gray-600, var(--wpds-color-stroke-interactive-neutral, #8d8d8d))`,
8289
+ 400: `var(--wp-components-color-gray-400, var(--wpds-color-stroke-interactive-neutral, #8d8d8d))`,
8290
+ 300: `var(--wp-components-color-gray-300, var(--wpds-color-stroke-surface-neutral, #dbdbdb))`,
8291
+ 200: `var(--wp-components-color-gray-200, var(--wpds-color-stroke-surface-neutral, #dbdbdb))`,
8292
+ 100: `var(--wp-components-color-gray-100, var(--wpds-color-background-surface-neutral, #fcfcfc))`
7841
8293
  }
7842
8294
  };
7843
8295
  var UI = {
@@ -7875,7 +8327,7 @@ var COLORS = Object.freeze({
7875
8327
  ui: UI
7876
8328
  });
7877
8329
  //#endregion
7878
- //#region ../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/config-values.mjs
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/config-values.mjs
7879
8331
  var CONTROL_HEIGHT = "36px";
7880
8332
  var CONTROL_PROPS = {
7881
8333
  controlPaddingX: 12,
@@ -7940,7 +8392,7 @@ var config_values_default = Object.assign({}, CONTROL_PROPS, {
7940
8392
  transitionTimingFunctionControl: "cubic-bezier(0.12, 0.8, 0.32, 1)"
7941
8393
  });
7942
8394
  //#endregion
7943
- //#region ../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/hook.mjs
8395
+ //#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
7944
8396
  function useGrid(props) {
7945
8397
  const { align, alignment, className, columnGap, columns = 2, gap = 3, isInline = false, justify, rowGap, rows, templateColumns, templateRows, ...otherProps } = useContextSystem(props, "Grid");
7946
8398
  const column = useResponsiveValue(Array.isArray(columns) ? columns : [columns]);
@@ -7981,7 +8433,7 @@ function useGrid(props) {
7981
8433
  };
7982
8434
  }
7983
8435
  //#endregion
7984
- //#region ../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/component.mjs
8436
+ //#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
7985
8437
  function UnconnectedGrid(props, forwardedRef) {
7986
8438
  return /* @__PURE__ */ jsx(component_default$1, {
7987
8439
  ...useGrid(props),
@@ -9108,6 +9560,6 @@ function TrendIndicator({ direction, value, className, style, showIcon = true })
9108
9560
  });
9109
9561
  }
9110
9562
  //#endregion
9111
- 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 };
9563
+ 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 };
9112
9564
 
9113
9565
  //# sourceMappingURL=index.js.map