@automattic/charts 0.56.7 → 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 (223) hide show
  1. package/AGENTS.md +28 -98
  2. package/CHANGELOG.md +30 -0
  3. package/dist/charts/bar-chart/index.cjs +7 -6
  4. package/dist/charts/bar-chart/index.cjs.map +1 -1
  5. package/dist/charts/bar-chart/index.css +12 -24
  6. package/dist/charts/bar-chart/index.css.map +1 -1
  7. package/dist/charts/bar-chart/index.d.cts +3 -4
  8. package/dist/charts/bar-chart/index.d.ts +3 -4
  9. package/dist/charts/bar-chart/index.js +6 -5
  10. package/dist/charts/bar-list-chart/index.cjs +8 -7
  11. package/dist/charts/bar-list-chart/index.cjs.map +1 -1
  12. package/dist/charts/bar-list-chart/index.css +12 -24
  13. package/dist/charts/bar-list-chart/index.css.map +1 -1
  14. package/dist/charts/bar-list-chart/index.d.cts +3 -3
  15. package/dist/charts/bar-list-chart/index.d.ts +3 -3
  16. package/dist/charts/bar-list-chart/index.js +7 -6
  17. package/dist/charts/conversion-funnel-chart/index.cjs +5 -6
  18. package/dist/charts/conversion-funnel-chart/index.cjs.map +1 -1
  19. package/dist/charts/conversion-funnel-chart/index.css +0 -94
  20. package/dist/charts/conversion-funnel-chart/index.css.map +1 -1
  21. package/dist/charts/conversion-funnel-chart/index.d.cts +1 -1
  22. package/dist/charts/conversion-funnel-chart/index.d.ts +1 -1
  23. package/dist/charts/conversion-funnel-chart/index.js +4 -5
  24. package/dist/charts/geo-chart/index.cjs +4 -4
  25. package/dist/charts/geo-chart/index.css +0 -94
  26. package/dist/charts/geo-chart/index.css.map +1 -1
  27. package/dist/charts/geo-chart/index.d.cts +1 -1
  28. package/dist/charts/geo-chart/index.d.ts +1 -1
  29. package/dist/charts/geo-chart/index.js +3 -3
  30. package/dist/charts/leaderboard-chart/index.cjs +7 -6
  31. package/dist/charts/leaderboard-chart/index.cjs.map +1 -1
  32. package/dist/charts/leaderboard-chart/index.css +20 -33
  33. package/dist/charts/leaderboard-chart/index.css.map +1 -1
  34. package/dist/charts/leaderboard-chart/index.d.cts +3 -3
  35. package/dist/charts/leaderboard-chart/index.d.ts +3 -3
  36. package/dist/charts/leaderboard-chart/index.js +6 -5
  37. package/dist/charts/line-chart/index.cjs +7 -6
  38. package/dist/charts/line-chart/index.cjs.map +1 -1
  39. package/dist/charts/line-chart/index.css +12 -24
  40. package/dist/charts/line-chart/index.css.map +1 -1
  41. package/dist/charts/line-chart/index.d.cts +3 -4
  42. package/dist/charts/line-chart/index.d.ts +3 -4
  43. package/dist/charts/line-chart/index.js +6 -5
  44. package/dist/charts/pie-chart/index.cjs +7 -7
  45. package/dist/charts/pie-chart/index.css +12 -24
  46. package/dist/charts/pie-chart/index.css.map +1 -1
  47. package/dist/charts/pie-chart/index.d.cts +7 -13
  48. package/dist/charts/pie-chart/index.d.ts +7 -13
  49. package/dist/charts/pie-chart/index.js +6 -6
  50. package/dist/charts/pie-semi-circle-chart/index.cjs +7 -7
  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 -6
  56. package/dist/charts/sparkline/index.cjs +8 -7
  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 -6
  61. package/dist/{chunk-RFSHE3HL.js → chunk-2I67QUIV.js} +84 -431
  62. package/dist/chunk-2I67QUIV.js.map +1 -0
  63. package/dist/{chunk-OMS5QIJN.js → chunk-2ICEEQOC.js} +31 -25
  64. package/dist/chunk-2ICEEQOC.js.map +1 -0
  65. package/dist/{chunk-GWBS65VC.js → chunk-4B7BL2DD.js} +3 -3
  66. package/dist/{chunk-7FDQGBY7.js → chunk-4OXMTKAL.js} +24 -24
  67. package/dist/chunk-4OXMTKAL.js.map +1 -0
  68. package/dist/{chunk-SSFFCBCF.js → chunk-B6NLZFRW.js} +32 -26
  69. package/dist/chunk-B6NLZFRW.js.map +1 -0
  70. package/dist/{chunk-3EXJP67N.cjs → chunk-BBAUQOW6.cjs} +9 -9
  71. package/dist/{chunk-3EXJP67N.cjs.map → chunk-BBAUQOW6.cjs.map} +1 -1
  72. package/dist/{chunk-NQJE2CC7.cjs → chunk-CMMHCTBX.cjs} +45 -45
  73. package/dist/chunk-CMMHCTBX.cjs.map +1 -0
  74. package/dist/{chunk-O2JIANHK.cjs → chunk-CPPXJATQ.cjs} +51 -45
  75. package/dist/chunk-CPPXJATQ.cjs.map +1 -0
  76. package/dist/{chunk-MDRCAGKZ.js → chunk-DKU775VC.js} +3 -3
  77. package/dist/{chunk-BXFD7JIG.cjs → chunk-GRA7Y2ZG.cjs} +46 -46
  78. package/dist/chunk-GRA7Y2ZG.cjs.map +1 -0
  79. package/dist/{chunk-TE63Y5PX.js → chunk-JJIMABHT.js} +10 -3
  80. package/dist/chunk-JJIMABHT.js.map +1 -0
  81. package/dist/{chunk-KHQPN77E.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-VPAEBI2F.js → chunk-LTFH7SEG.js} +24 -24
  85. package/dist/chunk-LTFH7SEG.js.map +1 -0
  86. package/dist/{chunk-E62LCBGD.js → chunk-MUNOKLLE.js} +3 -3
  87. package/dist/{chunk-ZVGEDXDP.cjs → chunk-MXGLYWVP.cjs} +10 -3
  88. package/dist/chunk-MXGLYWVP.cjs.map +1 -0
  89. package/dist/{chunk-55ZCOYDF.cjs → chunk-OYC34VTO.cjs} +252 -827
  90. package/dist/chunk-OYC34VTO.cjs.map +1 -0
  91. package/dist/{chunk-CAFJRZPZ.cjs → chunk-PQL5I3F6.cjs} +17 -17
  92. package/dist/{chunk-CAFJRZPZ.cjs.map → chunk-PQL5I3F6.cjs.map} +1 -1
  93. package/dist/{chunk-UFRBUT2D.cjs → chunk-REZTQ4PH.cjs} +87 -24
  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-XD2HV7M5.js → chunk-UTYVIOWZ.js} +226 -801
  98. package/dist/chunk-UTYVIOWZ.js.map +1 -0
  99. package/dist/{chunk-YAXY5L7I.cjs → chunk-W2LDIX26.cjs} +5 -5
  100. package/dist/{chunk-YAXY5L7I.cjs.map → chunk-W2LDIX26.cjs.map} +1 -1
  101. package/dist/{chunk-K6TGILHX.cjs → chunk-WSG64BVN.cjs} +6 -6
  102. package/dist/{chunk-K6TGILHX.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-YDVHT7GS.cjs → chunk-WYK7EL5R.cjs} +100 -447
  106. package/dist/chunk-WYK7EL5R.cjs.map +1 -0
  107. package/dist/{chunk-X7JL2NYJ.cjs → chunk-XC4KHJYX.cjs} +51 -45
  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-IS5YYLTV.js → chunk-YAFQVVDI.js} +85 -22
  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 +9 -13
  127. package/dist/hooks/index.d.ts +9 -13
  128. package/dist/hooks/index.js +2 -4
  129. package/dist/index.cjs +18 -17
  130. package/dist/index.cjs.map +1 -1
  131. package/dist/index.css +20 -33
  132. package/dist/index.css.map +1 -1
  133. package/dist/index.d.cts +6 -6
  134. package/dist/index.d.ts +6 -6
  135. package/dist/index.js +17 -16
  136. package/dist/{leaderboard-chart-COtgamhe.d.cts → leaderboard-chart-BSbg0ufV.d.cts} +3 -11
  137. package/dist/{leaderboard-chart-BSgEw_Um.d.ts → leaderboard-chart-odEYxxEC.d.ts} +3 -11
  138. package/dist/{legend-C9ahiwOt.d.cts → legend-DFkosEvC.d.cts} +1 -1
  139. package/dist/{legend-jjMmhSg3.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-CVR5rmIs.d.cts → themes-D0qc5JaW.d.cts} +2 -2
  147. package/dist/{themes-DQzmaSze.d.ts → themes-itO4Ht5g.d.ts} +2 -2
  148. package/dist/{types-BBwg4Evw.d.cts → types-B5f6XQ7Q.d.cts} +1 -1
  149. package/dist/{types-DQNnq5Fr.d.ts → types-BsHooDbM.d.ts} +1 -1
  150. package/dist/{types-C05PdDJa.d.cts → types-BuSrRM4p.d.ts} +15 -23
  151. package/dist/{types-CzdN7rUe.d.cts → types-ChOUI9-N.d.cts} +90 -46
  152. package/dist/{types-CzdN7rUe.d.ts → types-ChOUI9-N.d.ts} +90 -46
  153. package/dist/{types-C05PdDJa.d.ts → types-Dfw9VOKI.d.cts} +15 -23
  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 +10 -8
  159. package/src/charts/bar-chart/bar-chart.tsx +19 -19
  160. package/src/charts/bar-chart/test/bar-chart.test.tsx +78 -31
  161. package/src/charts/conversion-funnel-chart/test/conversion-funnel-chart.test.tsx +2 -2
  162. package/src/charts/leaderboard-chart/hooks/use-leaderboard-legend-items.ts +0 -2
  163. package/src/charts/leaderboard-chart/leaderboard-chart.module.scss +9 -10
  164. package/src/charts/leaderboard-chart/leaderboard-chart.tsx +124 -102
  165. package/src/charts/leaderboard-chart/test/leaderboard-chart.test.tsx +61 -33
  166. package/src/charts/leaderboard-chart/test/use-leaderboard-legend-items.test.tsx +2 -5
  167. package/src/charts/leaderboard-chart/types.ts +2 -15
  168. package/src/charts/line-chart/line-chart.tsx +18 -17
  169. package/src/charts/line-chart/test/line-chart.test.tsx +49 -27
  170. package/src/charts/line-chart/types.ts +0 -1
  171. package/src/charts/pie-chart/pie-chart.tsx +23 -23
  172. package/src/charts/pie-chart/test/composition-api.test.tsx +41 -0
  173. package/src/charts/pie-chart/test/pie-chart.test.tsx +9 -9
  174. package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx +21 -24
  175. package/src/charts/pie-semi-circle-chart/test/pie-semi-circle-chart.test.tsx +33 -5
  176. package/src/charts/private/chart-composition/index.ts +2 -0
  177. package/src/charts/private/chart-composition/render-legend-slot.ts +22 -0
  178. package/src/charts/private/chart-composition/test/render-legend-slot.test.tsx +60 -0
  179. package/src/charts/private/chart-composition/test/use-chart-children.test.tsx +91 -0
  180. package/src/charts/private/chart-composition/use-chart-children.ts +34 -2
  181. package/src/components/legend/private/base-legend.module.scss +19 -37
  182. package/src/components/legend/private/base-legend.tsx +32 -24
  183. package/src/components/legend/test/legend.test.tsx +148 -52
  184. package/src/components/legend/types.ts +23 -24
  185. package/src/hooks/index.ts +0 -1
  186. package/src/hooks/test/use-zero-value-display.test.tsx +206 -0
  187. package/src/hooks/use-zero-value-display.ts +52 -23
  188. package/src/providers/chart-context/test/chart-context.test.tsx +12 -6
  189. package/src/providers/chart-context/themes.ts +6 -4
  190. package/src/types.ts +93 -44
  191. package/src/utils/date-parsing.ts +10 -1
  192. package/src/utils/get-styles.ts +1 -1
  193. package/src/utils/test/date-parsing.test.ts +12 -0
  194. package/src/utils/test/get-styles.test.ts +12 -10
  195. package/src/utils/test/resolve-css-var.test.ts +2 -2
  196. package/tsup.config.ts +1 -1
  197. package/dist/chunk-55ZCOYDF.cjs.map +0 -1
  198. package/dist/chunk-6CCZL2JJ.js.map +0 -1
  199. package/dist/chunk-7FDQGBY7.js.map +0 -1
  200. package/dist/chunk-BXFD7JIG.cjs.map +0 -1
  201. package/dist/chunk-IS5YYLTV.js.map +0 -1
  202. package/dist/chunk-KNIMXN6Z.js +0 -51
  203. package/dist/chunk-KNIMXN6Z.js.map +0 -1
  204. package/dist/chunk-NQJE2CC7.cjs.map +0 -1
  205. package/dist/chunk-O2JIANHK.cjs.map +0 -1
  206. package/dist/chunk-OMS5QIJN.js.map +0 -1
  207. package/dist/chunk-RCY6XLGU.cjs.map +0 -1
  208. package/dist/chunk-RFSHE3HL.js.map +0 -1
  209. package/dist/chunk-SSFFCBCF.js.map +0 -1
  210. package/dist/chunk-SUDERBUA.cjs +0 -51
  211. package/dist/chunk-SUDERBUA.cjs.map +0 -1
  212. package/dist/chunk-TE63Y5PX.js.map +0 -1
  213. package/dist/chunk-UFRBUT2D.cjs.map +0 -1
  214. package/dist/chunk-VPAEBI2F.js.map +0 -1
  215. package/dist/chunk-X7JL2NYJ.cjs.map +0 -1
  216. package/dist/chunk-XD2HV7M5.js.map +0 -1
  217. package/dist/chunk-YDVHT7GS.cjs.map +0 -1
  218. package/dist/chunk-ZVGEDXDP.cjs.map +0 -1
  219. package/src/hooks/use-has-legend-child.ts +0 -22
  220. /package/dist/{chunk-GWBS65VC.js.map → chunk-4B7BL2DD.js.map} +0 -0
  221. /package/dist/{chunk-MDRCAGKZ.js.map → chunk-DKU775VC.js.map} +0 -0
  222. /package/dist/{chunk-KHQPN77E.js.map → chunk-KJHWXOCZ.js.map} +0 -0
  223. /package/dist/{chunk-E62LCBGD.js.map → chunk-MUNOKLLE.js.map} +0 -0
@@ -6,8 +6,8 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkYDVHT7GScjs = require('../chunk-YDVHT7GS.cjs');
10
- require('../chunk-ZVGEDXDP.cjs');
9
+ var _chunkWYK7EL5Rcjs = require('../chunk-WYK7EL5R.cjs');
10
+ require('../chunk-MXGLYWVP.cjs');
11
11
  require('../chunk-EMMSS5I5.cjs');
12
12
 
13
13
 
@@ -17,5 +17,5 @@ require('../chunk-EMMSS5I5.cjs');
17
17
 
18
18
 
19
19
 
20
- exports.GlobalChartsContext = _chunkYDVHT7GScjs.GlobalChartsContext; exports.GlobalChartsProvider = _chunkYDVHT7GScjs.GlobalChartsProvider; exports.defaultTheme = _chunkYDVHT7GScjs.defaultTheme; exports.useChartId = _chunkYDVHT7GScjs.useChartId; exports.useChartRegistration = _chunkYDVHT7GScjs.useChartRegistration; exports.useGlobalChartsContext = _chunkYDVHT7GScjs.useGlobalChartsContext; exports.useGlobalChartsTheme = _chunkYDVHT7GScjs.useGlobalChartsTheme;
20
+ exports.GlobalChartsContext = _chunkWYK7EL5Rcjs.GlobalChartsContext; exports.GlobalChartsProvider = _chunkWYK7EL5Rcjs.GlobalChartsProvider; exports.defaultTheme = _chunkWYK7EL5Rcjs.defaultTheme; exports.useChartId = _chunkWYK7EL5Rcjs.useChartId; exports.useChartRegistration = _chunkWYK7EL5Rcjs.useChartRegistration; exports.useGlobalChartsContext = _chunkWYK7EL5Rcjs.useGlobalChartsContext; exports.useGlobalChartsTheme = _chunkWYK7EL5Rcjs.useGlobalChartsTheme;
21
21
  //# sourceMappingURL=index.cjs.map
@@ -6,98 +6,4 @@
6
6
  z-index: 1;
7
7
  pointer-events: none;
8
8
  }
9
-
10
- /* esbuild-sass-plugin:css-chunk:src/components/legend/private/base-legend.module.scss */
11
- .a8ccharts-AELBvX {
12
- display: flex;
13
- flex-direction: row;
14
- flex-wrap: wrap;
15
- gap: 16px;
16
- }
17
- .a8ccharts-fX8uQe {
18
- display: flex;
19
- flex-direction: column;
20
- gap: 8px;
21
- }
22
- .a8ccharts-fX8uQe.a8ccharts-DEe0wg {
23
- align-items: flex-start;
24
- }
25
- .a8ccharts-fX8uQe.a8ccharts-WBKF9I {
26
- align-items: center;
27
- }
28
- .a8ccharts-fX8uQe.a8ccharts-JfwMng {
29
- align-items: flex-end;
30
- }
31
- .a8ccharts-8Y73Kh {
32
- position: relative;
33
- }
34
- .a8ccharts-8Y73Kh.a8ccharts-DEe0wg {
35
- justify-content: flex-start;
36
- }
37
- .a8ccharts-8Y73Kh.a8ccharts-WBKF9I {
38
- justify-content: center;
39
- }
40
- .a8ccharts-8Y73Kh.a8ccharts-JfwMng {
41
- justify-content: flex-end;
42
- }
43
- .a8ccharts-TVM-IY {
44
- position: relative;
45
- }
46
- .a8ccharts-TVM-IY.a8ccharts-DEe0wg {
47
- justify-content: flex-start;
48
- }
49
- .a8ccharts-TVM-IY.a8ccharts-WBKF9I {
50
- justify-content: center;
51
- }
52
- .a8ccharts-TVM-IY.a8ccharts-JfwMng {
53
- justify-content: flex-end;
54
- }
55
- .a8ccharts-Vflwq8 {
56
- display: flex;
57
- align-items: center;
58
- font-size: 0.875rem;
59
- }
60
- .a8ccharts-qGsavM {
61
- cursor: pointer;
62
- user-select: none;
63
- transition: opacity 0.2s ease;
64
- }
65
- .a8ccharts-qGsavM:hover {
66
- opacity: 0.8;
67
- }
68
- .a8ccharts-qGsavM:focus {
69
- outline: 2px solid currentColor;
70
- outline-offset: 2px;
71
- border-radius: 4px;
72
- }
73
- .a8ccharts-qGsavM:focus:not(:focus-visible) {
74
- outline: none;
75
- }
76
- .a8ccharts-ZtDY-Q {
77
- opacity: 0.4;
78
- }
79
- .a8ccharts-ZtDY-Q .a8ccharts-2H65Kr {
80
- text-decoration: line-through;
81
- }
82
- .a8ccharts-2H65Kr {
83
- display: flex;
84
- align-items: center;
85
- gap: 0.5rem;
86
- }
87
- .a8ccharts-faSDBI {
88
- overflow-wrap: break-word;
89
- white-space: normal;
90
- hyphens: auto;
91
- }
92
- .a8ccharts-FISUIO {
93
- white-space: nowrap;
94
- overflow: hidden;
95
- text-overflow: ellipsis;
96
- flex-shrink: 1;
97
- min-width: 0;
98
- }
99
- .a8ccharts-DTZlT- {
100
- font-weight: 500;
101
- flex-shrink: 0;
102
- }
103
9
  /*# sourceMappingURL=index.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["esbuild-sass-plugin:css-chunk:src/hooks/use-tooltip-portal-relocator.module.scss","esbuild-sass-plugin:css-chunk:src/components/legend/private/base-legend.module.scss"],"sourcesContent":[".a8ccharts-jCw5dQ {\n position: fixed;\n inset: 0;\n overflow: visible;\n z-index: 1;\n pointer-events: none;\n}",".a8ccharts-AELBvX {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 16px;\n}\n.a8ccharts-fX8uQe {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.a8ccharts-fX8uQe.a8ccharts-DEe0wg {\n align-items: flex-start;\n}\n.a8ccharts-fX8uQe.a8ccharts-WBKF9I {\n align-items: center;\n}\n.a8ccharts-fX8uQe.a8ccharts-JfwMng {\n align-items: flex-end;\n}\n.a8ccharts-8Y73Kh {\n position: relative;\n}\n.a8ccharts-8Y73Kh.a8ccharts-DEe0wg {\n justify-content: flex-start;\n}\n.a8ccharts-8Y73Kh.a8ccharts-WBKF9I {\n justify-content: center;\n}\n.a8ccharts-8Y73Kh.a8ccharts-JfwMng {\n justify-content: flex-end;\n}\n.a8ccharts-TVM-IY {\n position: relative;\n}\n.a8ccharts-TVM-IY.a8ccharts-DEe0wg {\n justify-content: flex-start;\n}\n.a8ccharts-TVM-IY.a8ccharts-WBKF9I {\n justify-content: center;\n}\n.a8ccharts-TVM-IY.a8ccharts-JfwMng {\n justify-content: flex-end;\n}\n\n.a8ccharts-Vflwq8 {\n display: flex;\n align-items: center;\n font-size: 0.875rem;\n}\n.a8ccharts-qGsavM {\n cursor: pointer;\n user-select: none;\n transition: opacity 0.2s ease;\n}\n.a8ccharts-qGsavM:hover {\n opacity: 0.8;\n}\n.a8ccharts-qGsavM:focus {\n outline: 2px solid currentColor;\n outline-offset: 2px;\n border-radius: 4px;\n}\n.a8ccharts-qGsavM:focus:not(:focus-visible) {\n outline: none;\n}\n.a8ccharts-ZtDY-Q {\n opacity: 0.4;\n}\n.a8ccharts-ZtDY-Q .a8ccharts-2H65Kr {\n text-decoration: line-through;\n}\n\n.a8ccharts-2H65Kr {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n /* Text wrapping is handled at the text level, not the label container */\n}\n\n.a8ccharts-faSDBI {\n overflow-wrap: break-word;\n white-space: normal;\n hyphens: auto;\n}\n.a8ccharts-FISUIO {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex-shrink: 1;\n min-width: 0;\n}\n\n.a8ccharts-DTZlT- {\n font-weight: 500;\n flex-shrink: 0;\n}"],"mappings":";AAAA,CAAC;AACC,YAAU;AACV,SAAO;AACP,YAAU;AACV,WAAS;AACT,kBAAgB;AAClB;;;ACNA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,aAAW;AACX,OAAK;AACP;AACA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,OAAK;AACP;AACA,CALC,gBAKgB,CAAC;AAChB,eAAa;AACf;AACA,CARC,gBAQgB,CAAC;AAChB,eAAa;AACf;AACA,CAXC,gBAWgB,CAAC;AAChB,eAAa;AACf;AACA,CAAC;AACC,YAAU;AACZ;AACA,CAHC,gBAGgB,CAZC;AAahB,mBAAiB;AACnB;AACA,CANC,gBAMgB,CAZC;AAahB,mBAAiB;AACnB;AACA,CATC,gBASgB,CAZC;AAahB,mBAAiB;AACnB;AACA,CAAC;AACC,YAAU;AACZ;AACA,CAHC,gBAGgB,CAxBC;AAyBhB,mBAAiB;AACnB;AACA,CANC,gBAMgB,CAxBC;AAyBhB,mBAAiB;AACnB;AACA,CATC,gBASgB,CAxBC;AAyBhB,mBAAiB;AACnB;AAEA,CAAC;AACC,WAAS;AACT,eAAa;AACb,aAAW;AACb;AACA,CAAC;AACC,UAAQ;AACR,eAAa;AACb,cAAY,QAAQ,KAAK;AAC3B;AACA,CALC,gBAKgB;AACf,WAAS;AACX;AACA,CARC,gBAQgB;AACf,WAAS,IAAI,MAAM;AACnB,kBAAgB;AAChB,iBAAe;AACjB;AACA,CAbC,gBAagB,MAAM,KAAK;AAC1B,WAAS;AACX;AACA,CAAC;AACC,WAAS;AACX;AACA,CAHC,iBAGiB,CAAC;AACjB,mBAAiB;AACnB;AAEA,CAJmB;AAKjB,WAAS;AACT,eAAa;AACb,OAAK;AAEP;AAEA,CAAC;AACC,iBAAe;AACf,eAAa;AACb,WAAS;AACX;AACA,CAAC;AACC,eAAa;AACb,YAAU;AACV,iBAAe;AACf,eAAa;AACb,aAAW;AACb;AAEA,CAAC;AACC,eAAa;AACb,eAAa;AACf;","names":[]}
1
+ {"version":3,"sources":["esbuild-sass-plugin:css-chunk:src/hooks/use-tooltip-portal-relocator.module.scss"],"sourcesContent":[".a8ccharts-jCw5dQ {\n position: fixed;\n inset: 0;\n overflow: visible;\n z-index: 1;\n pointer-events: none;\n}"],"mappings":";AAAA,CAAC;AACC,YAAU;AACV,SAAO;AACP,YAAU;AACV,WAAS;AACT,kBAAgB;AAClB;","names":[]}
@@ -1,7 +1,7 @@
1
- export { C as ChartRegistration, E as ElementStyles, c as GetElementStylesParams, G as GlobalChartsContext, e as GlobalChartsContextValue, a as GlobalChartsProvider, d as defaultTheme, u as useGlobalChartsContext, b as useGlobalChartsTheme } from '../themes-CVR5rmIs.cjs';
2
- import { B as BaseLegendItem } from '../types-C05PdDJa.cjs';
1
+ export { C as ChartRegistration, E as ElementStyles, c as GetElementStylesParams, G as GlobalChartsContext, e as GlobalChartsContextValue, a as GlobalChartsProvider, d as defaultTheme, u as useGlobalChartsContext, b as useGlobalChartsTheme } from '../themes-D0qc5JaW.cjs';
2
+ import { B as BaseLegendItem } from '../types-Dfw9VOKI.cjs';
3
3
  import 'react';
4
- import '../types-CzdN7rUe.cjs';
4
+ import '../types-ChOUI9-N.cjs';
5
5
  import '@visx/annotation/lib/components/CircleSubject';
6
6
  import '@visx/annotation/lib/components/Connector';
7
7
  import '@visx/annotation/lib/components/Label';
@@ -1,7 +1,7 @@
1
- export { C as ChartRegistration, E as ElementStyles, c as GetElementStylesParams, G as GlobalChartsContext, e as GlobalChartsContextValue, a as GlobalChartsProvider, d as defaultTheme, u as useGlobalChartsContext, b as useGlobalChartsTheme } from '../themes-DQzmaSze.js';
2
- import { B as BaseLegendItem } from '../types-C05PdDJa.js';
1
+ export { C as ChartRegistration, E as ElementStyles, c as GetElementStylesParams, G as GlobalChartsContext, e as GlobalChartsContextValue, a as GlobalChartsProvider, d as defaultTheme, u as useGlobalChartsContext, b as useGlobalChartsTheme } from '../themes-itO4Ht5g.js';
2
+ import { B as BaseLegendItem } from '../types-BuSrRM4p.js';
3
3
  import 'react';
4
- import '../types-CzdN7rUe.js';
4
+ import '../types-ChOUI9-N.js';
5
5
  import '@visx/annotation/lib/components/CircleSubject';
6
6
  import '@visx/annotation/lib/components/Connector';
7
7
  import '@visx/annotation/lib/components/Label';
@@ -6,8 +6,8 @@ import {
6
6
  useChartRegistration,
7
7
  useGlobalChartsContext,
8
8
  useGlobalChartsTheme
9
- } from "../chunk-RFSHE3HL.js";
10
- import "../chunk-TE63Y5PX.js";
9
+ } from "../chunk-2I67QUIV.js";
10
+ import "../chunk-JJIMABHT.js";
11
11
  import "../chunk-G3PMV62Z.js";
12
12
  export {
13
13
  GlobalChartsContext,
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, CSSProperties, FC } from 'react';
3
- import { b as CompleteChartTheme, j as SeriesData, d as DataPointPercentage, C as ChartTheme } from './types-CzdN7rUe.cjs';
4
- import { B as BaseLegendItem } from './types-C05PdDJa.cjs';
3
+ import { c as CompleteChartTheme, o as SeriesData, e as DataPointPercentage, b as ChartTheme } from './types-ChOUI9-N.cjs';
4
+ import { B as BaseLegendItem } from './types-Dfw9VOKI.cjs';
5
5
  import { LegendShape } from '@visx/legend/lib/types';
6
6
  import { LineStyles, GlyphProps } from '@visx/xychart';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, CSSProperties, FC } from 'react';
3
- import { b as CompleteChartTheme, j as SeriesData, d as DataPointPercentage, C as ChartTheme } from './types-CzdN7rUe.js';
4
- import { B as BaseLegendItem } from './types-C05PdDJa.js';
3
+ import { c as CompleteChartTheme, o as SeriesData, e as DataPointPercentage, b as ChartTheme } from './types-ChOUI9-N.js';
4
+ import { B as BaseLegendItem } from './types-BuSrRM4p.js';
5
5
  import { LegendShape } from '@visx/legend/lib/types';
6
6
  import { LineStyles, GlyphProps } from '@visx/xychart';
7
7
 
@@ -1,4 +1,4 @@
1
- import { L as Legend } from './legend-C9ahiwOt.cjs';
1
+ import { L as Legend } from './legend-DFkosEvC.cjs';
2
2
  import { ComponentType, FC, PropsWithChildren } from 'react';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { L as Legend } from './legend-jjMmhSg3.js';
1
+ import { L as Legend } from './legend-DLswHhOk.js';
2
2
  import { ComponentType, FC, PropsWithChildren } from 'react';
3
3
 
4
4
  /**
@@ -1,32 +1,24 @@
1
1
  import { LegendOrdinal } from '@visx/legend';
2
+ import { j as LegendPosition, h as LegendItemStyles, i as LegendLabelStyles, k as LegendShapeStyles } from './types-ChOUI9-N.js';
2
3
  import { GlyphProps, LineStyles } from '@visx/xychart';
3
4
  import { ComponentProps, ReactNode, CSSProperties } from 'react';
4
5
 
5
- type LegendOrdinalProps = Omit<ComponentProps<typeof LegendOrdinal>, 'scale' | 'direction'>;
6
- type BaseLegendProps = Omit<LegendOrdinalProps, 'shapeStyle'> & {
6
+ type VisxLegendProps = Pick<ComponentProps<typeof LegendOrdinal>, 'className' | 'shape' | 'fill' | 'size' | 'labelFormat' | 'labelTransform'>;
7
+ type BaseLegendProps = VisxLegendProps & {
7
8
  items: BaseLegendItem[];
8
9
  orientation?: 'horizontal' | 'vertical';
9
- /**
10
- * TODO: Add 'left' | 'right' positioning support in future implementation
11
- */
12
- position?: 'top' | 'bottom';
10
+ position?: LegendPosition;
13
11
  alignment?: 'start' | 'center' | 'end';
14
- /**
15
- * Maximum width for legend items. When set, text overflow behavior is controlled by textOverflow prop.
16
- * Should be a CSS value string (e.g. '200px', '50%', '10rem')
17
- */
18
- maxWidth?: string;
19
- /**
20
- * Controls how text behaves when it exceeds maxWidth.
21
- * - 'ellipsis': Truncate with ellipsis (ideal for widgets/small devices)
22
- * - 'wrap': Wrap text to multiple lines (default, ideal for larger displays)
23
- */
24
- textOverflow?: 'ellipsis' | 'wrap';
25
- /**
26
- * Additional CSS class name for legend items.
27
- * This allows consumers to customize individual legend item styling.
28
- */
29
- legendItemClassName?: string;
12
+ /** Additional CSS class name for legend items. */
13
+ itemClassName?: string;
14
+ /** CSS styles for each legend item (margin, flexDirection). */
15
+ itemStyles?: LegendItemStyles;
16
+ /** Additional CSS class name for legend labels. */
17
+ labelClassName?: string;
18
+ /** CSS styles for legend labels (justifyContent, flex, margin). */
19
+ labelStyles?: LegendLabelStyles;
20
+ /** Styles for legend shapes (width, height, margin). */
21
+ shapeStyles?: LegendShapeStyles;
30
22
  /**
31
23
  * Function for rendering a custom legend layout.
32
24
  */
@@ -47,7 +39,7 @@ type LegendProps = Omit<BaseLegendProps, 'items'> & {
47
39
  };
48
40
  type BaseLegendItem = {
49
41
  label: string;
50
- value: number | string;
42
+ value?: number | string;
51
43
  color: string;
52
44
  glyphSize?: number;
53
45
  renderGlyph?: <Datum extends object>(props: GlyphProps<Datum>) => ReactNode;
@@ -8,7 +8,7 @@ import { ScaleType, ScaleInput } from '@visx/scale';
8
8
  import { TextProps } from '@visx/text/lib/Text';
9
9
  import { EventHandlerParams, LineStyles, GridStyles, GlyphProps } from '@visx/xychart';
10
10
  import { GapSize } from '@wordpress/theme';
11
- import { PointerEvent, ReactNode, CSSProperties } from 'react';
11
+ import { PointerEvent, CSSProperties, ReactNode } from 'react';
12
12
  import { GoogleDataTableColumn, GoogleDataTableRow } from 'react-google-charts';
13
13
 
14
14
  type ValueOf<T> = T[keyof T];
@@ -192,14 +192,17 @@ type ChartTheme = {
192
192
  xAxisLineStyles?: LineStyles;
193
193
  /** Styles for series lines */
194
194
  seriesLineStyles?: LineStyles[];
195
- /** Styles for legend shapes */
196
- legendShapeStyles?: Record<string, unknown>[];
197
195
  /** Array of render functions for glyphs */
198
196
  glyphs?: Array<(<Datum extends object>(props: GlyphProps<Datum>) => ReactNode)>;
199
- /** Styles for legend labels */
200
- legendLabelStyles?: CSSProperties;
201
- /** Styles for legend container */
202
- legendContainerStyles?: CSSProperties;
197
+ /** Legend specific settings */
198
+ legend?: {
199
+ /** Styles for legend shapes */
200
+ shapeStyles?: Record<string, unknown>[];
201
+ /** Styles for legend labels */
202
+ labelStyles?: CSSProperties;
203
+ /** Styles for legend container */
204
+ containerStyles?: CSSProperties;
205
+ };
203
206
  /** Styles for small SVG text (eg. axis tick labels), passed through to the XYChart theme. */
204
207
  svgLabelSmall?: TextProps;
205
208
  annotationStyles?: AnnotationStyles;
@@ -260,6 +263,7 @@ type CompleteChartTheme = Required<ChartTheme> & {
260
263
  lineChart: {
261
264
  lineStyles: Record<NonNullable<SeriesDataOptions['type']>, LineStyles>;
262
265
  };
266
+ legend: Required<NonNullable<ChartTheme['legend']>>;
263
267
  sparkline: Required<NonNullable<ChartTheme['sparkline']>> & {
264
268
  margin: Required<NonNullable<ChartTheme['sparkline']>['margin']>;
265
269
  };
@@ -318,6 +322,81 @@ type ScaleOptions = {
318
322
  */
319
323
  paddingOuter?: number;
320
324
  };
325
+ type LegendItemStyles = {
326
+ /** Margin around each legend item. */
327
+ margin?: CSSProperties['margin'];
328
+ /** Flex direction for items within each legend entry. */
329
+ flexDirection?: 'row' | 'row-reverse' | 'column' | 'column-reverse';
330
+ };
331
+ type LegendLabelStyles = Pick<CSSProperties, 'justifyContent' | 'flex' | 'margin'> & {
332
+ /**
333
+ * Maximum width for legend label text as a CSS value (e.g. '200px', '50%', '10rem').
334
+ * When set, text overflow behavior is controlled by textOverflow.
335
+ */
336
+ maxWidth?: string;
337
+ /**
338
+ * Controls how text behaves when it exceeds maxWidth.
339
+ * - 'ellipsis': Truncate with ellipsis (ideal for widgets/small devices)
340
+ * - 'wrap': Wrap text to multiple lines (default, ideal for larger displays)
341
+ */
342
+ textOverflow?: 'ellipsis' | 'wrap';
343
+ };
344
+ type LegendShapeStyles = {
345
+ /** Width of the legend shape in pixels. */
346
+ width?: number;
347
+ /** Height of the legend shape in pixels. */
348
+ height?: number;
349
+ /** Margin around the legend shape. */
350
+ margin?: CSSProperties['margin'];
351
+ };
352
+ /** Position of the legend relative to chart content. */
353
+ type LegendPosition = 'top' | 'bottom';
354
+ /**
355
+ * Configuration object for chart legend appearance and behavior.
356
+ * Consolidates all legend styling and layout props into a single structured object.
357
+ */
358
+ type ChartLegendConfig<T = DataPoint | DataPointDate | LeaderboardEntry> = {
359
+ /**
360
+ * Layout direction of legend items.
361
+ */
362
+ orientation?: 'horizontal' | 'vertical';
363
+ /**
364
+ * Position of the legend relative to the chart.
365
+ * TODO: Add 'left' | 'right' positioning support in future implementation
366
+ */
367
+ position?: LegendPosition;
368
+ /**
369
+ * Alignment of the legend within its position.
370
+ */
371
+ alignment?: 'start' | 'center' | 'end';
372
+ /**
373
+ * Shape of the legend marker icon.
374
+ */
375
+ shape?: LegendShape<T, number>;
376
+ /**
377
+ * Enable interactive legend items that can toggle series visibility.
378
+ * Supported for all chart types that render series.
379
+ * Requires chartId and GlobalChartsProvider.
380
+ * For pie charts, percentages are recalculated so visible segments total 100%.
381
+ */
382
+ interactive?: boolean;
383
+ /**
384
+ * Additional CSS class name for individual legend items.
385
+ */
386
+ itemClassName?: string;
387
+ /**
388
+ * CSS styles for each legend item (margin, flexDirection).
389
+ */
390
+ itemStyles?: LegendItemStyles;
391
+ /**
392
+ * CSS styles for legend labels (maxWidth, textOverflow, justifyContent, flex, margin).
393
+ */
394
+ labelStyles?: LegendLabelStyles;
395
+ /**
396
+ * Styles for legend shapes (width, height, margin).
397
+ */
398
+ shapeStyles?: LegendShapeStyles;
399
+ };
321
400
  /**
322
401
  * Base properties shared across all chart components
323
402
  */
@@ -382,45 +461,10 @@ type BaseChartProps<T = DataPoint | DataPointDate | LeaderboardEntry> = {
382
461
  */
383
462
  showLegend?: boolean;
384
463
  /**
385
- * Legend orientation
386
- */
387
- legendOrientation?: 'horizontal' | 'vertical';
388
- /**
389
- * Legend shape
390
- */
391
- legendShape?: LegendShape<T, number>;
392
- /**
393
- * Legend position (where the legend appears)
394
- * TODO: Add 'left' | 'right' positioning support in future implementation
395
- */
396
- legendPosition?: 'top' | 'bottom';
397
- /**
398
- * Legend alignment within its position
399
- */
400
- legendAlignment?: 'start' | 'center' | 'end';
401
- /**
402
- * Maximum width for legend items. When set, text overflow behavior is controlled by legendTextOverflow.
403
- * Should be a CSS value string (e.g. '200px', '50%', '10rem')
404
- */
405
- legendMaxWidth?: string;
406
- /**
407
- * Controls how text behaves when it exceeds legendMaxWidth.
408
- * - 'ellipsis': Truncate with ellipsis (ideal for widgets/small devices)
409
- * - 'wrap': Wrap text to multiple lines (default, ideal for larger displays)
410
- */
411
- legendTextOverflow?: 'ellipsis' | 'wrap';
412
- /**
413
- * Additional CSS class name for legend items.
414
- * This allows consumers to customize individual legend item styling.
415
- */
416
- legendItemClassName?: string;
417
- /**
418
- * Enable interactive legend items that can toggle series visibility.
419
- * Supported for LineChart, PieChart, and PieSemiCircleChart.
420
- * Requires chartId and GlobalChartsProvider.
421
- * For pie charts, percentages are recalculated so visible segments total 100%.
464
+ * Legend configuration object for controlling legend appearance and behavior.
465
+ * Includes orientation, position, alignment, shape, styling, and interactivity options.
422
466
  */
423
- legendInteractive?: boolean;
467
+ legend?: ChartLegendConfig<T>;
424
468
  /**
425
469
  * Grid visibility. x is default when orientation is vertical. y is default when orientation is horizontal.
426
470
  */
@@ -498,4 +542,4 @@ interface ToggleEvent extends Event {
498
542
  oldState: 'open' | 'closed';
499
543
  }
500
544
 
501
- export type { AnnotationStyles as A, BaseChartProps as B, ChartTheme as C, DataPoint as D, GeoData as G, LeaderboardEntry as L, MultipleDataPointsDate as M, Optional as O, PopoverButtonAttributes as P, ScaleOptions as S, ToggleEvent as T, ButtonWithPopover as a, CompleteChartTheme as b, DataPointDate as c, DataPointPercentage as d, GradientStop as e, GridProps as f, OrientationType as g, PopoverElement as h, PopoverElementAttributes as i, SeriesData as j, SeriesDataOptions as k };
545
+ export type { AnnotationStyles as A, BaseChartProps as B, ChartLegendConfig as C, DataPoint as D, GeoData as G, LeaderboardEntry as L, MultipleDataPointsDate as M, Optional as O, PopoverButtonAttributes as P, ScaleOptions as S, ToggleEvent as T, ButtonWithPopover as a, ChartTheme as b, CompleteChartTheme as c, DataPointDate as d, DataPointPercentage as e, GradientStop as f, GridProps as g, LegendItemStyles as h, LegendLabelStyles as i, LegendPosition as j, LegendShapeStyles as k, OrientationType as l, PopoverElement as m, PopoverElementAttributes as n, SeriesData as o, SeriesDataOptions as p };
@@ -8,7 +8,7 @@ import { ScaleType, ScaleInput } from '@visx/scale';
8
8
  import { TextProps } from '@visx/text/lib/Text';
9
9
  import { EventHandlerParams, LineStyles, GridStyles, GlyphProps } from '@visx/xychart';
10
10
  import { GapSize } from '@wordpress/theme';
11
- import { PointerEvent, ReactNode, CSSProperties } from 'react';
11
+ import { PointerEvent, CSSProperties, ReactNode } from 'react';
12
12
  import { GoogleDataTableColumn, GoogleDataTableRow } from 'react-google-charts';
13
13
 
14
14
  type ValueOf<T> = T[keyof T];
@@ -192,14 +192,17 @@ type ChartTheme = {
192
192
  xAxisLineStyles?: LineStyles;
193
193
  /** Styles for series lines */
194
194
  seriesLineStyles?: LineStyles[];
195
- /** Styles for legend shapes */
196
- legendShapeStyles?: Record<string, unknown>[];
197
195
  /** Array of render functions for glyphs */
198
196
  glyphs?: Array<(<Datum extends object>(props: GlyphProps<Datum>) => ReactNode)>;
199
- /** Styles for legend labels */
200
- legendLabelStyles?: CSSProperties;
201
- /** Styles for legend container */
202
- legendContainerStyles?: CSSProperties;
197
+ /** Legend specific settings */
198
+ legend?: {
199
+ /** Styles for legend shapes */
200
+ shapeStyles?: Record<string, unknown>[];
201
+ /** Styles for legend labels */
202
+ labelStyles?: CSSProperties;
203
+ /** Styles for legend container */
204
+ containerStyles?: CSSProperties;
205
+ };
203
206
  /** Styles for small SVG text (eg. axis tick labels), passed through to the XYChart theme. */
204
207
  svgLabelSmall?: TextProps;
205
208
  annotationStyles?: AnnotationStyles;
@@ -260,6 +263,7 @@ type CompleteChartTheme = Required<ChartTheme> & {
260
263
  lineChart: {
261
264
  lineStyles: Record<NonNullable<SeriesDataOptions['type']>, LineStyles>;
262
265
  };
266
+ legend: Required<NonNullable<ChartTheme['legend']>>;
263
267
  sparkline: Required<NonNullable<ChartTheme['sparkline']>> & {
264
268
  margin: Required<NonNullable<ChartTheme['sparkline']>['margin']>;
265
269
  };
@@ -318,6 +322,81 @@ type ScaleOptions = {
318
322
  */
319
323
  paddingOuter?: number;
320
324
  };
325
+ type LegendItemStyles = {
326
+ /** Margin around each legend item. */
327
+ margin?: CSSProperties['margin'];
328
+ /** Flex direction for items within each legend entry. */
329
+ flexDirection?: 'row' | 'row-reverse' | 'column' | 'column-reverse';
330
+ };
331
+ type LegendLabelStyles = Pick<CSSProperties, 'justifyContent' | 'flex' | 'margin'> & {
332
+ /**
333
+ * Maximum width for legend label text as a CSS value (e.g. '200px', '50%', '10rem').
334
+ * When set, text overflow behavior is controlled by textOverflow.
335
+ */
336
+ maxWidth?: string;
337
+ /**
338
+ * Controls how text behaves when it exceeds maxWidth.
339
+ * - 'ellipsis': Truncate with ellipsis (ideal for widgets/small devices)
340
+ * - 'wrap': Wrap text to multiple lines (default, ideal for larger displays)
341
+ */
342
+ textOverflow?: 'ellipsis' | 'wrap';
343
+ };
344
+ type LegendShapeStyles = {
345
+ /** Width of the legend shape in pixels. */
346
+ width?: number;
347
+ /** Height of the legend shape in pixels. */
348
+ height?: number;
349
+ /** Margin around the legend shape. */
350
+ margin?: CSSProperties['margin'];
351
+ };
352
+ /** Position of the legend relative to chart content. */
353
+ type LegendPosition = 'top' | 'bottom';
354
+ /**
355
+ * Configuration object for chart legend appearance and behavior.
356
+ * Consolidates all legend styling and layout props into a single structured object.
357
+ */
358
+ type ChartLegendConfig<T = DataPoint | DataPointDate | LeaderboardEntry> = {
359
+ /**
360
+ * Layout direction of legend items.
361
+ */
362
+ orientation?: 'horizontal' | 'vertical';
363
+ /**
364
+ * Position of the legend relative to the chart.
365
+ * TODO: Add 'left' | 'right' positioning support in future implementation
366
+ */
367
+ position?: LegendPosition;
368
+ /**
369
+ * Alignment of the legend within its position.
370
+ */
371
+ alignment?: 'start' | 'center' | 'end';
372
+ /**
373
+ * Shape of the legend marker icon.
374
+ */
375
+ shape?: LegendShape<T, number>;
376
+ /**
377
+ * Enable interactive legend items that can toggle series visibility.
378
+ * Supported for all chart types that render series.
379
+ * Requires chartId and GlobalChartsProvider.
380
+ * For pie charts, percentages are recalculated so visible segments total 100%.
381
+ */
382
+ interactive?: boolean;
383
+ /**
384
+ * Additional CSS class name for individual legend items.
385
+ */
386
+ itemClassName?: string;
387
+ /**
388
+ * CSS styles for each legend item (margin, flexDirection).
389
+ */
390
+ itemStyles?: LegendItemStyles;
391
+ /**
392
+ * CSS styles for legend labels (maxWidth, textOverflow, justifyContent, flex, margin).
393
+ */
394
+ labelStyles?: LegendLabelStyles;
395
+ /**
396
+ * Styles for legend shapes (width, height, margin).
397
+ */
398
+ shapeStyles?: LegendShapeStyles;
399
+ };
321
400
  /**
322
401
  * Base properties shared across all chart components
323
402
  */
@@ -382,45 +461,10 @@ type BaseChartProps<T = DataPoint | DataPointDate | LeaderboardEntry> = {
382
461
  */
383
462
  showLegend?: boolean;
384
463
  /**
385
- * Legend orientation
386
- */
387
- legendOrientation?: 'horizontal' | 'vertical';
388
- /**
389
- * Legend shape
390
- */
391
- legendShape?: LegendShape<T, number>;
392
- /**
393
- * Legend position (where the legend appears)
394
- * TODO: Add 'left' | 'right' positioning support in future implementation
395
- */
396
- legendPosition?: 'top' | 'bottom';
397
- /**
398
- * Legend alignment within its position
399
- */
400
- legendAlignment?: 'start' | 'center' | 'end';
401
- /**
402
- * Maximum width for legend items. When set, text overflow behavior is controlled by legendTextOverflow.
403
- * Should be a CSS value string (e.g. '200px', '50%', '10rem')
404
- */
405
- legendMaxWidth?: string;
406
- /**
407
- * Controls how text behaves when it exceeds legendMaxWidth.
408
- * - 'ellipsis': Truncate with ellipsis (ideal for widgets/small devices)
409
- * - 'wrap': Wrap text to multiple lines (default, ideal for larger displays)
410
- */
411
- legendTextOverflow?: 'ellipsis' | 'wrap';
412
- /**
413
- * Additional CSS class name for legend items.
414
- * This allows consumers to customize individual legend item styling.
415
- */
416
- legendItemClassName?: string;
417
- /**
418
- * Enable interactive legend items that can toggle series visibility.
419
- * Supported for LineChart, PieChart, and PieSemiCircleChart.
420
- * Requires chartId and GlobalChartsProvider.
421
- * For pie charts, percentages are recalculated so visible segments total 100%.
464
+ * Legend configuration object for controlling legend appearance and behavior.
465
+ * Includes orientation, position, alignment, shape, styling, and interactivity options.
422
466
  */
423
- legendInteractive?: boolean;
467
+ legend?: ChartLegendConfig<T>;
424
468
  /**
425
469
  * Grid visibility. x is default when orientation is vertical. y is default when orientation is horizontal.
426
470
  */
@@ -498,4 +542,4 @@ interface ToggleEvent extends Event {
498
542
  oldState: 'open' | 'closed';
499
543
  }
500
544
 
501
- export type { AnnotationStyles as A, BaseChartProps as B, ChartTheme as C, DataPoint as D, GeoData as G, LeaderboardEntry as L, MultipleDataPointsDate as M, Optional as O, PopoverButtonAttributes as P, ScaleOptions as S, ToggleEvent as T, ButtonWithPopover as a, CompleteChartTheme as b, DataPointDate as c, DataPointPercentage as d, GradientStop as e, GridProps as f, OrientationType as g, PopoverElement as h, PopoverElementAttributes as i, SeriesData as j, SeriesDataOptions as k };
545
+ export type { AnnotationStyles as A, BaseChartProps as B, ChartLegendConfig as C, DataPoint as D, GeoData as G, LeaderboardEntry as L, MultipleDataPointsDate as M, Optional as O, PopoverButtonAttributes as P, ScaleOptions as S, ToggleEvent as T, ButtonWithPopover as a, ChartTheme as b, CompleteChartTheme as c, DataPointDate as d, DataPointPercentage as e, GradientStop as f, GridProps as g, LegendItemStyles as h, LegendLabelStyles as i, LegendPosition as j, LegendShapeStyles as k, OrientationType as l, PopoverElement as m, PopoverElementAttributes as n, SeriesData as o, SeriesDataOptions as p };