@automattic/charts 0.56.2 → 0.56.4

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 (184) 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-4YYROZDJ.cjs +375 -0
  44. package/dist/chunk-4YYROZDJ.cjs.map +1 -0
  45. package/dist/{chunk-YYQ4IK5V.cjs → chunk-5N77S5N3.cjs} +103 -80
  46. package/dist/chunk-5N77S5N3.cjs.map +1 -0
  47. package/dist/chunk-66BXSWMW.cjs +1065 -0
  48. package/dist/chunk-66BXSWMW.cjs.map +1 -0
  49. package/dist/{chunk-CEZGL6YP.js → chunk-6CCZL2JJ.js} +15 -7
  50. package/dist/chunk-6CCZL2JJ.js.map +1 -0
  51. package/dist/{chunk-NW3RUYK2.cjs → chunk-7QDEU3KN.cjs} +15 -22
  52. package/dist/chunk-7QDEU3KN.cjs.map +1 -0
  53. package/dist/{chunk-H34CJSR6.js → chunk-AWNCAKZY.js} +367 -358
  54. package/dist/chunk-AWNCAKZY.js.map +1 -0
  55. package/dist/{chunk-5XI443YP.js → chunk-BPYKWMI7.js} +72 -64
  56. package/dist/chunk-BPYKWMI7.js.map +1 -0
  57. package/dist/{chunk-7UJPVCMB.cjs → chunk-CERFRCXD.cjs} +265 -262
  58. package/dist/chunk-CERFRCXD.cjs.map +1 -0
  59. package/dist/chunk-CMHPXSCI.js +351 -0
  60. package/dist/chunk-CMHPXSCI.js.map +1 -0
  61. package/dist/chunk-EBDUXL5K.js +421 -0
  62. package/dist/chunk-EBDUXL5K.js.map +1 -0
  63. package/dist/{chunk-2VPPTJS2.js → chunk-FZYJM5PN.js} +256 -253
  64. package/dist/chunk-FZYJM5PN.js.map +1 -0
  65. package/dist/chunk-GBDFC74U.cjs +165 -0
  66. package/dist/chunk-GBDFC74U.cjs.map +1 -0
  67. package/dist/{chunk-ODF5O5PV.cjs → chunk-HNEG3EFJ.cjs} +154 -170
  68. package/dist/chunk-HNEG3EFJ.cjs.map +1 -0
  69. package/dist/{chunk-SRXJLAKG.cjs → chunk-I2276W3I.cjs} +28 -37
  70. package/dist/chunk-I2276W3I.cjs.map +1 -0
  71. package/dist/chunk-KKPZ4MVF.js +375 -0
  72. package/dist/chunk-KKPZ4MVF.js.map +1 -0
  73. package/dist/chunk-KMYJJTSR.cjs +421 -0
  74. package/dist/chunk-KMYJJTSR.cjs.map +1 -0
  75. package/dist/{chunk-A3AEEGKR.js → chunk-KXRWNFQJ.js} +20 -21
  76. package/dist/chunk-KXRWNFQJ.js.map +1 -0
  77. package/dist/{chunk-TVV7ZI7C.cjs → chunk-LSV7F26B.cjs} +362 -353
  78. package/dist/chunk-LSV7F26B.cjs.map +1 -0
  79. package/dist/{chunk-T4J6TI55.js → chunk-M7PRGJFE.js} +102 -79
  80. package/dist/chunk-M7PRGJFE.js.map +1 -0
  81. package/dist/{chunk-TNRKEBTA.js → chunk-PGJAZN2H.js} +148 -164
  82. package/dist/{chunk-TNRKEBTA.js.map → chunk-PGJAZN2H.js.map} +1 -1
  83. package/dist/chunk-R23BFDIW.js +1065 -0
  84. package/dist/chunk-R23BFDIW.js.map +1 -0
  85. package/dist/{chunk-HIWNB5PK.cjs → chunk-RCY6XLGU.cjs} +13 -5
  86. package/dist/chunk-RCY6XLGU.cjs.map +1 -0
  87. package/dist/chunk-RSYD434G.cjs +351 -0
  88. package/dist/chunk-RSYD434G.cjs.map +1 -0
  89. package/dist/{chunk-C33AQZEC.js → chunk-TYIH5LMV.js} +16 -23
  90. package/dist/chunk-TYIH5LMV.js.map +1 -0
  91. package/dist/chunk-WMWAUOQ4.js +165 -0
  92. package/dist/chunk-WMWAUOQ4.js.map +1 -0
  93. package/dist/chunk-XWYZIFZW.js +66 -0
  94. package/dist/chunk-XWYZIFZW.js.map +1 -0
  95. package/dist/{chunk-7HROSZRS.cjs → chunk-Y3NNQMAX.cjs} +70 -62
  96. package/dist/chunk-Y3NNQMAX.cjs.map +1 -0
  97. package/dist/chunk-ZXEFMKVP.cjs +120 -0
  98. package/dist/chunk-ZXEFMKVP.cjs.map +1 -0
  99. package/dist/chunk-ZY4FXLMM.js +120 -0
  100. package/dist/chunk-ZY4FXLMM.js.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 +7 -4
  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-tooltip-portal-relocator.test.ts +216 -0
  139. package/src/hooks/use-tooltip-portal-relocator.module.scss +10 -0
  140. package/src/hooks/use-tooltip-portal-relocator.ts +177 -0
  141. package/src/providers/chart-context/global-charts-provider.tsx +18 -1
  142. package/tsup.config.ts +11 -0
  143. package/dist/chunk-2VPPTJS2.js.map +0 -1
  144. package/dist/chunk-5XI443YP.js.map +0 -1
  145. package/dist/chunk-7HROSZRS.cjs.map +0 -1
  146. package/dist/chunk-7UJPVCMB.cjs.map +0 -1
  147. package/dist/chunk-A3AEEGKR.js.map +0 -1
  148. package/dist/chunk-C33AQZEC.js.map +0 -1
  149. package/dist/chunk-CEZGL6YP.js.map +0 -1
  150. package/dist/chunk-COOC2TVQ.js +0 -167
  151. package/dist/chunk-COOC2TVQ.js.map +0 -1
  152. package/dist/chunk-EJHLLXBV.js +0 -362
  153. package/dist/chunk-EJHLLXBV.js.map +0 -1
  154. package/dist/chunk-FWMJ2FR2.js +0 -121
  155. package/dist/chunk-FWMJ2FR2.js.map +0 -1
  156. package/dist/chunk-GRYNIPWH.cjs +0 -385
  157. package/dist/chunk-GRYNIPWH.cjs.map +0 -1
  158. package/dist/chunk-H34CJSR6.js.map +0 -1
  159. package/dist/chunk-HIWNB5PK.cjs.map +0 -1
  160. package/dist/chunk-IZWC33YN.cjs +0 -357
  161. package/dist/chunk-IZWC33YN.cjs.map +0 -1
  162. package/dist/chunk-KOF32DBL.cjs +0 -1058
  163. package/dist/chunk-KOF32DBL.cjs.map +0 -1
  164. package/dist/chunk-LHWRZMF7.cjs +0 -362
  165. package/dist/chunk-LHWRZMF7.cjs.map +0 -1
  166. package/dist/chunk-MFRS2PEY.cjs +0 -121
  167. package/dist/chunk-MFRS2PEY.cjs.map +0 -1
  168. package/dist/chunk-MMDLXS6O.js +0 -75
  169. package/dist/chunk-MMDLXS6O.js.map +0 -1
  170. package/dist/chunk-NW3RUYK2.cjs.map +0 -1
  171. package/dist/chunk-ODF5O5PV.cjs.map +0 -1
  172. package/dist/chunk-OTZT3MC2.cjs.map +0 -1
  173. package/dist/chunk-SBRMWDWM.js +0 -357
  174. package/dist/chunk-SBRMWDWM.js.map +0 -1
  175. package/dist/chunk-SRXJLAKG.cjs.map +0 -1
  176. package/dist/chunk-T4J6TI55.js.map +0 -1
  177. package/dist/chunk-TVV7ZI7C.cjs.map +0 -1
  178. package/dist/chunk-XVMXWV3C.cjs +0 -167
  179. package/dist/chunk-XVMXWV3C.cjs.map +0 -1
  180. package/dist/chunk-YYQ4IK5V.cjs.map +0 -1
  181. package/dist/chunk-ZDNCF642.js +0 -1058
  182. package/dist/chunk-ZDNCF642.js.map +0 -1
  183. package/dist/chunk-ZWBUEHKF.js +0 -385
  184. package/dist/chunk-ZWBUEHKF.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useChartChildren
3
- } from "./chunk-CEZGL6YP.js";
3
+ } from "./chunk-6CCZL2JJ.js";
4
4
  import {
5
5
  Children,
6
6
  Fragment,
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-SEKPIG5K.js";
20
20
  import {
21
21
  withResponsive
22
- } from "./chunk-C33AQZEC.js";
22
+ } from "./chunk-TYIH5LMV.js";
23
23
  import {
24
24
  GlobalChartsContext,
25
25
  GlobalChartsProvider,
@@ -30,7 +30,7 @@ import {
30
30
  useGlobalChartsContext,
31
31
  useGlobalChartsTheme,
32
32
  usePrefersReducedMotion
33
- } from "./chunk-H34CJSR6.js";
33
+ } from "./chunk-AWNCAKZY.js";
34
34
  import {
35
35
  attachSubComponents,
36
36
  formatMetricValue
@@ -223,7 +223,7 @@ var require_react_is_development = __commonJS({
223
223
  var ContextProvider = REACT_PROVIDER_TYPE;
224
224
  var Element = REACT_ELEMENT_TYPE;
225
225
  var ForwardRef = REACT_FORWARD_REF_TYPE;
226
- var Fragment6 = REACT_FRAGMENT_TYPE;
226
+ var Fragment5 = REACT_FRAGMENT_TYPE;
227
227
  var Lazy = REACT_LAZY_TYPE;
228
228
  var Memo = REACT_MEMO_TYPE;
229
229
  var Portal = REACT_PORTAL_TYPE;
@@ -282,7 +282,7 @@ var require_react_is_development = __commonJS({
282
282
  exports.ContextProvider = ContextProvider;
283
283
  exports.Element = Element;
284
284
  exports.ForwardRef = ForwardRef;
285
- exports.Fragment = Fragment6;
285
+ exports.Fragment = Fragment5;
286
286
  exports.Lazy = Lazy;
287
287
  exports.Memo = Memo;
288
288
  exports.Portal = Portal;
@@ -2312,10 +2312,10 @@ var jsx = function jsx2(type, props) {
2312
2312
  }
2313
2313
  return React3.createElement.apply(null, createElementArgArray);
2314
2314
  };
2315
- (function(_jsx8) {
2315
+ (function(_jsx9) {
2316
2316
  var JSX;
2317
2317
  /* @__PURE__ */ (function(_JSX) {
2318
- })(JSX || (JSX = _jsx8.JSX || (_jsx8.JSX = {})));
2318
+ })(JSX || (JSX = _jsx9.JSX || (_jsx9.JSX = {})));
2319
2319
  })(jsx || (jsx = {}));
2320
2320
  function css() {
2321
2321
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -4254,7 +4254,7 @@ var leaderboard_chart_module_default = {
4254
4254
  };
4255
4255
 
4256
4256
  // src/charts/leaderboard-chart/leaderboard-chart.tsx
4257
- import { Fragment as Fragment5, jsx as jsx3, jsxs } from "react/jsx-runtime";
4257
+ import { jsx as _jsx8, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
4258
4258
  var defaultValueFormatter = (value) => {
4259
4259
  return formatMetricValue(value, "number", {
4260
4260
  useMultipliers: true,
@@ -4267,7 +4267,14 @@ var defaultDeltaFormatter = (value) => {
4267
4267
  signDisplay: "exceptZero"
4268
4268
  });
4269
4269
  };
4270
- var BarLabel = ({ label }) => /* @__PURE__ */ jsx3(Fragment5, { children: typeof label === "string" ? /* @__PURE__ */ jsx3(component_default4, { className: leaderboard_chart_module_default.label, children: label }) : label });
4270
+ var BarLabel = ({
4271
+ label
4272
+ }) => /* @__PURE__ */ _jsx8(_Fragment, {
4273
+ children: typeof label === "string" ? /* @__PURE__ */ _jsx8(component_default4, {
4274
+ className: leaderboard_chart_module_default.label,
4275
+ children: label
4276
+ }) : label
4277
+ });
4271
4278
  var BarWithLabel = ({
4272
4279
  entry,
4273
4280
  withComparison,
@@ -4277,41 +4284,30 @@ var BarWithLabel = ({
4277
4284
  animation,
4278
4285
  isPrimaryVisible = true,
4279
4286
  isComparisonVisible = true
4280
- }) => /* @__PURE__ */ jsxs(
4281
- "div",
4282
- {
4283
- className: clsx(leaderboard_chart_module_default.barWithLabelContainer, {
4284
- [leaderboard_chart_module_default["is-overlay"]]: withOverlayLabel
4287
+ }) => /* @__PURE__ */ _jsxs("div", {
4288
+ className: clsx(leaderboard_chart_module_default.barWithLabelContainer, {
4289
+ [leaderboard_chart_module_default["is-overlay"]]: withOverlayLabel
4290
+ }),
4291
+ children: [/* @__PURE__ */ _jsx8(BarLabel, {
4292
+ label: entry.label
4293
+ }), isPrimaryVisible && /* @__PURE__ */ _jsx8("div", {
4294
+ className: clsx(leaderboard_chart_module_default.bar, {
4295
+ [leaderboard_chart_module_default["bar--animated"]]: animation
4285
4296
  }),
4286
- children: [
4287
- /* @__PURE__ */ jsx3(BarLabel, { label: entry.label }),
4288
- isPrimaryVisible && /* @__PURE__ */ jsx3(
4289
- "div",
4290
- {
4291
- className: clsx(leaderboard_chart_module_default.bar, {
4292
- [leaderboard_chart_module_default["bar--animated"]]: animation
4293
- }),
4294
- style: {
4295
- width: entry.currentShare + "%",
4296
- backgroundColor: primaryColor
4297
- }
4298
- }
4299
- ),
4300
- withComparison && !withOverlayLabel && isComparisonVisible && /* @__PURE__ */ jsx3(
4301
- "div",
4302
- {
4303
- className: clsx(leaderboard_chart_module_default.bar, {
4304
- [leaderboard_chart_module_default["bar--animated"]]: animation
4305
- }),
4306
- style: {
4307
- width: entry.previousShare + "%",
4308
- backgroundColor: secondaryColor
4309
- }
4310
- }
4311
- )
4312
- ]
4313
- }
4314
- );
4297
+ style: {
4298
+ width: entry.currentShare + "%",
4299
+ backgroundColor: primaryColor
4300
+ }
4301
+ }), withComparison && !withOverlayLabel && isComparisonVisible && /* @__PURE__ */ _jsx8("div", {
4302
+ className: clsx(leaderboard_chart_module_default.bar, {
4303
+ [leaderboard_chart_module_default["bar--animated"]]: animation
4304
+ }),
4305
+ style: {
4306
+ width: entry.previousShare + "%",
4307
+ backgroundColor: secondaryColor
4308
+ }
4309
+ })]
4310
+ });
4315
4311
  var LeaderboardChartInternal = ({
4316
4312
  data,
4317
4313
  chartId: providedChartId,
@@ -4337,8 +4333,12 @@ var LeaderboardChartInternal = ({
4337
4333
  children
4338
4334
  }) => {
4339
4335
  const chartId = useChartId(providedChartId);
4340
- const { leaderboardChart: leaderboardChartSettings } = useGlobalChartsTheme();
4341
- const { otherChildren } = useChartChildren(children, "LeaderboardChart");
4336
+ const {
4337
+ leaderboardChart: leaderboardChartSettings
4338
+ } = useGlobalChartsTheme();
4339
+ const {
4340
+ otherChildren
4341
+ } = useChartChildren(children, "LeaderboardChart");
4342
4342
  const {
4343
4343
  labelSpacing,
4344
4344
  rowGap,
@@ -4347,12 +4347,19 @@ var LeaderboardChartInternal = ({
4347
4347
  secondaryColor: settingsSecondaryColor,
4348
4348
  deltaColors
4349
4349
  } = leaderboardChartSettings;
4350
- const { getElementStyles, isSeriesVisible } = useGlobalChartsContext();
4351
- const { color: resolvedPrimaryColor } = getElementStyles({
4350
+ const {
4351
+ getElementStyles,
4352
+ isSeriesVisible
4353
+ } = useGlobalChartsContext();
4354
+ const {
4355
+ color: resolvedPrimaryColor
4356
+ } = getElementStyles({
4352
4357
  index: 0,
4353
4358
  overrideColor: primaryColor || settingsPrimaryColor
4354
4359
  });
4355
- const { color: resolvedSecondaryColor } = getElementStyles({
4360
+ const {
4361
+ color: resolvedSecondaryColor
4362
+ } = getElementStyles({
4356
4363
  index: 1,
4357
4364
  overrideColor: secondaryColor || settingsSecondaryColor
4358
4365
  });
@@ -4382,21 +4389,12 @@ var LeaderboardChartInternal = ({
4382
4389
  return !isPrimaryVisible && !isComparisonVisible;
4383
4390
  }
4384
4391
  return !isPrimaryVisible;
4385
- }, [
4386
- legendInteractive,
4387
- isPrimaryVisible,
4388
- isComparisonVisible,
4392
+ }, [legendInteractive, isPrimaryVisible, isComparisonVisible, withComparison, withOverlayLabel]);
4393
+ const isDataValid = Boolean(data && data.length > 0);
4394
+ const chartMetadata = useMemo3(() => ({
4389
4395
  withComparison,
4390
4396
  withOverlayLabel
4391
- ]);
4392
- const isDataValid = Boolean(data && data.length > 0);
4393
- const chartMetadata = useMemo3(
4394
- () => ({
4395
- withComparison,
4396
- withOverlayLabel
4397
- }),
4398
- [withComparison, withOverlayLabel]
4399
- );
4397
+ }), [withComparison, withOverlayLabel]);
4400
4398
  useChartRegistration({
4401
4399
  chartId,
4402
4400
  legendItems,
@@ -4406,124 +4404,110 @@ var LeaderboardChartInternal = ({
4406
4404
  });
4407
4405
  const prefersReducedMotion = usePrefersReducedMotion();
4408
4406
  if (!data || data.length === 0) {
4409
- return /* @__PURE__ */ jsx3(
4410
- SingleChartContext.Provider,
4411
- {
4412
- value: {
4413
- chartId,
4414
- chartWidth: 0,
4415
- // LeaderboardChart doesn't need specific dimensions
4416
- chartHeight: 0
4417
- },
4418
- children: /* @__PURE__ */ jsxs(
4419
- "div",
4420
- {
4421
- className: clsx(
4422
- leaderboard_chart_module_default.leaderboardChart,
4423
- { [leaderboard_chart_module_default["leaderboardChart--loading"]]: loading },
4424
- className
4425
- ),
4426
- style,
4427
- children: [
4428
- /* @__PURE__ */ jsx3("div", { className: leaderboard_chart_module_default.emptyState, children: loading ? __2("Loading\u2026", "jetpack-charts") : __2("No data available", "jetpack-charts") }),
4429
- otherChildren
4430
- ]
4431
- }
4432
- )
4433
- }
4434
- );
4435
- }
4436
- return /* @__PURE__ */ jsx3(
4437
- SingleChartContext.Provider,
4438
- {
4407
+ return /* @__PURE__ */ _jsx8(SingleChartContext.Provider, {
4439
4408
  value: {
4440
4409
  chartId,
4441
4410
  chartWidth: 0,
4442
4411
  // LeaderboardChart doesn't need specific dimensions
4443
4412
  chartHeight: 0
4444
4413
  },
4445
- children: /* @__PURE__ */ jsxs(
4446
- "div",
4447
- {
4448
- className: clsx(
4449
- leaderboard_chart_module_default.leaderboardChart,
4450
- {
4451
- [leaderboard_chart_module_default["leaderboardChart--loading"]]: loading,
4452
- [leaderboard_chart_module_default["leaderboardChart--with-legend"]]: showLegend,
4453
- [leaderboard_chart_module_default["leaderboardChart--legend-top"]]: showLegend && legendPosition === "top"
4454
- },
4455
- className
4456
- ),
4457
- style,
4458
- children: [
4459
- allSeriesHidden ? /* @__PURE__ */ jsx3("div", { className: leaderboard_chart_module_default.emptyState, children: __2("All series are hidden. Click legend items to show data.", "jetpack-charts") }) : /* @__PURE__ */ jsx3(component_default6, { templateColumns: "minmax(0, 1fr) auto", rowGap, columnGap, children: data.map((entry) => {
4460
- const colorIndex = Math.sign(entry.delta) + 1;
4461
- const deltaColor = deltaColors[colorIndex];
4462
- return /* @__PURE__ */ jsxs(Fragment, { children: [
4463
- /* @__PURE__ */ jsx3(component_default5, { spacing: labelSpacing, children: /* @__PURE__ */ jsx3(
4464
- BarWithLabel,
4465
- {
4466
- entry,
4467
- withComparison,
4468
- withOverlayLabel,
4469
- primaryColor: resolvedPrimaryColor,
4470
- secondaryColor: resolvedSecondaryColor,
4471
- isPrimaryVisible,
4472
- isComparisonVisible,
4473
- animation: animation && !loading && !prefersReducedMotion
4474
- }
4475
- ) }),
4476
- /* @__PURE__ */ jsxs(
4477
- "div",
4478
- {
4479
- className: clsx(leaderboard_chart_module_default.valueContainer, {
4480
- [leaderboard_chart_module_default.overlayLabel]: withOverlayLabel
4481
- }),
4482
- children: [
4483
- isPrimaryVisible && /* @__PURE__ */ jsx3(component_default4, { children: valueFormatter(entry.currentValue) }),
4484
- withComparison && isComparisonVisible && /* @__PURE__ */ jsx3(component_default4, { style: { color: deltaColor }, children: deltaFormatter(entry.delta) })
4485
- ]
4486
- }
4487
- )
4488
- ] }, entry.id);
4489
- }) }),
4490
- showLegend && /* @__PURE__ */ jsx3(
4491
- Legend,
4492
- {
4493
- orientation: legendOrientation,
4494
- position: legendPosition,
4495
- alignment: legendAlignment,
4496
- shape: legendShape,
4497
- shapeWidth: legendShapeWidth,
4498
- shapeHeight: legendShapeHeight,
4499
- chartId,
4500
- interactive: legendInteractive
4501
- }
4502
- ),
4503
- otherChildren
4504
- ]
4505
- }
4506
- )
4507
- }
4508
- );
4414
+ children: /* @__PURE__ */ _jsxs("div", {
4415
+ className: clsx(leaderboard_chart_module_default.leaderboardChart, {
4416
+ [leaderboard_chart_module_default["leaderboardChart--loading"]]: loading
4417
+ }, className),
4418
+ style,
4419
+ children: [/* @__PURE__ */ _jsx8("div", {
4420
+ className: leaderboard_chart_module_default.emptyState,
4421
+ children: loading ? __2("Loading\u2026", "jetpack-charts") : __2("No data available", "jetpack-charts")
4422
+ }), otherChildren]
4423
+ })
4424
+ });
4425
+ }
4426
+ return /* @__PURE__ */ _jsx8(SingleChartContext.Provider, {
4427
+ value: {
4428
+ chartId,
4429
+ chartWidth: 0,
4430
+ // LeaderboardChart doesn't need specific dimensions
4431
+ chartHeight: 0
4432
+ },
4433
+ children: /* @__PURE__ */ _jsxs("div", {
4434
+ className: clsx(leaderboard_chart_module_default.leaderboardChart, {
4435
+ [leaderboard_chart_module_default["leaderboardChart--loading"]]: loading,
4436
+ [leaderboard_chart_module_default["leaderboardChart--with-legend"]]: showLegend,
4437
+ [leaderboard_chart_module_default["leaderboardChart--legend-top"]]: showLegend && legendPosition === "top"
4438
+ }, className),
4439
+ style,
4440
+ children: [allSeriesHidden ? /* @__PURE__ */ _jsx8("div", {
4441
+ className: leaderboard_chart_module_default.emptyState,
4442
+ children: __2("All series are hidden. Click legend items to show data.", "jetpack-charts")
4443
+ }) : /* @__PURE__ */ _jsx8(component_default6, {
4444
+ templateColumns: "minmax(0, 1fr) auto",
4445
+ rowGap,
4446
+ columnGap,
4447
+ children: data.map((entry) => {
4448
+ const colorIndex = Math.sign(entry.delta) + 1;
4449
+ const deltaColor = deltaColors[colorIndex];
4450
+ return /* @__PURE__ */ _jsxs(Fragment, {
4451
+ children: [/* @__PURE__ */ _jsx8(component_default5, {
4452
+ spacing: labelSpacing,
4453
+ children: /* @__PURE__ */ _jsx8(BarWithLabel, {
4454
+ entry,
4455
+ withComparison,
4456
+ withOverlayLabel,
4457
+ primaryColor: resolvedPrimaryColor,
4458
+ secondaryColor: resolvedSecondaryColor,
4459
+ isPrimaryVisible,
4460
+ isComparisonVisible,
4461
+ animation: animation && !loading && !prefersReducedMotion
4462
+ })
4463
+ }), /* @__PURE__ */ _jsxs("div", {
4464
+ className: clsx(leaderboard_chart_module_default.valueContainer, {
4465
+ [leaderboard_chart_module_default.overlayLabel]: withOverlayLabel
4466
+ }),
4467
+ children: [isPrimaryVisible && /* @__PURE__ */ _jsx8(component_default4, {
4468
+ children: valueFormatter(entry.currentValue)
4469
+ }), withComparison && isComparisonVisible && /* @__PURE__ */ _jsx8(component_default4, {
4470
+ style: {
4471
+ color: deltaColor
4472
+ },
4473
+ children: deltaFormatter(entry.delta)
4474
+ })]
4475
+ })]
4476
+ }, entry.id);
4477
+ })
4478
+ }), showLegend && /* @__PURE__ */ _jsx8(Legend, {
4479
+ orientation: legendOrientation,
4480
+ position: legendPosition,
4481
+ alignment: legendAlignment,
4482
+ shape: legendShape,
4483
+ shapeWidth: legendShapeWidth,
4484
+ shapeHeight: legendShapeHeight,
4485
+ chartId,
4486
+ interactive: legendInteractive
4487
+ }), otherChildren]
4488
+ })
4489
+ });
4509
4490
  };
4510
4491
  var LeaderboardChartWithProvider = (props) => {
4511
4492
  const existingContext = useContext6(GlobalChartsContext);
4512
4493
  if (existingContext) {
4513
- return /* @__PURE__ */ jsx3(LeaderboardChartInternal, { ...props });
4494
+ return /* @__PURE__ */ _jsx8(LeaderboardChartInternal, {
4495
+ ...props
4496
+ });
4514
4497
  }
4515
- return /* @__PURE__ */ jsx3(GlobalChartsProvider, { children: /* @__PURE__ */ jsx3(LeaderboardChartInternal, { ...props }) });
4498
+ return /* @__PURE__ */ _jsx8(GlobalChartsProvider, {
4499
+ children: /* @__PURE__ */ _jsx8(LeaderboardChartInternal, {
4500
+ ...props
4501
+ })
4502
+ });
4516
4503
  };
4517
4504
  LeaderboardChartWithProvider.displayName = "LeaderboardChart";
4518
4505
  var LeaderboardChart = attachSubComponents(LeaderboardChartWithProvider, {
4519
4506
  Legend
4520
4507
  });
4521
- var LeaderboardChartResponsive = attachSubComponents(
4522
- withResponsive(LeaderboardChartWithProvider),
4523
- {
4524
- Legend
4525
- }
4526
- );
4508
+ var LeaderboardChartResponsive = attachSubComponents(withResponsive(LeaderboardChartWithProvider), {
4509
+ Legend
4510
+ });
4527
4511
 
4528
4512
  export {
4529
4513
  useLeaderboardLegendItems,
@@ -4560,4 +4544,4 @@ is-plain-object/dist/is-plain-object.mjs:
4560
4544
  * Released under the MIT License.
4561
4545
  *)
4562
4546
  */
4563
- //# sourceMappingURL=chunk-TNRKEBTA.js.map
4547
+ //# sourceMappingURL=chunk-PGJAZN2H.js.map