@automattic/charts 0.33.0 → 0.34.1

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 (222) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/README.md +91 -7
  3. package/dist/chunk-3F4KXMJ5.js +897 -0
  4. package/dist/chunk-3F4KXMJ5.js.map +1 -0
  5. package/dist/chunk-3Z526IL2.cjs +55 -0
  6. package/dist/chunk-3Z526IL2.cjs.map +1 -0
  7. package/dist/chunk-5JUW6JQO.js +353 -0
  8. package/dist/chunk-5JUW6JQO.js.map +1 -0
  9. package/dist/chunk-6KOC7ZWU.js +177 -0
  10. package/dist/chunk-6KOC7ZWU.js.map +1 -0
  11. package/dist/chunk-7OZEQ5HE.cjs +9 -0
  12. package/dist/chunk-7OZEQ5HE.cjs.map +1 -0
  13. package/dist/chunk-AMY2POSB.js +4324 -0
  14. package/dist/chunk-AMY2POSB.js.map +1 -0
  15. package/dist/chunk-BS3VZTWU.cjs +764 -0
  16. package/dist/chunk-BS3VZTWU.cjs.map +1 -0
  17. package/dist/chunk-CEOMF3BN.cjs +451 -0
  18. package/dist/chunk-CEOMF3BN.cjs.map +1 -0
  19. package/dist/chunk-CZDSDFHD.js +278 -0
  20. package/dist/chunk-CZDSDFHD.js.map +1 -0
  21. package/dist/chunk-D3DZT2EK.js +55 -0
  22. package/dist/{chunk-BNAXWJSF.cjs.map → chunk-D3DZT2EK.js.map} +1 -1
  23. package/dist/chunk-EMMSS5I5.cjs +36 -0
  24. package/dist/chunk-EMMSS5I5.cjs.map +1 -0
  25. package/dist/chunk-FX2PTUFC.cjs +58 -0
  26. package/dist/chunk-FX2PTUFC.cjs.map +1 -0
  27. package/dist/chunk-G3PMV62Z.js +36 -0
  28. package/dist/chunk-H43FBWWZ.cjs +177 -0
  29. package/dist/chunk-H43FBWWZ.cjs.map +1 -0
  30. package/dist/chunk-JFRMYLPI.js +363 -0
  31. package/dist/chunk-JFRMYLPI.js.map +1 -0
  32. package/dist/chunk-JRDN5LQ7.cjs +288 -0
  33. package/dist/chunk-JRDN5LQ7.cjs.map +1 -0
  34. package/dist/chunk-KNTSYQPX.cjs +353 -0
  35. package/dist/chunk-KNTSYQPX.cjs.map +1 -0
  36. package/dist/chunk-KXOPD63R.cjs +4324 -0
  37. package/dist/chunk-KXOPD63R.cjs.map +1 -0
  38. package/dist/chunk-LGCQRR2I.js +288 -0
  39. package/dist/chunk-LGCQRR2I.js.map +1 -0
  40. package/dist/chunk-MFROL3SY.cjs +363 -0
  41. package/dist/chunk-MFROL3SY.cjs.map +1 -0
  42. package/dist/chunk-MNVVKT7E.js +195 -0
  43. package/dist/{chunk-VFET7YXL.js.map → chunk-MNVVKT7E.js.map} +1 -1
  44. package/dist/chunk-NB3M3ZHU.js +764 -0
  45. package/dist/{chunk-6HERQ6UJ.js.map → chunk-NB3M3ZHU.js.map} +1 -1
  46. package/dist/chunk-NFRB2POF.js +9 -0
  47. package/dist/chunk-NFRB2POF.js.map +1 -0
  48. package/dist/chunk-RXE5VSSC.cjs +897 -0
  49. package/dist/chunk-RXE5VSSC.cjs.map +1 -0
  50. package/dist/chunk-TYYW4BG3.js +58 -0
  51. package/dist/{chunk-GRHWUZHQ.js.map → chunk-TYYW4BG3.js.map} +1 -1
  52. package/dist/chunk-V3VAJ7ZP.cjs +195 -0
  53. package/dist/chunk-V3VAJ7ZP.cjs.map +1 -0
  54. package/dist/chunk-W33ZCFIV.cjs +278 -0
  55. package/dist/chunk-W33ZCFIV.cjs.map +1 -0
  56. package/dist/chunk-WFSQYOGO.js +451 -0
  57. package/dist/chunk-WFSQYOGO.js.map +1 -0
  58. package/dist/components/bar-chart/index.cjs +11 -1
  59. package/dist/components/bar-chart/index.cjs.map +1 -1
  60. package/dist/components/bar-chart/index.css +84 -0
  61. package/dist/components/bar-chart/index.css.map +1 -0
  62. package/dist/components/bar-chart/index.d.cts +1 -1
  63. package/dist/components/bar-chart/index.d.ts +1 -1
  64. package/dist/components/bar-chart/index.js +11 -1
  65. package/dist/components/bar-list-chart/index.cjs +12 -1
  66. package/dist/components/bar-list-chart/index.cjs.map +1 -1
  67. package/dist/components/bar-list-chart/index.css +84 -0
  68. package/dist/components/bar-list-chart/index.css.map +1 -0
  69. package/dist/components/bar-list-chart/index.d.cts +1 -1
  70. package/dist/components/bar-list-chart/index.d.ts +1 -1
  71. package/dist/components/bar-list-chart/index.js +12 -1
  72. package/dist/components/conversion-funnel-chart/index.cjs +8 -1
  73. package/dist/components/conversion-funnel-chart/index.cjs.map +1 -1
  74. package/dist/components/conversion-funnel-chart/index.css +141 -0
  75. package/dist/components/conversion-funnel-chart/index.css.map +1 -0
  76. package/dist/components/conversion-funnel-chart/index.js +8 -1
  77. package/dist/components/leaderboard-chart/index.cjs +11 -1
  78. package/dist/components/leaderboard-chart/index.cjs.map +1 -1
  79. package/dist/components/leaderboard-chart/index.css +46 -0
  80. package/dist/components/leaderboard-chart/index.css.map +1 -0
  81. package/dist/components/leaderboard-chart/index.d.cts +10 -1
  82. package/dist/components/leaderboard-chart/index.d.ts +10 -1
  83. package/dist/components/leaderboard-chart/index.js +11 -1
  84. package/dist/components/legend/index.cjs +10 -1
  85. package/dist/components/legend/index.cjs.map +1 -1
  86. package/dist/components/legend/index.css +59 -0
  87. package/dist/components/legend/index.css.map +1 -0
  88. package/dist/components/legend/index.d.cts +1 -1
  89. package/dist/components/legend/index.d.ts +1 -1
  90. package/dist/components/legend/index.js +10 -1
  91. package/dist/components/line-chart/index.cjs +11 -1
  92. package/dist/components/line-chart/index.cjs.map +1 -1
  93. package/dist/components/line-chart/index.css +162 -0
  94. package/dist/components/line-chart/index.css.map +1 -0
  95. package/dist/components/line-chart/index.d.cts +1 -1
  96. package/dist/components/line-chart/index.d.ts +1 -1
  97. package/dist/components/line-chart/index.js +11 -1
  98. package/dist/components/pie-chart/index.cjs +15 -1
  99. package/dist/components/pie-chart/index.cjs.map +1 -1
  100. package/dist/components/pie-chart/index.css +79 -0
  101. package/dist/components/pie-chart/index.css.map +1 -0
  102. package/dist/components/pie-chart/index.d.cts +1 -1
  103. package/dist/components/pie-chart/index.d.ts +1 -1
  104. package/dist/components/pie-chart/index.js +15 -1
  105. package/dist/components/pie-semi-circle-chart/index.cjs +12 -1
  106. package/dist/components/pie-semi-circle-chart/index.cjs.map +1 -1
  107. package/dist/components/pie-semi-circle-chart/index.css +88 -0
  108. package/dist/components/pie-semi-circle-chart/index.css.map +1 -0
  109. package/dist/components/pie-semi-circle-chart/index.d.cts +10 -1
  110. package/dist/components/pie-semi-circle-chart/index.d.ts +10 -1
  111. package/dist/components/pie-semi-circle-chart/index.js +12 -1
  112. package/dist/components/tooltip/index.cjs +11 -1
  113. package/dist/components/tooltip/index.cjs.map +1 -1
  114. package/dist/components/tooltip/index.css +13 -0
  115. package/dist/components/tooltip/index.css.map +1 -0
  116. package/dist/components/tooltip/index.d.cts +1 -1
  117. package/dist/components/tooltip/index.d.ts +1 -1
  118. package/dist/components/tooltip/index.js +11 -1
  119. package/dist/hooks/index.cjs +19 -1
  120. package/dist/hooks/index.cjs.map +1 -1
  121. package/dist/hooks/index.d.cts +1 -1
  122. package/dist/hooks/index.d.ts +1 -1
  123. package/dist/hooks/index.js +19 -1
  124. package/dist/index.cjs +62 -1
  125. package/dist/index.cjs.map +1 -1
  126. package/dist/index.css +384 -0
  127. package/dist/index.css.map +1 -0
  128. package/dist/index.d.cts +3 -3
  129. package/dist/index.d.ts +3 -3
  130. package/dist/index.js +62 -1
  131. package/dist/leaderboard-chart-BQwp7N9o.d.cts +43 -0
  132. package/dist/leaderboard-chart-Ki5_oTuo.d.ts +43 -0
  133. package/dist/providers/index.cjs +27 -1
  134. package/dist/providers/index.cjs.map +1 -1
  135. package/dist/providers/index.d.cts +2 -2
  136. package/dist/providers/index.d.ts +2 -2
  137. package/dist/providers/index.js +27 -1
  138. package/dist/{types-DdYRE7ga.d.ts → types-pVkkGIaQ.d.cts} +37 -3
  139. package/dist/{types-DdYRE7ga.d.cts → types-pVkkGIaQ.d.ts} +37 -3
  140. package/dist/{use-global-charts-theme-mXcouoeC.d.cts → use-global-charts-theme-Cr2-_NOr.d.cts} +1 -1
  141. package/dist/{use-global-charts-theme-D3LjTUGh.d.ts → use-global-charts-theme-D8nlMH1c.d.ts} +1 -1
  142. package/dist/visx/group/index.cjs +7 -1
  143. package/dist/visx/group/index.cjs.map +1 -1
  144. package/dist/visx/group/index.js +7 -1
  145. package/dist/visx/group/index.js.map +1 -1
  146. package/dist/visx/legend/index.cjs +9 -1
  147. package/dist/visx/legend/index.cjs.map +1 -1
  148. package/dist/visx/legend/index.js +9 -1
  149. package/dist/visx/legend/index.js.map +1 -1
  150. package/dist/visx/text/index.cjs +11 -1
  151. package/dist/visx/text/index.cjs.map +1 -1
  152. package/dist/visx/text/index.js +11 -1
  153. package/package.json +13 -1
  154. package/src/components/leaderboard-chart/index.ts +2 -1
  155. package/src/components/leaderboard-chart/leaderboard-chart.tsx +2 -96
  156. package/src/components/leaderboard-chart/test/leaderboard-chart.test.tsx +1 -1
  157. package/src/components/leaderboard-chart/types.ts +46 -0
  158. package/src/components/pie-semi-circle-chart/pie-semi-circle-chart.tsx +15 -1
  159. package/src/types.ts +44 -2
  160. package/tsup.config.ts +13 -3
  161. package/dist/bar-chart.module-BGQPECGS.scss +0 -12
  162. package/dist/base-legend.module-YZJXJR45.scss +0 -76
  163. package/dist/base-tooltip.module-NILZYBVJ.scss +0 -11
  164. package/dist/chunk-253F4WJT.cjs +0 -2
  165. package/dist/chunk-253F4WJT.cjs.map +0 -1
  166. package/dist/chunk-2CEQF5RH.cjs +0 -2
  167. package/dist/chunk-2CEQF5RH.cjs.map +0 -1
  168. package/dist/chunk-2O5XXOKH.cjs +0 -32
  169. package/dist/chunk-2O5XXOKH.cjs.map +0 -1
  170. package/dist/chunk-4CPALWEX.cjs +0 -2
  171. package/dist/chunk-4CPALWEX.cjs.map +0 -1
  172. package/dist/chunk-6HERQ6UJ.js +0 -2
  173. package/dist/chunk-76MUGFRK.cjs +0 -2
  174. package/dist/chunk-76MUGFRK.cjs.map +0 -1
  175. package/dist/chunk-7C6PJGWI.js +0 -2
  176. package/dist/chunk-7C6PJGWI.js.map +0 -1
  177. package/dist/chunk-7TRU7Z3V.cjs +0 -2
  178. package/dist/chunk-7TRU7Z3V.cjs.map +0 -1
  179. package/dist/chunk-A6B522YL.js +0 -2
  180. package/dist/chunk-A6B522YL.js.map +0 -1
  181. package/dist/chunk-ALC6I6HA.js +0 -2
  182. package/dist/chunk-ALC6I6HA.js.map +0 -1
  183. package/dist/chunk-BNAXWJSF.cjs +0 -2
  184. package/dist/chunk-DBGSHU4Q.js +0 -2
  185. package/dist/chunk-DBGSHU4Q.js.map +0 -1
  186. package/dist/chunk-GRHWUZHQ.js +0 -2
  187. package/dist/chunk-HJYSGVCM.cjs +0 -2
  188. package/dist/chunk-HJYSGVCM.cjs.map +0 -1
  189. package/dist/chunk-JNA2WFY7.cjs +0 -12
  190. package/dist/chunk-JNA2WFY7.cjs.map +0 -1
  191. package/dist/chunk-MPWOYZHH.js +0 -12
  192. package/dist/chunk-MPWOYZHH.js.map +0 -1
  193. package/dist/chunk-QAF44M37.cjs +0 -2
  194. package/dist/chunk-QAF44M37.cjs.map +0 -1
  195. package/dist/chunk-QZBB6KI3.js +0 -2
  196. package/dist/chunk-QZBB6KI3.js.map +0 -1
  197. package/dist/chunk-RFBBAUMM.js +0 -2
  198. package/dist/chunk-RS3D7LRG.cjs +0 -2
  199. package/dist/chunk-RS3D7LRG.cjs.map +0 -1
  200. package/dist/chunk-SJSVNSI5.cjs +0 -2
  201. package/dist/chunk-SJSVNSI5.cjs.map +0 -1
  202. package/dist/chunk-UMO3DIW3.js +0 -2
  203. package/dist/chunk-UMO3DIW3.js.map +0 -1
  204. package/dist/chunk-UPZWVSQA.cjs +0 -2
  205. package/dist/chunk-UPZWVSQA.cjs.map +0 -1
  206. package/dist/chunk-VFET7YXL.js +0 -2
  207. package/dist/chunk-WH6WPZPG.cjs +0 -2
  208. package/dist/chunk-WH6WPZPG.cjs.map +0 -1
  209. package/dist/chunk-WRNE6E3B.js +0 -2
  210. package/dist/chunk-WRNE6E3B.js.map +0 -1
  211. package/dist/chunk-XTK36YFB.js +0 -32
  212. package/dist/chunk-XTK36YFB.js.map +0 -1
  213. package/dist/chunk-Z7T2M5EL.js +0 -2
  214. package/dist/chunk-Z7T2M5EL.js.map +0 -1
  215. package/dist/conversion-funnel-chart.module-5ZPZQXF3.scss +0 -165
  216. package/dist/leaderboard-chart-D8KNIPOq.d.cts +0 -83
  217. package/dist/leaderboard-chart-D8KNIPOq.d.ts +0 -83
  218. package/dist/leaderboard-chart.module-AZFQ7TAT.scss +0 -55
  219. package/dist/line-chart.module-NRZUHHPY.scss +0 -106
  220. package/dist/pie-chart.module-LOP3Y52M.scss +0 -5
  221. package/dist/pie-semi-circle-chart.module-7NJL5QNB.scss +0 -17
  222. /package/dist/{chunk-RFBBAUMM.js.map → chunk-G3PMV62Z.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -5,12 +5,23 @@ 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.34.1] - 2025-09-08
9
+ ### Fixed
10
+ - Charts: fix Type error with legendValueDisplay [#45099]
11
+
12
+ ## [0.34.0] - 2025-09-08
13
+ ### Changed
14
+ - Leaderboard Chart: Extend BaseChartProps [#45100]
15
+
16
+ ### Fixed
17
+ - Fix SASS and CSS Modules processing. [#45098]
18
+
8
19
  ## [0.33.0] - 2025-09-08
9
20
  ### Added
10
21
  - Add ability to control percentage vs. value display. [#45052]
11
22
 
12
23
  ### Changed
13
- - LeaderboardChart: Use GlobalContextProvider theme for colors. [#45067]
24
+ - Leaderboard Chart: Use GlobalContextProvider theme for colors. [#45067]
14
25
  - Update package dependencies. [#45027] [#45097]
15
26
  - Use `tsup` for builds. [#45051]
16
27
 
@@ -430,6 +441,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
430
441
  - Fixed lints following ESLint rule changes for TS [#40584]
431
442
  - Fixing a bug in Chart storybook data. [#40640]
432
443
 
444
+ [0.34.1]: https://github.com/Automattic/charts/compare/v0.34.0...v0.34.1
445
+ [0.34.0]: https://github.com/Automattic/charts/compare/v0.33.0...v0.34.0
433
446
  [0.33.0]: https://github.com/Automattic/charts/compare/v0.32.0...v0.33.0
434
447
  [0.32.0]: https://github.com/Automattic/charts/compare/v0.31.0...v0.32.0
435
448
  [0.31.0]: https://github.com/Automattic/charts/compare/v0.30.0...v0.31.0
package/README.md CHANGED
@@ -16,22 +16,106 @@ pnpm add @automattic/charts
16
16
  yarn add @automattic/charts
17
17
  ```
18
18
 
19
- ### Local development with Storybook
19
+ ### Importing Components
20
20
 
21
- To run Storybook locally, from the root of the monorepo follow these steps:
21
+ You can import charts from the package in several ways depending on your needs:
22
22
 
23
- 1. Run `pnpm install` to install the dependencies.
24
- 2. Run `cd projects/js-packages/charts` to navigate to the charts package.
25
- 3. Run `pnpm run storybook` to start the storybook server.
23
+ #### Option 1: Import everything from the main entry (includes all styles)
26
24
 
27
- ## Contributing
25
+ ```javascript
26
+ import { LineChart, BarChart, PieChart } from '@automattic/charts';
27
+ import '@automattic/charts/style.css'; // Import all styles
28
+ ```
28
29
 
29
- Ready to contribute? Check out the [Jetpack contributing guide](https://github.com/Automattic/jetpack/blob/trunk/docs/CONTRIBUTING.md) and the [Charts AI documentation guide](https://github.com/Automattic/jetpack/blob/trunk/projects/js-packages/charts/docs/ai-documentation-guide.md) for detailed information on adding new features and documentation.
30
+ #### Option 2: Import individual components (tree-shaking friendly)
31
+
32
+ For better bundle optimization, you can import components individually:
33
+
34
+ ```javascript
35
+ // Import individual components
36
+ import { LineChart } from '@automattic/charts/line-chart';
37
+ import { BarChart } from '@automattic/charts/bar-chart';
38
+ import { PieChart } from '@automattic/charts/pie-chart';
39
+
40
+ // Import individual component styles
41
+ import '@automattic/charts/line-chart/style.css';
42
+ import '@automattic/charts/bar-chart/style.css';
43
+ import '@automattic/charts/pie-chart/style.css';
44
+ ```
45
+
46
+ Individual entry exports also provide easier access to chart-specific types and helpers when available. This makes it simpler to find and leverage TypeScript types, utility functions, and other chart-specific tools that are exported alongside the main component.
47
+
48
+ #### Available Components and Entry Points
49
+
50
+ The following components can be imported individually:
51
+
52
+ - `@automattic/charts/bar-chart` - Bar Chart component
53
+ - `@automattic/charts/bar-list-chart` - Bar List Chart component
54
+ - `@automattic/charts/conversion-funnel-chart` - Conversion Funnel Chart component
55
+ - `@automattic/charts/leaderboard-chart` - Leaderboard Chart component
56
+ - `@automattic/charts/legend` - Legend component
57
+ - `@automattic/charts/line-chart` - Line Chart component
58
+ - `@automattic/charts/pie-chart` - Pie Chart component
59
+ - `@automattic/charts/pie-semi-circle-chart` - Pie Semi-Circle Chart component
60
+ - `@automattic/charts/tooltip` - Tooltip component
61
+ - `@automattic/charts/hooks` - React hooks
62
+ - `@automattic/charts/providers` - Context providers
63
+ - `@automattic/charts/visx/group` - Visx group utilities
64
+ - `@automattic/charts/visx/legend` - Visx legend utilities
65
+ - `@automattic/charts/visx/text` - Visx text utilities
66
+
67
+ #### Available Style Imports
68
+
69
+ Each component has its own CSS file that can be imported individually:
70
+
71
+ - `@automattic/charts/bar-chart/style.css`
72
+ - `@automattic/charts/bar-list-chart/style.css`
73
+ - `@automattic/charts/conversion-funnel-chart/style.css`
74
+ - `@automattic/charts/leaderboard-chart/style.css`
75
+ - `@automattic/charts/legend/style.css`
76
+ - `@automattic/charts/line-chart/style.css`
77
+ - `@automattic/charts/pie-chart/style.css`
78
+ - `@automattic/charts/pie-semi-circle-chart/style.css`
79
+ - `@automattic/charts/tooltip/style.css`
80
+
81
+ ### Basic Usage Example
82
+
83
+ ```javascript
84
+ import React from 'react';
85
+ import { LineChart } from '@automattic/charts';
86
+ import '@automattic/charts/line-chart/style.css';
87
+
88
+ const data = [
89
+ { date: new Date( '2024-01-01' ), value: 10 },
90
+ { date: new Date( '2024-01-02' ), value: 90 }, // Sharp rise
91
+ { date: new Date( '2024-01-03' ), value: 85 }, // Slight decline
92
+ { date: new Date( '2024-01-04' ), value: 82 }, // Gradual decline
93
+ { date: new Date( '2024-01-05' ), value: 5 }, // Sharp drop
94
+ { date: new Date( '2024-01-06' ), value: 8 }, // Slight rise
95
+ { date: new Date( '2024-01-07' ), value: 10 }, // Gradual rise
96
+ ];
97
+
98
+ function MyComponent() {
99
+ return <LineChart data={ data } width={ 400 } height={ 300 } />;
100
+ }
101
+ ```
30
102
 
31
103
  ## Using this package in your WordPress plugin
32
104
 
33
105
  If you plan on using this package in your WordPress plugin, we would recommend that you use [Jetpack Autoloader](https://packagist.org/packages/automattic/jetpack-autoloader) as your autoloader. This will allow for maximum interoperability with other plugins that use this package as well.
34
106
 
107
+ ## Contributing
108
+
109
+ Ready to contribute? Check out the [Jetpack contributing guide](https://github.com/Automattic/jetpack/blob/trunk/docs/CONTRIBUTING.md) and the [Charts AI documentation guide](https://github.com/Automattic/jetpack/blob/trunk/projects/js-packages/charts/docs/ai-documentation-guide.md) for detailed information on adding new features and documentation.
110
+
111
+ ### Local development with Storybook
112
+
113
+ To run Storybook locally, from the root of the monorepo follow these steps:
114
+
115
+ 1. Run `pnpm install` to install the dependencies.
116
+ 2. Run `cd projects/js-packages/charts` to navigate to the charts package.
117
+ 3. Run `pnpm run storybook` to start the storybook server.
118
+
35
119
  ## Security
36
120
 
37
121
  Need to report a security vulnerability? Go to [https://automattic.com/security/](https://automattic.com/security/) or directly to our security bug bounty site [https://hackerone.com/automattic](https://hackerone.com/automattic).