@automattic/charts 0.57.0 → 0.58.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 (210) hide show
  1. package/CHANGELOG.md +16 -2
  2. package/dist/charts/bar-chart/index.cjs +7 -5
  3. package/dist/charts/bar-chart/index.cjs.map +1 -1
  4. package/dist/charts/bar-chart/index.css +12 -24
  5. package/dist/charts/bar-chart/index.css.map +1 -1
  6. package/dist/charts/bar-chart/index.d.cts +3 -4
  7. package/dist/charts/bar-chart/index.d.ts +3 -4
  8. package/dist/charts/bar-chart/index.js +6 -4
  9. package/dist/charts/bar-list-chart/index.cjs +8 -6
  10. package/dist/charts/bar-list-chart/index.cjs.map +1 -1
  11. package/dist/charts/bar-list-chart/index.css +12 -24
  12. package/dist/charts/bar-list-chart/index.css.map +1 -1
  13. package/dist/charts/bar-list-chart/index.d.cts +3 -3
  14. package/dist/charts/bar-list-chart/index.d.ts +3 -3
  15. package/dist/charts/bar-list-chart/index.js +7 -5
  16. package/dist/charts/conversion-funnel-chart/index.cjs +5 -5
  17. package/dist/charts/conversion-funnel-chart/index.css +0 -94
  18. package/dist/charts/conversion-funnel-chart/index.css.map +1 -1
  19. package/dist/charts/conversion-funnel-chart/index.d.cts +1 -1
  20. package/dist/charts/conversion-funnel-chart/index.d.ts +1 -1
  21. package/dist/charts/conversion-funnel-chart/index.js +4 -4
  22. package/dist/charts/geo-chart/index.cjs +4 -4
  23. package/dist/charts/geo-chart/index.css +0 -94
  24. package/dist/charts/geo-chart/index.css.map +1 -1
  25. package/dist/charts/geo-chart/index.d.cts +1 -1
  26. package/dist/charts/geo-chart/index.d.ts +1 -1
  27. package/dist/charts/geo-chart/index.js +3 -3
  28. package/dist/charts/leaderboard-chart/index.cjs +7 -6
  29. package/dist/charts/leaderboard-chart/index.cjs.map +1 -1
  30. package/dist/charts/leaderboard-chart/index.css +12 -24
  31. package/dist/charts/leaderboard-chart/index.css.map +1 -1
  32. package/dist/charts/leaderboard-chart/index.d.cts +3 -3
  33. package/dist/charts/leaderboard-chart/index.d.ts +3 -3
  34. package/dist/charts/leaderboard-chart/index.js +6 -5
  35. package/dist/charts/line-chart/index.cjs +7 -5
  36. package/dist/charts/line-chart/index.cjs.map +1 -1
  37. package/dist/charts/line-chart/index.css +12 -24
  38. package/dist/charts/line-chart/index.css.map +1 -1
  39. package/dist/charts/line-chart/index.d.cts +3 -4
  40. package/dist/charts/line-chart/index.d.ts +3 -4
  41. package/dist/charts/line-chart/index.js +6 -4
  42. package/dist/charts/pie-chart/index.cjs +7 -6
  43. package/dist/charts/pie-chart/index.cjs.map +1 -1
  44. package/dist/charts/pie-chart/index.css +12 -24
  45. package/dist/charts/pie-chart/index.css.map +1 -1
  46. package/dist/charts/pie-chart/index.d.cts +7 -13
  47. package/dist/charts/pie-chart/index.d.ts +7 -13
  48. package/dist/charts/pie-chart/index.js +6 -5
  49. package/dist/charts/pie-semi-circle-chart/index.cjs +7 -6
  50. package/dist/charts/pie-semi-circle-chart/index.cjs.map +1 -1
  51. package/dist/charts/pie-semi-circle-chart/index.css +12 -24
  52. package/dist/charts/pie-semi-circle-chart/index.css.map +1 -1
  53. package/dist/charts/pie-semi-circle-chart/index.d.cts +7 -13
  54. package/dist/charts/pie-semi-circle-chart/index.d.ts +7 -13
  55. package/dist/charts/pie-semi-circle-chart/index.js +6 -5
  56. package/dist/charts/sparkline/index.cjs +8 -6
  57. package/dist/charts/sparkline/index.cjs.map +1 -1
  58. package/dist/charts/sparkline/index.css +12 -24
  59. package/dist/charts/sparkline/index.css.map +1 -1
  60. package/dist/charts/sparkline/index.js +7 -5
  61. package/dist/{chunk-32DH6JDF.js → chunk-2I67QUIV.js} +52 -420
  62. package/dist/chunk-2I67QUIV.js.map +1 -0
  63. package/dist/{chunk-WLODYNLB.js → chunk-2ICEEQOC.js} +31 -27
  64. package/dist/chunk-2ICEEQOC.js.map +1 -0
  65. package/dist/{chunk-IU4DYUAV.js → chunk-4B7BL2DD.js} +3 -3
  66. package/dist/{chunk-BCX5THDQ.js → chunk-4OXMTKAL.js} +24 -26
  67. package/dist/chunk-4OXMTKAL.js.map +1 -0
  68. package/dist/{chunk-4OPFE4RM.js → chunk-B6NLZFRW.js} +30 -27
  69. package/dist/chunk-B6NLZFRW.js.map +1 -0
  70. package/dist/{chunk-D2UH4CFE.cjs → chunk-BBAUQOW6.cjs} +9 -9
  71. package/dist/{chunk-D2UH4CFE.cjs.map → chunk-BBAUQOW6.cjs.map} +1 -1
  72. package/dist/{chunk-XKRJL2QT.cjs → chunk-CMMHCTBX.cjs} +45 -47
  73. package/dist/chunk-CMMHCTBX.cjs.map +1 -0
  74. package/dist/{chunk-YE2T52VZ.cjs → chunk-CPPXJATQ.cjs} +51 -47
  75. package/dist/chunk-CPPXJATQ.cjs.map +1 -0
  76. package/dist/{chunk-H2V4JMSA.js → chunk-DKU775VC.js} +3 -3
  77. package/dist/{chunk-ZH4F5RMG.cjs → chunk-GRA7Y2ZG.cjs} +46 -48
  78. package/dist/chunk-GRA7Y2ZG.cjs.map +1 -0
  79. package/dist/{chunk-DAU3HNEG.js → chunk-JJIMABHT.js} +9 -2
  80. package/dist/chunk-JJIMABHT.js.map +1 -0
  81. package/dist/{chunk-CZGYJKG6.js → chunk-KJHWXOCZ.js} +4 -4
  82. package/dist/{chunk-6CCZL2JJ.js → chunk-KRWGSOJ2.js} +30 -2
  83. package/dist/chunk-KRWGSOJ2.js.map +1 -0
  84. package/dist/{chunk-V36ERY7Y.js → chunk-LTFH7SEG.js} +24 -26
  85. package/dist/chunk-LTFH7SEG.js.map +1 -0
  86. package/dist/{chunk-PXLEMUGJ.js → chunk-MUNOKLLE.js} +3 -3
  87. package/dist/{chunk-VTS3PNMS.cjs → chunk-MXGLYWVP.cjs} +9 -2
  88. package/dist/chunk-MXGLYWVP.cjs.map +1 -0
  89. package/dist/{chunk-Z45KX47P.cjs → chunk-OYC34VTO.cjs} +154 -94
  90. package/dist/chunk-OYC34VTO.cjs.map +1 -0
  91. package/dist/{chunk-77OKCVQN.cjs → chunk-PQL5I3F6.cjs} +17 -17
  92. package/dist/{chunk-77OKCVQN.cjs.map → chunk-PQL5I3F6.cjs.map} +1 -1
  93. package/dist/{chunk-I35UYJJR.cjs → chunk-REZTQ4PH.cjs} +41 -21
  94. package/dist/chunk-REZTQ4PH.cjs.map +1 -0
  95. package/dist/{chunk-RCY6XLGU.cjs → chunk-TZRUHQOH.cjs} +36 -8
  96. package/dist/chunk-TZRUHQOH.cjs.map +1 -0
  97. package/dist/{chunk-2NCY7R4G.js → chunk-UTYVIOWZ.js} +111 -51
  98. package/dist/chunk-UTYVIOWZ.js.map +1 -0
  99. package/dist/{chunk-TO3OQBXG.cjs → chunk-W2LDIX26.cjs} +5 -5
  100. package/dist/{chunk-TO3OQBXG.cjs.map → chunk-W2LDIX26.cjs.map} +1 -1
  101. package/dist/{chunk-7FQX4ALL.cjs → chunk-WSG64BVN.cjs} +6 -6
  102. package/dist/{chunk-7FQX4ALL.cjs.map → chunk-WSG64BVN.cjs.map} +1 -1
  103. package/dist/chunk-WTQYGUNF.js +400 -0
  104. package/dist/chunk-WTQYGUNF.js.map +1 -0
  105. package/dist/{chunk-RHHVEJHJ.cjs → chunk-WYK7EL5R.cjs} +68 -436
  106. package/dist/chunk-WYK7EL5R.cjs.map +1 -0
  107. package/dist/{chunk-VJM5XCB4.cjs → chunk-XC4KHJYX.cjs} +49 -46
  108. package/dist/chunk-XC4KHJYX.cjs.map +1 -0
  109. package/dist/chunk-XVBH5XHE.cjs +400 -0
  110. package/dist/chunk-XVBH5XHE.cjs.map +1 -0
  111. package/dist/{chunk-Z26M4V2M.js → chunk-YAFQVVDI.js} +41 -21
  112. package/dist/chunk-YAFQVVDI.js.map +1 -0
  113. package/dist/components/legend/index.cjs +4 -3
  114. package/dist/components/legend/index.cjs.map +1 -1
  115. package/dist/components/legend/index.css +12 -24
  116. package/dist/components/legend/index.css.map +1 -1
  117. package/dist/components/legend/index.d.cts +4 -4
  118. package/dist/components/legend/index.d.ts +4 -4
  119. package/dist/components/legend/index.js +3 -2
  120. package/dist/components/tooltip/index.d.cts +1 -1
  121. package/dist/components/tooltip/index.d.ts +1 -1
  122. package/dist/hooks/index.cjs +3 -5
  123. package/dist/hooks/index.cjs.map +1 -1
  124. package/dist/hooks/index.css +0 -94
  125. package/dist/hooks/index.css.map +1 -1
  126. package/dist/hooks/index.d.cts +3 -11
  127. package/dist/hooks/index.d.ts +3 -11
  128. package/dist/hooks/index.js +2 -4
  129. package/dist/index.cjs +18 -16
  130. package/dist/index.cjs.map +1 -1
  131. package/dist/index.css +12 -24
  132. package/dist/index.css.map +1 -1
  133. package/dist/index.d.cts +7 -7
  134. package/dist/index.d.ts +7 -7
  135. package/dist/index.js +17 -15
  136. package/dist/{leaderboard-chart-DR7CGb0L.d.cts → leaderboard-chart-BSbg0ufV.d.cts} +3 -7
  137. package/dist/{leaderboard-chart-BKYYXcg2.d.ts → leaderboard-chart-odEYxxEC.d.ts} +3 -7
  138. package/dist/{legend-C2grwnWk.d.cts → legend-DFkosEvC.d.cts} +1 -1
  139. package/dist/{legend-Cj0xM5dU.d.ts → legend-DLswHhOk.d.ts} +1 -1
  140. package/dist/providers/index.cjs +3 -3
  141. package/dist/providers/index.css +0 -94
  142. package/dist/providers/index.css.map +1 -1
  143. package/dist/providers/index.d.cts +3 -3
  144. package/dist/providers/index.d.ts +3 -3
  145. package/dist/providers/index.js +2 -2
  146. package/dist/{themes-CyjKm-P_.d.cts → themes-D0qc5JaW.d.cts} +2 -2
  147. package/dist/{themes-BmVGrYnF.d.ts → themes-itO4Ht5g.d.ts} +2 -2
  148. package/dist/{types-KtOPPzPX.d.cts → types-B5f6XQ7Q.d.cts} +1 -1
  149. package/dist/{types-CuUEszrM.d.ts → types-BsHooDbM.d.ts} +1 -1
  150. package/dist/{types-I67mddpr.d.cts → types-BuSrRM4p.d.ts} +3 -32
  151. package/dist/{types-DZordNiO.d.cts → types-ChOUI9-N.d.cts} +80 -40
  152. package/dist/{types-DZordNiO.d.ts → types-ChOUI9-N.d.ts} +80 -40
  153. package/dist/{types-I67mddpr.d.ts → types-Dfw9VOKI.d.cts} +3 -32
  154. package/dist/utils/index.cjs +2 -2
  155. package/dist/utils/index.d.cts +1 -1
  156. package/dist/utils/index.d.ts +1 -1
  157. package/dist/utils/index.js +1 -1
  158. package/package.json +6 -6
  159. package/src/charts/bar-chart/bar-chart.tsx +17 -18
  160. package/src/charts/bar-chart/test/bar-chart.test.tsx +48 -31
  161. package/src/charts/leaderboard-chart/leaderboard-chart.tsx +38 -41
  162. package/src/charts/leaderboard-chart/test/leaderboard-chart.test.tsx +4 -5
  163. package/src/charts/leaderboard-chart/types.ts +1 -11
  164. package/src/charts/line-chart/line-chart.tsx +18 -16
  165. package/src/charts/line-chart/test/line-chart.test.tsx +49 -27
  166. package/src/charts/line-chart/types.ts +0 -1
  167. package/src/charts/pie-chart/pie-chart.tsx +23 -22
  168. package/src/charts/pie-chart/test/composition-api.test.tsx +41 -0
  169. package/src/charts/pie-chart/test/pie-chart.test.tsx +9 -9
  170. package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx +21 -23
  171. package/src/charts/pie-semi-circle-chart/test/pie-semi-circle-chart.test.tsx +33 -5
  172. package/src/charts/private/chart-composition/index.ts +2 -0
  173. package/src/charts/private/chart-composition/render-legend-slot.ts +22 -0
  174. package/src/charts/private/chart-composition/test/render-legend-slot.test.tsx +60 -0
  175. package/src/charts/private/chart-composition/test/use-chart-children.test.tsx +91 -0
  176. package/src/charts/private/chart-composition/use-chart-children.ts +34 -2
  177. package/src/components/legend/index.ts +1 -8
  178. package/src/components/legend/private/base-legend.module.scss +19 -37
  179. package/src/components/legend/private/base-legend.tsx +0 -2
  180. package/src/components/legend/types.ts +7 -34
  181. package/src/hooks/index.ts +0 -1
  182. package/src/index.ts +1 -7
  183. package/src/types.ts +83 -38
  184. package/src/utils/date-parsing.ts +10 -1
  185. package/src/utils/test/date-parsing.test.ts +12 -0
  186. package/src/utils/test/resolve-css-var.test.ts +2 -2
  187. package/tsup.config.ts +1 -1
  188. package/dist/chunk-2NCY7R4G.js.map +0 -1
  189. package/dist/chunk-32DH6JDF.js.map +0 -1
  190. package/dist/chunk-4OPFE4RM.js.map +0 -1
  191. package/dist/chunk-6CCZL2JJ.js.map +0 -1
  192. package/dist/chunk-BCX5THDQ.js.map +0 -1
  193. package/dist/chunk-DAU3HNEG.js.map +0 -1
  194. package/dist/chunk-I35UYJJR.cjs.map +0 -1
  195. package/dist/chunk-RCY6XLGU.cjs.map +0 -1
  196. package/dist/chunk-RHHVEJHJ.cjs.map +0 -1
  197. package/dist/chunk-V36ERY7Y.js.map +0 -1
  198. package/dist/chunk-VJM5XCB4.cjs.map +0 -1
  199. package/dist/chunk-VTS3PNMS.cjs.map +0 -1
  200. package/dist/chunk-WLODYNLB.js.map +0 -1
  201. package/dist/chunk-XKRJL2QT.cjs.map +0 -1
  202. package/dist/chunk-YE2T52VZ.cjs.map +0 -1
  203. package/dist/chunk-Z26M4V2M.js.map +0 -1
  204. package/dist/chunk-Z45KX47P.cjs.map +0 -1
  205. package/dist/chunk-ZH4F5RMG.cjs.map +0 -1
  206. package/src/hooks/use-has-legend-child.ts +0 -22
  207. /package/dist/{chunk-IU4DYUAV.js.map → chunk-4B7BL2DD.js.map} +0 -0
  208. /package/dist/{chunk-H2V4JMSA.js.map → chunk-DKU775VC.js.map} +0 -0
  209. /package/dist/{chunk-CZGYJKG6.js.map → chunk-KJHWXOCZ.js.map} +0 -0
  210. /package/dist/{chunk-PXLEMUGJ.js.map → chunk-MUNOKLLE.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
3
  var _chunk7OZEQ5HEcjs = require('./chunk-7OZEQ5HE.cjs');
4
4
 
@@ -8,21 +8,22 @@ var _chunk2A34OA5Ocjs = require('./chunk-2A34OA5O.cjs');
8
8
 
9
9
 
10
10
 
11
- var _chunkRCY6XLGUcjs = require('./chunk-RCY6XLGU.cjs');
12
11
 
12
+ var _chunkTZRUHQOHcjs = require('./chunk-TZRUHQOH.cjs');
13
13
 
14
- var _chunkY3NNQMAXcjs = require('./chunk-Y3NNQMAX.cjs');
15
14
 
16
15
 
17
- var _chunkI35UYJJRcjs = require('./chunk-I35UYJJR.cjs');
18
16
 
17
+ var _chunkXVBH5XHEcjs = require('./chunk-XVBH5XHE.cjs');
19
18
 
20
- var _chunkASLARV7Lcjs = require('./chunk-ASLARV7L.cjs');
21
19
 
20
+ var _chunkY3NNQMAXcjs = require('./chunk-Y3NNQMAX.cjs');
22
21
 
23
22
 
23
+ var _chunkREZTQ4PHcjs = require('./chunk-REZTQ4PH.cjs');
24
24
 
25
25
 
26
+ var _chunkASLARV7Lcjs = require('./chunk-ASLARV7L.cjs');
26
27
 
27
28
 
28
29
 
@@ -31,10 +32,12 @@ var _chunkASLARV7Lcjs = require('./chunk-ASLARV7L.cjs');
31
32
 
32
33
 
33
34
 
34
- var _chunkRHHVEJHJcjs = require('./chunk-RHHVEJHJ.cjs');
35
35
 
36
36
 
37
- var _chunkVTS3PNMScjs = require('./chunk-VTS3PNMS.cjs');
37
+ var _chunkWYK7EL5Rcjs = require('./chunk-WYK7EL5R.cjs');
38
+
39
+
40
+ var _chunkMXGLYWVPcjs = require('./chunk-MXGLYWVP.cjs');
38
41
 
39
42
  // src/charts/pie-chart/pie-chart.tsx
40
43
  var _group = require('@visx/group');
@@ -95,13 +98,7 @@ var PieChartInternal = ({
95
98
  withTooltips = false,
96
99
  className,
97
100
  showLegend = false,
98
- legendOrientation = "horizontal",
99
- legendPosition = "bottom",
100
- legendAlignment = "center",
101
- legendMaxWidth,
102
- legendTextOverflow = "wrap",
103
- legendItemClassName,
104
- legendShape = "circle",
101
+ legend = {},
105
102
  width: propWidth,
106
103
  height: propHeight,
107
104
  size,
@@ -112,16 +109,17 @@ var PieChartInternal = ({
112
109
  cornerScale = 0,
113
110
  showLabels = true,
114
111
  legendValueDisplay = "percentage",
115
- legendInteractive = false,
116
112
  children = null,
117
113
  tooltipOffsetX = 0,
118
114
  tooltipOffsetY = -15,
119
115
  renderTooltip = renderDefaultPieTooltip,
120
116
  gap = "md"
121
117
  }) => {
122
- const providerTheme = _chunkRHHVEJHJcjs.useGlobalChartsTheme.call(void 0, );
123
- const chartId = _chunkRHHVEJHJcjs.useChartId.call(void 0, providedChartId);
124
- const [svgWrapperRef, svgWrapperWidth, svgWrapperHeight] = _chunkRHHVEJHJcjs.useElementSize.call(void 0, );
118
+ const legendInteractive = _nullishCoalesce(legend.interactive, () => ( false));
119
+ const legendPosition = _nullishCoalesce(legend.position, () => ( "bottom"));
120
+ const providerTheme = _chunkWYK7EL5Rcjs.useGlobalChartsTheme.call(void 0, );
121
+ const chartId = _chunkWYK7EL5Rcjs.useChartId.call(void 0, providedChartId);
122
+ const [svgWrapperRef, svgWrapperWidth, svgWrapperHeight] = _chunkWYK7EL5Rcjs.useElementSize.call(void 0, );
125
123
  const {
126
124
  tooltipOpen,
127
125
  tooltipLeft,
@@ -148,12 +146,12 @@ var PieChartInternal = ({
148
146
  const {
149
147
  getElementStyles,
150
148
  isSeriesVisible
151
- } = _chunkRHHVEJHJcjs.useGlobalChartsContext.call(void 0, );
149
+ } = _chunkWYK7EL5Rcjs.useGlobalChartsContext.call(void 0, );
152
150
  const {
153
151
  visibleData,
154
152
  allSegmentsHidden,
155
153
  legendData
156
- } = _chunkRHHVEJHJcjs.useInteractiveLegendData.call(void 0, {
154
+ } = _chunkWYK7EL5Rcjs.useInteractiveLegendData.call(void 0, {
157
155
  data,
158
156
  chartId,
159
157
  legendInteractive,
@@ -163,7 +161,7 @@ var PieChartInternal = ({
163
161
  showValues: true,
164
162
  legendValueDisplay
165
163
  }), [legendValueDisplay]);
166
- const legendItems = _chunkRHHVEJHJcjs.useChartLegendItems.call(void 0, legendData, legendOptions);
164
+ const legendItems = _chunkXVBH5XHEcjs.useChartLegendItems.call(void 0, legendData, legendOptions);
167
165
  const {
168
166
  isValid,
169
167
  message
@@ -171,21 +169,22 @@ var PieChartInternal = ({
171
169
  const {
172
170
  svgChildren,
173
171
  htmlChildren,
172
+ legendChildren,
174
173
  otherChildren
175
- } = _chunkRCY6XLGUcjs.useChartChildren.call(void 0, children, "PieChart");
174
+ } = _chunkTZRUHQOHcjs.useChartChildren.call(void 0, children, "PieChart");
176
175
  const chartMetadata = _react.useMemo.call(void 0, () => ({
177
176
  thickness,
178
177
  gapScale,
179
178
  cornerScale
180
179
  }), [thickness, gapScale, cornerScale]);
181
- _chunkRHHVEJHJcjs.useChartRegistration.call(void 0, {
180
+ _chunkWYK7EL5Rcjs.useChartRegistration.call(void 0, {
182
181
  chartId,
183
182
  legendItems,
184
183
  chartType: "pie",
185
184
  isDataValid: isValid,
186
185
  metadata: chartMetadata
187
186
  });
188
- const prefersReducedMotion = _chunkRHHVEJHJcjs.usePrefersReducedMotion.call(void 0, );
187
+ const prefersReducedMotion = _chunkWYK7EL5Rcjs.usePrefersReducedMotion.call(void 0, );
189
188
  if (!isValid) {
190
189
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
191
190
  className: _clsx2.default.call(void 0, "pie-chart", pie_chart_module_default["pie-chart"], className),
@@ -225,26 +224,25 @@ var PieChartInternal = ({
225
224
  }).color;
226
225
  }
227
226
  };
228
- const legendElement = showLegend && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRHHVEJHJcjs.Legend, {
229
- orientation: legendOrientation,
227
+ const legendElement = showLegend && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXVBH5XHEcjs.Legend, {
228
+ orientation: _nullishCoalesce(legend.orientation, () => ( "horizontal")),
230
229
  position: legendPosition,
231
- alignment: legendAlignment,
232
- labelStyles: {
233
- maxWidth: legendMaxWidth,
234
- textOverflow: legendTextOverflow
235
- },
236
- itemClassName: legendItemClassName,
237
- shape: legendShape,
230
+ alignment: _nullishCoalesce(legend.alignment, () => ( "center")),
231
+ labelStyles: legend.labelStyles,
232
+ itemClassName: legend.itemClassName,
233
+ itemStyles: legend.itemStyles,
234
+ shapeStyles: legend.shapeStyles,
235
+ shape: _nullishCoalesce(legend.shape, () => ( "circle")),
238
236
  chartId,
239
237
  interactive: legendInteractive
240
238
  });
241
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRHHVEJHJcjs.SingleChartContext.Provider, {
239
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXVBH5XHEcjs.SingleChartContext.Provider, {
242
240
  value: {
243
241
  chartId,
244
242
  chartWidth: width,
245
243
  chartHeight: height
246
244
  },
247
- children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkI35UYJJRcjs.Stack, {
245
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkREZTQ4PHcjs.Stack, {
248
246
  ref: containerRef,
249
247
  direction: "column",
250
248
  gap,
@@ -261,7 +259,7 @@ var PieChartInternal = ({
261
259
  width: propWidth || void 0,
262
260
  height: propHeight || void 0
263
261
  },
264
- children: [legendPosition === "top" && legendElement, /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
262
+ children: [legendPosition === "top" && legendElement, _chunkTZRUHQOHcjs.renderLegendSlot.call(void 0, legendChildren, "top"), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
265
263
  className: pie_chart_module_default["pie-chart__svg-wrapper"],
266
264
  ref: svgWrapperRef,
267
265
  children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", {
@@ -358,7 +356,7 @@ var PieChartInternal = ({
358
356
  }), !allSegmentsHidden && svgChildren]
359
357
  })]
360
358
  })
361
- }), legendPosition === "bottom" && legendElement, withTooltips && tooltipOpen && tooltipData && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TooltipInPortal, {
359
+ }), legendPosition === "bottom" && legendElement, _chunkTZRUHQOHcjs.renderLegendSlot.call(void 0, legendChildren, "bottom"), withTooltips && tooltipOpen && tooltipData && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TooltipInPortal, {
362
360
  top: tooltipTop || 0,
363
361
  left: tooltipLeft || 0,
364
362
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
@@ -372,32 +370,32 @@ var PieChartInternal = ({
372
370
  });
373
371
  };
374
372
  var PieChartWithProvider = (props) => {
375
- const existingContext = _react.useContext.call(void 0, _chunkRHHVEJHJcjs.GlobalChartsContext);
373
+ const existingContext = _react.useContext.call(void 0, _chunkWYK7EL5Rcjs.GlobalChartsContext);
376
374
  if (existingContext) {
377
375
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PieChartInternal, {
378
376
  ...props
379
377
  });
380
378
  }
381
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRHHVEJHJcjs.GlobalChartsProvider, {
379
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWYK7EL5Rcjs.GlobalChartsProvider, {
382
380
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PieChartInternal, {
383
381
  ...props
384
382
  })
385
383
  });
386
384
  };
387
385
  PieChartWithProvider.displayName = "PieChart";
388
- var PieChart = _chunkVTS3PNMScjs.attachSubComponents.call(void 0, PieChartWithProvider, {
389
- Legend: _chunkRHHVEJHJcjs.Legend,
390
- SVG: _chunkRCY6XLGUcjs.ChartSVG,
391
- HTML: _chunkRCY6XLGUcjs.ChartHTML
386
+ var PieChart = _chunkMXGLYWVPcjs.attachSubComponents.call(void 0, PieChartWithProvider, {
387
+ Legend: _chunkXVBH5XHEcjs.Legend,
388
+ SVG: _chunkTZRUHQOHcjs.ChartSVG,
389
+ HTML: _chunkTZRUHQOHcjs.ChartHTML
392
390
  });
393
- var PieChartResponsive = _chunkVTS3PNMScjs.attachSubComponents.call(void 0, _chunkASLARV7Lcjs.withResponsive.call(void 0, PieChartWithProvider), {
394
- Legend: _chunkRHHVEJHJcjs.Legend,
395
- SVG: _chunkRCY6XLGUcjs.ChartSVG,
396
- HTML: _chunkRCY6XLGUcjs.ChartHTML
391
+ var PieChartResponsive = _chunkMXGLYWVPcjs.attachSubComponents.call(void 0, _chunkASLARV7Lcjs.withResponsive.call(void 0, PieChartWithProvider), {
392
+ Legend: _chunkXVBH5XHEcjs.Legend,
393
+ SVG: _chunkTZRUHQOHcjs.ChartSVG,
394
+ HTML: _chunkTZRUHQOHcjs.ChartHTML
397
395
  });
398
396
 
399
397
 
400
398
 
401
399
 
402
400
  exports.PieChart = PieChart; exports.PieChartResponsive = PieChartResponsive;
403
- //# sourceMappingURL=chunk-ZH4F5RMG.cjs.map
401
+ //# sourceMappingURL=chunk-GRA7Y2ZG.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-GRA7Y2ZG.cjs","../src/charts/pie-chart/pie-chart.tsx","../src/charts/pie-chart/pie-chart.module.scss"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACzCA,oCAAsB;AACtB,oCAAoB;AACpB,wCAA+C;AAC/C,uCAAmB;AAEnB,wEAAiB;AACjB,8BAAiD;AD0CjD;AACA;AEjD8D,IAAO,yBAAA,EAAQ;AAAA,EAC3E,WAAA,EAAa,kBAAA;AAAA,EACb,uBAA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tB,YAAA;AACD,UAAA;AACF,QAAA;AAC4B,MAAA;AAChC,IAAA;AACF,EAAA;AACH;AACsC;AACD,EAAA;AAGd,EAAA;AACM,IAAA;AACpB,MAAA;AACJ,IAAA;AACH,EAAA;AAGyB,EAAA;AACK,IAAA;AACvB,MAAA;AACJ,IAAA;AACF,EAAA;AACH;AACmC;AAGE;AACnC,EAAA;AACK,EAAA;AACC,EAAA;AACP;AAG0B;AACzB,EAAA;AACK,EAAA;AACC,EAAA;AACP;ADpCyC;AACA;AACA;AACA;AACA","file":"/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-GRA7Y2ZG.cjs","sourcesContent":[null,"import { Group } from '@visx/group';\nimport { Pie } from '@visx/shape';\nimport { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { BaseTooltip } from '../../components/tooltip';\nimport { useElementSize, useInteractiveLegendData, usePrefersReducedMotion } from '../../hooks';\nimport { GlobalChartsProvider, useChartId, useChartRegistration, useGlobalChartsContext, useGlobalChartsTheme, GlobalChartsContext } from '../../providers';\nimport { attachSubComponents } from '../../utils';\nimport { getStringWidth } from '../../visx/text';\nimport { ChartSVG, ChartHTML, useChartChildren, renderLegendSlot } from '../private/chart-composition';\nimport { RadialWipeAnimation } from '../private/radial-wipe-animation/';\nimport { SingleChartContext } from '../private/single-chart-context';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './pie-chart.module.scss';\n\n/**\n * Parameters passed to the renderTooltip function for pie charts.\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/**\n * Default tooltip renderer for pie charts.\n * Renders a BaseTooltip with the hovered segment's data.\n *\n * @param {PieChartRenderTooltipParams} params - The tooltip parameters containing the hovered data point\n * @return {ReactNode} The rendered tooltip content\n */\nconst renderDefaultPieTooltip = ({\n tooltipData\n}) => {\n return /*#__PURE__*/_jsx(BaseTooltip, {\n data: tooltipData,\n top: 0,\n left: 0,\n renderContainer: false\n });\n};\n\n// Base props type with optional responsive properties\n\n// Composition API types\n\n/**\n * Validates the pie chart data\n * @param data - The data to validate\n * @return Object containing validation result and error message\n */\nconst validateData = data => {\n if (!data.length) {\n return {\n isValid: false,\n message: 'No data available'\n };\n }\n\n // Check for negative values\n const hasNegativeValues = data.some(item => item.percentage < 0 || item.value < 0);\n if (hasNegativeValues) {\n return {\n isValid: false,\n message: 'Invalid data: Negative values are not allowed'\n };\n }\n\n // Validate total percentage\n const totalPercentage = data.reduce((sum, item) => sum + item.percentage, 0);\n if (Math.abs(totalPercentage - 100) > 0.01) {\n // Using small epsilon for floating point comparison\n return {\n isValid: false,\n message: 'Invalid percentage total: Must equal 100'\n };\n }\n return {\n isValid: true,\n message: ''\n };\n};\n\n/**\n * Renders a pie or donut chart using the provided data.\n *\n * @param {PieChartProps} props - Component props\n * @return {JSX.Element} The rendered chart component\n */\nconst PieChartInternal = ({\n data,\n chartId: providedChartId,\n withTooltips = false,\n className,\n showLegend = false,\n legend = {},\n width: propWidth,\n height: propHeight,\n size,\n animation,\n thickness = 1,\n padding = 0,\n gapScale = 0,\n cornerScale = 0,\n showLabels = true,\n legendValueDisplay = 'percentage',\n children = null,\n tooltipOffsetX = 0,\n tooltipOffsetY = -15,\n renderTooltip = renderDefaultPieTooltip,\n gap = 'md'\n}) => {\n const legendInteractive = legend.interactive ?? false;\n const legendPosition = legend.position ?? 'bottom';\n const providerTheme = useGlobalChartsTheme();\n const chartId = useChartId(providedChartId);\n const [svgWrapperRef, svgWrapperWidth, svgWrapperHeight] = useElementSize();\n const {\n tooltipOpen,\n tooltipLeft,\n tooltipTop,\n tooltipData,\n hideTooltip,\n showTooltip\n } = useTooltip();\n\n // Set up portal tooltip for better z-index handling\n // We get containerBounds to cancel out stale offsets in the position calculation\n const {\n containerRef,\n TooltipInPortal,\n containerBounds\n } = useTooltipInPortal({\n detectBounds: true,\n scroll: true,\n debounce: 0\n });\n const onMouseLeave = useCallback(() => {\n if (!withTooltips) {\n return;\n }\n hideTooltip();\n }, [withTooltips, hideTooltip]);\n const {\n getElementStyles,\n isSeriesVisible\n } = useGlobalChartsContext();\n\n // Filter and recalculate data for interactive legends\n const {\n visibleData,\n allSegmentsHidden,\n legendData\n } = useInteractiveLegendData({\n data,\n chartId,\n legendInteractive,\n isSeriesVisible\n });\n\n // Memoize legend options to prevent unnecessary re-calculations\n const legendOptions = useMemo(() => ({\n showValues: true,\n legendValueDisplay\n }), [legendValueDisplay]);\n\n // Create legend items using legendData (has recalculated percentages for visible items)\n const legendItems = useChartLegendItems(legendData, legendOptions);\n const {\n isValid,\n message\n } = validateData(data);\n\n // Process children to extract compound components\n const {\n svgChildren,\n htmlChildren,\n legendChildren,\n otherChildren\n } = useChartChildren(children, 'PieChart');\n\n // Memoize metadata to prevent unnecessary re-registration\n const chartMetadata = useMemo(() => ({\n thickness,\n gapScale,\n cornerScale\n }), [thickness, gapScale, cornerScale]);\n\n // Register chart with context only if data is valid\n useChartRegistration({\n chartId,\n legendItems,\n chartType: 'pie',\n isDataValid: isValid,\n metadata: chartMetadata\n });\n const prefersReducedMotion = usePrefersReducedMotion();\n if (!isValid) {\n return /*#__PURE__*/_jsx(\"div\", {\n className: clsx('pie-chart', styles['pie-chart'], className),\n children: /*#__PURE__*/_jsx(\"div\", {\n className: styles['error-message'],\n children: message\n })\n });\n }\n\n // Calculate the actual pie size:\n // - Measure available space from the svg-wrapper\n // - If size prop provided: use it as max, but shrink if container is smaller\n // - If no size prop: fill available space\n const availableWidth = svgWrapperWidth > 0 ? svgWrapperWidth : 300;\n const availableHeight = svgWrapperHeight > 0 ? svgWrapperHeight : 300;\n const availableSize = Math.min(availableWidth, availableHeight);\n const actualSize = size ? Math.min(size, availableSize) : availableSize;\n const width = actualSize;\n const height = actualSize;\n\n // Calculate radius based on width/height\n const radius = Math.min(width, height) / 2;\n\n // Center the chart in the available space\n const centerX = width / 2;\n const centerY = height / 2;\n\n // Calculate the angle between each (use original data length for consistent spacing)\n const padAngle = gapScale * (2 * Math.PI / data.length);\n const outerRadius = radius - padding;\n const innerRadius = thickness === 0 ? 0 : outerRadius * (1 - thickness);\n const maxCornerRadius = (outerRadius - innerRadius) / 2;\n const cornerRadius = cornerScale ? Math.min(cornerScale * outerRadius, maxCornerRadius) : 0;\n\n // Map the data to include index for color assignment\n // When interactive, we need to find the original index to maintain consistent colors\n const dataWithIndex = visibleData.map(d => {\n const originalIndex = data.findIndex(item => item.label === d.label);\n return {\n ...d,\n index: originalIndex >= 0 ? originalIndex : 0\n };\n });\n const accessors = {\n value: d => d.value,\n fill: d => {\n return getElementStyles({\n data: d,\n index: d.index\n }).color;\n }\n };\n const legendElement = showLegend && /*#__PURE__*/_jsx(Legend, {\n orientation: legend.orientation ?? 'horizontal',\n position: legendPosition,\n alignment: legend.alignment ?? 'center',\n labelStyles: legend.labelStyles,\n itemClassName: legend.itemClassName,\n itemStyles: legend.itemStyles,\n shapeStyles: legend.shapeStyles,\n shape: legend.shape ?? 'circle',\n chartId: chartId,\n interactive: legendInteractive\n });\n return /*#__PURE__*/_jsx(SingleChartContext.Provider, {\n value: {\n chartId,\n chartWidth: width,\n chartHeight: height\n },\n children: /*#__PURE__*/_jsxs(Stack, {\n ref: containerRef,\n direction: \"column\",\n gap: gap,\n className: clsx('pie-chart', styles['pie-chart'],\n // Fill parent when no explicit dimensions provided\n {\n [styles['pie-chart--responsive']]: !propWidth && !propHeight\n }, className),\n style: {\n width: propWidth || undefined,\n height: propHeight || undefined\n },\n children: [legendPosition === 'top' && legendElement, renderLegendSlot(legendChildren, 'top'), /*#__PURE__*/_jsx(\"div\", {\n className: styles['pie-chart__svg-wrapper'],\n ref: svgWrapperRef,\n children: /*#__PURE__*/_jsxs(\"svg\", {\n viewBox: `0 0 ${width} ${height}`,\n preserveAspectRatio: \"xMidYMid meet\",\n width: width,\n height: height,\n children: [/*#__PURE__*/_jsx(\"defs\", {\n children: /*#__PURE__*/_jsx(RadialWipeAnimation, {\n id: `radial-wipe-${chartId}`,\n radius: outerRadius,\n innerRadius: innerRadius\n })\n }), /*#__PURE__*/_jsxs(Group, {\n top: centerY,\n left: centerX,\n mask: animation && !prefersReducedMotion ? `url(#radial-wipe-${chartId})` : null,\n children: [allSegmentsHidden ? /*#__PURE__*/_jsx(\"text\", {\n textAnchor: \"middle\",\n dy: \".33em\",\n fill: providerTheme.gridColor || '#ccc',\n fontSize: \"14\",\n fontFamily: \"-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif\",\n children: __('All segments are hidden. Click legend items to show data.', 'jetpack-charts')\n }) : /*#__PURE__*/_jsx(Pie, {\n data: dataWithIndex,\n pieValue: accessors.value,\n outerRadius: outerRadius,\n innerRadius: innerRadius,\n padAngle: padAngle,\n cornerRadius: cornerRadius,\n children: pie => {\n return pie.arcs.map((arc, index) => {\n const [centroidX, centroidY] = pie.path.centroid(arc);\n const hasSpaceForLabel = arc.endAngle - arc.startAngle >= 0.25;\n const handleMouseMove = event => {\n if (!withTooltips) {\n return;\n }\n\n // Don't show tooltip until container bounds are measured\n if (containerBounds.width === 0 || containerBounds.height === 0) {\n return;\n }\n\n // Use clientX/Y and subtract containerBounds to cancel out any stale offset.\n // TooltipInPortal calculates: tooltipLeft + containerBounds.left + scrollX\n // By passing (clientX - containerBounds.left), we get:\n // (clientX - containerBounds.left) + containerBounds.left + scrollX = clientX + scrollX\n // This gives correct page coordinates regardless of stale bounds.\n showTooltip({\n tooltipData: arc.data,\n tooltipLeft: event.clientX - containerBounds.left + tooltipOffsetX,\n tooltipTop: event.clientY - containerBounds.top + tooltipOffsetY\n });\n };\n const pathProps = {\n d: pie.path(arc) || '',\n fill: accessors.fill(arc.data),\n 'data-testid': 'pie-segment'\n };\n const groupProps = {};\n if (withTooltips) {\n groupProps.onMouseMove = handleMouseMove;\n groupProps.onMouseLeave = onMouseLeave;\n }\n\n // Estimate text width more accurately for background sizing\n const fontSize = 12;\n const estimatedTextWidth = getStringWidth(arc.data.label, {\n fontSize\n });\n const labelPadding = 6;\n const backgroundWidth = estimatedTextWidth + labelPadding * 2;\n const backgroundHeight = fontSize + labelPadding * 2;\n return /*#__PURE__*/_jsxs(\"g\", {\n ...groupProps,\n children: [/*#__PURE__*/_jsx(\"path\", {\n ...pathProps\n }), showLabels && hasSpaceForLabel && /*#__PURE__*/_jsxs(\"g\", {\n children: [providerTheme.labelBackgroundColor && /*#__PURE__*/_jsx(\"rect\", {\n x: centroidX - backgroundWidth / 2,\n y: centroidY - backgroundHeight / 2,\n width: backgroundWidth,\n height: backgroundHeight,\n fill: providerTheme.labelBackgroundColor,\n rx: 4,\n ry: 4,\n pointerEvents: \"none\"\n }), /*#__PURE__*/_jsx(\"text\", {\n x: centroidX,\n y: centroidY,\n dy: \".33em\",\n fill: providerTheme.labelTextColor || '#333',\n fontSize: fontSize,\n textAnchor: \"middle\",\n pointerEvents: \"none\",\n children: arc.data.label\n })]\n })]\n }, `arc-${index}`);\n });\n }\n }), !allSegmentsHidden && svgChildren]\n })]\n })\n }), legendPosition === 'bottom' && legendElement, renderLegendSlot(legendChildren, 'bottom'), withTooltips && tooltipOpen && tooltipData && /*#__PURE__*/_jsx(TooltipInPortal, {\n top: tooltipTop || 0,\n left: tooltipLeft || 0,\n children: /*#__PURE__*/_jsx(\"div\", {\n role: \"tooltip\",\n children: renderTooltip({\n tooltipData\n })\n })\n }), htmlChildren, otherChildren]\n })\n });\n};\nconst PieChartWithProvider = props => {\n const existingContext = useContext(GlobalChartsContext);\n\n // If we're already in a GlobalChartsProvider context, don't create a new one\n if (existingContext) {\n return /*#__PURE__*/_jsx(PieChartInternal, {\n ...props\n });\n }\n\n // Otherwise, create our own GlobalChartsProvider\n return /*#__PURE__*/_jsx(GlobalChartsProvider, {\n children: /*#__PURE__*/_jsx(PieChartInternal, {\n ...props\n })\n });\n};\nPieChartWithProvider.displayName = 'PieChart';\n\n// Create PieChart with composition API\nconst PieChart = attachSubComponents(PieChartWithProvider, {\n Legend: Legend,\n SVG: ChartSVG,\n HTML: ChartHTML\n});\n\n// Create responsive PieChart with composition API\nconst PieChartResponsive = attachSubComponents(withResponsive(PieChartWithProvider), {\n Legend: Legend,\n SVG: ChartSVG,\n HTML: ChartHTML\n});\nexport { PieChartResponsive as default, PieChart as PieChartUnresponsive };","import 'css-chunk:src/charts/pie-chart/pie-chart.module.scss';export default {\n \"pie-chart\": \"a8ccharts-C-n-Gu\",\n \"pie-chart--responsive\": \"a8ccharts-IQVR6j\",\n \"pie-chart__svg-wrapper\": \"a8ccharts-iQ1Rki\"\n};"]}
@@ -6,7 +6,14 @@ function attachSubComponents(Chart, subComponents) {
6
6
  // src/utils/date-parsing.ts
7
7
  import { parse, parseISO, isValid } from "date-fns";
8
8
  var hasTimezone = (dateString) => {
9
- return /T.*[Z]$|T.*[+-]\d{2}:?\d{2}$/.test(dateString);
9
+ const tIndex = dateString.indexOf("T");
10
+ if (tIndex === -1) {
11
+ return false;
12
+ }
13
+ if (dateString.endsWith("Z")) {
14
+ return true;
15
+ }
16
+ return /[+-]\d{2}:?\d{2}$/.test(dateString.slice(tIndex + 1));
10
17
  };
11
18
  var parseAsLocalDate = (dateString) => {
12
19
  const trimmedString = dateString.trim();
@@ -341,4 +348,4 @@ export {
341
348
  lightenHexColor,
342
349
  resolveCssVariable
343
350
  };
344
- //# sourceMappingURL=chunk-DAU3HNEG.js.map
351
+ //# sourceMappingURL=chunk-JJIMABHT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/create-composition.ts","../src/utils/date-parsing.ts","../src/utils/format-metric-value.ts","../src/utils/format-percentage.ts","../src/utils/get-longest-tick-width.ts","../src/utils/get-styles.ts","../src/utils/is-safari.ts","../src/utils/merge-themes.ts","../src/utils/color-utils.ts","../src/utils/resolve-css-var.ts"],"sourcesContent":["/**\n * Utility function to create chart components with composition API.\n *\n * This function attaches subcomponents to a chart component to enable\n * dot notation access like <Chart.Legend />, <Chart.Tooltip />, etc.\n *\n * @param Chart - The main chart component\n * @param subComponents - Object containing subcomponents to attach\n * @return Chart component with attached subcomponents\n */\nexport function attachSubComponents< TChart, TSubComponents extends Record< string, unknown > >(\n\tChart: TChart,\n\tsubComponents: TSubComponents\n): TChart & TSubComponents {\n\treturn Object.assign( Chart, subComponents );\n}\n","/**\n * @file Date parsing utilities using date-fns for local timezone handling\n *\n * This module provides utilities for parsing various date string formats and converting\n * them to local timezone dates using the battle-tested date-fns library. For formats\n * without timezone info, they're treated as local. For formats with timezone info,\n * they're converted to the equivalent local time.\n *\n * Note: And specifically it prevents format `YYYY-MM-DD` being parsed as UTC date.\n *\n * Key Features:\n * - All parsed dates are in local timezone\n * - Converts timezone-aware strings to local equivalent\n * - Robust input validation and error handling using date-fns\n * - TypeScript type safety\n * - Much smaller codebase than custom parsing\n *\n * Supported Formats:\n * - YYYY-MM-DD (treated as local)\n * - YYYY-MM-DD HH:mm:ss (treated as local)\n * - YYYY-MM-DD HH:mm (treated as local)\n * - YYYY-MM-DDTHH:mm:ss (treated as local)\n * - YYYY-MM-DDTHH:mm:ss.SSS (treated as local)\n * - YYYY-MM-DDTHH:mm (treated as local)\n * - YYYY-MM-DDTHH:mm:ssZ (converted to local)\n * - YYYY-MM-DDTHH:mm:ss±HH:mm (converted to local)\n *\n * @example\n * ```typescript\n * parseAsLocalDate(\"2025-01-01\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01 14:30:00\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01 14:30\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01T14:30:45.123\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01T14:30:00Z\"); // UTC 14:30 → Local equivalent\n * parseAsLocalDate(\"2025-01-01T14:30:00+05:00\"); // +05:00 14:30 → Local equivalent\n * ```\n */\n\nimport { parse, parseISO, isValid } from 'date-fns';\n\n/**\n * Checks if a date string contains timezone information\n * @param {string} dateString - The date string to check for timezone information\n * @return {boolean} True if the date string contains timezone information, false otherwise\n */\nconst hasTimezone = ( dateString: string ): boolean => {\n\tconst tIndex = dateString.indexOf( 'T' );\n\tif ( tIndex === -1 ) {\n\t\treturn false;\n\t}\n\n\tif ( dateString.endsWith( 'Z' ) ) {\n\t\treturn true;\n\t}\n\n\treturn /[+-]\\d{2}:?\\d{2}$/.test( dateString.slice( tIndex + 1 ) );\n};\n\n/**\n * Parses any supported date string format and returns a local timezone date\n *\n * Uses date-fns for robust parsing and validation. For strings without timezone\n * info, treats as local timezone. For strings with timezone info, converts to\n * local timezone equivalent.\n *\n * Supports:\n * - YYYY-MM-DD (local)\n * - YYYY-MM-DD HH:mm:ss (local)\n * - YYYY-MM-DD HH:mm (local)\n * - YYYY-MM-DDTHH:mm:ss (local)\n * - YYYY-MM-DDTHH:mm:ss.SSS (local)\n * - YYYY-MM-DDTHH:mm (local)\n * - YYYY-MM-DDTHH:mm:ssZ (UTC → local)\n * - YYYY-MM-DDTHH:mm:ss±HH:mm (offset → local)\n * @param {string} dateString - The date string to parse into a local timezone date\n * @return {Date} A Date object representing the parsed date in local timezone, or an invalid Date if parsing fails\n */\nexport const parseAsLocalDate = ( dateString: string ): Date => {\n\tconst trimmedString = dateString.trim();\n\n\t// If it has timezone information, parse as ISO and convert to local\n\tif ( hasTimezone( trimmedString ) ) {\n\t\tconst isoDate = parseISO( trimmedString );\n\n\t\tif ( ! isValid( isoDate ) ) {\n\t\t\treturn new Date( NaN );\n\t\t}\n\n\t\t// parseISO automatically converts to local timezone\n\t\treturn isoDate;\n\t}\n\n\t// For naive strings, try different local formats\n\tconst formats = [\n\t\t'yyyy-MM-dd', // 2025-01-01\n\t\t'yyyy-MM-dd HH:mm:ss', // 2025-01-01 14:30:45\n\t\t'yyyy-MM-dd HH:mm', // 2025-01-01 14:30\n\t\t\"yyyy-MM-dd'T'HH:mm:ss\", // 2025-01-01T14:30:45\n\t\t\"yyyy-MM-dd'T'HH:mm:ss.SSS\", // 2025-01-01T14:30:45.123\n\t\t\"yyyy-MM-dd'T'HH:mm\", // 2025-01-01T14:30\n\t];\n\n\tfor ( const format of formats ) {\n\t\tconst result = parse( trimmedString, format, new Date() );\n\t\tif ( isValid( result ) ) {\n\t\t\treturn result;\n\t\t}\n\t}\n\n\t// If no format matched, return invalid date\n\treturn new Date( NaN );\n};\n","import { formatNumberCompact, formatNumber } from '@automattic/number-formatters';\n\n/**\n * Types for formatMetricValue\n */\nexport type MetricValueType = 'number' | 'average' | 'currency';\n\ntype FormatMetricValueOptions = {\n\tdecimals?: number;\n\tuseMultipliers?: boolean;\n\tsignDisplay?: Intl.NumberFormatOptions[ 'signDisplay' ];\n};\n\n/**\n * Format a numeric metric value based on type, precision and scale.\n * Supports currency, number and percentage, using `@automattic/number-formatters`.\n *\n * @param value - The value to format\n * @param type - The type of formatting to apply\n * @param options - Formatting options\n * @param options.decimals - Number of decimal places to show\n * @param options.useMultipliers - Whether to use K, M, B suffixes for large numbers\n * @param options.signDisplay - Controls when to display the sign (auto, always, never, exceptZero)\n * @return Formatted string\n */\nexport const formatMetricValue = (\n\tvalue: string | number,\n\ttype: MetricValueType = 'number',\n\t{ decimals, useMultipliers = false, signDisplay }: FormatMetricValueOptions = {}\n): string => {\n\tif ( value === null || value === undefined ) {\n\t\treturn '';\n\t}\n\n\tconst numericValue = Number( value );\n\tif ( isNaN( numericValue ) ) {\n\t\treturn '';\n\t}\n\n\tswitch ( type ) {\n\t\tcase 'currency': {\n\t\t\t// Basic currency formatting - can be enhanced with full currency support\n\t\t\tconst formatted = useMultipliers\n\t\t\t\t? formatNumberCompact( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 2,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tmaximumFractionDigits: decimals ?? 2,\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } )\n\t\t\t\t: formatNumber( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 2,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } );\n\t\t\treturn `$${ formatted }`;\n\t\t}\n\n\t\tcase 'average': {\n\t\t\tif ( ! Number.isFinite( numericValue ) ) {\n\t\t\t\treturn '—';\n\t\t\t}\n\n\t\t\treturn formatNumber( numericValue, {\n\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\tstyle: 'percent',\n\t\t\t\t\tsignDisplay: signDisplay ?? 'exceptZero',\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tcase 'number':\n\t\tdefault: {\n\t\t\treturn useMultipliers\n\t\t\t\t? formatNumberCompact( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tmaximumFractionDigits: decimals ?? 0,\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } )\n\t\t\t\t: formatNumber( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } );\n\t\t}\n\t}\n};\n","import { formatNumber } from '@automattic/number-formatters';\n\n/**\n * Format a percentage value with smart decimal handling.\n * Uses `@automattic/number-formatters` for consistent formatting.\n * Removes unnecessary trailing zeros and caps at 2 decimal places.\n *\n * @param value - The percentage value (0-100 range)\n * @return Formatted percentage string (e.g., \"30%\", \"30.1%\", \"30.25%\")\n */\nexport const formatPercentage = ( value: number ): string => {\n\t// Use formatNumber with percentage style, but convert from 0-100 range to 0-1 range\n\treturn formatNumber( value / 100, {\n\t\tnumberFormatOptions: {\n\t\t\tstyle: 'percent',\n\t\t\tminimumFractionDigits: 0,\n\t\t\tmaximumFractionDigits: 2,\n\t\t},\n\t} );\n};\n","import { getStringWidth } from '@visx/text';\nimport type { TickFormatter } from '@visx/axis';\nimport type { AnyD3Scale, ScaleInput } from '@visx/scale';\n\n/**\n * Returns the width of the longest tick.\n *\n * @param ticks - Ticks to get the width of.\n * @param formatTick - Function to format the tick.\n * @param {object} labelStyle - Style object for the label.\n * @return {number} - Width of the longest tick.\n */\nexport const getLongestTickWidth = < T extends AnyD3Scale >(\n\tticks: ScaleInput< T >[],\n\tformatTick: TickFormatter< ScaleInput< T > >,\n\tlabelStyle?: object\n) => {\n\tconst formattedTicks = ticks.map( tick => formatTick( tick, 0, [] ) );\n\tconst longestTick = formattedTicks.reduce(\n\t\t( longest, current ) => ( longest.length >= current.length ? longest : current ),\n\t\tformattedTicks[ 0 ]\n\t);\n\n\treturn getStringWidth( longestTick, labelStyle );\n};\n","import type { ChartTheme, SeriesData } from '../types';\nimport type { LegendShape } from '@visx/legend/lib/types';\nimport type { LineStyles } from '@visx/xychart';\n\n/**\n * Utility function to get consolidated line styles for a series\n * This consolidates the logic used by both LineChart and Legend components\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} providerTheme - The chart theme configuration\n * @return {LineStyles} The consolidated line styles for the series\n */\nexport function getSeriesLineStyles(\n\tseriesData: SeriesData,\n\tindex: number,\n\tproviderTheme: ChartTheme\n): LineStyles {\n\t// Get theme-based line styles for line type\n\tconst themeSemanticLineStyle = providerTheme?.lineChart?.lineStyles?.[ seriesData.options?.type ];\n\n\t// Get theme-based line styles for index of series data\n\tconst themeSeriesLineStyle =\n\t\tproviderTheme?.seriesLineStyles?.[ index % providerTheme.seriesLineStyles.length ];\n\n\t// Priority order: custom series style > theme line type style > default theme series style\n\treturn (\n\t\tseriesData.options?.seriesLineStyle ?? themeSemanticLineStyle ?? themeSeriesLineStyle ?? {}\n\t);\n}\n\n/**\n * Utility function to get stroke color for a series\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {string[]} themeColors - Array of theme colors\n * @return {string} The stroke color for the series\n */\nexport function getSeriesStroke(\n\tseriesData: SeriesData,\n\tindex: number,\n\tthemeColors: string[]\n): string {\n\treturn seriesData.options?.stroke ?? themeColors[ index % themeColors.length ];\n}\n\n/**\n * Utility function to get shape styles for a legend item\n *\n * @param {SeriesData} series - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} theme - The chart theme configuration\n * @param {LegendShape} legendShape - The shape to use for the item (optional)\n * @return {Record< string, unknown >} The shape styles for the item\n */\nexport function getItemShapeStyles(\n\tseries: SeriesData,\n\tindex: number,\n\ttheme: ChartTheme,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): Record< string, unknown > {\n\tconst seriesShapeStyles = series.options?.legendShapeStyle ?? {};\n\tconst lineStyles = legendShape === 'line' ? getSeriesLineStyles( series, index, theme ) : {};\n\tconst themeShapeStyles = theme.legend?.shapeStyles?.[ index ];\n\n\tconst itemShapeStyles = {\n\t\t...seriesShapeStyles,\n\t\t...lineStyles,\n\t};\n\n\t// Return item shape styles if they are not empty\n\tif (\n\t\tObject.values( itemShapeStyles ).some(\n\t\t\tvalue => value !== undefined && value !== null && value !== ''\n\t\t)\n\t) {\n\t\treturn itemShapeStyles;\n\t}\n\n\t// Fallback to theme shape styles if defined\n\treturn themeShapeStyles ?? {};\n}\n","export const isSafari = () => {\n\tif ( typeof navigator !== 'undefined' && navigator.userAgent ) {\n\t\treturn /^((?!chrome|android).)*safari/i.test( navigator.userAgent );\n\t}\n\treturn false;\n};\n","import deepmerge from 'deepmerge';\nimport type { ChartTheme, CompleteChartTheme } from '../types';\n\n/**\n * Merges chart themes with proper precedence.\n * The second theme (override) takes precedence over the first theme (base).\n *\n * @param baseTheme - Base theme object\n * @param overrideTheme - Theme to override base with (takes precedence)\n * @return Merged theme with overrideTheme values taking precedence\n */\nexport function mergeThemes(\n\tbaseTheme: CompleteChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): CompleteChartTheme;\nexport function mergeThemes(\n\tbaseTheme: ChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): ChartTheme;\nexport function mergeThemes(\n\tbaseTheme: ChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): ChartTheme {\n\t// Use deepmerge to properly merge nested objects, with overrideTheme taking precedence\n\treturn deepmerge( baseTheme, overrideTheme, {\n\t\t// Ensure arrays are replaced rather than concatenated\n\t\tarrayMerge: ( _destinationArray, sourceArray ) => sourceArray,\n\t} ) as ChartTheme;\n}\n","import { color as d3Color, hsl as d3Hsl } from '@visx/vendor/d3-color';\n\n/**\n * Check if a value is a valid 6-digit hex color\n * @param hex - The value to check\n * @return true if valid hex color format (e.g., '#ff0000')\n */\nexport const isValidHexColor = ( hex: unknown ): hex is string => {\n\treturn typeof hex === 'string' && /^#[0-9a-fA-F]{6}$/.test( hex );\n};\n\n/**\n * Validate hex color format, throwing descriptive errors if invalid\n * @param hex - The hex color string to validate\n * @throws {Error} if hex string is malformed\n */\nexport const validateHexColor = ( hex: unknown ): void => {\n\tif ( isValidHexColor( hex ) ) {\n\t\treturn;\n\t}\n\n\t// Provide specific error messages for common issues\n\tif ( typeof hex !== 'string' ) {\n\t\tthrow new Error( 'Hex color must be a string' );\n\t}\n\tif ( ! hex.startsWith( '#' ) ) {\n\t\tthrow new Error( 'Hex color must start with #' );\n\t}\n\tif ( hex.length !== 7 ) {\n\t\tthrow new Error( 'Hex color must be 7 characters long (e.g., #ff0000)' );\n\t}\n\tthrow new Error( 'Hex color contains invalid characters. Only 0-9, a-f, A-F are allowed' );\n};\n\n/**\n * Convert hex color to rgba with specified opacity.\n * This is genuinely reusable across chart components.\n * @param hex - The hex color string (e.g., '#ff0000')\n * @param alpha - The opacity value. Values outside the [0, 1] range will be clamped by the underlying d3 color library.\n * @return The rgba color string (e.g., 'rgba(255, 0, 0, 0.5)')\n * @throws {Error} if hex string is malformed or alpha is not a valid number\n */\nexport const hexToRgba = ( hex: string, alpha: number ): string => {\n\tvalidateHexColor( hex );\n\n\tif ( typeof alpha !== 'number' || isNaN( alpha ) ) {\n\t\tthrow new Error( 'Alpha must be a number' );\n\t}\n\n\t// Safe to use non-null assertion since validateHexColor ensures valid hex\n\treturn d3Color( hex )!.copy( { opacity: alpha } ).formatRgb();\n};\n\n/**\n * Calculate the perceptual distance between two HSL colors\n * @param hsl1 - first color in HSL format [h, s, l]\n * @param hsl2 - second color in HSL format [h, s, l]\n * @return distance value (0-100+, lower means more similar)\n */\nexport const getColorDistance = (\n\thsl1: [ number, number, number ],\n\thsl2: [ number, number, number ]\n): number => {\n\tconst [ h1, s1, l1 ] = hsl1;\n\tconst [ h2, s2, l2 ] = hsl2;\n\n\t// Calculate hue difference, accounting for circular nature (0° = 360°)\n\tlet hueDiff = Math.abs( h1 - h2 );\n\thueDiff = Math.min( hueDiff, 360 - hueDiff );\n\n\t// Weight the differences: hue is most important, then lightness, then saturation\n\tconst hueWeight = 2;\n\tconst lightnessWeight = 1;\n\tconst saturationWeight = 0.5;\n\n\treturn Math.sqrt(\n\t\tMath.pow( hueDiff * hueWeight, 2 ) +\n\t\t\tMath.pow( ( l1 - l2 ) * lightnessWeight, 2 ) +\n\t\t\tMath.pow( ( s1 - s2 ) * saturationWeight, 2 )\n\t);\n};\n\n/**\n * Parse an HSL string like 'hsl(120, 50%, 50%)' into an HSL tuple.\n *\n * @param hslString - HSL color string\n * @return HSL tuple [h, s, l] or null if invalid\n */\nexport const parseHslString = ( hslString: string ): [ number, number, number ] | null => {\n\tconst lower = hslString.toLowerCase().trim();\n\n\t// Check prefix - d3-color handles the parsing\n\tif ( ! lower.startsWith( 'hsl(' ) ) {\n\t\treturn null;\n\t}\n\n\tconst parsed = d3Hsl( lower );\n\n\t// d3Hsl returns NaN values for invalid colors\n\tif ( isNaN( parsed.h ) && isNaN( parsed.s ) && isNaN( parsed.l ) ) {\n\t\treturn null;\n\t}\n\n\t// Normalize hue to 0-360 range (d3 may return NaN for achromatic colors)\n\tconst h = isNaN( parsed.h ) ? 0 : ( ( parsed.h % 360 ) + 360 ) % 360;\n\n\t// d3-color uses 0-1 scale, convert to 0-100\n\treturn [ h, parsed.s * 100, parsed.l * 100 ];\n};\n\n/**\n * Parse an RGB string like 'rgb(255, 0, 0)' into a hex color.\n *\n * @param rgbString - RGB color string\n * @return hex color string or null if invalid\n */\nexport const parseRgbString = ( rgbString: string ): string | null => {\n\tconst lower = rgbString.toLowerCase().trim();\n\n\t// Check prefix - only handle rgb(), not rgba()\n\tif ( ! lower.startsWith( 'rgb(' ) || lower.startsWith( 'rgba(' ) ) {\n\t\treturn null;\n\t}\n\n\tconst parsed = d3Color( lower );\n\n\t// d3Color returns null for invalid colors\n\tif ( ! parsed ) {\n\t\treturn null;\n\t}\n\n\t// d3-color clamps values automatically\n\treturn parsed.formatHex();\n};\n\n/**\n * Normalize any CSS color value to a hex color string.\n * Handles hex colors, HSL strings, RGB strings, and CSS variables.\n *\n * @param color - Any CSS color value\n * @param element - Optional DOM element for resolving CSS variables\n * @param resolveCss - Function to resolve CSS variables (injected for testability)\n * @return hex color string, or the original value if conversion fails\n */\nexport const normalizeColorToHex = (\n\tcolor: string,\n\telement?: HTMLElement | null,\n\tresolveCss?: ( value: string, el?: HTMLElement | null ) => string | null\n): string => {\n\tif ( ! color || typeof color !== 'string' ) {\n\t\treturn '';\n\t}\n\n\t// Already a valid hex color (6-digit format)\n\tif ( /^#[0-9a-fA-F]{6}$/.test( color ) ) {\n\t\treturn color;\n\t}\n\n\tconst trimmed = color.trim().toLowerCase();\n\n\t// Handle 3-digit hex colors - expand to 6-digit\n\tif ( /^#[0-9a-f]{3}$/i.test( trimmed ) ) {\n\t\tconst r = trimmed[ 1 ];\n\t\tconst g = trimmed[ 2 ];\n\t\tconst b = trimmed[ 3 ];\n\t\treturn `#${ r }${ r }${ g }${ g }${ b }${ b }`;\n\t}\n\n\t// Handle CSS variables - must be resolved before d3-color can parse\n\tif ( trimmed.startsWith( '--' ) || trimmed.startsWith( 'var(' ) ) {\n\t\tif ( resolveCss ) {\n\t\t\tconst resolved = resolveCss( color, element );\n\t\t\tif ( resolved ) {\n\t\t\t\t// Recursively normalize the resolved value\n\t\t\t\treturn normalizeColorToHex( resolved, element, resolveCss );\n\t\t\t}\n\t\t}\n\t\t// Can't resolve CSS variable, return original\n\t\treturn color;\n\t}\n\n\t// Handle HSL and RGB strings using d3-color\n\tif ( trimmed.startsWith( 'hsl(' ) || trimmed.startsWith( 'rgb(' ) ) {\n\t\t// Reject rgba() - we only handle rgb()\n\t\tif ( trimmed.startsWith( 'rgba(' ) ) {\n\t\t\treturn color;\n\t\t}\n\t\tconst parsed = d3Color( trimmed );\n\t\tif ( parsed ) {\n\t\t\treturn parsed.formatHex();\n\t\t}\n\t\treturn color;\n\t}\n\n\t// Unknown format, return as-is\n\treturn color;\n};\n\n/**\n * Lighten a hex color by blending it with white.\n * Useful for creating color gradients or lighter variants.\n *\n * @param hex - Hex color string (e.g., '#98C8DF')\n * @param blend - Blend amount with white (0 = original color, 1 = white)\n * @return Lightened hex color string (e.g., '#cce4ef')\n * @throws {Error} if hex string is malformed\n */\nexport const lightenHexColor = ( hex: string, blend: number ): string => {\n\tvalidateHexColor( hex );\n\n\tconst r = parseInt( hex.slice( 1, 3 ), 16 );\n\tconst g = parseInt( hex.slice( 3, 5 ), 16 );\n\tconst b = parseInt( hex.slice( 5, 7 ), 16 );\n\n\t// Blend with white (255, 255, 255)\n\tconst newR = Math.round( r + ( 255 - r ) * blend );\n\tconst newG = Math.round( g + ( 255 - g ) * blend );\n\tconst newB = Math.round( b + ( 255 - b ) * blend );\n\n\treturn `#${ newR.toString( 16 ).padStart( 2, '0' ) }${ newG\n\t\t.toString( 16 )\n\t\t.padStart( 2, '0' ) }${ newB.toString( 16 ).padStart( 2, '0' ) }`;\n};\n","/**\n * Pattern for valid CSS custom property names (e.g., '--my-color', '--jp-gray-10')\n */\nconst CSS_VAR_NAME_PATTERN = /^--[\\w-]+$/;\n\n/**\n * Resolves a CSS custom property (variable) to its computed value.\n * Handles multiple formats:\n * - Plain variable names: '--my-color'\n * - CSS var() syntax: 'var(--my-color)'\n * - CSS var() with fallback: 'var(--my-color, #ffffff)'\n * - Regular values (returned as-is): '#ffffff', 'red'\n *\n * @param value - A CSS variable name, var() expression, or regular value\n * @param element - Optional DOM element to resolve the variable from (defaults to document.documentElement)\n * @return The resolved value, fallback value, or null if unresolvable\n */\nexport const resolveCssVariable = (\n\tvalue: string,\n\telement?: HTMLElement | null\n): string | null => {\n\tif ( ! value ) {\n\t\treturn null;\n\t}\n\n\t// Check if it's a var() expression: var(--name) or var(--name, fallback)\n\t// Parse manually to avoid regex backtracking vulnerabilities\n\tif ( value.startsWith( 'var(' ) && value.endsWith( ')' ) ) {\n\t\tconst parsed = parseVarExpression( value );\n\n\t\tif ( parsed ) {\n\t\t\tconst resolved = resolveVariableName( parsed.varName, element );\n\n\t\t\treturn resolved || parsed.fallback;\n\t\t}\n\t}\n\n\t// Check if it's a plain variable name (starts with --)\n\tif ( value.startsWith( '--' ) ) {\n\t\treturn resolveVariableName( value, element );\n\t}\n\n\t// Return regular values as-is (e.g., '#ffffff', 'red')\n\treturn value;\n};\n\n/**\n * Parses a var() expression into its variable name and optional fallback.\n * Uses string manipulation instead of complex regex to avoid ReDoS.\n *\n * @param expr - A var() expression like 'var(--name)' or 'var(--name, fallback)'\n * @return Parsed result or null if invalid\n */\nfunction parseVarExpression( expr: string ): { varName: string; fallback: string | null } | null {\n\t// Remove 'var(' prefix and ')' suffix\n\tconst inner = expr.slice( 4, -1 ).trim();\n\n\tif ( ! inner.startsWith( '--' ) ) {\n\t\treturn null;\n\t}\n\n\t// Find the comma separator (if any)\n\tconst commaIndex = inner.indexOf( ',' );\n\n\tif ( commaIndex === -1 ) {\n\t\t// No fallback: var(--name)\n\t\tconst varName = inner.trim();\n\t\t// Validate variable name format\n\t\tif ( ! CSS_VAR_NAME_PATTERN.test( varName ) ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn { varName, fallback: null };\n\t}\n\n\t// Has fallback: var(--name, fallback)\n\tconst varName = inner.slice( 0, commaIndex ).trim();\n\n\t// Validate variable name format\n\tif ( ! CSS_VAR_NAME_PATTERN.test( varName ) ) {\n\t\treturn null;\n\t}\n\n\tconst fallback = inner.slice( commaIndex + 1 ).trim();\n\n\treturn { varName, fallback: fallback || null };\n}\n\n/**\n * Resolves a plain CSS variable name to its computed value.\n *\n * @param varName - A CSS variable name like '--my-color'\n * @param element - Optional DOM element to resolve from\n * @return The computed value or null\n */\nfunction resolveVariableName( varName: string, element?: HTMLElement | null ): string | null {\n\tif ( typeof window === 'undefined' || typeof document === 'undefined' ) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst targetElement = element || document.documentElement;\n\t\tconst computedValue = getComputedStyle( targetElement ).getPropertyValue( varName ).trim();\n\n\t\treturn computedValue || null;\n\t} catch {\n\t\t// Return null if getComputedStyle throws (e.g., detached element)\n\t\treturn null;\n\t}\n}\n"],"mappings":";AAUO,SAAS,oBACf,OACA,eAC0B;AAC1B,SAAO,OAAO,OAAQ,OAAO,aAAc;AAC5C;;;ACuBA,SAAS,OAAO,UAAU,eAAe;AAOzC,IAAM,cAAc,CAAE,eAAiC;AACtD,QAAM,SAAS,WAAW,QAAS,GAAI;AACvC,MAAK,WAAW,IAAK;AACpB,WAAO;AAAA,EACR;AAEA,MAAK,WAAW,SAAU,GAAI,GAAI;AACjC,WAAO;AAAA,EACR;AAEA,SAAO,oBAAoB,KAAM,WAAW,MAAO,SAAS,CAAE,CAAE;AACjE;AAqBO,IAAM,mBAAmB,CAAE,eAA8B;AAC/D,QAAM,gBAAgB,WAAW,KAAK;AAGtC,MAAK,YAAa,aAAc,GAAI;AACnC,UAAM,UAAU,SAAU,aAAc;AAExC,QAAK,CAAE,QAAS,OAAQ,GAAI;AAC3B,aAAO,oBAAI,KAAM,GAAI;AAAA,IACtB;AAGA,WAAO;AAAA,EACR;AAGA,QAAM,UAAU;AAAA,IACf;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IAC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A,EACR;AAEA,MAAI;AACH,UAAM,gBAAgB,WAAW,SAAS;AAC1C,UAAM,gBAAgB,iBAAkB,aAAc,EAAE,iBAAkB,OAAQ,EAAE,KAAK;AAEzF,WAAO,iBAAiB;AAAA,EACzB,QAAQ;AAEP,WAAO;AAAA,EACR;AACD;","names":["formatNumber","varName"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Stack
3
- } from "./chunk-Z26M4V2M.js";
3
+ } from "./chunk-YAFQVVDI.js";
4
4
  import {
5
5
  GlobalChartsContext,
6
6
  GlobalChartsProvider,
@@ -9,11 +9,11 @@ import {
9
9
  useGlobalChartsContext,
10
10
  useGlobalChartsTheme,
11
11
  usePrefersReducedMotion
12
- } from "./chunk-32DH6JDF.js";
12
+ } from "./chunk-2I67QUIV.js";
13
13
  import {
14
14
  formatPercentage,
15
15
  hexToRgba
16
- } from "./chunk-DAU3HNEG.js";
16
+ } from "./chunk-JJIMABHT.js";
17
17
 
18
18
  // src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx
19
19
  import { useTooltip, useTooltipInPortal } from "@visx/tooltip";
@@ -418,4 +418,4 @@ ConversionFunnelChartWithProvider.displayName = "ConversionFunnelChart";
418
418
  export {
419
419
  ConversionFunnelChartWithProvider
420
420
  };
421
- //# sourceMappingURL=chunk-CZGYJKG6.js.map
421
+ //# sourceMappingURL=chunk-KJHWXOCZ.js.map
@@ -1,3 +1,7 @@
1
+ import {
2
+ Legend
3
+ } from "./chunk-WTQYGUNF.js";
4
+
1
5
  // src/charts/private/chart-composition/chart-svg.tsx
2
6
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
7
  var ChartSVG = ({
@@ -20,6 +24,14 @@ var ChartHTML = ({
20
24
  };
21
25
  ChartHTML.displayName = "Chart.HTML";
22
26
 
27
+ // src/charts/private/chart-composition/render-legend-slot.ts
28
+ import { createElement, Fragment } from "react";
29
+ function renderLegendSlot(legendChildren, position) {
30
+ return legendChildren.filter((l) => l.position === position).map(
31
+ (l, i) => createElement(Fragment, { key: `legend-${position}-${i}` }, l.element)
32
+ );
33
+ }
34
+
23
35
  // src/charts/private/chart-composition/use-chart-children.ts
24
36
  import { Group } from "@visx/group";
25
37
  import { useMemo, Children, isValidElement } from "react";
@@ -27,9 +39,17 @@ function useChartChildren(children, chartType) {
27
39
  return useMemo(() => {
28
40
  const svg = [];
29
41
  const html = [];
42
+ const legend = [];
30
43
  const other = [];
44
+ const nonLegend = [];
31
45
  Children.forEach(children, (child) => {
32
46
  if (isValidElement(child)) {
47
+ if (child.type === Legend) {
48
+ const rawPosition = child.props?.position;
49
+ const position = rawPosition === "top" || rawPosition === "bottom" ? rawPosition : "bottom";
50
+ legend.push({ element: child, position });
51
+ return;
52
+ }
33
53
  const childType = child.type;
34
54
  const displayName = childType?.displayName;
35
55
  if (displayName === `${chartType}.SVG` || displayName === "Chart.SVG") {
@@ -50,14 +70,22 @@ function useChartChildren(children, chartType) {
50
70
  other.push(child);
51
71
  }
52
72
  }
73
+ nonLegend.push(child);
53
74
  });
54
- return { svgChildren: svg, htmlChildren: html, otherChildren: other };
75
+ return {
76
+ svgChildren: svg,
77
+ htmlChildren: html,
78
+ legendChildren: legend,
79
+ otherChildren: other,
80
+ nonLegendChildren: nonLegend
81
+ };
55
82
  }, [children, chartType]);
56
83
  }
57
84
 
58
85
  export {
59
86
  ChartSVG,
60
87
  ChartHTML,
88
+ renderLegendSlot,
61
89
  useChartChildren
62
90
  };
63
- //# sourceMappingURL=chunk-6CCZL2JJ.js.map
91
+ //# sourceMappingURL=chunk-KRWGSOJ2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/charts/private/chart-composition/chart-svg.tsx","../src/charts/private/chart-composition/chart-html.tsx","../src/charts/private/chart-composition/render-legend-slot.ts","../src/charts/private/chart-composition/use-chart-children.ts"],"sourcesContent":["import { Fragment as _Fragment, jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Compound component for SVG children in charts.\n * This component serves as a marker for SVG content that should be rendered\n * inside the chart's SVG element. The actual rendering is handled by the parent chart.\n *\n * @param {PropsWithChildren} props - Component props\n * @param {ReactNode} props.children - Child elements to render inside the SVG\n * @return {JSX.Element} The children wrapped in a fragment\n */\nexport const ChartSVG = ({\n children\n}) => {\n // This component doesn't render directly - its children are extracted by the parent chart\n // We just return the children as-is\n return /*#__PURE__*/_jsx(_Fragment, {\n children: children\n });\n};\n\n// Set displayName for better debugging and type checking\nChartSVG.displayName = 'Chart.SVG';","import { Fragment as _Fragment, jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Compound component for HTML children in charts.\n * This component serves as a marker for HTML content that should be rendered\n * outside the chart's SVG element. The actual rendering is handled by the parent chart.\n *\n * @param {PropsWithChildren} props - Component props\n * @param {ReactNode} props.children - Child elements to render outside the SVG\n * @return {JSX.Element} The children wrapped in a fragment\n */\nexport const ChartHTML = ({\n children\n}) => {\n // This component doesn't render directly - its children are extracted by the parent chart\n // We just return the children as-is\n return /*#__PURE__*/_jsx(_Fragment, {\n children: children\n });\n};\n\n// Set displayName for better debugging and type checking\nChartHTML.displayName = 'Chart.HTML';","import { createElement, Fragment } from 'react';\nimport type { LegendChild } from './use-chart-children';\nimport type { LegendPosition } from '../../../types';\nimport type { ReactNode } from 'react';\n\n/**\n * Renders legend children filtered by position slot.\n *\n * @param {LegendChild[]} legendChildren - The legend children to filter and render\n * @param {LegendPosition} position - The position slot to render\n * @return {ReactNode[]} Array of legend elements for the given position\n */\nexport function renderLegendSlot(\n\tlegendChildren: LegendChild[],\n\tposition: LegendPosition\n): ReactNode[] {\n\treturn legendChildren\n\t\t.filter( l => l.position === position )\n\t\t.map( ( l, i ) =>\n\t\t\tcreateElement( Fragment, { key: `legend-${ position }-${ i }` }, l.element )\n\t\t);\n}\n","import { Group } from '@visx/group';\nimport { useMemo, Children, isValidElement } from 'react';\nimport { Legend } from '../../../components/legend';\nimport type { LegendPosition } from '../../../types';\nimport type { ReactElement, ReactNode } from 'react';\n\nexport type LegendChild = {\n\telement: ReactElement;\n\tposition: LegendPosition;\n};\n\ninterface ChartChildren {\n\tsvgChildren: ReactNode[];\n\thtmlChildren: ReactNode[];\n\tlegendChildren: LegendChild[];\n\totherChildren: ReactNode[];\n\t/** All children except Legend, in original order. */\n\tnonLegendChildren: ReactNode[];\n}\n\n/**\n * Custom hook to process and categorize chart children for composition API.\n * Extracts children from compound components (Chart.SVG, Chart.HTML) and\n * maintains backward compatibility with legacy Group components.\n *\n * @param {ReactNode} children - The children prop from the chart component\n * @param {string} chartType - The type of chart (e.g., 'PieChart', 'BarChart')\n * @return {ChartChildren} Categorized children for rendering\n */\nexport function useChartChildren( children: ReactNode, chartType: string ): ChartChildren {\n\treturn useMemo( () => {\n\t\tconst svg: ReactNode[] = [];\n\t\tconst html: ReactNode[] = [];\n\t\tconst legend: LegendChild[] = [];\n\t\tconst other: ReactNode[] = [];\n\t\tconst nonLegend: ReactNode[] = [];\n\n\t\tChildren.forEach( children, child => {\n\t\t\tif ( isValidElement( child ) ) {\n\t\t\t\t// Extract Legend children for position-based slot rendering\n\t\t\t\tif ( child.type === Legend ) {\n\t\t\t\t\tconst rawPosition = child.props?.position;\n\t\t\t\t\tconst position =\n\t\t\t\t\t\trawPosition === 'top' || rawPosition === 'bottom' ? rawPosition : 'bottom';\n\n\t\t\t\t\tlegend.push( { element: child as ReactElement, position } );\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check displayName for compound components\n\t\t\t\tconst childType = child.type as { displayName?: string };\n\t\t\t\tconst displayName = childType?.displayName;\n\n\t\t\t\t// Handle chart-specific compound components (e.g., PieChart.SVG)\n\t\t\t\tif ( displayName === `${ chartType }.SVG` || displayName === 'Chart.SVG' ) {\n\t\t\t\t\t// Extract children from Chart.SVG with safety checks\n\t\t\t\t\tif ( child.props?.children ) {\n\t\t\t\t\t\tChildren.forEach( child.props.children, svgChild => {\n\t\t\t\t\t\t\tsvg.push( svgChild );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( displayName === `${ chartType }.HTML` || displayName === 'Chart.HTML' ) {\n\t\t\t\t\t// Extract children from Chart.HTML with safety checks\n\t\t\t\t\tif ( child.props?.children ) {\n\t\t\t\t\t\tChildren.forEach( child.props.children, htmlChild => {\n\t\t\t\t\t\t\thtml.push( htmlChild );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( child.type === Group ) {\n\t\t\t\t\t// Legacy support: still check for Group type for backward compatibility\n\t\t\t\t\tsvg.push( child );\n\t\t\t\t} else {\n\t\t\t\t\tother.push( child );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Preserve original order of all non-Legend children\n\t\t\tnonLegend.push( child );\n\t\t} );\n\n\t\treturn {\n\t\t\tsvgChildren: svg,\n\t\t\thtmlChildren: html,\n\t\t\tlegendChildren: legend,\n\t\t\totherChildren: other,\n\t\t\tnonLegendChildren: nonLegend,\n\t\t};\n\t}, [ children, chartType ] );\n}\n"],"mappings":";;;;;AAAA,SAAS,YAAY,WAAW,OAAO,YAAY;AAU5C,IAAM,WAAW,CAAC;AAAA,EACvB;AACF,MAAM;AAGJ,SAAoB,qBAAK,WAAW;AAAA,IAClC;AAAA,EACF,CAAC;AACH;AAGA,SAAS,cAAc;;;ACrBvB,SAAS,YAAYA,YAAW,OAAOC,aAAY;AAU5C,IAAM,YAAY,CAAC;AAAA,EACxB;AACF,MAAM;AAGJ,SAAoB,gBAAAA,MAAKD,YAAW;AAAA,IAClC;AAAA,EACF,CAAC;AACH;AAGA,UAAU,cAAc;;;ACrBxB,SAAS,eAAe,gBAAgB;AAYjC,SAAS,iBACf,gBACA,UACc;AACd,SAAO,eACL,OAAQ,OAAK,EAAE,aAAa,QAAS,EACrC;AAAA,IAAK,CAAE,GAAG,MACV,cAAe,UAAU,EAAE,KAAK,UAAW,QAAS,IAAK,CAAE,GAAG,GAAG,EAAE,OAAQ;AAAA,EAC5E;AACF;;;ACrBA,SAAS,aAAa;AACtB,SAAS,SAAS,U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4,33 +4,36 @@ import {
4
4
  import {
5
5
  ChartHTML,
6
6
  ChartSVG,
7
+ renderLegendSlot,
7
8
  useChartChildren
8
- } from "./chunk-6CCZL2JJ.js";
9
+ } from "./chunk-KRWGSOJ2.js";
10
+ import {
11
+ Legend,
12
+ SingleChartContext,
13
+ useChartLegendItems
14
+ } from "./chunk-WTQYGUNF.js";
9
15
  import {
10
16
  BaseTooltip
11
17
  } from "./chunk-BPYKWMI7.js";
12
18
  import {
13
19
  Stack
14
- } from "./chunk-Z26M4V2M.js";
20
+ } from "./chunk-YAFQVVDI.js";
15
21
  import {
16
22
  withResponsive
17
23
  } from "./chunk-OP6PHB2U.js";
18
24
  import {
19
25
  GlobalChartsContext,
20
26
  GlobalChartsProvider,
21
- Legend,
22
- SingleChartContext,
23
27
  useChartId,
24
- useChartLegendItems,
25
28
  useChartRegistration,
26
29
  useElementSize,
27
30
  useGlobalChartsContext,
28
31
  useInteractiveLegendData,
29
32
  usePrefersReducedMotion
30
- } from "./chunk-32DH6JDF.js";
33
+ } from "./chunk-2I67QUIV.js";
31
34
  import {
32
35
  attachSubComponents
33
- } from "./chunk-DAU3HNEG.js";
36
+ } from "./chunk-JJIMABHT.js";
34
37
 
35
38
  // src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx
36
39
  import { Group } from "@visx/group";
@@ -99,15 +102,8 @@ var PieSemiCircleChartInternal = ({
99
102
  clockwise = true,
100
103
  withTooltips = false,
101
104
  showLegend = false,
102
- legendOrientation = "horizontal",
103
- legendPosition = "bottom",
104
- legendAlignment = "center",
105
- legendMaxWidth,
106
- legendTextOverflow = "wrap",
107
- legendItemClassName,
108
- legendShape = "circle",
105
+ legend = {},
109
106
  legendValueDisplay = "percentage",
110
- legendInteractive = false,
111
107
  label,
112
108
  animation,
113
109
  note,
@@ -118,6 +114,8 @@ var PieSemiCircleChartInternal = ({
118
114
  renderTooltip = renderDefaultPieSemiCircleTooltip,
119
115
  gap = "md"
120
116
  }) => {
117
+ const legendInteractive = legend.interactive ?? false;
118
+ const legendPosition = legend.position ?? "bottom";
121
119
  const chartId = useChartId(providedChartId);
122
120
  const [svgWrapperRef, svgWrapperWidth, svgWrapperHeight] = useElementSize();
123
121
  const {
@@ -187,6 +185,7 @@ var PieSemiCircleChartInternal = ({
187
185
  const {
188
186
  svgChildren,
189
187
  htmlChildren,
188
+ legendChildren,
190
189
  otherChildren
191
190
  } = useChartChildren(children, "PieSemiCircleChart");
192
191
  const chartMetadata = useMemo(() => ({
@@ -236,15 +235,14 @@ var PieSemiCircleChartInternal = ({
236
235
  const startAngle = clockwise ? -Math.PI / 2 : Math.PI / 2;
237
236
  const endAngle = clockwise ? Math.PI / 2 : -Math.PI / 2;
238
237
  const legendElement = showLegend && /* @__PURE__ */ _jsx(Legend, {
239
- orientation: legendOrientation,
238
+ orientation: legend.orientation ?? "horizontal",
240
239
  position: legendPosition,
241
- alignment: legendAlignment,
242
- labelStyles: {
243
- maxWidth: legendMaxWidth,
244
- textOverflow: legendTextOverflow
245
- },
246
- itemClassName: legendItemClassName,
247
- shape: legendShape,
240
+ alignment: legend.alignment ?? "center",
241
+ labelStyles: legend.labelStyles,
242
+ itemClassName: legend.itemClassName,
243
+ itemStyles: legend.itemStyles,
244
+ shapeStyles: legend.shapeStyles,
245
+ shape: legend.shape ?? "circle",
248
246
  chartId,
249
247
  interactive: legendInteractive
250
248
  });
@@ -265,7 +263,7 @@ var PieSemiCircleChartInternal = ({
265
263
  width: propWidth || void 0,
266
264
  height: propHeight || void 0
267
265
  },
268
- children: [legendPosition === "top" && legendElement, /* @__PURE__ */ _jsx("div", {
266
+ children: [legendPosition === "top" && legendElement, renderLegendSlot(legendChildren, "top"), /* @__PURE__ */ _jsx("div", {
269
267
  ref: svgWrapperRef,
270
268
  className: pie_semi_circle_chart_module_default["pie-semi-circle-chart__svg-wrapper"],
271
269
  children: /* @__PURE__ */ _jsxs("svg", {
@@ -330,7 +328,7 @@ var PieSemiCircleChartInternal = ({
330
328
  })
331
329
  })]
332
330
  })
333
- }), legendPosition !== "top" && legendElement, withTooltips && tooltipOpen && tooltipData && /* @__PURE__ */ _jsx(TooltipInPortal, {
331
+ }), legendPosition === "bottom" && legendElement, renderLegendSlot(legendChildren, "bottom"), withTooltips && tooltipOpen && tooltipData && /* @__PURE__ */ _jsx(TooltipInPortal, {
334
332
  top: tooltipTop || 0,
335
333
  left: tooltipLeft || 0,
336
334
  children: /* @__PURE__ */ _jsx("div", {
@@ -372,4 +370,4 @@ export {
372
370
  PieSemiCircleChart,
373
371
  PieSemiCircleChartResponsive
374
372
  };
375
- //# sourceMappingURL=chunk-V36ERY7Y.js.map
373
+ //# sourceMappingURL=chunk-LTFH7SEG.js.map