@automattic/charts 0.41.1 → 0.43.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 (125) hide show
  1. package/CHANGELOG.md +22 -8
  2. package/dist/{chunk-IHUHB3JB.js → chunk-2HB55BRH.js} +31 -43
  3. package/dist/{chunk-IHUHB3JB.js.map → chunk-2HB55BRH.js.map} +1 -1
  4. package/dist/{chunk-TEEQFJFL.cjs → chunk-2HUX2CAT.cjs} +51 -3
  5. package/dist/chunk-2HUX2CAT.cjs.map +1 -0
  6. package/dist/{chunk-TY64IJ34.js → chunk-3O6FHD2T.js} +51 -3
  7. package/dist/chunk-3O6FHD2T.js.map +1 -0
  8. package/dist/{chunk-RUJCC3Q4.cjs → chunk-BZ6UDD37.cjs} +20 -20
  9. package/dist/{chunk-RUJCC3Q4.cjs.map → chunk-BZ6UDD37.cjs.map} +1 -1
  10. package/dist/{chunk-LIYP7LQW.js → chunk-DRWOBYEQ.js} +45 -19
  11. package/dist/chunk-DRWOBYEQ.js.map +1 -0
  12. package/dist/{chunk-7CSF2X4Q.cjs → chunk-G4FX5I3V.cjs} +48 -60
  13. package/dist/chunk-G4FX5I3V.cjs.map +1 -0
  14. package/dist/{chunk-LD4SAJTJ.js → chunk-G66WE3ON.js} +3 -3
  15. package/dist/{chunk-76XOLO7F.cjs → chunk-GK3XEXVI.cjs} +144 -82
  16. package/dist/chunk-GK3XEXVI.cjs.map +1 -0
  17. package/dist/{chunk-OYPAAX3P.js → chunk-KM62I6SD.js} +3 -3
  18. package/dist/{chunk-UD3QSGWI.js → chunk-Q2LDRQN7.js} +143 -81
  19. package/dist/chunk-Q2LDRQN7.js.map +1 -0
  20. package/dist/{chunk-XJSZXQON.cjs → chunk-QLLKOSJ6.cjs} +17 -17
  21. package/dist/{chunk-XJSZXQON.cjs.map → chunk-QLLKOSJ6.cjs.map} +1 -1
  22. package/dist/{chunk-LGAG6GQ5.cjs → chunk-SC462VDM.cjs} +11 -11
  23. package/dist/{chunk-LGAG6GQ5.cjs.map → chunk-SC462VDM.cjs.map} +1 -1
  24. package/dist/{chunk-CES34TN5.js → chunk-SHADFB3T.js} +2 -2
  25. package/dist/{chunk-ILOC2UDX.cjs → chunk-UHESRL2F.cjs} +6 -6
  26. package/dist/{chunk-ILOC2UDX.cjs.map → chunk-UHESRL2F.cjs.map} +1 -1
  27. package/dist/{chunk-CSSH4P7L.js → chunk-W5RFMC3A.js} +3 -3
  28. package/dist/{chunk-M3JU5JTP.js → chunk-XDIWMJZD.js} +3 -3
  29. package/dist/{chunk-BP3IFJ5V.cjs → chunk-ZA7OWPY7.cjs} +16 -16
  30. package/dist/{chunk-BP3IFJ5V.cjs.map → chunk-ZA7OWPY7.cjs.map} +1 -1
  31. package/dist/{chunk-HZTHPE5F.cjs → chunk-ZHKI4TVW.cjs} +72 -46
  32. package/dist/chunk-ZHKI4TVW.cjs.map +1 -0
  33. package/dist/components/bar-chart/index.cjs +4 -4
  34. package/dist/components/bar-chart/index.css +22 -0
  35. package/dist/components/bar-chart/index.css.map +1 -1
  36. package/dist/components/bar-chart/index.d.cts +2 -2
  37. package/dist/components/bar-chart/index.d.ts +2 -2
  38. package/dist/components/bar-chart/index.js +3 -3
  39. package/dist/components/bar-list-chart/index.cjs +5 -5
  40. package/dist/components/bar-list-chart/index.css +22 -0
  41. package/dist/components/bar-list-chart/index.css.map +1 -1
  42. package/dist/components/bar-list-chart/index.d.cts +2 -2
  43. package/dist/components/bar-list-chart/index.d.ts +2 -2
  44. package/dist/components/bar-list-chart/index.js +4 -4
  45. package/dist/components/conversion-funnel-chart/index.cjs +3 -3
  46. package/dist/components/conversion-funnel-chart/index.js +2 -2
  47. package/dist/components/leaderboard-chart/index.cjs +4 -4
  48. package/dist/components/leaderboard-chart/index.css +22 -0
  49. package/dist/components/leaderboard-chart/index.css.map +1 -1
  50. package/dist/components/leaderboard-chart/index.d.cts +2 -2
  51. package/dist/components/leaderboard-chart/index.d.ts +2 -2
  52. package/dist/components/leaderboard-chart/index.js +3 -3
  53. package/dist/components/legend/index.cjs +3 -3
  54. package/dist/components/legend/index.css +22 -0
  55. package/dist/components/legend/index.css.map +1 -1
  56. package/dist/components/legend/index.d.cts +3 -3
  57. package/dist/components/legend/index.d.ts +3 -3
  58. package/dist/components/legend/index.js +2 -2
  59. package/dist/components/line-chart/index.cjs +4 -4
  60. package/dist/components/line-chart/index.css +22 -0
  61. package/dist/components/line-chart/index.css.map +1 -1
  62. package/dist/components/line-chart/index.d.cts +3 -2
  63. package/dist/components/line-chart/index.d.ts +3 -2
  64. package/dist/components/line-chart/index.js +3 -3
  65. package/dist/components/pie-chart/index.cjs +4 -4
  66. package/dist/components/pie-chart/index.css +22 -0
  67. package/dist/components/pie-chart/index.css.map +1 -1
  68. package/dist/components/pie-chart/index.d.cts +3 -3
  69. package/dist/components/pie-chart/index.d.ts +3 -3
  70. package/dist/components/pie-chart/index.js +3 -3
  71. package/dist/components/pie-semi-circle-chart/index.cjs +4 -4
  72. package/dist/components/pie-semi-circle-chart/index.css +22 -0
  73. package/dist/components/pie-semi-circle-chart/index.css.map +1 -1
  74. package/dist/components/pie-semi-circle-chart/index.d.cts +3 -3
  75. package/dist/components/pie-semi-circle-chart/index.d.ts +3 -3
  76. package/dist/components/pie-semi-circle-chart/index.js +3 -3
  77. package/dist/hooks/index.cjs +2 -2
  78. package/dist/hooks/index.js +1 -1
  79. package/dist/index.cjs +13 -11
  80. package/dist/index.cjs.map +1 -1
  81. package/dist/index.css +22 -0
  82. package/dist/index.css.map +1 -1
  83. package/dist/index.d.cts +5 -5
  84. package/dist/index.d.ts +5 -5
  85. package/dist/index.js +13 -11
  86. package/dist/{leaderboard-chart-CPwbMH2m.d.ts → leaderboard-chart-By0W6-PK.d.ts} +1 -1
  87. package/dist/{leaderboard-chart-0L0WHLB8.d.cts → leaderboard-chart-DnrgthFl.d.cts} +1 -1
  88. package/dist/{legend-CpXHpy43.d.cts → legend-C9ahiwOt.d.cts} +1 -1
  89. package/dist/{legend-CiRaC2E5.d.ts → legend-jjMmhSg3.d.ts} +1 -1
  90. package/dist/providers/index.cjs +2 -2
  91. package/dist/providers/index.d.cts +2 -2
  92. package/dist/providers/index.d.ts +2 -2
  93. package/dist/providers/index.js +1 -1
  94. package/dist/{themes-CiIUyHWe.d.cts → themes-CzAoZ_JO.d.cts} +4 -1
  95. package/dist/{themes-NKtjcCQP.d.ts → themes-bkPMQyLm.d.ts} +4 -1
  96. package/dist/{types-wJz7SVob.d.cts → types-BBwg4Evw.d.cts} +1 -1
  97. package/dist/{types-DK1CMp9i.d.cts → types-C05PdDJa.d.cts} +9 -0
  98. package/dist/{types-DK1CMp9i.d.ts → types-C05PdDJa.d.ts} +9 -0
  99. package/dist/{types-DQv1GcN4.d.ts → types-DQNnq5Fr.d.ts} +1 -1
  100. package/package.json +1 -1
  101. package/src/components/leaderboard-chart/leaderboard-chart.tsx +1 -9
  102. package/src/components/legend/legend.tsx +1 -1
  103. package/src/components/legend/private/base-legend.module.scss +28 -0
  104. package/src/components/legend/private/base-legend.tsx +148 -71
  105. package/src/components/legend/test/legend.test.tsx +119 -0
  106. package/src/components/legend/types.ts +9 -0
  107. package/src/components/line-chart/line-chart.tsx +54 -18
  108. package/src/components/line-chart/test/line-chart.test.tsx +106 -0
  109. package/src/components/line-chart/types.ts +1 -0
  110. package/src/index.ts +1 -1
  111. package/src/providers/chart-context/global-charts-provider.tsx +57 -1
  112. package/src/providers/chart-context/test/chart-context.test.tsx +269 -1
  113. package/src/providers/chart-context/types.ts +4 -0
  114. package/dist/chunk-76XOLO7F.cjs.map +0 -1
  115. package/dist/chunk-7CSF2X4Q.cjs.map +0 -1
  116. package/dist/chunk-HZTHPE5F.cjs.map +0 -1
  117. package/dist/chunk-LIYP7LQW.js.map +0 -1
  118. package/dist/chunk-TEEQFJFL.cjs.map +0 -1
  119. package/dist/chunk-TY64IJ34.js.map +0 -1
  120. package/dist/chunk-UD3QSGWI.js.map +0 -1
  121. /package/dist/{chunk-LD4SAJTJ.js.map → chunk-G66WE3ON.js.map} +0 -0
  122. /package/dist/{chunk-OYPAAX3P.js.map → chunk-KM62I6SD.js.map} +0 -0
  123. /package/dist/{chunk-CES34TN5.js.map → chunk-SHADFB3T.js.map} +0 -0
  124. /package/dist/{chunk-CSSH4P7L.js.map → chunk-W5RFMC3A.js.map} +0 -0
  125. /package/dist/{chunk-M3JU5JTP.js.map → chunk-XDIWMJZD.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -5,19 +5,31 @@ 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.43.0] - 2025-10-20
9
+ ### Added
10
+ - Add legend interactivity. [#45506]
11
+ - Show ticks in year format when the interval is more than a year. [#45529]
12
+
13
+ ### Changed
14
+ - Charts: Group Storybook controls. [#45503]
15
+
16
+ ## [0.42.0] - 2025-10-14
17
+ ### Changed
18
+ - Leaderboard chart: Update exports and layout flex behavior. [#45480]
19
+
8
20
  ## [0.41.1] - 2025-10-13
9
21
  ### Fixed
10
22
  - Fix conversion funnel height inconsistency when toggling comparison mode. [#45434]
11
23
 
12
24
  ## [0.41.0] - 2025-10-08
13
25
  ### Added
14
- - Charts: Add custom legend support [#45347]
15
- - Charts: Set the color of the axis labels via the theme [#45406]
16
- - Charts Legend: Update docs [#45391]
26
+ - Add custom legend support. [#45347]
27
+ - Set the color of the axis labels via the theme. [#45406]
28
+ - Legend: Update docs. [#45391]
17
29
  - Show ticks in hours when the interval is less than 24 hours. [#45390]
18
30
 
19
31
  ### Changed
20
- - Charts: Separate API reference documentation from usage documentation [#45322]
32
+ - Separate API reference documentation from usage documentation. [#45322]
21
33
 
22
34
  ## [0.40.0] - 2025-10-06
23
35
  ### Added
@@ -47,14 +59,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
47
59
 
48
60
  ## [0.38.0] - 2025-09-19
49
61
  ### Added
50
- - Charts: Add get element styles utility to global context [#45207]
62
+ - Add get element styles utility to global context. [#45207]
51
63
 
52
64
  ### Changed
53
65
  - Update package dependencies. [#45229]
54
66
 
55
67
  ## [0.37.0] - 2025-09-15
56
68
  ### Changed
57
- - Charts: Handle legend overflow when not enough space. [#45144]
69
+ - Handle legend overflow when not enough space. [#45144]
58
70
 
59
71
  ## [0.36.0] - 2025-09-11
60
72
  ### Added
@@ -69,11 +81,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
69
81
  - Export all unresponsive charts. [#45129]
70
82
 
71
83
  ### Removed
72
- - Charts: Deprecate ThemeProvider in favor of GlobalChartsProvider [#45081]
84
+ - Deprecate ThemeProvider in favor of GlobalChartsProvider. [#45081]
73
85
 
74
86
  ## [0.34.1] - 2025-09-08
75
87
  ### Fixed
76
- - Charts: fix Type error with legendValueDisplay [#45099]
88
+ - Fix Type error with legendValueDisplay. [#45099]
77
89
 
78
90
  ## [0.34.0] - 2025-09-08
79
91
  ### Changed
@@ -507,6 +519,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
507
519
  - Fixed lints following ESLint rule changes for TS [#40584]
508
520
  - Fixing a bug in Chart storybook data. [#40640]
509
521
 
522
+ [0.43.0]: https://github.com/Automattic/charts/compare/v0.42.0...v0.43.0
523
+ [0.42.0]: https://github.com/Automattic/charts/compare/v0.41.1...v0.42.0
510
524
  [0.41.1]: https://github.com/Automattic/charts/compare/v0.41.0...v0.41.1
511
525
  [0.41.0]: https://github.com/Automattic/charts/compare/v0.40.0...v0.41.0
512
526
  [0.40.0]: https://github.com/Automattic/charts/compare/v0.39.0...v0.40.0
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  Legend,
9
9
  SingleChartContext
10
- } from "./chunk-UD3QSGWI.js";
10
+ } from "./chunk-Q2LDRQN7.js";
11
11
  import {
12
12
  GlobalChartsContext,
13
13
  GlobalChartsProvider,
@@ -17,7 +17,7 @@ import {
17
17
  useChartRegistration,
18
18
  useGlobalChartsContext,
19
19
  useGlobalChartsTheme
20
- } from "./chunk-TY64IJ34.js";
20
+ } from "./chunk-3O6FHD2T.js";
21
21
  import {
22
22
  __commonJS,
23
23
  __export,
@@ -4374,46 +4374,34 @@ var LeaderboardChartInternal = ({
4374
4374
  gap: showLegend ? "16px" : "0"
4375
4375
  },
4376
4376
  children: [
4377
- /* @__PURE__ */ jsx3(
4378
- component_default6,
4379
- {
4380
- className: leaderboard_chart_module_default.leaderboardGrid,
4381
- templateColumns: "minmax(0, 1fr) auto",
4382
- rowGap,
4383
- columnGap,
4384
- style: {
4385
- flex: 1
4386
- },
4387
- children: data.map((entry) => {
4388
- const colorIndex = Math.sign(entry.delta) + 1;
4389
- const deltaColor = deltaColors[colorIndex];
4390
- return /* @__PURE__ */ jsxs(Fragment, { children: [
4391
- /* @__PURE__ */ jsx3(component_default5, { spacing: labelSpacing, children: /* @__PURE__ */ jsx3(
4392
- BarWithLabel,
4393
- {
4394
- entry,
4395
- withComparison,
4396
- withOverlayLabel,
4397
- primaryColor: resolvedPrimaryColor,
4398
- secondaryColor: resolvedSecondaryColor
4399
- }
4400
- ) }),
4401
- /* @__PURE__ */ jsxs(
4402
- "div",
4403
- {
4404
- className: clsx(leaderboard_chart_module_default.valueContainer, {
4405
- [leaderboard_chart_module_default.overlayLabel]: withOverlayLabel
4406
- }),
4407
- children: [
4408
- /* @__PURE__ */ jsx3(component_default4, { children: valueFormatter(entry.currentValue) }),
4409
- withComparison && /* @__PURE__ */ jsx3(component_default4, { style: { color: deltaColor }, children: deltaFormatter(entry.delta) })
4410
- ]
4411
- }
4412
- )
4413
- ] }, entry.id);
4414
- })
4415
- }
4416
- ),
4377
+ /* @__PURE__ */ jsx3(component_default6, { templateColumns: "minmax(0, 1fr) auto", rowGap, columnGap, children: data.map((entry) => {
4378
+ const colorIndex = Math.sign(entry.delta) + 1;
4379
+ const deltaColor = deltaColors[colorIndex];
4380
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
4381
+ /* @__PURE__ */ jsx3(component_default5, { spacing: labelSpacing, children: /* @__PURE__ */ jsx3(
4382
+ BarWithLabel,
4383
+ {
4384
+ entry,
4385
+ withComparison,
4386
+ withOverlayLabel,
4387
+ primaryColor: resolvedPrimaryColor,
4388
+ secondaryColor: resolvedSecondaryColor
4389
+ }
4390
+ ) }),
4391
+ /* @__PURE__ */ jsxs(
4392
+ "div",
4393
+ {
4394
+ className: clsx(leaderboard_chart_module_default.valueContainer, {
4395
+ [leaderboard_chart_module_default.overlayLabel]: withOverlayLabel
4396
+ }),
4397
+ children: [
4398
+ /* @__PURE__ */ jsx3(component_default4, { children: valueFormatter(entry.currentValue) }),
4399
+ withComparison && /* @__PURE__ */ jsx3(component_default4, { style: { color: deltaColor }, children: deltaFormatter(entry.delta) })
4400
+ ]
4401
+ }
4402
+ )
4403
+ ] }, entry.id);
4404
+ }) }),
4417
4405
  showLegend && /* @__PURE__ */ jsx3(
4418
4406
  Legend,
4419
4407
  {
@@ -4486,4 +4474,4 @@ is-plain-object/dist/is-plain-object.mjs:
4486
4474
  * Released under the MIT License.
4487
4475
  *)
4488
4476
  */
4489
- //# sourceMappingURL=chunk-IHUHB3JB.js.map
4477
+ //# sourceMappingURL=chunk-2HB55BRH.js.map