@automattic/charts 0.56.3 → 0.56.5

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 (186) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/charts/bar-chart/index.cjs +5 -5
  3. package/dist/charts/bar-chart/index.css +12 -0
  4. package/dist/charts/bar-chart/index.css.map +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.css +12 -0
  8. package/dist/charts/bar-list-chart/index.css.map +1 -1
  9. package/dist/charts/bar-list-chart/index.js +5 -5
  10. package/dist/charts/conversion-funnel-chart/index.cjs +5 -3
  11. package/dist/charts/conversion-funnel-chart/index.cjs.map +1 -1
  12. package/dist/charts/conversion-funnel-chart/index.css +14 -1
  13. package/dist/charts/conversion-funnel-chart/index.css.map +1 -1
  14. package/dist/charts/conversion-funnel-chart/index.d.cts +2 -0
  15. package/dist/charts/conversion-funnel-chart/index.d.ts +2 -0
  16. package/dist/charts/conversion-funnel-chart/index.js +4 -2
  17. package/dist/charts/geo-chart/index.cjs +4 -4
  18. package/dist/charts/geo-chart/index.css +12 -0
  19. package/dist/charts/geo-chart/index.css.map +1 -1
  20. package/dist/charts/geo-chart/index.js +3 -3
  21. package/dist/charts/leaderboard-chart/index.cjs +5 -5
  22. package/dist/charts/leaderboard-chart/index.css +12 -0
  23. package/dist/charts/leaderboard-chart/index.css.map +1 -1
  24. package/dist/charts/leaderboard-chart/index.js +4 -4
  25. package/dist/charts/line-chart/index.cjs +5 -5
  26. package/dist/charts/line-chart/index.css +12 -0
  27. package/dist/charts/line-chart/index.css.map +1 -1
  28. package/dist/charts/line-chart/index.js +4 -4
  29. package/dist/charts/pie-chart/index.cjs +7 -7
  30. package/dist/charts/pie-chart/index.css +12 -0
  31. package/dist/charts/pie-chart/index.css.map +1 -1
  32. package/dist/charts/pie-chart/index.js +6 -6
  33. package/dist/charts/pie-semi-circle-chart/index.cjs +7 -7
  34. package/dist/charts/pie-semi-circle-chart/index.css +12 -0
  35. package/dist/charts/pie-semi-circle-chart/index.css.map +1 -1
  36. package/dist/charts/pie-semi-circle-chart/index.js +6 -6
  37. package/dist/charts/sparkline/index.cjs +6 -6
  38. package/dist/charts/sparkline/index.css +12 -0
  39. package/dist/charts/sparkline/index.css.map +1 -1
  40. package/dist/charts/sparkline/index.js +5 -5
  41. package/dist/{chunk-OTZT3MC2.cjs → chunk-2A34OA5O.cjs} +19 -20
  42. package/dist/chunk-2A34OA5O.cjs.map +1 -0
  43. package/dist/{chunk-H34CJSR6.js → chunk-32ESS4MV.js} +406 -363
  44. package/dist/chunk-32ESS4MV.js.map +1 -0
  45. package/dist/{chunk-CEZGL6YP.js → chunk-6CCZL2JJ.js} +15 -7
  46. package/dist/chunk-6CCZL2JJ.js.map +1 -0
  47. package/dist/{chunk-NW3RUYK2.cjs → chunk-7QDEU3KN.cjs} +15 -22
  48. package/dist/chunk-7QDEU3KN.cjs.map +1 -0
  49. package/dist/chunk-7TQSPLIN.js +351 -0
  50. package/dist/chunk-7TQSPLIN.js.map +1 -0
  51. package/dist/{chunk-T4J6TI55.js → chunk-AFWQR3SM.js} +102 -79
  52. package/dist/chunk-AFWQR3SM.js.map +1 -0
  53. package/dist/{chunk-5XI443YP.js → chunk-BPYKWMI7.js} +72 -64
  54. package/dist/chunk-BPYKWMI7.js.map +1 -0
  55. package/dist/{chunk-TNRKEBTA.js → chunk-DBY6C4O2.js} +148 -164
  56. package/dist/{chunk-TNRKEBTA.js.map → chunk-DBY6C4O2.js.map} +1 -1
  57. package/dist/chunk-DLSUC7RN.js +1065 -0
  58. package/dist/chunk-DLSUC7RN.js.map +1 -0
  59. package/dist/{chunk-TVV7ZI7C.cjs → chunk-EJJO2QNB.cjs} +399 -356
  60. package/dist/chunk-EJJO2QNB.cjs.map +1 -0
  61. package/dist/{chunk-ODF5O5PV.cjs → chunk-FIFSYVN6.cjs} +154 -170
  62. package/dist/chunk-FIFSYVN6.cjs.map +1 -0
  63. package/dist/chunk-FY325WQ4.cjs +1065 -0
  64. package/dist/chunk-FY325WQ4.cjs.map +1 -0
  65. package/dist/{chunk-SRXJLAKG.cjs → chunk-I2276W3I.cjs} +28 -37
  66. package/dist/chunk-I2276W3I.cjs.map +1 -0
  67. package/dist/{chunk-7UJPVCMB.cjs → chunk-IHESL7H5.cjs} +265 -262
  68. package/dist/chunk-IHESL7H5.cjs.map +1 -0
  69. package/dist/chunk-JL4ZKKZU.cjs +375 -0
  70. package/dist/chunk-JL4ZKKZU.cjs.map +1 -0
  71. package/dist/chunk-KHRPRH4V.js +165 -0
  72. package/dist/chunk-KHRPRH4V.js.map +1 -0
  73. package/dist/{chunk-A3AEEGKR.js → chunk-KXRWNFQJ.js} +20 -21
  74. package/dist/chunk-KXRWNFQJ.js.map +1 -0
  75. package/dist/{chunk-2VPPTJS2.js → chunk-KXSLMOW5.js} +256 -253
  76. package/dist/chunk-KXSLMOW5.js.map +1 -0
  77. package/dist/chunk-LT4YOIMM.js +375 -0
  78. package/dist/chunk-LT4YOIMM.js.map +1 -0
  79. package/dist/chunk-LTPJPIDP.cjs +165 -0
  80. package/dist/chunk-LTPJPIDP.cjs.map +1 -0
  81. package/dist/chunk-NGHXTIUE.cjs +120 -0
  82. package/dist/chunk-NGHXTIUE.cjs.map +1 -0
  83. package/dist/chunk-PCOI2GT5.js +120 -0
  84. package/dist/chunk-PCOI2GT5.js.map +1 -0
  85. package/dist/{chunk-YYQ4IK5V.cjs → chunk-Q6G3BGCL.cjs} +103 -80
  86. package/dist/chunk-Q6G3BGCL.cjs.map +1 -0
  87. package/dist/{chunk-HIWNB5PK.cjs → chunk-RCY6XLGU.cjs} +13 -5
  88. package/dist/chunk-RCY6XLGU.cjs.map +1 -0
  89. package/dist/chunk-TKPK4RFS.cjs +351 -0
  90. package/dist/chunk-TKPK4RFS.cjs.map +1 -0
  91. package/dist/{chunk-C33AQZEC.js → chunk-TYIH5LMV.js} +16 -23
  92. package/dist/chunk-TYIH5LMV.js.map +1 -0
  93. package/dist/chunk-X6GX4QUJ.js +421 -0
  94. package/dist/chunk-X6GX4QUJ.js.map +1 -0
  95. package/dist/chunk-XCXAWMJQ.cjs +421 -0
  96. package/dist/chunk-XCXAWMJQ.cjs.map +1 -0
  97. package/dist/chunk-XWYZIFZW.js +66 -0
  98. package/dist/chunk-XWYZIFZW.js.map +1 -0
  99. package/dist/{chunk-7HROSZRS.cjs → chunk-Y3NNQMAX.cjs} +70 -62
  100. package/dist/chunk-Y3NNQMAX.cjs.map +1 -0
  101. package/dist/components/legend/index.cjs +2 -2
  102. package/dist/components/legend/index.css +12 -0
  103. package/dist/components/legend/index.css.map +1 -1
  104. package/dist/components/legend/index.js +1 -1
  105. package/dist/components/tooltip/index.cjs +2 -2
  106. package/dist/components/tooltip/index.js +1 -1
  107. package/dist/components/trend-indicator/index.cjs +2 -2
  108. package/dist/components/trend-indicator/index.js +1 -1
  109. package/dist/hooks/index.cjs +4 -2
  110. package/dist/hooks/index.cjs.map +1 -1
  111. package/dist/hooks/index.css +12 -0
  112. package/dist/hooks/index.css.map +1 -1
  113. package/dist/hooks/index.d.cts +28 -2
  114. package/dist/hooks/index.d.ts +28 -2
  115. package/dist/hooks/index.js +3 -1
  116. package/dist/index.cjs +18 -18
  117. package/dist/index.cjs.map +1 -1
  118. package/dist/index.css +14 -1
  119. package/dist/index.css.map +1 -1
  120. package/dist/index.d.cts +1 -1
  121. package/dist/index.d.ts +1 -1
  122. package/dist/index.js +17 -17
  123. package/dist/providers/index.cjs +2 -2
  124. package/dist/providers/index.css +12 -0
  125. package/dist/providers/index.css.map +1 -1
  126. package/dist/providers/index.d.cts +1 -1
  127. package/dist/providers/index.d.ts +1 -1
  128. package/dist/providers/index.js +1 -1
  129. package/dist/{themes-DQs9rbN5.d.cts → themes-BDVaIfBz.d.cts} +9 -0
  130. package/dist/{themes-CRV5fVzJ.d.ts → themes-mcS8QNkQ.d.ts} +9 -0
  131. package/package.json +6 -2
  132. package/src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss +2 -1
  133. package/src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx +16 -6
  134. package/src/charts/conversion-funnel-chart/test/conversion-funnel-chart.test.tsx +34 -0
  135. package/src/charts/conversion-funnel-chart/types.ts +2 -0
  136. package/src/charts/pie-chart/pie-chart.tsx +2 -3
  137. package/src/hooks/index.ts +1 -0
  138. package/src/hooks/test/use-chart-margin.test.tsx +44 -0
  139. package/src/hooks/test/use-tooltip-portal-relocator.test.ts +216 -0
  140. package/src/hooks/use-chart-margin.tsx +92 -6
  141. package/src/hooks/use-tooltip-portal-relocator.module.scss +10 -0
  142. package/src/hooks/use-tooltip-portal-relocator.ts +177 -0
  143. package/src/providers/chart-context/global-charts-provider.tsx +18 -1
  144. package/tsup.config.ts +11 -0
  145. package/dist/chunk-2VPPTJS2.js.map +0 -1
  146. package/dist/chunk-5XI443YP.js.map +0 -1
  147. package/dist/chunk-7HROSZRS.cjs.map +0 -1
  148. package/dist/chunk-7UJPVCMB.cjs.map +0 -1
  149. package/dist/chunk-A3AEEGKR.js.map +0 -1
  150. package/dist/chunk-C33AQZEC.js.map +0 -1
  151. package/dist/chunk-CEZGL6YP.js.map +0 -1
  152. package/dist/chunk-COOC2TVQ.js +0 -167
  153. package/dist/chunk-COOC2TVQ.js.map +0 -1
  154. package/dist/chunk-EJHLLXBV.js +0 -362
  155. package/dist/chunk-EJHLLXBV.js.map +0 -1
  156. package/dist/chunk-FWMJ2FR2.js +0 -121
  157. package/dist/chunk-FWMJ2FR2.js.map +0 -1
  158. package/dist/chunk-GRYNIPWH.cjs +0 -385
  159. package/dist/chunk-GRYNIPWH.cjs.map +0 -1
  160. package/dist/chunk-H34CJSR6.js.map +0 -1
  161. package/dist/chunk-HIWNB5PK.cjs.map +0 -1
  162. package/dist/chunk-IZWC33YN.cjs +0 -357
  163. package/dist/chunk-IZWC33YN.cjs.map +0 -1
  164. package/dist/chunk-KOF32DBL.cjs +0 -1058
  165. package/dist/chunk-KOF32DBL.cjs.map +0 -1
  166. package/dist/chunk-LHWRZMF7.cjs +0 -362
  167. package/dist/chunk-LHWRZMF7.cjs.map +0 -1
  168. package/dist/chunk-MFRS2PEY.cjs +0 -121
  169. package/dist/chunk-MFRS2PEY.cjs.map +0 -1
  170. package/dist/chunk-MMDLXS6O.js +0 -75
  171. package/dist/chunk-MMDLXS6O.js.map +0 -1
  172. package/dist/chunk-NW3RUYK2.cjs.map +0 -1
  173. package/dist/chunk-ODF5O5PV.cjs.map +0 -1
  174. package/dist/chunk-OTZT3MC2.cjs.map +0 -1
  175. package/dist/chunk-SBRMWDWM.js +0 -357
  176. package/dist/chunk-SBRMWDWM.js.map +0 -1
  177. package/dist/chunk-SRXJLAKG.cjs.map +0 -1
  178. package/dist/chunk-T4J6TI55.js.map +0 -1
  179. package/dist/chunk-TVV7ZI7C.cjs.map +0 -1
  180. package/dist/chunk-XVMXWV3C.cjs +0 -167
  181. package/dist/chunk-XVMXWV3C.cjs.map +0 -1
  182. package/dist/chunk-YYQ4IK5V.cjs.map +0 -1
  183. package/dist/chunk-ZDNCF642.js +0 -1058
  184. package/dist/chunk-ZDNCF642.js.map +0 -1
  185. package/dist/chunk-ZWBUEHKF.js +0 -385
  186. package/dist/chunk-ZWBUEHKF.js.map +0 -1
@@ -0,0 +1,165 @@
1
+ import {
2
+ LineChart
3
+ } from "./chunk-DLSUC7RN.js";
4
+ import {
5
+ withResponsive
6
+ } from "./chunk-TYIH5LMV.js";
7
+ import {
8
+ useGlobalChartsTheme
9
+ } from "./chunk-32ESS4MV.js";
10
+
11
+ // src/charts/sparkline/sparkline.tsx
12
+ import clsx from "clsx";
13
+ import { useMemo, forwardRef } from "react";
14
+
15
+ // src/charts/sparkline/sparkline.module.scss
16
+ var sparkline_module_default = {
17
+ "sparkline": "a8ccharts-o-3Z8B",
18
+ "sparkline--empty": "a8ccharts-CbLbcd"
19
+ };
20
+
21
+ // src/charts/sparkline/sparkline.tsx
22
+ import { jsx as _jsx } from "react/jsx-runtime";
23
+ var DEFAULT_WIDTH = 100;
24
+ var DEFAULT_HEIGHT = 40;
25
+ var transformToSeriesData = (data, color, strokeWidth) => {
26
+ const baseDate = new Date(2e3, 0, 1);
27
+ return [{
28
+ label: "sparkline",
29
+ data: data.map((value, index) => ({
30
+ date: new Date(baseDate.getTime() + index * 864e5),
31
+ // Add days
32
+ value
33
+ })),
34
+ options: {
35
+ stroke: color,
36
+ seriesLineStyle: strokeWidth ? {
37
+ strokeWidth
38
+ } : void 0
39
+ }
40
+ }];
41
+ };
42
+ var SparklineComponent = /* @__PURE__ */ forwardRef(({
43
+ data,
44
+ width = DEFAULT_WIDTH,
45
+ height = DEFAULT_HEIGHT,
46
+ color,
47
+ strokeWidth: strokeWidthProp,
48
+ withGradientFill = true,
49
+ gradient,
50
+ className,
51
+ chartId,
52
+ margin: marginProp,
53
+ animation
54
+ }, ref) => {
55
+ const theme = useGlobalChartsTheme();
56
+ const themeStrokeWidth = theme.sparkline?.strokeWidth ?? 1.5;
57
+ const strokeWidth = strokeWidthProp ?? themeStrokeWidth;
58
+ const seriesData = useMemo(() => {
59
+ if (!data || data.length === 0) {
60
+ return [];
61
+ }
62
+ return transformToSeriesData(data, color, strokeWidth);
63
+ }, [data, color, strokeWidth]);
64
+ const finalMargin = useMemo(() => {
65
+ const themeMargin = theme.sparkline?.margin ?? {
66
+ top: 2,
67
+ right: 2,
68
+ bottom: 2,
69
+ left: 2
70
+ };
71
+ const margin = marginProp ?? themeMargin;
72
+ return {
73
+ ...themeMargin,
74
+ ...margin
75
+ };
76
+ }, [marginProp, theme.sparkline?.margin]);
77
+ const seriesWithGradient = useMemo(() => {
78
+ if (!gradient || seriesData.length === 0) {
79
+ return seriesData;
80
+ }
81
+ return seriesData.map((series) => ({
82
+ ...series,
83
+ options: {
84
+ ...series.options,
85
+ gradient: {
86
+ from: gradient.from || color || "#000000",
87
+ to: gradient.to || "#ffffff",
88
+ fromOpacity: gradient.fromOpacity ?? 0.5,
89
+ toOpacity: gradient.toOpacity ?? 0
90
+ }
91
+ }
92
+ }));
93
+ }, [seriesData, gradient, color]);
94
+ if (!data || data.length === 0) {
95
+ return /* @__PURE__ */ _jsx("div", {
96
+ ref,
97
+ className: clsx("sparkline", sparkline_module_default.sparkline, sparkline_module_default["sparkline--empty"], className),
98
+ style: {
99
+ width,
100
+ height
101
+ }
102
+ });
103
+ }
104
+ if (data.length === 1) {
105
+ const cx = width / 2;
106
+ const cy = height / 2;
107
+ const resolvedColor = color || "#000000";
108
+ return /* @__PURE__ */ _jsx("div", {
109
+ ref,
110
+ className: clsx("sparkline", sparkline_module_default.sparkline, sparkline_module_default["sparkline--single-point"], className),
111
+ style: {
112
+ width,
113
+ height
114
+ },
115
+ children: /* @__PURE__ */ _jsx("svg", {
116
+ width,
117
+ height,
118
+ "aria-hidden": "true",
119
+ children: /* @__PURE__ */ _jsx("circle", {
120
+ cx,
121
+ cy,
122
+ r: strokeWidth * 1.5,
123
+ fill: resolvedColor
124
+ })
125
+ })
126
+ });
127
+ }
128
+ return /* @__PURE__ */ _jsx("div", {
129
+ ref,
130
+ className: clsx("sparkline", sparkline_module_default.sparkline, className),
131
+ children: /* @__PURE__ */ _jsx(LineChart, {
132
+ data: seriesWithGradient,
133
+ width,
134
+ height,
135
+ margin: finalMargin,
136
+ chartId,
137
+ withGradientFill,
138
+ withTooltips: false,
139
+ showLegend: false,
140
+ gridVisibility: "none",
141
+ options: {
142
+ axis: {
143
+ x: {
144
+ display: false
145
+ },
146
+ y: {
147
+ display: false
148
+ }
149
+ }
150
+ },
151
+ curveType: "monotone",
152
+ animation
153
+ })
154
+ });
155
+ });
156
+ SparklineComponent.displayName = "SparklineComponent";
157
+ var SparklineUnresponsive = SparklineComponent;
158
+ SparklineUnresponsive.displayName = "SparklineUnresponsive";
159
+ var Sparkline = withResponsive(SparklineUnresponsive);
160
+
161
+ export {
162
+ SparklineUnresponsive,
163
+ Sparkline
164
+ };
165
+ //# sourceMappingURL=chunk-KHRPRH4V.js.map
@@ -0,0 +1 @@
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 { jsx as _jsx } from \"react/jsx-runtime\";\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 = (data, color, strokeWidth) => {\n // Use a fixed base date and increment by index to create linear spacing\n const baseDate = new Date(2000, 0, 1);\n return [{\n label: 'sparkline',\n data: data.map((value, index) => ({\n date: new Date(baseDate.getTime() + index * 86400000),\n // Add days\n value\n })),\n options: {\n stroke: color,\n seriesLineStyle: strokeWidth ? {\n strokeWidth\n } : undefined\n }\n }];\n};\nconst SparklineComponent = /*#__PURE__*/forwardRef(({\n data,\n width = DEFAULT_WIDTH,\n height = DEFAULT_HEIGHT,\n color,\n strokeWidth: strokeWidthProp,\n withGradientFill = true,\n gradient,\n className,\n chartId,\n margin: marginProp,\n animation\n}, ref) => {\n const theme = useGlobalChartsTheme();\n\n // Get theme defaults for sparkline\n const themeStrokeWidth = theme.sparkline?.strokeWidth ?? 1.5;\n\n // Use prop values or fall back to theme defaults\n const strokeWidth = strokeWidthProp ?? themeStrokeWidth;\n\n // Transform number[] to SeriesData[] for LineChart\n const seriesData = useMemo(() => {\n if (!data || data.length === 0) {\n return [];\n }\n return transformToSeriesData(data, color, strokeWidth);\n }, [data, color, strokeWidth]);\n\n // Merge margins with theme defaults\n const finalMargin = useMemo(() => {\n const themeMargin = theme.sparkline?.margin ?? {\n top: 2,\n right: 2,\n bottom: 2,\n left: 2\n };\n const margin = marginProp ?? themeMargin;\n return {\n ...themeMargin,\n ...margin\n };\n }, [marginProp, theme.sparkline?.margin]);\n\n // Build gradient options for the series if custom gradient is provided\n // Note: This must be called before any early returns to follow React hooks rules\n const seriesWithGradient = useMemo(() => {\n if (!gradient || seriesData.length === 0) {\n return seriesData;\n }\n return seriesData.map(series => ({\n ...series,\n options: {\n ...series.options,\n gradient: {\n from: gradient.from || color || '#000000',\n to: gradient.to || '#ffffff',\n fromOpacity: gradient.fromOpacity ?? 0.5,\n toOpacity: gradient.toOpacity ?? 0.0\n }\n }\n }));\n }, [seriesData, gradient, color]);\n\n // Handle empty data\n if (!data || data.length === 0) {\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n className: clsx('sparkline', styles.sparkline, styles['sparkline--empty'], className),\n style: {\n width,\n height\n }\n });\n }\n\n // Handle single data point - render a simple dot\n if (data.length === 1) {\n const cx = width / 2;\n const cy = height / 2;\n const resolvedColor = color || '#000000';\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n className: clsx('sparkline', styles.sparkline, styles['sparkline--single-point'], className),\n style: {\n width,\n height\n },\n children: /*#__PURE__*/_jsx(\"svg\", {\n width: width,\n height: height,\n \"aria-hidden\": \"true\",\n children: /*#__PURE__*/_jsx(\"circle\", {\n cx: cx,\n cy: cy,\n r: strokeWidth * 1.5,\n fill: resolvedColor\n })\n })\n });\n }\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n className: clsx('sparkline', styles.sparkline, className),\n children: /*#__PURE__*/_jsx(LineChartUnresponsive, {\n data: seriesWithGradient,\n width: width,\n height: height,\n margin: finalMargin,\n chartId: chartId,\n withGradientFill: withGradientFill,\n withTooltips: false,\n showLegend: false,\n gridVisibility: \"none\",\n options: {\n axis: {\n x: {\n display: false\n },\n y: {\n display: false\n }\n }\n },\n curveType: \"monotone\",\n animation: animation\n })\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;\nSparklineUnresponsive.displayName = 'SparklineUnresponsive';\n\n/**\n * Responsive Sparkline chart component\n */\nconst Sparkline = withResponsive(SparklineUnresponsive);\nexport { Sparkline as default, SparklineUnresponsive };","import 'css-chunk:src/charts/sparkline/sparkline.module.scss';export default {\n \"sparkline\": \"a8ccharts-o-3Z8B\",\n \"sparkline--empty\": \"a8ccharts-CbLbcd\"\n};"],"mappings":"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","names":[]}
@@ -1,5 +1,5 @@
1
1
  // src/charts/private/radial-wipe-animation/radial-wipe-animation.tsx
2
- import { jsx } from "react/jsx-runtime";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  function RadialWipeAnimation({
4
4
  id,
5
5
  radius,
@@ -15,9 +15,9 @@ function RadialWipeAnimation({
15
15
  const isValidWipePercentage = 0 < wipePercentage && wipePercentage <= 100;
16
16
  const animationDuration = `${// If wipePercentage is invalid, set animation duration to 0 to disable animation.
17
17
  isValidWipePercentage ? durationMs * (100 / wipePercentage) : 0}ms`;
18
- return /* @__PURE__ */ jsx("mask", { id, children: /* @__PURE__ */ jsx(
19
- "circle",
20
- {
18
+ return /* @__PURE__ */ _jsx("mask", {
19
+ id,
20
+ children: /* @__PURE__ */ _jsx("circle", {
21
21
  cx: 0,
22
22
  cy: 0,
23
23
  r: radius,
@@ -27,26 +27,25 @@ function RadialWipeAnimation({
27
27
  strokeWidth,
28
28
  strokeDasharray: "100, 1000",
29
29
  strokeDashoffset: "0",
30
- style: { transform: `rotate(${startAngle}) scaleY(${scaleY})` },
31
- children: /* @__PURE__ */ jsx(
32
- "animate",
33
- {
34
- attributeName: "stroke-dashoffset",
35
- from: "0",
36
- to: "100.1",
37
- dur: animationDuration,
38
- fill: "freeze",
39
- calcMode: "spline",
40
- keySplines: "0.42 0 0.58 1;0 0 1 1",
41
- keyTimes: `0;${wipePercentage / 100};1`
42
- }
43
- )
44
- }
45
- ) });
30
+ style: {
31
+ transform: `rotate(${startAngle}) scaleY(${scaleY})`
32
+ },
33
+ children: /* @__PURE__ */ _jsx("animate", {
34
+ attributeName: "stroke-dashoffset",
35
+ from: "0",
36
+ to: "100.1",
37
+ dur: animationDuration,
38
+ fill: "freeze",
39
+ calcMode: "spline",
40
+ keySplines: "0.42 0 0.58 1;0 0 1 1",
41
+ keyTimes: `0;${wipePercentage / 100};1`
42
+ })
43
+ })
44
+ });
46
45
  }
47
46
  var radial_wipe_animation_default = RadialWipeAnimation;
48
47
 
49
48
  export {
50
49
  radial_wipe_animation_default
51
50
  };
52
- //# sourceMappingURL=chunk-A3AEEGKR.js.map
51
+ //# sourceMappingURL=chunk-KXRWNFQJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/charts/private/radial-wipe-animation/radial-wipe-animation.tsx"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * This animation uses the SVG self-drawing technique (source: https://www.joshwcomeau.com/svg/friendly-introduction-to-svg/),\n * leveraging stroke-dasharray and stroke-dashoffset properties to create the effect.\n *\n * Here, we reverse the animation to \"un-draw\" the circle for the revealing / radial wipe effect:\n * - Initially, the entire circle is drawn with a white mask.\n * - The circle's border (stroke) is drawn with a black stroke, wide enough to cover the circle.\n * - The stroke is then \"un-drawn,\" creating the wipe animation.\n * - A white mask makes the area visible, while a black mask makes the area invisible.\n */\n\n/**\n * RadialWipeAnimationProps - SVG mask props that requires a radial wipe animation effect.\n *\n * @param {object} props - The properties object.\n * @param {string} props.id - The unique ID for the mask.\n * @param {number} props.radius - The outer radius of the radial wipe.\n * @param {number} [props.innerRadius=0] - The inner radius of the radial wipe.\n * @param {number} [props.durationMs=1000] - The duration of the animation in milliseconds.\n * @param {number} [props.wipePercentage=100] - The percentage of the wipe animation to complete.\n * @param {'clockwise' | 'counter-clockwise'} [props.direction='clockwise'] - The direction of the wipe animation.\n * @param {Angle} [props.startAngle='-90deg'] - The starting angle of the wipe animation.\n *\n * @return {JSX.Element} The radial wipe mask element.\n */\n\n/**\n * Renders a SVG mask that creates a radial wipe animation effect.\n *\n * @param {RadialWipeAnimationProps} props - Component props\n * @return {JSX.Element} The rendered mask component\n */\nfunction RadialWipeAnimation({\n id,\n radius,\n innerRadius = 0,\n durationMs = 1000,\n wipePercentage = 100,\n direction = 'clockwise',\n startAngle = '-90deg'\n}) {\n const strokeWidth = (radius - innerRadius) * 2 +\n // The stroke is centered on the circumference, so we need to double the width.\n 1; // Added 1 to prevent sub-pixel rendering issues.\n\n const scaleY = direction === 'clockwise' ? -1 : 1;\n const isValidWipePercentage = 0 < wipePercentage && wipePercentage <= 100;\n const animationDuration = `${\n // If wipePercentage is invalid, set animation duration to 0 to disable animation.\n isValidWipePercentage ? durationMs * (100 / wipePercentage) : 0}ms`;\n return /*#__PURE__*/_jsx(\"mask\", {\n id: id,\n children: /*#__PURE__*/_jsx(\"circle\", {\n cx: 0,\n cy: 0,\n r: radius,\n pathLength: \"100\",\n fill: \"white\",\n stroke: \"black\" // The stroke will be un-drawn, hence 'black' mask.\n ,\n strokeWidth: strokeWidth,\n strokeDasharray: \"100, 1000\",\n strokeDashoffset: \"0\",\n style: {\n transform: `rotate(${startAngle}) scaleY(${scaleY})`\n },\n children: /*#__PURE__*/_jsx(\"animate\", {\n attributeName: \"stroke-dashoffset\",\n from: \"0\",\n to: \"100.1\",\n dur: animationDuration,\n fill: \"freeze\" // Same as CSS 'forwards' to retain the final state after animation.\n ,\n calcMode: \"spline\" // custom easing\n ,\n keySplines: \"0.42 0 0.58 1;0 0 1 1\" // ease-in-out ; linear (unimportant)\n ,\n keyTimes: `0;${wipePercentage / 100};1`\n })\n })\n });\n}\nexport default RadialWipeAnimation;"],"mappings":";AAAA,SAAS,OAAO,YAAY;AAiC5B,SAAS,oBAAoB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,aAAa;AACf,GAAG;AACD,QAAM,eAAe,SAAS,eAAe;AAAA,EAE7C;AAEA,QAAM,SAAS,cAAc,cAAc,KAAK;AAChD,QAAM,wBAAwB,IAAI,kBAAkB,kBAAkB;AACtE,QAAM,oBAAoB;AAAA,EAE1B,wBAAwB,cAAc,MAAM,kBAAkB,CAAC;AAC/D,SAAoB,qBAAK,QAAQ;AAAA,IAC/B;AAAA,IACA,UAAuB,qBAAK,UAAU;AAAA,MACpC,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,GAAG;AAAA,MACH,YAAY;AAAA,MACZ,MAAM;AAAA,MACN,QAAQ;AAAA,MAER;AAAA,MACA,iBAAiB;AAAA,MACjB,kBAAkB;AAAA,MAClB,OAAO;AAAA,QACL,WAAW,UAAU,UAAU,YAAY,MAAM;AAAA,MACnD;AAAA,MACA,UAAuB,qBAAK,WAAW;AAAA,QACrC,eAAe;AAAA,QACf,MAAM;AAAA,QACN,IAAI;AAAA,QACJ,KAAK;AAAA,QACL,MAAM;AAAA,QAEN,UAAU;AAAA,QAEV,YAAY;AAAA,QAEZ,UAAU,KAAK,iBAAiB,GAAG;AAAA,MACrC,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH;AACA,IAAO,gCAAQ;","names":[]}