@automattic/charts 0.53.0 → 0.53.2

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 (122) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/charts/bar-chart/index.cjs +5 -5
  3. package/dist/charts/bar-chart/index.d.cts +1 -1
  4. package/dist/charts/bar-chart/index.d.ts +1 -1
  5. package/dist/charts/bar-chart/index.js +4 -4
  6. package/dist/charts/bar-list-chart/index.cjs +6 -6
  7. package/dist/charts/bar-list-chart/index.d.cts +1 -1
  8. package/dist/charts/bar-list-chart/index.d.ts +1 -1
  9. package/dist/charts/bar-list-chart/index.js +5 -5
  10. package/dist/charts/conversion-funnel-chart/index.cjs +4 -4
  11. package/dist/charts/conversion-funnel-chart/index.d.cts +1 -1
  12. package/dist/charts/conversion-funnel-chart/index.d.ts +1 -1
  13. package/dist/charts/conversion-funnel-chart/index.js +3 -3
  14. package/dist/charts/geo-chart/index.cjs +13 -0
  15. package/dist/charts/geo-chart/index.cjs.map +1 -0
  16. package/dist/charts/geo-chart/index.css +8 -0
  17. package/dist/charts/geo-chart/index.css.map +1 -0
  18. package/dist/charts/geo-chart/index.d.cts +62 -0
  19. package/dist/charts/geo-chart/index.d.ts +62 -0
  20. package/dist/charts/geo-chart/index.js +13 -0
  21. package/dist/charts/geo-chart/index.js.map +1 -0
  22. package/dist/charts/leaderboard-chart/index.cjs +5 -5
  23. package/dist/charts/leaderboard-chart/index.d.cts +2 -2
  24. package/dist/charts/leaderboard-chart/index.d.ts +2 -2
  25. package/dist/charts/leaderboard-chart/index.js +4 -4
  26. package/dist/charts/line-chart/index.cjs +5 -5
  27. package/dist/charts/line-chart/index.d.cts +1 -1
  28. package/dist/charts/line-chart/index.d.ts +1 -1
  29. package/dist/charts/line-chart/index.js +4 -4
  30. package/dist/charts/pie-chart/index.cjs +6 -6
  31. package/dist/charts/pie-chart/index.d.cts +1 -1
  32. package/dist/charts/pie-chart/index.d.ts +1 -1
  33. package/dist/charts/pie-chart/index.js +5 -5
  34. package/dist/charts/pie-semi-circle-chart/index.cjs +6 -6
  35. package/dist/charts/pie-semi-circle-chart/index.d.cts +1 -1
  36. package/dist/charts/pie-semi-circle-chart/index.d.ts +1 -1
  37. package/dist/charts/pie-semi-circle-chart/index.js +5 -5
  38. package/dist/{chunk-ERGEUE7R.cjs → chunk-4KEE36W3.cjs} +19 -19
  39. package/dist/chunk-4KEE36W3.cjs.map +1 -0
  40. package/dist/{chunk-4RYV2TII.js → chunk-6RKPV3UP.js} +10 -10
  41. package/dist/{chunk-VER6S543.js → chunk-ALDWCNLH.js} +3 -3
  42. package/dist/chunk-CLSMJQCO.cjs +121 -0
  43. package/dist/chunk-CLSMJQCO.cjs.map +1 -0
  44. package/dist/{chunk-2FRTJVQ3.js → chunk-DCZ47KPZ.js} +6 -6
  45. package/dist/chunk-DCZ47KPZ.js.map +1 -0
  46. package/dist/{chunk-GWNXOI4M.cjs → chunk-DDV5726Q.cjs} +25 -25
  47. package/dist/{chunk-GWNXOI4M.cjs.map → chunk-DDV5726Q.cjs.map} +1 -1
  48. package/dist/{chunk-O2BJMTIS.js → chunk-DYMJWNYM.js} +2 -2
  49. package/dist/{chunk-A7X3CNEO.cjs → chunk-FVWTBK44.cjs} +6 -6
  50. package/dist/{chunk-A7X3CNEO.cjs.map → chunk-FVWTBK44.cjs.map} +1 -1
  51. package/dist/{chunk-ZN7KVU4R.cjs → chunk-GX4XTD6V.cjs} +76 -76
  52. package/dist/{chunk-ZN7KVU4R.cjs.map → chunk-GX4XTD6V.cjs.map} +1 -1
  53. package/dist/{chunk-VTMJWCCW.js → chunk-H6XRINJE.js} +10 -10
  54. package/dist/{chunk-CQPKK55N.js → chunk-HPJ5XSZM.js} +60 -60
  55. package/dist/{chunk-CQPKK55N.js.map → chunk-HPJ5XSZM.js.map} +1 -1
  56. package/dist/{chunk-6QCSXXDY.cjs → chunk-JWMWOBAX.cjs} +23 -23
  57. package/dist/{chunk-6QCSXXDY.cjs.map → chunk-JWMWOBAX.cjs.map} +1 -1
  58. package/dist/{chunk-DY7IVYWP.js → chunk-KBORJZKC.js} +8 -8
  59. package/dist/{chunk-W4ZYJ74Q.js → chunk-KORG7ITC.js} +3 -3
  60. package/dist/{chunk-AHUSYMYS.cjs → chunk-LNLHCZ6F.cjs} +28 -28
  61. package/dist/{chunk-AHUSYMYS.cjs.map → chunk-LNLHCZ6F.cjs.map} +1 -1
  62. package/dist/chunk-RDJ5PKC5.js +121 -0
  63. package/dist/chunk-RDJ5PKC5.js.map +1 -0
  64. package/dist/{chunk-P3QEXFTA.js → chunk-TE63Y5PX.js} +9 -1
  65. package/dist/chunk-TE63Y5PX.js.map +1 -0
  66. package/dist/{chunk-O23EGQ3H.cjs → chunk-UWAZGLHG.cjs} +22 -22
  67. package/dist/{chunk-O23EGQ3H.cjs.map → chunk-UWAZGLHG.cjs.map} +1 -1
  68. package/dist/{chunk-W3H42XRV.cjs → chunk-WKN6C4ZE.cjs} +10 -10
  69. package/dist/{chunk-W3H42XRV.cjs.map → chunk-WKN6C4ZE.cjs.map} +1 -1
  70. package/dist/{chunk-RHQIACQT.js → chunk-Z34VYZGR.js} +9 -9
  71. package/dist/{chunk-NYZFVI2P.cjs → chunk-ZPJHWKEK.cjs} +9 -9
  72. package/dist/{chunk-NYZFVI2P.cjs.map → chunk-ZPJHWKEK.cjs.map} +1 -1
  73. package/dist/{chunk-DAKYGZG6.cjs → chunk-ZVGEDXDP.cjs} +10 -2
  74. package/dist/chunk-ZVGEDXDP.cjs.map +1 -0
  75. package/dist/components/legend/index.cjs +4 -4
  76. package/dist/components/legend/index.d.cts +1 -1
  77. package/dist/components/legend/index.d.ts +1 -1
  78. package/dist/components/legend/index.js +3 -3
  79. package/dist/components/tooltip/index.d.cts +1 -1
  80. package/dist/components/tooltip/index.d.ts +1 -1
  81. package/dist/hooks/index.cjs +3 -3
  82. package/dist/hooks/index.d.cts +1 -1
  83. package/dist/hooks/index.d.ts +1 -1
  84. package/dist/hooks/index.js +2 -2
  85. package/dist/index.cjs +26 -126
  86. package/dist/index.cjs.map +1 -1
  87. package/dist/index.d.cts +15 -55
  88. package/dist/index.d.ts +15 -55
  89. package/dist/index.js +38 -138
  90. package/dist/index.js.map +1 -1
  91. package/dist/{leaderboard-chart-3dKYMfoP.d.cts → leaderboard-chart-CN80sJmQ.d.cts} +1 -1
  92. package/dist/{leaderboard-chart-BqH8BLiG.d.ts → leaderboard-chart-DPi2ueOg.d.ts} +1 -1
  93. package/dist/providers/index.cjs +3 -3
  94. package/dist/providers/index.d.cts +2 -2
  95. package/dist/providers/index.d.ts +2 -2
  96. package/dist/providers/index.js +2 -2
  97. package/dist/{themes-ChB_VjWt.d.ts → themes-AriuFXQ2.d.ts} +2 -2
  98. package/dist/{themes-DijSDhqQ.d.cts → themes-Dzg0wE3B.d.cts} +2 -2
  99. package/dist/{types-sQ20gAeB.d.cts → types-D1lTxRyg.d.cts} +1 -1
  100. package/dist/{types-sQ20gAeB.d.ts → types-D1lTxRyg.d.ts} +1 -1
  101. package/dist/utils/index.cjs +4 -2
  102. package/dist/utils/index.cjs.map +1 -1
  103. package/dist/utils/index.d.cts +11 -2
  104. package/dist/utils/index.d.ts +11 -2
  105. package/dist/utils/index.js +3 -1
  106. package/package.json +31 -23
  107. package/src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx +2 -5
  108. package/src/charts/sparkline/sparkline.tsx +2 -0
  109. package/src/charts/sparkline/types.ts +8 -0
  110. package/src/utils/color-utils.ts +19 -0
  111. package/src/utils/test/color-utils.test.ts +232 -0
  112. package/dist/chunk-2FRTJVQ3.js.map +0 -1
  113. package/dist/chunk-DAKYGZG6.cjs.map +0 -1
  114. package/dist/chunk-ERGEUE7R.cjs.map +0 -1
  115. package/dist/chunk-P3QEXFTA.js.map +0 -1
  116. /package/dist/{chunk-4RYV2TII.js.map → chunk-6RKPV3UP.js.map} +0 -0
  117. /package/dist/{chunk-VER6S543.js.map → chunk-ALDWCNLH.js.map} +0 -0
  118. /package/dist/{chunk-O2BJMTIS.js.map → chunk-DYMJWNYM.js.map} +0 -0
  119. /package/dist/{chunk-VTMJWCCW.js.map → chunk-H6XRINJE.js.map} +0 -0
  120. /package/dist/{chunk-DY7IVYWP.js.map → chunk-KBORJZKC.js.map} +0 -0
  121. /package/dist/{chunk-W4ZYJ74Q.js.map → chunk-KORG7ITC.js.map} +0 -0
  122. /package/dist/{chunk-RHQIACQT.js.map → chunk-Z34VYZGR.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,13 +1,9 @@
1
1
  export { BarChart, BarChartUnresponsive } from './charts/bar-chart/index.js';
2
2
  export { BarListChart, BarListChartUnresponsive } from './charts/bar-list-chart/index.js';
3
3
  export { ConversionFunnelChart } from './charts/conversion-funnel-chart/index.js';
4
- import { B as BaseChartProps, G as GeoData } from './types-sQ20gAeB.js';
5
- export { A as AnnotationStyles, j as ButtonWithPopover, C as ChartTheme, f as CompleteChartTheme, b as DataPoint, D as DataPointDate, e as DataPointPercentage, c as GradientStop, h as GridProps, L as LeaderboardEntry, M as MultipleDataPointsDate, O as Optional, a as OrientationType, P as PopoverButtonAttributes, k as PopoverElement, i as PopoverElementAttributes, g as ScaleOptions, S as SeriesData, d as SeriesDataOptions, T as ToggleEvent } from './types-sQ20gAeB.js';
6
- import * as react_jsx_runtime from 'react/jsx-runtime';
7
- import { R as ResponsiveConfig } from './with-responsive-Cp2qnQPo.js';
8
- import * as react from 'react';
9
- import { FC } from 'react';
10
- export { L as LeaderboardChart, a as LeaderboardChartUnresponsive } from './leaderboard-chart-BqH8BLiG.js';
4
+ export { A as AnnotationStyles, B as BaseChartProps, j as ButtonWithPopover, C as ChartTheme, f as CompleteChartTheme, D as DataPoint, b as DataPointDate, e as DataPointPercentage, G as GeoData, c as GradientStop, h as GridProps, L as LeaderboardEntry, M as MultipleDataPointsDate, O as Optional, a as OrientationType, P as PopoverButtonAttributes, k as PopoverElement, i as PopoverElementAttributes, g as ScaleOptions, d as SeriesData, S as SeriesDataOptions, T as ToggleEvent } from './types-D1lTxRyg.js';
5
+ export { GeoChart, GeoChartProps, GeoChartUnresponsive, GeoRegion, GeoResolution } from './charts/geo-chart/index.js';
6
+ export { L as LeaderboardChart, a as LeaderboardChartUnresponsive } from './leaderboard-chart-DPi2ueOg.js';
11
7
  export { EventHandlerParams, GridStyles, LineStyles } from '@visx/xychart';
12
8
  export { L as Legend } from './legend-jjMmhSg3.js';
13
9
  export { LegendValueDisplay, useChartLegendItems } from './components/legend/index.js';
@@ -16,9 +12,12 @@ export { LineChart, LineChartUnresponsive } from './charts/line-chart/index.js';
16
12
  export { RenderTooltipParams } from '@visx/xychart/lib/components/Tooltip';
17
13
  export { PieChart, PieChartProps, PieChartUnresponsive } from './charts/pie-chart/index.js';
18
14
  export { PieSemiCircleChart, PieSemiCircleChartUnresponsive } from './charts/pie-semi-circle-chart/index.js';
15
+ import * as react_jsx_runtime from 'react/jsx-runtime';
16
+ import { R as ResponsiveConfig } from './with-responsive-Cp2qnQPo.js';
17
+ import * as react from 'react';
19
18
  export { B as BaseTooltip } from './base-tooltip-DOq93wjU.js';
20
19
  export { TrendDirection, TrendIndicator, TrendIndicatorProps } from './components/trend-indicator/index.js';
21
- export { a as GlobalChartsContext, G as GlobalChartsProvider, G as ThemeProvider, e as defaultTheme, u as useGlobalChartsContext, b as useGlobalChartsTheme } from './themes-ChB_VjWt.js';
20
+ export { b as GlobalChartsContext, G as GlobalChartsProvider, G as ThemeProvider, d as defaultTheme, u as useGlobalChartsContext, a as useGlobalChartsTheme } from './themes-AriuFXQ2.js';
22
21
  export { GoogleDataTableColumn, GoogleDataTableColumnRoleType, GoogleDataTableRow } from 'react-google-charts';
23
22
  import '@visx/text';
24
23
  import '@visx/annotation/lib/components/CircleSubject';
@@ -33,52 +32,6 @@ import '@visx/legend';
33
32
  import './types-DQNnq5Fr.js';
34
33
  import '@visx/shape/lib/shapes/Pie';
35
34
 
36
- /**
37
- * Region to display on the map.
38
- * Use 'world' for global view or any ISO 3166-1 alpha-2 country code
39
- * (e.g., 'US' for United States, 'CA' for Canada).
40
- */
41
- type GeoRegion = 'world' | (string & {});
42
- /**
43
- * Resolution level for the map.
44
- * - 'countries': Country-level (default for 'world')
45
- * - 'provinces': State/province level (use with specific region like 'US')
46
- * - 'metros': Metropolitan areas (US only)
47
- */
48
- type GeoResolution = 'countries' | 'provinces' | 'metros';
49
- interface GeoChartProps extends Pick<BaseChartProps, 'className' | 'chartId' | 'width' | 'height'> {
50
- /**
51
- * Data in Google Charts native format for maximum flexibility.
52
- * First row contains column headers, subsequent rows contain data.
53
- *
54
- * Country identifiers can be either full country names or ISO 3166-1 alpha-2 codes
55
- * (e.g., 'United States' or 'US').
56
- */
57
- data: GeoData;
58
- /**
59
- * Region to display. Use 'world' for global view, 'US' for United States,
60
- * or any ISO 3166-1 alpha-2 country code.
61
- * @default 'world'
62
- */
63
- region?: GeoRegion;
64
- /**
65
- * Resolution level for the map.
66
- * - 'countries': Country-level (default for 'world')
67
- * - 'provinces': State/province level (use with specific region like 'US')
68
- * - 'metros': Metropolitan areas (US only)
69
- * @default 'countries'
70
- */
71
- resolution?: GeoResolution;
72
- /**
73
- * Optional render function for the loading placeholder.
74
- * Called while Google Charts is loading.
75
- */
76
- renderPlaceholder?: () => React.ReactNode;
77
- }
78
-
79
- declare const GeoChartWithProvider: FC<GeoChartProps>;
80
- declare const GeoChartResponsive: ({ resizeDebounceTime, maxWidth, aspectRatio, ...chartProps }: Pick<Partial<GeoChartProps>, "width" | "height" | "size"> & Omit<GeoChartProps, "width" | "height" | "size"> & ResponsiveConfig) => react_jsx_runtime.JSX.Element;
81
-
82
35
  type SparklineDataPoint = number;
83
36
  type GradientConfig = {
84
37
  /**
@@ -158,6 +111,13 @@ interface SparklineProps {
158
111
  bottom?: number;
159
112
  left?: number;
160
113
  };
114
+ /**
115
+ * Enable entry animation on initial render
116
+ * Creates a rising effect where the line scales up from the bottom.
117
+ * Automatically respects user's prefers-reduced-motion system setting.
118
+ * @default false
119
+ */
120
+ animation?: boolean;
161
121
  }
162
122
 
163
123
  /**
@@ -176,4 +136,4 @@ declare const SparklineUnresponsive: react.ForwardRefExoticComponent<SparklinePr
176
136
  */
177
137
  declare const Sparkline: ({ resizeDebounceTime, maxWidth, aspectRatio, ...chartProps }: Pick<Partial<SparklineProps>, "width" | "height" | "size"> & Omit<SparklineProps, "width" | "height" | "size"> & ResponsiveConfig) => react_jsx_runtime.JSX.Element;
178
138
 
179
- export { BaseChartProps, GeoChartResponsive as GeoChart, type GeoChartProps, GeoChartWithProvider as GeoChartUnresponsive, GeoData, type GeoRegion, type GeoResolution, Sparkline, SparklineUnresponsive };
139
+ export { Sparkline, SparklineUnresponsive };
package/dist/index.js CHANGED
@@ -1,165 +1,63 @@
1
+ import {
2
+ LeaderboardChart,
3
+ LeaderboardChartResponsive
4
+ } from "./chunk-HPJ5XSZM.js";
1
5
  import {
2
6
  LineChart,
3
7
  LineChartResponsive
4
- } from "./chunk-RHQIACQT.js";
8
+ } from "./chunk-Z34VYZGR.js";
5
9
  import {
6
10
  PieChart,
7
11
  PieChartResponsive
8
- } from "./chunk-VTMJWCCW.js";
12
+ } from "./chunk-H6XRINJE.js";
9
13
  import "./chunk-NFRB2POF.js";
10
14
  import {
11
15
  PieSemiCircleChart,
12
16
  PieSemiCircleChartResponsive
13
- } from "./chunk-4RYV2TII.js";
17
+ } from "./chunk-6RKPV3UP.js";
14
18
  import "./chunk-A3AEEGKR.js";
19
+ import "./chunk-CEZGL6YP.js";
15
20
  import {
16
21
  TrendIndicator
17
22
  } from "./chunk-MMDLXS6O.js";
18
23
  import {
19
24
  BarListChart,
20
25
  BarListChartResponsive
21
- } from "./chunk-W4ZYJ74Q.js";
26
+ } from "./chunk-KORG7ITC.js";
22
27
  import {
23
28
  BarChart,
24
29
  BarChartResponsive
25
- } from "./chunk-DY7IVYWP.js";
30
+ } from "./chunk-KBORJZKC.js";
31
+ import {
32
+ Legend,
33
+ useChartLegendItems
34
+ } from "./chunk-ALDWCNLH.js";
26
35
  import {
27
36
  BaseTooltip
28
37
  } from "./chunk-5XI443YP.js";
29
38
  import {
30
39
  ConversionFunnelChartWithProvider
31
- } from "./chunk-2FRTJVQ3.js";
40
+ } from "./chunk-DCZ47KPZ.js";
32
41
  import {
33
- LeaderboardChart,
34
- LeaderboardChartResponsive
35
- } from "./chunk-CQPKK55N.js";
36
- import "./chunk-CEZGL6YP.js";
42
+ GeoChartResponsive,
43
+ GeoChartWithProvider
44
+ } from "./chunk-RDJ5PKC5.js";
37
45
  import {
38
46
  withResponsive
39
47
  } from "./chunk-NONODB3K.js";
40
- import {
41
- Legend,
42
- useChartLegendItems
43
- } from "./chunk-VER6S543.js";
44
48
  import {
45
49
  GlobalChartsContext,
46
50
  GlobalChartsProvider,
47
51
  defaultTheme,
48
52
  useGlobalChartsContext,
49
53
  useGlobalChartsTheme
50
- } from "./chunk-O2BJMTIS.js";
51
- import {
52
- lightenHexColor,
53
- normalizeColorToHex,
54
- resolveCssVariable
55
- } from "./chunk-P3QEXFTA.js";
54
+ } from "./chunk-DYMJWNYM.js";
55
+ import "./chunk-TE63Y5PX.js";
56
56
  import "./chunk-G3PMV62Z.js";
57
57
 
58
- // src/charts/geo-chart/geo-chart.tsx
59
- import { __ } from "@wordpress/i18n";
60
- import clsx from "clsx";
61
- import { useContext, useMemo } from "react";
62
- import { Chart } from "react-google-charts";
63
-
64
- // src/charts/geo-chart/geo-chart.module.scss
65
- var geo_chart_module_default = {
66
- "container": "a8ccharts-JvcqOz"
67
- };
68
-
69
- // src/charts/geo-chart/geo-chart.tsx
70
- import { jsx } from "react/jsx-runtime";
71
- var DEFAULT_FEATURE_FILL_COLOR = "#ffffff";
72
- var DEFAULT_BACKGROUND_COLOR = "#ffffff";
73
- var GeoChartInternal = ({
74
- className,
75
- data,
76
- width,
77
- height,
78
- region = "world",
79
- resolution = "countries",
80
- renderPlaceholder
81
- }) => {
82
- const {
83
- getElementStyles,
84
- theme: {
85
- geoChart: { featureFillColor },
86
- backgroundColor
87
- }
88
- } = useGlobalChartsContext();
89
- const loadingPlaceholder = /* @__PURE__ */ jsx(
90
- "div",
91
- {
92
- className: clsx("geo-chart", geo_chart_module_default.container, className),
93
- "data-testid": "geo-chart-loading",
94
- style: { width, height },
95
- children: renderPlaceholder ? renderPlaceholder() : __("Loading map", "jetpack-charts")
96
- }
97
- );
98
- const fullColorHex = getElementStyles({ index: 0 }).color;
99
- const lightColorHex = lightenHexColor(fullColorHex, 0.8);
100
- const backgroundColorHex = normalizeColorToHex(backgroundColor, null, resolveCssVariable) || DEFAULT_BACKGROUND_COLOR;
101
- const defaultFillColorHex = normalizeColorToHex(featureFillColor, null, resolveCssVariable) || DEFAULT_FEATURE_FILL_COLOR;
102
- const hasHtmlTooltips = useMemo(
103
- () => data.length > 0 && data[0].some(
104
- (col) => typeof col === "object" && col !== null && "role" in col && col.role === "tooltip" && "p" in col && typeof col.p === "object" && col.p !== null && "html" in col.p && col.p.html === true
105
- ),
106
- [data]
107
- );
108
- const options = useMemo(
109
- () => ({
110
- ...region !== "world" && { region },
111
- ...resolution !== "countries" && { resolution },
112
- colorAxis: { colors: [lightColorHex, fullColorHex] },
113
- backgroundColor: backgroundColorHex,
114
- datalessRegionColor: defaultFillColorHex,
115
- defaultColor: defaultFillColorHex,
116
- tooltip: { trigger: "focus", isHtml: hasHtmlTooltips },
117
- legend: "none",
118
- keepAspectRatio: true
119
- }),
120
- [
121
- region,
122
- resolution,
123
- lightColorHex,
124
- fullColorHex,
125
- backgroundColorHex,
126
- defaultFillColorHex,
127
- hasHtmlTooltips
128
- ]
129
- );
130
- return /* @__PURE__ */ jsx(
131
- "div",
132
- {
133
- className: clsx("geo-chart", geo_chart_module_default.container, className),
134
- "data-testid": "geo-chart",
135
- style: { width, height, backgroundColor },
136
- children: /* @__PURE__ */ jsx(
137
- Chart,
138
- {
139
- chartType: "GeoChart",
140
- width,
141
- height,
142
- data,
143
- options,
144
- loader: loadingPlaceholder
145
- }
146
- )
147
- }
148
- );
149
- };
150
- var GeoChartWithProvider = (props) => {
151
- const existingContext = useContext(GlobalChartsContext);
152
- if (existingContext) {
153
- return /* @__PURE__ */ jsx(GeoChartInternal, { ...props });
154
- }
155
- return /* @__PURE__ */ jsx(GlobalChartsProvider, { children: /* @__PURE__ */ jsx(GeoChartInternal, { ...props }) });
156
- };
157
- GeoChartWithProvider.displayName = "GeoChart";
158
- var GeoChartResponsive = withResponsive(GeoChartWithProvider);
159
-
160
58
  // src/charts/sparkline/sparkline.tsx
161
- import clsx2 from "clsx";
162
- import { useMemo as useMemo2, forwardRef } from "react";
59
+ import clsx from "clsx";
60
+ import { useMemo, forwardRef } from "react";
163
61
 
164
62
  // src/charts/sparkline/sparkline.module.scss
165
63
  var sparkline_module_default = {
@@ -168,7 +66,7 @@ var sparkline_module_default = {
168
66
  };
169
67
 
170
68
  // src/charts/sparkline/sparkline.tsx
171
- import { jsx as jsx2 } from "react/jsx-runtime";
69
+ import { jsx } from "react/jsx-runtime";
172
70
  var DEFAULT_WIDTH = 100;
173
71
  var DEFAULT_HEIGHT = 40;
174
72
  var transformToSeriesData = (data, color, strokeWidth) => {
@@ -199,18 +97,19 @@ var SparklineComponent = forwardRef(
199
97
  gradient,
200
98
  className,
201
99
  chartId,
202
- margin: marginProp
100
+ margin: marginProp,
101
+ animation
203
102
  }, ref) => {
204
103
  const theme = useGlobalChartsTheme();
205
104
  const themeStrokeWidth = theme.sparkline?.strokeWidth ?? 1.5;
206
105
  const strokeWidth = strokeWidthProp ?? themeStrokeWidth;
207
- const seriesData = useMemo2(() => {
106
+ const seriesData = useMemo(() => {
208
107
  if (!data || data.length === 0) {
209
108
  return [];
210
109
  }
211
110
  return transformToSeriesData(data, color, strokeWidth);
212
111
  }, [data, color, strokeWidth]);
213
- const finalMargin = useMemo2(() => {
112
+ const finalMargin = useMemo(() => {
214
113
  const themeMargin = theme.sparkline?.margin ?? { top: 2, right: 2, bottom: 2, left: 2 };
215
114
  const margin = marginProp ?? themeMargin;
216
115
  return {
@@ -218,7 +117,7 @@ var SparklineComponent = forwardRef(
218
117
  ...margin
219
118
  };
220
119
  }, [marginProp, theme.sparkline?.margin]);
221
- const seriesWithGradient = useMemo2(() => {
120
+ const seriesWithGradient = useMemo(() => {
222
121
  if (!gradient || seriesData.length === 0) {
223
122
  return seriesData;
224
123
  }
@@ -236,11 +135,11 @@ var SparklineComponent = forwardRef(
236
135
  }));
237
136
  }, [seriesData, gradient, color]);
238
137
  if (!data || data.length === 0) {
239
- return /* @__PURE__ */ jsx2(
138
+ return /* @__PURE__ */ jsx(
240
139
  "div",
241
140
  {
242
141
  ref,
243
- className: clsx2(
142
+ className: clsx(
244
143
  "sparkline",
245
144
  sparkline_module_default.sparkline,
246
145
  sparkline_module_default["sparkline--empty"],
@@ -255,11 +154,11 @@ var SparklineComponent = forwardRef(
255
154
  const cx = width / 2;
256
155
  const cy = height / 2;
257
156
  const resolvedColor = color || "#000000";
258
- return /* @__PURE__ */ jsx2(
157
+ return /* @__PURE__ */ jsx(
259
158
  "div",
260
159
  {
261
160
  ref,
262
- className: clsx2(
161
+ className: clsx(
263
162
  "sparkline",
264
163
  sparkline_module_default.sparkline,
265
164
  sparkline_module_default["sparkline--single-point"],
@@ -267,17 +166,17 @@ var SparklineComponent = forwardRef(
267
166
  ),
268
167
  style: { width, height },
269
168
  "data-testid": "sparkline-single-point",
270
- children: /* @__PURE__ */ jsx2("svg", { width, height, "aria-hidden": "true", children: /* @__PURE__ */ jsx2("circle", { cx, cy, r: strokeWidth * 1.5, fill: resolvedColor }) })
169
+ children: /* @__PURE__ */ jsx("svg", { width, height, "aria-hidden": "true", children: /* @__PURE__ */ jsx("circle", { cx, cy, r: strokeWidth * 1.5, fill: resolvedColor }) })
271
170
  }
272
171
  );
273
172
  }
274
- return /* @__PURE__ */ jsx2(
173
+ return /* @__PURE__ */ jsx(
275
174
  "div",
276
175
  {
277
176
  ref,
278
- className: clsx2("sparkline", sparkline_module_default.sparkline, className),
177
+ className: clsx("sparkline", sparkline_module_default.sparkline, className),
279
178
  "data-testid": "sparkline",
280
- children: /* @__PURE__ */ jsx2(
179
+ children: /* @__PURE__ */ jsx(
281
180
  LineChart,
282
181
  {
283
182
  data: seriesWithGradient,
@@ -295,7 +194,8 @@ var SparklineComponent = forwardRef(
295
194
  y: { display: false }
296
195
  }
297
196
  },
298
- curveType: "monotone"
197
+ curveType: "monotone",
198
+ animation
299
199
  }
300
200
  )
301
201
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/charts/geo-chart/geo-chart.tsx","../src/charts/geo-chart/geo-chart.module.scss","../src/charts/sparkline/sparkline.tsx","../src/charts/sparkline/sparkline.module.scss"],"sourcesContent":["/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { FC, useContext, useMemo } from 'react';\nimport { Chart, type GoogleChartOptions } from 'react-google-charts';\n/**\n * Internal dependencies\n */\nimport { GlobalChartsContext, GlobalChartsProvider, useGlobalChartsContext } from '../../providers';\nimport { lightenHexColor, normalizeColorToHex } from '../../utils/color-utils';\nimport { resolveCssVariable } from '../../utils/resolve-css-var';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './geo-chart.module.scss';\nimport { GeoChartProps } from './types';\n\nconst DEFAULT_FEATURE_FILL_COLOR = '#ffffff';\nconst DEFAULT_BACKGROUND_COLOR = '#ffffff';\n\n/**\n * Renders a geographical chart using Google Charts GeoChart to visualize data.\n *\n * Supports the full Google Charts data format including custom tooltips, formatted values,\n * and multiple data columns for maximum flexibility.\n *\n * Locations can be identified by full name (e.g., 'United States', 'California') or codes\n * (e.g., 'US', 'US-CA'). Full names are recommended for better readability in tooltips.\n *\n * @param props - The props for the GeoChart component\n * @param props.data - Data in Google Charts format (array of arrays with headers)\n * @param props.width - Width of the chart in pixels\n * @param props.height - Height of the chart in pixels\n * @param props.region - Region to display ('world', 'US', or ISO 3166-1 alpha-2 code)\n * @param props.resolution - Resolution level ('countries', 'provinces', or 'metros')\n * @param props.className - Additional CSS class name for the chart container\n * @param props.renderPlaceholder - Optional render function for the loading placeholder\n * @return A React component displaying an interactive map with data visualization\n */\nconst GeoChartInternal: FC< GeoChartProps > = ( {\n\tclassName,\n\tdata,\n\twidth,\n\theight,\n\tregion = 'world',\n\tresolution = 'countries',\n\trenderPlaceholder,\n} ) => {\n\tconst {\n\t\tgetElementStyles,\n\t\ttheme: {\n\t\t\tgeoChart: { featureFillColor },\n\t\t\tbackgroundColor,\n\t\t},\n\t} = useGlobalChartsContext();\n\n\t// Render loading placeholder\n\tconst loadingPlaceholder = (\n\t\t<div\n\t\t\tclassName={ clsx( 'geo-chart', styles.container, className ) }\n\t\t\tdata-testid=\"geo-chart-loading\"\n\t\t\tstyle={ { width, height } }\n\t\t>\n\t\t\t{ renderPlaceholder ? renderPlaceholder() : __( 'Loading map', 'jetpack-charts' ) }\n\t\t</div>\n\t);\n\n\t// Google charts doesn't accept CSS variables, so we need to convert them to hex colors\n\tconst fullColorHex = getElementStyles( { index: 0 } ).color;\n\tconst lightColorHex = lightenHexColor( fullColorHex, 0.8 );\n\t// Use normalizeColorToHex to ensure HSL/RGB values from CSS variables are converted to hex\n\tconst backgroundColorHex =\n\t\tnormalizeColorToHex( backgroundColor, null, resolveCssVariable ) || DEFAULT_BACKGROUND_COLOR;\n\tconst defaultFillColorHex =\n\t\tnormalizeColorToHex( featureFillColor, null, resolveCssVariable ) || DEFAULT_FEATURE_FILL_COLOR;\n\n\t// Check if data has HTML tooltips (column with role: 'tooltip' and p.html: true)\n\tconst hasHtmlTooltips = useMemo(\n\t\t() =>\n\t\t\tdata.length > 0 &&\n\t\t\tdata[ 0 ].some(\n\t\t\t\tcol =>\n\t\t\t\t\ttypeof col === 'object' &&\n\t\t\t\t\tcol !== null &&\n\t\t\t\t\t'role' in col &&\n\t\t\t\t\tcol.role === 'tooltip' &&\n\t\t\t\t\t'p' in col &&\n\t\t\t\t\ttypeof col.p === 'object' &&\n\t\t\t\t\tcol.p !== null &&\n\t\t\t\t\t'html' in col.p &&\n\t\t\t\t\tcol.p.html === true\n\t\t\t),\n\t\t[ data ]\n\t);\n\n\tconst options: GoogleChartOptions = useMemo(\n\t\t() => ( {\n\t\t\t...( region !== 'world' && { region } ),\n\t\t\t...( resolution !== 'countries' && { resolution } ),\n\t\t\tcolorAxis: { colors: [ lightColorHex, fullColorHex ] },\n\t\t\tbackgroundColor: backgroundColorHex,\n\t\t\tdatalessRegionColor: defaultFillColorHex,\n\t\t\tdefaultColor: defaultFillColorHex,\n\t\t\ttooltip: { trigger: 'focus', isHtml: hasHtmlTooltips },\n\t\t\tlegend: 'none',\n\t\t\tkeepAspectRatio: true,\n\t\t} ),\n\t\t[\n\t\t\tregion,\n\t\t\tresolution,\n\t\t\tlightColorHex,\n\t\t\tfullColorHex,\n\t\t\tbackgroundColorHex,\n\t\t\tdefaultFillColorHex,\n\t\t\thasHtmlTooltips,\n\t\t]\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'geo-chart', styles.container, className ) }\n\t\t\tdata-testid=\"geo-chart\"\n\t\t\tstyle={ { width, height, backgroundColor } }\n\t\t>\n\t\t\t<Chart\n\t\t\t\tchartType=\"GeoChart\"\n\t\t\t\twidth={ width }\n\t\t\t\theight={ height }\n\t\t\t\tdata={ data }\n\t\t\t\toptions={ options }\n\t\t\t\tloader={ loadingPlaceholder }\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\nconst GeoChartWithProvider: FC< GeoChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <GeoChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<GeoChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nGeoChartWithProvider.displayName = 'GeoChart';\n\nconst GeoChartResponsive = withResponsive< GeoChartProps >( GeoChartWithProvider );\n\nexport { GeoChartResponsive as default, GeoChartWithProvider as GeoChartUnresponsive };\n","import 'css-chunk:src/charts/geo-chart/geo-chart.module.scss';export default {\n \"container\": \"a8ccharts-JvcqOz\"\n};","import clsx from 'clsx';\nimport { useMemo, forwardRef } from 'react';\nimport { useGlobalChartsTheme } from '../../providers';\nimport { LineChartUnresponsive } from '../line-chart';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './sparkline.module.scss';\nimport type { SparklineProps } from './types';\nimport type { SeriesData } from '../../types';\n\nconst DEFAULT_WIDTH = 100;\nconst DEFAULT_HEIGHT = 40;\n\n/**\n * Transforms a simple number array into SeriesData format for LineChart.\n * Uses index-based dates to create a linear x-axis.\n *\n * @param data - Array of numeric values to plot\n * @param color - Optional color for the line stroke\n * @param strokeWidth - Optional stroke width for the line\n * @return SeriesData array suitable for LineChart\n */\nconst transformToSeriesData = (\n\tdata: number[],\n\tcolor?: string,\n\tstrokeWidth?: number\n): SeriesData[] => {\n\t// Use a fixed base date and increment by index to create linear spacing\n\tconst baseDate = new Date( 2000, 0, 1 );\n\n\treturn [\n\t\t{\n\t\t\tlabel: 'sparkline',\n\t\t\tdata: data.map( ( value, index ) => ( {\n\t\t\t\tdate: new Date( baseDate.getTime() + index * 86400000 ), // Add days\n\t\t\t\tvalue,\n\t\t\t} ) ),\n\t\t\toptions: {\n\t\t\t\tstroke: color,\n\t\t\t\tseriesLineStyle: strokeWidth ? { strokeWidth } : undefined,\n\t\t\t},\n\t\t},\n\t];\n};\n\nconst SparklineComponent = forwardRef< HTMLDivElement, SparklineProps >(\n\t(\n\t\t{\n\t\t\tdata,\n\t\t\twidth = DEFAULT_WIDTH,\n\t\t\theight = DEFAULT_HEIGHT,\n\t\t\tcolor,\n\t\t\tstrokeWidth: strokeWidthProp,\n\t\t\twithGradientFill = true,\n\t\t\tgradient,\n\t\t\tclassName,\n\t\t\tchartId,\n\t\t\tmargin: marginProp,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst theme = useGlobalChartsTheme();\n\n\t\t// Get theme defaults for sparkline\n\t\tconst themeStrokeWidth = theme.sparkline?.strokeWidth ?? 1.5;\n\n\t\t// Use prop values or fall back to theme defaults\n\t\tconst strokeWidth = strokeWidthProp ?? themeStrokeWidth;\n\n\t\t// Transform number[] to SeriesData[] for LineChart\n\t\tconst seriesData = useMemo( () => {\n\t\t\tif ( ! data || data.length === 0 ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\treturn transformToSeriesData( data, color, strokeWidth );\n\t\t}, [ data, color, strokeWidth ] );\n\n\t\t// Merge margins with theme defaults\n\t\tconst finalMargin = useMemo( () => {\n\t\t\tconst themeMargin = theme.sparkline?.margin ?? { top: 2, right: 2, bottom: 2, left: 2 };\n\t\t\tconst margin = marginProp ?? themeMargin;\n\t\t\treturn {\n\t\t\t\t...themeMargin,\n\t\t\t\t...margin,\n\t\t\t};\n\t\t}, [ marginProp, theme.sparkline?.margin ] );\n\n\t\t// Build gradient options for the series if custom gradient is provided\n\t\t// Note: This must be called before any early returns to follow React hooks rules\n\t\tconst seriesWithGradient = useMemo( () => {\n\t\t\tif ( ! gradient || seriesData.length === 0 ) {\n\t\t\t\treturn seriesData;\n\t\t\t}\n\n\t\t\treturn seriesData.map( series => ( {\n\t\t\t\t...series,\n\t\t\t\toptions: {\n\t\t\t\t\t...series.options,\n\t\t\t\t\tgradient: {\n\t\t\t\t\t\tfrom: gradient.from || color || '#000000',\n\t\t\t\t\t\tto: gradient.to || '#ffffff',\n\t\t\t\t\t\tfromOpacity: gradient.fromOpacity ?? 0.5,\n\t\t\t\t\t\ttoOpacity: gradient.toOpacity ?? 0.0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} ) );\n\t\t}, [ seriesData, gradient, color ] );\n\n\t\t// Handle empty data\n\t\tif ( ! data || data.length === 0 ) {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'sparkline',\n\t\t\t\t\t\tstyles.sparkline,\n\t\t\t\t\t\tstyles[ 'sparkline--empty' ],\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"sparkline-empty\"\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Handle single data point - render a simple dot\n\t\tif ( data.length === 1 ) {\n\t\t\tconst cx = width / 2;\n\t\t\tconst cy = height / 2;\n\t\t\tconst resolvedColor = color || '#000000';\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'sparkline',\n\t\t\t\t\t\tstyles.sparkline,\n\t\t\t\t\t\tstyles[ 'sparkline--single-point' ],\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"sparkline-single-point\"\n\t\t\t\t>\n\t\t\t\t\t<svg width={ width } height={ height } aria-hidden=\"true\">\n\t\t\t\t\t\t<circle cx={ cx } cy={ cy } r={ strokeWidth * 1.5 } fill={ resolvedColor } />\n\t\t\t\t\t</svg>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ ref }\n\t\t\t\tclassName={ clsx( 'sparkline', styles.sparkline, className ) }\n\t\t\t\tdata-testid=\"sparkline\"\n\t\t\t>\n\t\t\t\t<LineChartUnresponsive\n\t\t\t\t\tdata={ seriesWithGradient }\n\t\t\t\t\twidth={ width }\n\t\t\t\t\theight={ height }\n\t\t\t\t\tmargin={ finalMargin }\n\t\t\t\t\tchartId={ chartId }\n\t\t\t\t\twithGradientFill={ withGradientFill }\n\t\t\t\t\twithTooltips={ false }\n\t\t\t\t\tshowLegend={ false }\n\t\t\t\t\tgridVisibility=\"none\"\n\t\t\t\t\toptions={ {\n\t\t\t\t\t\taxis: {\n\t\t\t\t\t\t\tx: { display: false },\n\t\t\t\t\t\t\ty: { display: false },\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t\tcurveType=\"monotone\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nSparklineComponent.displayName = 'SparklineComponent';\n\n/**\n * Sparkline - A minimal line chart for inline data visualization.\n *\n * Sparklines are compact charts designed to be embedded inline with text or\n * displayed in small spaces like table cells or dashboards. They show trends\n * without axes, labels, or other chart chrome.\n *\n * This component is built on top of LineChart with preconfigured settings\n * for minimal display (no axes, grid, tooltips, or legend).\n */\nconst SparklineUnresponsive = SparklineComponent;\n\nSparklineUnresponsive.displayName = 'SparklineUnresponsive';\n\n/**\n * Responsive Sparkline chart component\n */\nconst Sparkline = withResponsive< SparklineProps >( SparklineUnresponsive );\n\nexport { Sparkline as default, SparklineUnresponsive };\n","import 'css-chunk:src/charts/sparkline/sparkline.module.scss';export default {\n \"sparkline\": \"a8ccharts-o-3Z8B\",\n \"sparkline--empty\": \"a8ccharts-CbLbcd\"\n};"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,UAAU;AACnB,OAAO,UAAU;AACjB,SAAa,YAAY,eAAe;AACxC,SAAS,aAAsC;;;ACNe,IAAO,2BAAQ;AAAA,EAC3E,aAAa;AACf;;;ADwDE;AAzCF,IAAM,6BAA6B;AACnC,IAAM,2BAA2B;AAqBjC,IAAM,mBAAwC,CAAE;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AAAA,EACb;AACD,MAAO;AACN,QAAM;AAAA,IACL;AAAA,IACA,OAAO;AAAA,MACN,UAAU,EAAE,iBAAiB;AAAA,MAC7B;AAAA,IACD;AAAA,EACD,IAAI,uBAAuB;AAG3B,QAAM,qBACL;AAAA,IAAC;AAAA;AAAA,MACA,WAAY,KAAM,aAAa,yBAAO,WAAW,SAAU;AA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;AACnB,YAAM,KAAK,SAAS;AACpB,YAAM,gBAAgB,SAAS;AAE/B,aACC,gBAAAF;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA,WAAYE;AAAA,YACX;AAAA,YACA,yBAAO;AAAA,YACP,yBAAQ,yBAA0B;AAAA,YAClC;AAAA,UACD;AAAA,UACA,OAAQ,EAAE,OAAO,OAAO;AAAA,UACxB,eAAY;AAAA,UAEZ,0BAAAF,KAAC,SAAI,OAAgB,QAAkB,eAAY,QAClD,0BAAAA,KAAC,YAAO,IAAU,IAAU,GAAI,cAAc,KAAM,MAAO,eAAgB,GAC5E;AAAA;AAAA,MACD;AAAA,IAEF;AAEA,WACC,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,WAAYE,MAAM,aAAa,yBAAO,WAAW,SAAU;AAAA,QAC3D,eAAY;AAAA,QAEZ,0BAAAF;AAAA,UAAC;AAAA;AAAA,YACA,MAAO;AAAA,YACP;AAAA,YACA;AAAA,YACA,QAAS;AAAA,YACT;AAAA,YACA;AAAA,YACA,cAAe;AAAA,YACf,YAAa;AAAA,YACb,gBAAe;AAAA,YACf,SAAU;AAAA,cACT,MAAM;AAAA,gBACL,GAAG,EAAE,SAAS,MAAM;AAAA,gBACpB,GAAG,EAAE,SAAS,MAAM;AAAA,cACrB;AAAA,YACD;AAAA,YACA,WAAU;AAAA;AAAA,QACX;AAAA;AAAA,IACD;AAAA,EAEF;AACD;AAEA,mBAAmB,cAAc;AAYjC,IAAM,wBAAwB;AAE9B,sBAAsB,cAAc;AAKpC,IAAM,YAAY,eAAkC,qBAAsB;","names":["clsx","useMemo","jsx","useMemo","clsx"]}
1
+ {"version":3,"sources":["../src/charts/sparkline/sparkline.tsx","../src/charts/sparkline/sparkline.module.scss"],"sourcesContent":["import clsx from 'clsx';\nimport { useMemo, forwardRef } from 'react';\nimport { useGlobalChartsTheme } from '../../providers';\nimport { LineChartUnresponsive } from '../line-chart';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './sparkline.module.scss';\nimport type { SparklineProps } from './types';\nimport type { SeriesData } from '../../types';\n\nconst DEFAULT_WIDTH = 100;\nconst DEFAULT_HEIGHT = 40;\n\n/**\n * Transforms a simple number array into SeriesData format for LineChart.\n * Uses index-based dates to create a linear x-axis.\n *\n * @param data - Array of numeric values to plot\n * @param color - Optional color for the line stroke\n * @param strokeWidth - Optional stroke width for the line\n * @return SeriesData array suitable for LineChart\n */\nconst transformToSeriesData = (\n\tdata: number[],\n\tcolor?: string,\n\tstrokeWidth?: number\n): SeriesData[] => {\n\t// Use a fixed base date and increment by index to create linear spacing\n\tconst baseDate = new Date( 2000, 0, 1 );\n\n\treturn [\n\t\t{\n\t\t\tlabel: 'sparkline',\n\t\t\tdata: data.map( ( value, index ) => ( {\n\t\t\t\tdate: new Date( baseDate.getTime() + index * 86400000 ), // Add days\n\t\t\t\tvalue,\n\t\t\t} ) ),\n\t\t\toptions: {\n\t\t\t\tstroke: color,\n\t\t\t\tseriesLineStyle: strokeWidth ? { strokeWidth } : undefined,\n\t\t\t},\n\t\t},\n\t];\n};\n\nconst SparklineComponent = forwardRef< HTMLDivElement, SparklineProps >(\n\t(\n\t\t{\n\t\t\tdata,\n\t\t\twidth = DEFAULT_WIDTH,\n\t\t\theight = DEFAULT_HEIGHT,\n\t\t\tcolor,\n\t\t\tstrokeWidth: strokeWidthProp,\n\t\t\twithGradientFill = true,\n\t\t\tgradient,\n\t\t\tclassName,\n\t\t\tchartId,\n\t\t\tmargin: marginProp,\n\t\t\tanimation,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst theme = useGlobalChartsTheme();\n\n\t\t// Get theme defaults for sparkline\n\t\tconst themeStrokeWidth = theme.sparkline?.strokeWidth ?? 1.5;\n\n\t\t// Use prop values or fall back to theme defaults\n\t\tconst strokeWidth = strokeWidthProp ?? themeStrokeWidth;\n\n\t\t// Transform number[] to SeriesData[] for LineChart\n\t\tconst seriesData = useMemo( () => {\n\t\t\tif ( ! data || data.length === 0 ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\treturn transformToSeriesData( data, color, strokeWidth );\n\t\t}, [ data, color, strokeWidth ] );\n\n\t\t// Merge margins with theme defaults\n\t\tconst finalMargin = useMemo( () => {\n\t\t\tconst themeMargin = theme.sparkline?.margin ?? { top: 2, right: 2, bottom: 2, left: 2 };\n\t\t\tconst margin = marginProp ?? themeMargin;\n\t\t\treturn {\n\t\t\t\t...themeMargin,\n\t\t\t\t...margin,\n\t\t\t};\n\t\t}, [ marginProp, theme.sparkline?.margin ] );\n\n\t\t// Build gradient options for the series if custom gradient is provided\n\t\t// Note: This must be called before any early returns to follow React hooks rules\n\t\tconst seriesWithGradient = useMemo( () => {\n\t\t\tif ( ! gradient || seriesData.length === 0 ) {\n\t\t\t\treturn seriesData;\n\t\t\t}\n\n\t\t\treturn seriesData.map( series => ( {\n\t\t\t\t...series,\n\t\t\t\toptions: {\n\t\t\t\t\t...series.options,\n\t\t\t\t\tgradient: {\n\t\t\t\t\t\tfrom: gradient.from || color || '#000000',\n\t\t\t\t\t\tto: gradient.to || '#ffffff',\n\t\t\t\t\t\tfromOpacity: gradient.fromOpacity ?? 0.5,\n\t\t\t\t\t\ttoOpacity: gradient.toOpacity ?? 0.0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} ) );\n\t\t}, [ seriesData, gradient, color ] );\n\n\t\t// Handle empty data\n\t\tif ( ! data || data.length === 0 ) {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'sparkline',\n\t\t\t\t\t\tstyles.sparkline,\n\t\t\t\t\t\tstyles[ 'sparkline--empty' ],\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"sparkline-empty\"\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Handle single data point - render a simple dot\n\t\tif ( data.length === 1 ) {\n\t\t\tconst cx = width / 2;\n\t\t\tconst cy = height / 2;\n\t\t\tconst resolvedColor = color || '#000000';\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'sparkline',\n\t\t\t\t\t\tstyles.sparkline,\n\t\t\t\t\t\tstyles[ 'sparkline--single-point' ],\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"sparkline-single-point\"\n\t\t\t\t>\n\t\t\t\t\t<svg width={ width } height={ height } aria-hidden=\"true\">\n\t\t\t\t\t\t<circle cx={ cx } cy={ cy } r={ strokeWidth * 1.5 } fill={ resolvedColor } />\n\t\t\t\t\t</svg>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ ref }\n\t\t\t\tclassName={ clsx( 'sparkline', styles.sparkline, className ) }\n\t\t\t\tdata-testid=\"sparkline\"\n\t\t\t>\n\t\t\t\t<LineChartUnresponsive\n\t\t\t\t\tdata={ seriesWithGradient }\n\t\t\t\t\twidth={ width }\n\t\t\t\t\theight={ height }\n\t\t\t\t\tmargin={ finalMargin }\n\t\t\t\t\tchartId={ chartId }\n\t\t\t\t\twithGradientFill={ withGradientFill }\n\t\t\t\t\twithTooltips={ false }\n\t\t\t\t\tshowLegend={ false }\n\t\t\t\t\tgridVisibility=\"none\"\n\t\t\t\t\toptions={ {\n\t\t\t\t\t\taxis: {\n\t\t\t\t\t\t\tx: { display: false },\n\t\t\t\t\t\t\ty: { display: false },\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t\tcurveType=\"monotone\"\n\t\t\t\t\tanimation={ animation }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nSparklineComponent.displayName = 'SparklineComponent';\n\n/**\n * Sparkline - A minimal line chart for inline data visualization.\n *\n * Sparklines are compact charts designed to be embedded inline with text or\n * displayed in small spaces like table cells or dashboards. They show trends\n * without axes, labels, or other chart chrome.\n *\n * This component is built on top of LineChart with preconfigured settings\n * for minimal display (no axes, grid, tooltips, or legend).\n */\nconst SparklineUnresponsive = SparklineComponent;\n\nSparklineUnresponsive.displayName = 'SparklineUnresponsive';\n\n/**\n * Responsive Sparkline chart component\n */\nconst Sparkline = withResponsive< SparklineProps >( SparklineUnresponsive );\n\nexport { Sparkline as default, SparklineUnresponsive };\n","import 'css-chunk:src/charts/sparkline/sparkline.module.scss';export default {\n \"sparkline\": \"a8ccharts-o-3Z8B\",\n \"sparkline--empty\": \"a8ccharts-CbLbcd\"\n};"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AACjB,SAAS,SAAS,kBAAkB;;;ACD0B,IAAO,2BAAQ;AAAA,EAC3E,aAAa;AAAA,EACb,oBAAoB;AACtB;;;AD4GI;AAtGJ,IAAM,gBAAgB;AACtB,IAAM,iBAAiB;AAWvB,IAAM,wBAAwB,CAC7B,MACA,OACA,gBACkB;AAElB,QAAM,WAAW,IAAI,KAAM,KAAM,GAAG,CAAE;AAEtC,SAAO;AAAA,IACN;AAAA,MACC,OAAO;AAAA,MACP,MAAM,KAAK,IAAK,CAAE,OAAO,WAAa;AAAA,QACrC,MAAM,IAAI,KAAM,SAAS,QAAQ,IAAI,QAAQ,KAAS;AAAA;AAAA,QACtD;AAAA,MACD,EAAI;AAAA,MACJ,SAAS;AAAA,QACR,QAAQ;AAAA,QACR,iBAAiB,cAAc,EAAE,YAAY,IAAI;AAAA,MAClD;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAM,qBAAqB;AAAA,EAC1B,CACC;AAAA,IACC;AAAA,IACA,QAAQ;AAAA,IACR,SAAS;AAAA,IACT;AAAA,IACA,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA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AY;AAAA;AAAA,MACb;AAAA,IAEF;AAGA,QAAK,KAAK,WAAW,GAAI;AACxB,YAAM,KAAK,QAAQ;AACnB,YAAM,KAAK,SAAS;AACpB,YAAM,gBAAgB,SAAS;AAE/B,aACC;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA,WAAY;AAAA,YACX;AAAA,YACA,yBAAO;AAAA,YACP,yBAAQ,yBAA0B;AAAA,YAClC;AAAA,UACD;AAAA,UACA,OAAQ,EAAE,OAAO,OAAO;AAAA,UACxB,eAAY;AAAA,UAEZ,8BAAC,SAAI,OAAgB,QAAkB,eAAY,QAClD,8BAAC,YAAO,IAAU,IAAU,GAAI,cAAc,KAAM,MAAO,eAAgB,GAC5E;AAAA;AAAA,MACD;AAAA,IAEF;AAEA,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,WAAY,KAAM,aAAa,yBAAO,WAAW,SAAU;AAAA,QAC3D,eAAY;AAAA,QAEZ;AAAA,UAAC;AAAA;AAAA,YACA,MAAO;AAAA,YACP;AAAA,YACA;AAAA,YACA,QAAS;AAAA,YACT;AAAA,YACA;AAAA,YACA,cAAe;AAAA,YACf,YAAa;AAAA,YACb,gBAAe;AAAA,YACf,SAAU;AAAA,cACT,MAAM;AAAA,gBACL,GAAG,EAAE,SAAS,MAAM;AAAA,gBACpB,GAAG,EAAE,SAAS,MAAM;AAAA,cACrB;AAAA,YACD;AAAA,YACA,WAAU;AAAA,YACV;AAAA;AAAA,QACD;AAAA;AAAA,IACD;AAAA,EAEF;AACD;AAEA,mBAAmB,cAAc;AAYjC,IAAM,wBAAwB;AAE9B,sBAAsB,cAAc;AAKpC,IAAM,YAAY,eAAkC,qBAAsB;","names":[]}
@@ -3,7 +3,7 @@ import { R as ResponsiveConfig } from './with-responsive-Cp2qnQPo.cjs';
3
3
  import * as react from 'react';
4
4
  import { ReactNode, FC } from 'react';
5
5
  import { a as BaseLegendProps, B as BaseLegendItem } from './types-C05PdDJa.cjs';
6
- import { B as BaseChartProps, L as LeaderboardEntry } from './types-sQ20gAeB.cjs';
6
+ import { B as BaseChartProps, L as LeaderboardEntry } from './types-D1lTxRyg.cjs';
7
7
 
8
8
  interface LeaderboardChartProps extends Pick<BaseChartProps<LeaderboardEntry>, 'className' | 'data' | 'showLegend' | 'legendOrientation' | 'legendPosition' | 'legendAlignment' | 'legendShape' | 'chartId' | 'width' | 'height' | 'size' | 'legendInteractive' | 'animation'> {
9
9
  /**
@@ -3,7 +3,7 @@ import { R as ResponsiveConfig } from './with-responsive-Cp2qnQPo.js';
3
3
  import * as react from 'react';
4
4
  import { ReactNode, FC } from 'react';
5
5
  import { a as BaseLegendProps, B as BaseLegendItem } from './types-C05PdDJa.js';
6
- import { B as BaseChartProps, L as LeaderboardEntry } from './types-sQ20gAeB.js';
6
+ import { B as BaseChartProps, L as LeaderboardEntry } from './types-D1lTxRyg.js';
7
7
 
8
8
  interface LeaderboardChartProps extends Pick<BaseChartProps<LeaderboardEntry>, 'className' | 'data' | 'showLegend' | 'legendOrientation' | 'legendPosition' | 'legendAlignment' | 'legendShape' | 'chartId' | 'width' | 'height' | 'size' | 'legendInteractive' | 'animation'> {
9
9
  /**
@@ -6,8 +6,8 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkW3H42XRVcjs = require('../chunk-W3H42XRV.cjs');
10
- require('../chunk-DAKYGZG6.cjs');
9
+ var _chunkWKN6C4ZEcjs = require('../chunk-WKN6C4ZE.cjs');
10
+ require('../chunk-ZVGEDXDP.cjs');
11
11
  require('../chunk-EMMSS5I5.cjs');
12
12
 
13
13
 
@@ -17,5 +17,5 @@ require('../chunk-EMMSS5I5.cjs');
17
17
 
18
18
 
19
19
 
20
- exports.GlobalChartsContext = _chunkW3H42XRVcjs.GlobalChartsContext; exports.GlobalChartsProvider = _chunkW3H42XRVcjs.GlobalChartsProvider; exports.defaultTheme = _chunkW3H42XRVcjs.defaultTheme; exports.useChartId = _chunkW3H42XRVcjs.useChartId; exports.useChartRegistration = _chunkW3H42XRVcjs.useChartRegistration; exports.useGlobalChartsContext = _chunkW3H42XRVcjs.useGlobalChartsContext; exports.useGlobalChartsTheme = _chunkW3H42XRVcjs.useGlobalChartsTheme;
20
+ exports.GlobalChartsContext = _chunkWKN6C4ZEcjs.GlobalChartsContext; exports.GlobalChartsProvider = _chunkWKN6C4ZEcjs.GlobalChartsProvider; exports.defaultTheme = _chunkWKN6C4ZEcjs.defaultTheme; exports.useChartId = _chunkWKN6C4ZEcjs.useChartId; exports.useChartRegistration = _chunkWKN6C4ZEcjs.useChartRegistration; exports.useGlobalChartsContext = _chunkWKN6C4ZEcjs.useGlobalChartsContext; exports.useGlobalChartsTheme = _chunkWKN6C4ZEcjs.useGlobalChartsTheme;
21
21
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
- export { C as ChartRegistration, E as ElementStyles, d as GetElementStylesParams, a as GlobalChartsContext, c as GlobalChartsContextValue, G as GlobalChartsProvider, e as defaultTheme, u as useGlobalChartsContext, b as useGlobalChartsTheme } from '../themes-DijSDhqQ.cjs';
1
+ export { C as ChartRegistration, E as ElementStyles, e as GetElementStylesParams, b as GlobalChartsContext, c as GlobalChartsContextValue, G as GlobalChartsProvider, d as defaultTheme, u as useGlobalChartsContext, a as useGlobalChartsTheme } from '../themes-Dzg0wE3B.cjs';
2
2
  import { B as BaseLegendItem } from '../types-C05PdDJa.cjs';
3
3
  import 'react';
4
- import '../types-sQ20gAeB.cjs';
4
+ import '../types-D1lTxRyg.cjs';
5
5
  import '@visx/annotation/lib/components/CircleSubject';
6
6
  import '@visx/annotation/lib/components/Connector';
7
7
  import '@visx/annotation/lib/components/Label';
@@ -1,7 +1,7 @@
1
- export { C as ChartRegistration, E as ElementStyles, d as GetElementStylesParams, a as GlobalChartsContext, c as GlobalChartsContextValue, G as GlobalChartsProvider, e as defaultTheme, u as useGlobalChartsContext, b as useGlobalChartsTheme } from '../themes-ChB_VjWt.js';
1
+ export { C as ChartRegistration, E as ElementStyles, e as GetElementStylesParams, b as GlobalChartsContext, c as GlobalChartsContextValue, G as GlobalChartsProvider, d as defaultTheme, u as useGlobalChartsContext, a as useGlobalChartsTheme } from '../themes-AriuFXQ2.js';
2
2
  import { B as BaseLegendItem } from '../types-C05PdDJa.js';
3
3
  import 'react';
4
- import '../types-sQ20gAeB.js';
4
+ import '../types-D1lTxRyg.js';
5
5
  import '@visx/annotation/lib/components/CircleSubject';
6
6
  import '@visx/annotation/lib/components/Connector';
7
7
  import '@visx/annotation/lib/components/Label';
@@ -6,8 +6,8 @@ import {
6
6
  useChartRegistration,
7
7
  useGlobalChartsContext,
8
8
  useGlobalChartsTheme
9
- } from "../chunk-O2BJMTIS.js";
10
- import "../chunk-P3QEXFTA.js";
9
+ } from "../chunk-DYMJWNYM.js";
10
+ import "../chunk-TE63Y5PX.js";
11
11
  import "../chunk-G3PMV62Z.js";
12
12
  export {
13
13
  GlobalChartsContext,
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, CSSProperties, FC } from 'react';
3
- import { f as CompleteChartTheme, S as SeriesData, e as DataPointPercentage, C as ChartTheme } from './types-sQ20gAeB.js';
3
+ import { f as CompleteChartTheme, d as SeriesData, e as DataPointPercentage, C as ChartTheme } from './types-D1lTxRyg.js';
4
4
  import { B as BaseLegendItem } from './types-C05PdDJa.js';
5
5
  import { LegendShape } from '@visx/legend/lib/types';
6
6
  import { LineStyles, GlyphProps } from '@visx/xychart';
@@ -55,4 +55,4 @@ declare const useGlobalChartsTheme: () => CompleteChartTheme;
55
55
  */
56
56
  declare const defaultTheme: CompleteChartTheme;
57
57
 
58
- export { type ChartRegistration as C, type ElementStyles as E, GlobalChartsProvider as G, GlobalChartsContext as a, useGlobalChartsTheme as b, type GlobalChartsContextValue as c, type GetElementStylesParams as d, defaultTheme as e, useGlobalChartsContext as u };
58
+ export { type ChartRegistration as C, type ElementStyles as E, GlobalChartsProvider as G, useGlobalChartsTheme as a, GlobalChartsContext as b, type GlobalChartsContextValue as c, defaultTheme as d, type GetElementStylesParams as e, useGlobalChartsContext as u };
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, CSSProperties, FC } from 'react';
3
- import { f as CompleteChartTheme, S as SeriesData, e as DataPointPercentage, C as ChartTheme } from './types-sQ20gAeB.cjs';
3
+ import { f as CompleteChartTheme, d as SeriesData, e as DataPointPercentage, C as ChartTheme } from './types-D1lTxRyg.cjs';
4
4
  import { B as BaseLegendItem } from './types-C05PdDJa.cjs';
5
5
  import { LegendShape } from '@visx/legend/lib/types';
6
6
  import { LineStyles, GlyphProps } from '@visx/xychart';
@@ -55,4 +55,4 @@ declare const useGlobalChartsTheme: () => CompleteChartTheme;
55
55
  */
56
56
  declare const defaultTheme: CompleteChartTheme;
57
57
 
58
- export { type ChartRegistration as C, type ElementStyles as E, GlobalChartsProvider as G, GlobalChartsContext as a, useGlobalChartsTheme as b, type GlobalChartsContextValue as c, type GetElementStylesParams as d, defaultTheme as e, useGlobalChartsContext as u };
58
+ export { type ChartRegistration as C, type ElementStyles as E, GlobalChartsProvider as G, useGlobalChartsTheme as a, GlobalChartsContext as b, type GlobalChartsContextValue as c, defaultTheme as d, type GetElementStylesParams as e, useGlobalChartsContext as u };
@@ -477,4 +477,4 @@ interface ToggleEvent extends Event {
477
477
  oldState: 'open' | 'closed';
478
478
  }
479
479
 
480
- export type { AnnotationStyles as A, BaseChartProps as B, ChartTheme as C, DataPointDate as D, GeoData as G, LeaderboardEntry as L, MultipleDataPointsDate as M, Optional as O, PopoverButtonAttributes as P, SeriesData as S, ToggleEvent as T, OrientationType as a, DataPoint as b, GradientStop as c, SeriesDataOptions as d, DataPointPercentage as e, CompleteChartTheme as f, ScaleOptions as g, GridProps as h, PopoverElementAttributes as i, ButtonWithPopover as j, PopoverElement as k };
480
+ export type { AnnotationStyles as A, BaseChartProps as B, ChartTheme as C, DataPoint as D, GeoData as G, LeaderboardEntry as L, MultipleDataPointsDate as M, Optional as O, PopoverButtonAttributes as P, SeriesDataOptions as S, ToggleEvent as T, OrientationType as a, DataPointDate as b, GradientStop as c, SeriesData as d, DataPointPercentage as e, CompleteChartTheme as f, ScaleOptions as g, GridProps as h, PopoverElementAttributes as i, ButtonWithPopover as j, PopoverElement as k };
@@ -477,4 +477,4 @@ interface ToggleEvent extends Event {
477
477
  oldState: 'open' | 'closed';
478
478
  }
479
479
 
480
- export type { AnnotationStyles as A, BaseChartProps as B, ChartTheme as C, DataPointDate as D, GeoData as G, LeaderboardEntry as L, MultipleDataPointsDate as M, Optional as O, PopoverButtonAttributes as P, SeriesData as S, ToggleEvent as T, OrientationType as a, DataPoint as b, GradientStop as c, SeriesDataOptions as d, DataPointPercentage as e, CompleteChartTheme as f, ScaleOptions as g, GridProps as h, PopoverElementAttributes as i, ButtonWithPopover as j, PopoverElement as k };
480
+ export type { AnnotationStyles as A, BaseChartProps as B, ChartTheme as C, DataPoint as D, GeoData as G, LeaderboardEntry as L, MultipleDataPointsDate as M, Optional as O, PopoverButtonAttributes as P, SeriesDataOptions as S, ToggleEvent as T, OrientationType as a, DataPointDate as b, GradientStop as c, SeriesData as d, DataPointPercentage as e, CompleteChartTheme as f, ScaleOptions as g, GridProps as h, PopoverElementAttributes as i, ButtonWithPopover as j, PopoverElement as k };
@@ -17,7 +17,8 @@
17
17
 
18
18
 
19
19
 
20
- var _chunkDAKYGZG6cjs = require('../chunk-DAKYGZG6.cjs');
20
+
21
+ var _chunkZVGEDXDPcjs = require('../chunk-ZVGEDXDP.cjs');
21
22
  require('../chunk-EMMSS5I5.cjs');
22
23
 
23
24
 
@@ -38,5 +39,6 @@ require('../chunk-EMMSS5I5.cjs');
38
39
 
39
40
 
40
41
 
41
- exports.attachSubComponents = _chunkDAKYGZG6cjs.attachSubComponents; exports.formatMetricValue = _chunkDAKYGZG6cjs.formatMetricValue; exports.formatPercentage = _chunkDAKYGZG6cjs.formatPercentage; exports.getColorDistance = _chunkDAKYGZG6cjs.getColorDistance; exports.getItemShapeStyles = _chunkDAKYGZG6cjs.getItemShapeStyles; exports.getLongestTickWidth = _chunkDAKYGZG6cjs.getLongestTickWidth; exports.getSeriesLineStyles = _chunkDAKYGZG6cjs.getSeriesLineStyles; exports.getSeriesStroke = _chunkDAKYGZG6cjs.getSeriesStroke; exports.isSafari = _chunkDAKYGZG6cjs.isSafari; exports.isValidHexColor = _chunkDAKYGZG6cjs.isValidHexColor; exports.lightenHexColor = _chunkDAKYGZG6cjs.lightenHexColor; exports.mergeThemes = _chunkDAKYGZG6cjs.mergeThemes; exports.normalizeColorToHex = _chunkDAKYGZG6cjs.normalizeColorToHex; exports.parseAsLocalDate = _chunkDAKYGZG6cjs.parseAsLocalDate; exports.parseHslString = _chunkDAKYGZG6cjs.parseHslString; exports.parseRgbString = _chunkDAKYGZG6cjs.parseRgbString; exports.resolveCssVariable = _chunkDAKYGZG6cjs.resolveCssVariable; exports.validateHexColor = _chunkDAKYGZG6cjs.validateHexColor;
42
+
43
+ exports.attachSubComponents = _chunkZVGEDXDPcjs.attachSubComponents; exports.formatMetricValue = _chunkZVGEDXDPcjs.formatMetricValue; exports.formatPercentage = _chunkZVGEDXDPcjs.formatPercentage; exports.getColorDistance = _chunkZVGEDXDPcjs.getColorDistance; exports.getItemShapeStyles = _chunkZVGEDXDPcjs.getItemShapeStyles; exports.getLongestTickWidth = _chunkZVGEDXDPcjs.getLongestTickWidth; exports.getSeriesLineStyles = _chunkZVGEDXDPcjs.getSeriesLineStyles; exports.getSeriesStroke = _chunkZVGEDXDPcjs.getSeriesStroke; exports.hexToRgba = _chunkZVGEDXDPcjs.hexToRgba; exports.isSafari = _chunkZVGEDXDPcjs.isSafari; exports.isValidHexColor = _chunkZVGEDXDPcjs.isValidHexColor; exports.lightenHexColor = _chunkZVGEDXDPcjs.lightenHexColor; exports.mergeThemes = _chunkZVGEDXDPcjs.mergeThemes; exports.normalizeColorToHex = _chunkZVGEDXDPcjs.normalizeColorToHex; exports.parseAsLocalDate = _chunkZVGEDXDPcjs.parseAsLocalDate; exports.parseHslString = _chunkZVGEDXDPcjs.parseHslString; exports.parseRgbString = _chunkZVGEDXDPcjs.parseRgbString; exports.resolveCssVariable = _chunkZVGEDXDPcjs.resolveCssVariable; exports.validateHexColor = _chunkZVGEDXDPcjs.validateHexColor;
42
44
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/utils/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,umCAAC","file":"/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/utils/index.cjs"}
1
+ {"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/utils/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wpCAAC","file":"/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/utils/index.cjs"}
@@ -1,7 +1,7 @@
1
1
  export { M as MetricValueType, f as formatMetricValue } from '../format-metric-value-MXm5DtQ_.cjs';
2
2
  import { TickFormatter } from '@visx/axis';
3
3
  import { AnyD3Scale, ScaleInput } from '@visx/scale';
4
- import { S as SeriesData, C as ChartTheme, f as CompleteChartTheme } from '../types-sQ20gAeB.cjs';
4
+ import { d as SeriesData, C as ChartTheme, f as CompleteChartTheme } from '../types-D1lTxRyg.cjs';
5
5
  import { LegendShape } from '@visx/legend/lib/types';
6
6
  import { LineStyles } from '@visx/xychart';
7
7
  import '@visx/annotation/lib/components/CircleSubject';
@@ -157,6 +157,15 @@ declare const isValidHexColor: (hex: unknown) => hex is string;
157
157
  * @throws {Error} if hex string is malformed
158
158
  */
159
159
  declare const validateHexColor: (hex: unknown) => void;
160
+ /**
161
+ * Convert hex color to rgba with specified opacity.
162
+ * This is genuinely reusable across chart components.
163
+ * @param hex - The hex color string (e.g., '#ff0000')
164
+ * @param alpha - The opacity value. Values outside the [0, 1] range will be clamped by the underlying d3 color library.
165
+ * @return The rgba color string (e.g., 'rgba(255, 0, 0, 0.5)')
166
+ * @throws {Error} if hex string is malformed or alpha is not a valid number
167
+ */
168
+ declare const hexToRgba: (hex: string, alpha: number) => string;
160
169
  /**
161
170
  * Calculate the perceptual distance between two HSL colors
162
171
  * @param hsl1 - first color in HSL format [h, s, l]
@@ -213,4 +222,4 @@ declare const lightenHexColor: (hex: string, blend: number) => string;
213
222
  */
214
223
  declare const resolveCssVariable: (value: string, element?: HTMLElement | null) => string | null;
215
224
 
216
- export { attachSubComponents, formatPercentage, getColorDistance, getItemShapeStyles, getLongestTickWidth, getSeriesLineStyles, getSeriesStroke, isSafari, isValidHexColor, lightenHexColor, mergeThemes, normalizeColorToHex, parseAsLocalDate, parseHslString, parseRgbString, resolveCssVariable, validateHexColor };
225
+ export { attachSubComponents, formatPercentage, getColorDistance, getItemShapeStyles, getLongestTickWidth, getSeriesLineStyles, getSeriesStroke, hexToRgba, isSafari, isValidHexColor, lightenHexColor, mergeThemes, normalizeColorToHex, parseAsLocalDate, parseHslString, parseRgbString, resolveCssVariable, validateHexColor };