@automattic/charts 0.48.0 → 0.49.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 (110) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/dist/{chunk-BQPCOFAP.cjs → chunk-2QROLLIB.cjs} +26 -24
  3. package/dist/chunk-2QROLLIB.cjs.map +1 -0
  4. package/dist/chunk-3OVXJFQY.js +52 -0
  5. package/dist/chunk-3OVXJFQY.js.map +1 -0
  6. package/dist/{chunk-EIMF7X6F.cjs → chunk-4R2MHLFN.cjs} +6 -6
  7. package/dist/{chunk-EIMF7X6F.cjs.map → chunk-4R2MHLFN.cjs.map} +1 -1
  8. package/dist/{chunk-MCFIVI3D.js → chunk-55WZQTJG.js} +9 -7
  9. package/dist/chunk-55WZQTJG.js.map +1 -0
  10. package/dist/{chunk-REQT5QUF.js → chunk-5HQCYLQN.js} +115 -91
  11. package/dist/chunk-5HQCYLQN.js.map +1 -0
  12. package/dist/{chunk-A3PGOCJO.js → chunk-5OB3F7GC.js} +24 -4
  13. package/dist/chunk-5OB3F7GC.js.map +1 -0
  14. package/dist/{chunk-EZYNBPAA.cjs → chunk-6ACZVRD6.cjs} +26 -24
  15. package/dist/chunk-6ACZVRD6.cjs.map +1 -0
  16. package/dist/{chunk-OBTBYVUR.js → chunk-DMU7YAZU.js} +3 -3
  17. package/dist/chunk-GR6WENSA.cjs +355 -0
  18. package/dist/chunk-GR6WENSA.cjs.map +1 -0
  19. package/dist/{chunk-PFT2X4OW.js → chunk-IKDM6OVX.js} +2 -2
  20. package/dist/{chunk-2UKC2E5X.js → chunk-J2APGORH.js} +8 -6
  21. package/dist/chunk-J2APGORH.js.map +1 -0
  22. package/dist/{chunk-LSGYIUQX.cjs → chunk-MNZD6UDQ.cjs} +22 -2
  23. package/dist/chunk-MNZD6UDQ.cjs.map +1 -0
  24. package/dist/{chunk-AJJHUVNE.js → chunk-OJCBYFXF.js} +6 -4
  25. package/dist/chunk-OJCBYFXF.js.map +1 -0
  26. package/dist/{chunk-PNSMPZ3E.cjs → chunk-QTQG3XNM.cjs} +8 -8
  27. package/dist/{chunk-PNSMPZ3E.cjs.map → chunk-QTQG3XNM.cjs.map} +1 -1
  28. package/dist/chunk-SDNRKKBP.cjs +52 -0
  29. package/dist/chunk-SDNRKKBP.cjs.map +1 -0
  30. package/dist/{chunk-J6XON6FM.cjs → chunk-SIY3XU3K.cjs} +17 -15
  31. package/dist/chunk-SIY3XU3K.cjs.map +1 -0
  32. package/dist/{chunk-RP2RT6RU.cjs → chunk-TKFKJUC3.cjs} +110 -84
  33. package/dist/chunk-TKFKJUC3.cjs.map +1 -0
  34. package/dist/{chunk-JECIAHAD.js → chunk-VVYLC4WL.js} +97 -71
  35. package/dist/chunk-VVYLC4WL.js.map +1 -0
  36. package/dist/{chunk-3BKMLA3S.js → chunk-YQ5JCDVX.js} +10 -8
  37. package/dist/{chunk-3BKMLA3S.js.map → chunk-YQ5JCDVX.js.map} +1 -1
  38. package/dist/{chunk-TJFB2TPL.cjs → chunk-Z5TSTVSS.cjs} +27 -25
  39. package/dist/chunk-Z5TSTVSS.cjs.map +1 -0
  40. package/dist/components/bar-chart/index.cjs +4 -4
  41. package/dist/components/bar-chart/index.css +2 -2
  42. package/dist/components/bar-chart/index.css.map +1 -1
  43. package/dist/components/bar-chart/index.js +3 -3
  44. package/dist/components/bar-list-chart/index.cjs +5 -5
  45. package/dist/components/bar-list-chart/index.css +2 -2
  46. package/dist/components/bar-list-chart/index.css.map +1 -1
  47. package/dist/components/bar-list-chart/index.js +4 -4
  48. package/dist/components/conversion-funnel-chart/index.cjs +3 -3
  49. package/dist/components/conversion-funnel-chart/index.css +11 -11
  50. package/dist/components/conversion-funnel-chart/index.css.map +1 -1
  51. package/dist/components/conversion-funnel-chart/index.js +2 -2
  52. package/dist/components/leaderboard-chart/index.cjs +4 -4
  53. package/dist/components/leaderboard-chart/index.css +1 -1
  54. package/dist/components/leaderboard-chart/index.css.map +1 -1
  55. package/dist/components/leaderboard-chart/index.js +3 -3
  56. package/dist/components/legend/index.cjs +3 -3
  57. package/dist/components/legend/index.js +2 -2
  58. package/dist/components/line-chart/index.cjs +4 -4
  59. package/dist/components/line-chart/index.d.cts +0 -1
  60. package/dist/components/line-chart/index.d.ts +0 -1
  61. package/dist/components/line-chart/index.js +3 -3
  62. package/dist/components/pie-chart/index.cjs +5 -4
  63. package/dist/components/pie-chart/index.cjs.map +1 -1
  64. package/dist/components/pie-chart/index.js +4 -3
  65. package/dist/components/pie-semi-circle-chart/index.cjs +5 -4
  66. package/dist/components/pie-semi-circle-chart/index.cjs.map +1 -1
  67. package/dist/components/pie-semi-circle-chart/index.js +4 -3
  68. package/dist/hooks/index.cjs +4 -2
  69. package/dist/hooks/index.cjs.map +1 -1
  70. package/dist/hooks/index.d.cts +7 -1
  71. package/dist/hooks/index.d.ts +7 -1
  72. package/dist/hooks/index.js +3 -1
  73. package/dist/index.cjs +11 -10
  74. package/dist/index.cjs.map +1 -1
  75. package/dist/index.css +14 -14
  76. package/dist/index.css.map +1 -1
  77. package/dist/index.js +10 -9
  78. package/dist/providers/index.cjs +2 -2
  79. package/dist/providers/index.js +1 -1
  80. package/package.json +1 -1
  81. package/src/components/bar-chart/bar-chart.module.scss +20 -20
  82. package/src/components/bar-chart/bar-chart.tsx +5 -1
  83. package/src/components/conversion-funnel-chart/conversion-funnel-chart.module.scss +14 -14
  84. package/src/components/conversion-funnel-chart/conversion-funnel-chart.tsx +5 -1
  85. package/src/components/leaderboard-chart/leaderboard-chart.module.scss +14 -12
  86. package/src/components/leaderboard-chart/leaderboard-chart.tsx +6 -3
  87. package/src/components/line-chart/line-chart.tsx +4 -1
  88. package/src/components/line-chart/types.ts +0 -1
  89. package/src/components/pie-chart/pie-chart.tsx +18 -2
  90. package/src/components/pie-semi-circle-chart/pie-semi-circle-chart.tsx +20 -2
  91. package/src/components/private/radial-wipe-animation/index.ts +4 -0
  92. package/src/components/private/radial-wipe-animation/radial-wipe-animation.tsx +94 -0
  93. package/src/hooks/index.ts +1 -0
  94. package/src/hooks/use-prefers-reduced-motion.ts +31 -0
  95. package/dist/chunk-2UKC2E5X.js.map +0 -1
  96. package/dist/chunk-2WY63MK3.cjs +0 -331
  97. package/dist/chunk-2WY63MK3.cjs.map +0 -1
  98. package/dist/chunk-A3PGOCJO.js.map +0 -1
  99. package/dist/chunk-AJJHUVNE.js.map +0 -1
  100. package/dist/chunk-BQPCOFAP.cjs.map +0 -1
  101. package/dist/chunk-EZYNBPAA.cjs.map +0 -1
  102. package/dist/chunk-J6XON6FM.cjs.map +0 -1
  103. package/dist/chunk-JECIAHAD.js.map +0 -1
  104. package/dist/chunk-LSGYIUQX.cjs.map +0 -1
  105. package/dist/chunk-MCFIVI3D.js.map +0 -1
  106. package/dist/chunk-REQT5QUF.js.map +0 -1
  107. package/dist/chunk-RP2RT6RU.cjs.map +0 -1
  108. package/dist/chunk-TJFB2TPL.cjs.map +0 -1
  109. /package/dist/{chunk-OBTBYVUR.js.map → chunk-DMU7YAZU.js.map} +0 -0
  110. /package/dist/{chunk-PFT2X4OW.js.map → chunk-IKDM6OVX.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -5,9 +5,14 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.49.0] - 2025-11-19
9
+ ### Added
10
+ - Add animation in circular shaped charts. [#45870]
11
+ - Add usePrefersReducedMotion hook for accecibility. [#45955]
12
+
8
13
  ## [0.48.0] - 2025-11-18
9
14
  ### Changed
10
- - Remove inline styles from containers to allow consumer overrides [#45953]
15
+ - Remove inline styles from containers to allow consumer overrides. [#45953]
11
16
 
12
17
  ## [0.47.0] - 2025-11-17
13
18
  ### Added
@@ -558,6 +563,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
558
563
  - Fixed lints following ESLint rule changes for TS [#40584]
559
564
  - Fixing a bug in Chart storybook data. [#40640]
560
565
 
566
+ [0.49.0]: https://github.com/Automattic/charts/compare/v0.48.0...v0.49.0
561
567
  [0.48.0]: https://github.com/Automattic/charts/compare/v0.47.0...v0.48.0
562
568
  [0.47.0]: https://github.com/Automattic/charts/compare/v0.46.3...v0.47.0
563
569
  [0.46.3]: https://github.com/Automattic/charts/compare/v0.46.2...v0.46.3
@@ -7,7 +7,7 @@ var _chunkFX2PTUFCcjs = require('./chunk-FX2PTUFC.cjs');
7
7
 
8
8
 
9
9
 
10
- var _chunkPNSMPZ3Ecjs = require('./chunk-PNSMPZ3E.cjs');
10
+ var _chunkQTQG3XNMcjs = require('./chunk-QTQG3XNM.cjs');
11
11
 
12
12
 
13
13
 
@@ -17,7 +17,8 @@ var _chunkPNSMPZ3Ecjs = require('./chunk-PNSMPZ3E.cjs');
17
17
 
18
18
 
19
19
 
20
- var _chunkLSGYIUQXcjs = require('./chunk-LSGYIUQX.cjs');
20
+
21
+ var _chunkMNZD6UDQcjs = require('./chunk-MNZD6UDQ.cjs');
21
22
 
22
23
 
23
24
 
@@ -4213,8 +4214,8 @@ function useLeaderboardLegendItems({
4213
4214
  withOverlayLabel = false,
4214
4215
  legendLabels
4215
4216
  }) {
4216
- const { leaderboardChart: leaderboardChartSettings } = _chunkLSGYIUQXcjs.useGlobalChartsTheme.call(void 0, );
4217
- const { getElementStyles } = _chunkLSGYIUQXcjs.useGlobalChartsContext.call(void 0, );
4217
+ const { leaderboardChart: leaderboardChartSettings } = _chunkMNZD6UDQcjs.useGlobalChartsTheme.call(void 0, );
4218
+ const { getElementStyles } = _chunkMNZD6UDQcjs.useGlobalChartsContext.call(void 0, );
4218
4219
  return _react.useMemo.call(void 0, () => {
4219
4220
  if (!data || data.length === 0) {
4220
4221
  return [];
@@ -4263,7 +4264,7 @@ var leaderboard_chart_module_default = {
4263
4264
  "is-overlay": "a8ccharts-Fqdi5w",
4264
4265
  "label": "a8ccharts-7ZUu0T",
4265
4266
  "bar": "a8ccharts-CnJvgl",
4266
- "bar__animated": "a8ccharts-qPpCM2",
4267
+ "bar--animated": "a8ccharts-VmRKPb",
4267
4268
  "stretch": "a8ccharts-VlC0fg",
4268
4269
  "valueContainer": "a8ccharts-ZlLh4R",
4269
4270
  "overlayLabel": "a8ccharts-pRqShB",
@@ -4273,13 +4274,13 @@ var leaderboard_chart_module_default = {
4273
4274
  // src/components/leaderboard-chart/leaderboard-chart.tsx
4274
4275
 
4275
4276
  var defaultValueFormatter = (value) => {
4276
- return _chunkLSGYIUQXcjs.formatMetricValue.call(void 0, value, "number", {
4277
+ return _chunkMNZD6UDQcjs.formatMetricValue.call(void 0, value, "number", {
4277
4278
  useMultipliers: true,
4278
4279
  decimals: 1
4279
4280
  });
4280
4281
  };
4281
4282
  var defaultDeltaFormatter = (value) => {
4282
- return _chunkLSGYIUQXcjs.formatMetricValue.call(void 0, value / 100, "average", {
4283
+ return _chunkMNZD6UDQcjs.formatMetricValue.call(void 0, value / 100, "average", {
4283
4284
  decimals: 0,
4284
4285
  signDisplay: "exceptZero"
4285
4286
  });
@@ -4306,7 +4307,7 @@ var BarWithLabel = ({
4306
4307
  "div",
4307
4308
  {
4308
4309
  className: _clsx2.default.call(void 0, leaderboard_chart_module_default.bar, {
4309
- [leaderboard_chart_module_default.bar__animated]: animation
4310
+ [leaderboard_chart_module_default["bar--animated"]]: animation
4310
4311
  }),
4311
4312
  style: {
4312
4313
  width: entry.currentShare + "%",
@@ -4318,7 +4319,7 @@ var BarWithLabel = ({
4318
4319
  "div",
4319
4320
  {
4320
4321
  className: _clsx2.default.call(void 0, leaderboard_chart_module_default.bar, {
4321
- [leaderboard_chart_module_default.bar__animated]: animation
4322
+ [leaderboard_chart_module_default["bar--animated"]]: animation
4322
4323
  }),
4323
4324
  style: {
4324
4325
  width: entry.previousShare + "%",
@@ -4353,8 +4354,8 @@ var LeaderboardChartInternal = ({
4353
4354
  style,
4354
4355
  children
4355
4356
  }) => {
4356
- const chartId = _chunkLSGYIUQXcjs.useChartId.call(void 0, providedChartId);
4357
- const { leaderboardChart: leaderboardChartSettings } = _chunkLSGYIUQXcjs.useGlobalChartsTheme.call(void 0, );
4357
+ const chartId = _chunkMNZD6UDQcjs.useChartId.call(void 0, providedChartId);
4358
+ const { leaderboardChart: leaderboardChartSettings } = _chunkMNZD6UDQcjs.useGlobalChartsTheme.call(void 0, );
4358
4359
  const { otherChildren } = _chunk3Z526IL2cjs.useChartChildren.call(void 0, children, "LeaderboardChart");
4359
4360
  const {
4360
4361
  labelSpacing,
@@ -4364,7 +4365,7 @@ var LeaderboardChartInternal = ({
4364
4365
  secondaryColor: settingsSecondaryColor,
4365
4366
  deltaColors
4366
4367
  } = leaderboardChartSettings;
4367
- const { getElementStyles, isSeriesVisible } = _chunkLSGYIUQXcjs.useGlobalChartsContext.call(void 0, );
4368
+ const { getElementStyles, isSeriesVisible } = _chunkMNZD6UDQcjs.useGlobalChartsContext.call(void 0, );
4368
4369
  const { color: resolvedPrimaryColor } = getElementStyles({
4369
4370
  index: 0,
4370
4371
  overrideColor: primaryColor || settingsPrimaryColor
@@ -4414,16 +4415,17 @@ var LeaderboardChartInternal = ({
4414
4415
  }),
4415
4416
  [withComparison, withOverlayLabel]
4416
4417
  );
4417
- _chunkLSGYIUQXcjs.useChartRegistration.call(void 0, {
4418
+ _chunkMNZD6UDQcjs.useChartRegistration.call(void 0, {
4418
4419
  chartId,
4419
4420
  legendItems,
4420
4421
  chartType: "leaderboard",
4421
4422
  isDataValid,
4422
4423
  metadata: chartMetadata
4423
4424
  });
4425
+ const prefersReducedMotion = _chunkMNZD6UDQcjs.usePrefersReducedMotion.call(void 0, );
4424
4426
  if (!data || data.length === 0) {
4425
4427
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4426
- _chunkPNSMPZ3Ecjs.SingleChartContext.Provider,
4428
+ _chunkQTQG3XNMcjs.SingleChartContext.Provider,
4427
4429
  {
4428
4430
  value: {
4429
4431
  chartId,
@@ -4450,7 +4452,7 @@ var LeaderboardChartInternal = ({
4450
4452
  );
4451
4453
  }
4452
4454
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4453
- _chunkPNSMPZ3Ecjs.SingleChartContext.Provider,
4455
+ _chunkQTQG3XNMcjs.SingleChartContext.Provider,
4454
4456
  {
4455
4457
  value: {
4456
4458
  chartId,
@@ -4486,7 +4488,7 @@ var LeaderboardChartInternal = ({
4486
4488
  secondaryColor: resolvedSecondaryColor,
4487
4489
  isPrimaryVisible,
4488
4490
  isComparisonVisible,
4489
- animation: animation && !loading
4491
+ animation: animation && !loading && !prefersReducedMotion
4490
4492
  }
4491
4493
  ) }),
4492
4494
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
@@ -4504,7 +4506,7 @@ var LeaderboardChartInternal = ({
4504
4506
  ] }, entry.id);
4505
4507
  }) }),
4506
4508
  showLegend && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4507
- _chunkPNSMPZ3Ecjs.Legend,
4509
+ _chunkQTQG3XNMcjs.Legend,
4508
4510
  {
4509
4511
  orientation: legendOrientation,
4510
4512
  position: legendPosition,
@@ -4524,20 +4526,20 @@ var LeaderboardChartInternal = ({
4524
4526
  );
4525
4527
  };
4526
4528
  var LeaderboardChartWithProvider = (props) => {
4527
- const existingContext = _react.useContext.call(void 0, _chunkLSGYIUQXcjs.GlobalChartsContext);
4529
+ const existingContext = _react.useContext.call(void 0, _chunkMNZD6UDQcjs.GlobalChartsContext);
4528
4530
  if (existingContext) {
4529
4531
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LeaderboardChartInternal, { ...props });
4530
4532
  }
4531
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLSGYIUQXcjs.GlobalChartsProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LeaderboardChartInternal, { ...props }) });
4533
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMNZD6UDQcjs.GlobalChartsProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LeaderboardChartInternal, { ...props }) });
4532
4534
  };
4533
4535
  LeaderboardChartWithProvider.displayName = "LeaderboardChart";
4534
- var LeaderboardChart = _chunkLSGYIUQXcjs.attachSubComponents.call(void 0, LeaderboardChartWithProvider, {
4535
- Legend: _chunkPNSMPZ3Ecjs.Legend
4536
+ var LeaderboardChart = _chunkMNZD6UDQcjs.attachSubComponents.call(void 0, LeaderboardChartWithProvider, {
4537
+ Legend: _chunkQTQG3XNMcjs.Legend
4536
4538
  });
4537
- var LeaderboardChartResponsive = _chunkLSGYIUQXcjs.attachSubComponents.call(void 0,
4539
+ var LeaderboardChartResponsive = _chunkMNZD6UDQcjs.attachSubComponents.call(void 0,
4538
4540
  _chunkFX2PTUFCcjs.withResponsive.call(void 0, LeaderboardChartWithProvider),
4539
4541
  {
4540
- Legend: _chunkPNSMPZ3Ecjs.Legend
4542
+ Legend: _chunkQTQG3XNMcjs.Legend
4541
4543
  }
4542
4544
  );
4543
4545
 
@@ -4576,4 +4578,4 @@ is-plain-object/dist/is-plain-object.mjs:
4576
4578
  * Released under the MIT License.
4577
4579
  *)
4578
4580
  */
4579
- //# sourceMappingURL=chunk-BQPCOFAP.cjs.map
4581
+ //# sourceMappingURL=chunk-2QROLLIB.cjs.map