@automattic/charts 0.58.0 → 1.0.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 (253) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +7 -54
  3. package/dist/index.cjs +9606 -22
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.css +20 -25
  6. package/dist/index.css.map +1 -1
  7. package/dist/index.d.cts +1612 -33
  8. package/dist/index.d.ts +1612 -33
  9. package/dist/index.js +9640 -56
  10. package/dist/index.js.map +1 -1
  11. package/package.json +8 -125
  12. package/src/charts/bar-chart/bar-chart.module.scss +0 -5
  13. package/src/charts/bar-chart/bar-chart.tsx +131 -137
  14. package/src/charts/leaderboard-chart/leaderboard-chart.tsx +23 -40
  15. package/src/charts/line-chart/line-chart.module.scss +0 -5
  16. package/src/charts/line-chart/line-chart.tsx +190 -183
  17. package/src/charts/line-chart/private/line-chart-annotations-overlay.tsx +1 -2
  18. package/src/charts/pie-chart/pie-chart.module.scss +2 -10
  19. package/src/charts/pie-chart/pie-chart.tsx +198 -199
  20. package/src/charts/pie-chart/test/composition-api.test.tsx +3 -3
  21. package/src/charts/pie-chart/test/pie-chart.test.tsx +42 -35
  22. package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.module.scss +2 -8
  23. package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx +155 -155
  24. package/src/charts/pie-semi-circle-chart/test/pie-semi-circle-chart.test.tsx +25 -25
  25. package/src/charts/private/chart-layout/chart-layout.module.scss +7 -0
  26. package/src/charts/private/chart-layout/chart-layout.tsx +106 -0
  27. package/src/charts/private/chart-layout/index.ts +2 -0
  28. package/src/charts/private/chart-layout/test/chart-layout.test.tsx +167 -0
  29. package/src/charts/private/single-chart-context/single-chart-context.tsx +2 -2
  30. package/src/charts/private/svg-empty-state/index.ts +1 -0
  31. package/src/charts/private/svg-empty-state/svg-empty-state.module.scss +7 -0
  32. package/src/charts/private/svg-empty-state/svg-empty-state.tsx +40 -0
  33. package/src/components/legend/hooks/test/use-chart-legend-items.test.tsx +12 -8
  34. package/src/components/legend/hooks/use-chart-legend-items.ts +12 -13
  35. package/src/components/legend/legend.tsx +33 -8
  36. package/src/components/legend/test/legend.test.tsx +93 -1
  37. package/src/hooks/index.ts +1 -0
  38. package/src/hooks/use-data-with-percentages.ts +24 -0
  39. package/src/hooks/use-interactive-legend-data.ts +18 -15
  40. package/src/index.ts +65 -2
  41. package/src/providers/chart-context/global-charts-provider.tsx +7 -1
  42. package/src/providers/chart-context/hooks/use-chart-registration.ts +2 -1
  43. package/src/providers/chart-context/types.ts +2 -2
  44. package/src/types.ts +27 -7
  45. package/src/utils/test/resolve-css-var.test.ts +2 -0
  46. package/dist/base-tooltip-DOq93wjU.d.cts +0 -38
  47. package/dist/base-tooltip-DOq93wjU.d.ts +0 -38
  48. package/dist/charts/bar-chart/index.cjs +0 -17
  49. package/dist/charts/bar-chart/index.cjs.map +0 -1
  50. package/dist/charts/bar-chart/index.css +0 -141
  51. package/dist/charts/bar-chart/index.css.map +0 -1
  52. package/dist/charts/bar-chart/index.d.cts +0 -36
  53. package/dist/charts/bar-chart/index.d.ts +0 -36
  54. package/dist/charts/bar-chart/index.js +0 -17
  55. package/dist/charts/bar-chart/index.js.map +0 -1
  56. package/dist/charts/bar-list-chart/index.cjs +0 -18
  57. package/dist/charts/bar-list-chart/index.cjs.map +0 -1
  58. package/dist/charts/bar-list-chart/index.css +0 -141
  59. package/dist/charts/bar-list-chart/index.css.map +0 -1
  60. package/dist/charts/bar-list-chart/index.d.cts +0 -92
  61. package/dist/charts/bar-list-chart/index.d.ts +0 -92
  62. package/dist/charts/bar-list-chart/index.js +0 -18
  63. package/dist/charts/bar-list-chart/index.js.map +0 -1
  64. package/dist/charts/conversion-funnel-chart/index.cjs +0 -11
  65. package/dist/charts/conversion-funnel-chart/index.cjs.map +0 -1
  66. package/dist/charts/conversion-funnel-chart/index.css +0 -157
  67. package/dist/charts/conversion-funnel-chart/index.css.map +0 -1
  68. package/dist/charts/conversion-funnel-chart/index.d.cts +0 -97
  69. package/dist/charts/conversion-funnel-chart/index.d.ts +0 -97
  70. package/dist/charts/conversion-funnel-chart/index.js +0 -11
  71. package/dist/charts/conversion-funnel-chart/index.js.map +0 -1
  72. package/dist/charts/geo-chart/index.cjs +0 -13
  73. package/dist/charts/geo-chart/index.cjs.map +0 -1
  74. package/dist/charts/geo-chart/index.css +0 -23
  75. package/dist/charts/geo-chart/index.css.map +0 -1
  76. package/dist/charts/geo-chart/index.d.cts +0 -67
  77. package/dist/charts/geo-chart/index.d.ts +0 -67
  78. package/dist/charts/geo-chart/index.js +0 -13
  79. package/dist/charts/geo-chart/index.js.map +0 -1
  80. package/dist/charts/leaderboard-chart/index.cjs +0 -21
  81. package/dist/charts/leaderboard-chart/index.cjs.map +0 -1
  82. package/dist/charts/leaderboard-chart/index.css +0 -160
  83. package/dist/charts/leaderboard-chart/index.css.map +0 -1
  84. package/dist/charts/leaderboard-chart/index.d.cts +0 -46
  85. package/dist/charts/leaderboard-chart/index.d.ts +0 -46
  86. package/dist/charts/leaderboard-chart/index.js +0 -21
  87. package/dist/charts/leaderboard-chart/index.js.map +0 -1
  88. package/dist/charts/line-chart/index.cjs +0 -17
  89. package/dist/charts/line-chart/index.cjs.map +0 -1
  90. package/dist/charts/line-chart/index.css +0 -213
  91. package/dist/charts/line-chart/index.css.map +0 -1
  92. package/dist/charts/line-chart/index.d.cts +0 -98
  93. package/dist/charts/line-chart/index.d.ts +0 -98
  94. package/dist/charts/line-chart/index.js +0 -17
  95. package/dist/charts/line-chart/index.js.map +0 -1
  96. package/dist/charts/pie-chart/index.cjs +0 -19
  97. package/dist/charts/pie-chart/index.cjs.map +0 -1
  98. package/dist/charts/pie-chart/index.css +0 -131
  99. package/dist/charts/pie-chart/index.css.map +0 -1
  100. package/dist/charts/pie-chart/index.d.cts +0 -91
  101. package/dist/charts/pie-chart/index.d.ts +0 -91
  102. package/dist/charts/pie-chart/index.js +0 -19
  103. package/dist/charts/pie-chart/index.js.map +0 -1
  104. package/dist/charts/pie-semi-circle-chart/index.cjs +0 -18
  105. package/dist/charts/pie-semi-circle-chart/index.cjs.map +0 -1
  106. package/dist/charts/pie-semi-circle-chart/index.css +0 -132
  107. package/dist/charts/pie-semi-circle-chart/index.css.map +0 -1
  108. package/dist/charts/pie-semi-circle-chart/index.d.cts +0 -88
  109. package/dist/charts/pie-semi-circle-chart/index.d.ts +0 -88
  110. package/dist/charts/pie-semi-circle-chart/index.js +0 -18
  111. package/dist/charts/pie-semi-circle-chart/index.js.map +0 -1
  112. package/dist/charts/sparkline/index.cjs +0 -18
  113. package/dist/charts/sparkline/index.cjs.map +0 -1
  114. package/dist/charts/sparkline/index.css +0 -230
  115. package/dist/charts/sparkline/index.css.map +0 -1
  116. package/dist/charts/sparkline/index.d.cts +0 -113
  117. package/dist/charts/sparkline/index.d.ts +0 -113
  118. package/dist/charts/sparkline/index.js +0 -18
  119. package/dist/charts/sparkline/index.js.map +0 -1
  120. package/dist/chunk-2A34OA5O.cjs +0 -51
  121. package/dist/chunk-2A34OA5O.cjs.map +0 -1
  122. package/dist/chunk-2I67QUIV.js +0 -895
  123. package/dist/chunk-2I67QUIV.js.map +0 -1
  124. package/dist/chunk-2ICEEQOC.js +0 -1071
  125. package/dist/chunk-2ICEEQOC.js.map +0 -1
  126. package/dist/chunk-4B7BL2DD.js +0 -120
  127. package/dist/chunk-4B7BL2DD.js.map +0 -1
  128. package/dist/chunk-4OXMTKAL.js +0 -401
  129. package/dist/chunk-4OXMTKAL.js.map +0 -1
  130. package/dist/chunk-ASLARV7L.cjs +0 -81
  131. package/dist/chunk-ASLARV7L.cjs.map +0 -1
  132. package/dist/chunk-B6NLZFRW.js +0 -617
  133. package/dist/chunk-B6NLZFRW.js.map +0 -1
  134. package/dist/chunk-BBAUQOW6.cjs +0 -120
  135. package/dist/chunk-BBAUQOW6.cjs.map +0 -1
  136. package/dist/chunk-BPYKWMI7.js +0 -194
  137. package/dist/chunk-BPYKWMI7.js.map +0 -1
  138. package/dist/chunk-CMMHCTBX.cjs +0 -373
  139. package/dist/chunk-CMMHCTBX.cjs.map +0 -1
  140. package/dist/chunk-CPPXJATQ.cjs +0 -1071
  141. package/dist/chunk-CPPXJATQ.cjs.map +0 -1
  142. package/dist/chunk-DKU775VC.js +0 -219
  143. package/dist/chunk-DKU775VC.js.map +0 -1
  144. package/dist/chunk-GRA7Y2ZG.cjs +0 -401
  145. package/dist/chunk-GRA7Y2ZG.cjs.map +0 -1
  146. package/dist/chunk-I2276W3I.cjs +0 -66
  147. package/dist/chunk-I2276W3I.cjs.map +0 -1
  148. package/dist/chunk-JJIMABHT.js +0 -351
  149. package/dist/chunk-JJIMABHT.js.map +0 -1
  150. package/dist/chunk-KJHWXOCZ.js +0 -421
  151. package/dist/chunk-KJHWXOCZ.js.map +0 -1
  152. package/dist/chunk-KRWGSOJ2.js +0 -91
  153. package/dist/chunk-KRWGSOJ2.js.map +0 -1
  154. package/dist/chunk-KXRWNFQJ.js +0 -51
  155. package/dist/chunk-KXRWNFQJ.js.map +0 -1
  156. package/dist/chunk-LTFH7SEG.js +0 -373
  157. package/dist/chunk-LTFH7SEG.js.map +0 -1
  158. package/dist/chunk-MUNOKLLE.js +0 -165
  159. package/dist/chunk-MUNOKLLE.js.map +0 -1
  160. package/dist/chunk-MXGLYWVP.cjs +0 -351
  161. package/dist/chunk-MXGLYWVP.cjs.map +0 -1
  162. package/dist/chunk-OP6PHB2U.js +0 -81
  163. package/dist/chunk-OP6PHB2U.js.map +0 -1
  164. package/dist/chunk-OYC34VTO.cjs +0 -3957
  165. package/dist/chunk-OYC34VTO.cjs.map +0 -1
  166. package/dist/chunk-PQL5I3F6.cjs +0 -421
  167. package/dist/chunk-PQL5I3F6.cjs.map +0 -1
  168. package/dist/chunk-REZTQ4PH.cjs +0 -488
  169. package/dist/chunk-REZTQ4PH.cjs.map +0 -1
  170. package/dist/chunk-TZRUHQOH.cjs +0 -91
  171. package/dist/chunk-TZRUHQOH.cjs.map +0 -1
  172. package/dist/chunk-UTYVIOWZ.js +0 -3957
  173. package/dist/chunk-UTYVIOWZ.js.map +0 -1
  174. package/dist/chunk-W2LDIX26.cjs +0 -165
  175. package/dist/chunk-W2LDIX26.cjs.map +0 -1
  176. package/dist/chunk-WSG64BVN.cjs +0 -219
  177. package/dist/chunk-WSG64BVN.cjs.map +0 -1
  178. package/dist/chunk-WTQYGUNF.js +0 -400
  179. package/dist/chunk-WTQYGUNF.js.map +0 -1
  180. package/dist/chunk-WYK7EL5R.cjs +0 -895
  181. package/dist/chunk-WYK7EL5R.cjs.map +0 -1
  182. package/dist/chunk-XC4KHJYX.cjs +0 -617
  183. package/dist/chunk-XC4KHJYX.cjs.map +0 -1
  184. package/dist/chunk-XVBH5XHE.cjs +0 -400
  185. package/dist/chunk-XVBH5XHE.cjs.map +0 -1
  186. package/dist/chunk-XWYZIFZW.js +0 -66
  187. package/dist/chunk-XWYZIFZW.js.map +0 -1
  188. package/dist/chunk-Y3NNQMAX.cjs +0 -194
  189. package/dist/chunk-Y3NNQMAX.cjs.map +0 -1
  190. package/dist/chunk-YAFQVVDI.js +0 -488
  191. package/dist/chunk-YAFQVVDI.js.map +0 -1
  192. package/dist/components/legend/index.cjs +0 -12
  193. package/dist/components/legend/index.cjs.map +0 -1
  194. package/dist/components/legend/index.css +0 -91
  195. package/dist/components/legend/index.css.map +0 -1
  196. package/dist/components/legend/index.d.cts +0 -37
  197. package/dist/components/legend/index.d.ts +0 -37
  198. package/dist/components/legend/index.js +0 -12
  199. package/dist/components/legend/index.js.map +0 -1
  200. package/dist/components/tooltip/index.cjs +0 -12
  201. package/dist/components/tooltip/index.cjs.map +0 -1
  202. package/dist/components/tooltip/index.css +0 -13
  203. package/dist/components/tooltip/index.css.map +0 -1
  204. package/dist/components/tooltip/index.d.cts +0 -71
  205. package/dist/components/tooltip/index.d.ts +0 -71
  206. package/dist/components/tooltip/index.js +0 -12
  207. package/dist/components/tooltip/index.js.map +0 -1
  208. package/dist/components/trend-indicator/index.cjs +0 -8
  209. package/dist/components/trend-indicator/index.cjs.map +0 -1
  210. package/dist/components/trend-indicator/index.css +0 -27
  211. package/dist/components/trend-indicator/index.css.map +0 -1
  212. package/dist/components/trend-indicator/index.d.cts +0 -44
  213. package/dist/components/trend-indicator/index.d.ts +0 -44
  214. package/dist/components/trend-indicator/index.js +0 -8
  215. package/dist/components/trend-indicator/index.js.map +0 -1
  216. package/dist/format-metric-value-MXm5DtQ_.d.cts +0 -24
  217. package/dist/format-metric-value-MXm5DtQ_.d.ts +0 -24
  218. package/dist/hooks/index.cjs +0 -29
  219. package/dist/hooks/index.cjs.map +0 -1
  220. package/dist/hooks/index.css +0 -9
  221. package/dist/hooks/index.css.map +0 -1
  222. package/dist/hooks/index.d.cts +0 -264
  223. package/dist/hooks/index.d.ts +0 -264
  224. package/dist/hooks/index.js +0 -29
  225. package/dist/hooks/index.js.map +0 -1
  226. package/dist/leaderboard-chart-BSbg0ufV.d.cts +0 -79
  227. package/dist/leaderboard-chart-odEYxxEC.d.ts +0 -79
  228. package/dist/legend-DFkosEvC.d.cts +0 -9
  229. package/dist/legend-DLswHhOk.d.ts +0 -9
  230. package/dist/providers/index.cjs +0 -21
  231. package/dist/providers/index.cjs.map +0 -1
  232. package/dist/providers/index.css +0 -9
  233. package/dist/providers/index.css.map +0 -1
  234. package/dist/providers/index.d.cts +0 -28
  235. package/dist/providers/index.d.ts +0 -28
  236. package/dist/providers/index.js +0 -21
  237. package/dist/providers/index.js.map +0 -1
  238. package/dist/themes-D0qc5JaW.d.cts +0 -67
  239. package/dist/themes-itO4Ht5g.d.ts +0 -67
  240. package/dist/types-B5f6XQ7Q.d.cts +0 -19
  241. package/dist/types-BsHooDbM.d.ts +0 -19
  242. package/dist/types-BuSrRM4p.d.ts +0 -49
  243. package/dist/types-ChOUI9-N.d.cts +0 -545
  244. package/dist/types-ChOUI9-N.d.ts +0 -545
  245. package/dist/types-Dfw9VOKI.d.cts +0 -49
  246. package/dist/utils/index.cjs +0 -44
  247. package/dist/utils/index.cjs.map +0 -1
  248. package/dist/utils/index.d.cts +0 -226
  249. package/dist/utils/index.d.ts +0 -226
  250. package/dist/utils/index.js +0 -44
  251. package/dist/utils/index.js.map +0 -1
  252. package/dist/with-responsive-CNfhzAUu.d.cts +0 -18
  253. package/dist/with-responsive-CNfhzAUu.d.ts +0 -18
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-CPPXJATQ.cjs","../src/charts/line-chart/line-chart.tsx","../src/charts/private/default-glyph/default-glyph.tsx","../src/charts/line-chart/line-chart.module.scss","../src/charts/line-chart/private/line-chart-annotation-label-popover.tsx","../src/charts/line-chart/private/line-chart-annotations-overlay.tsx","../src/charts/line-chart/private/line-chart-annotation.tsx","../src/charts/line-chart/private/line-chart-glyph.tsx"],"names":["_jsx","DataContext","useEffect","useState","useContext","x","y","yMin","yMax","xMin","xMax","_jsxs","useRef","useMemo","toNumber"],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACtCA,iEAAkD;AAClD,oCAA6D;AAC7D,0CAA+B;AAC/B,oCAA0B;AAC1B,wCAA6D;AAC7D,uCAAmB;AAEnB,wEAAiB;AACjB,mCAAqD;AACrD,8BAAwH;ADuCxH;AACA;AEjDA;AACA;AACA,+CAA4B;AACrB,IAAM,aAAA,EAAe,CAAA,KAAA,EAAA,GAAS;AACnC,EAAA,MAAM;AAAA,IACJ;AAAA,EACF,EAAA,EAAI,+BAAA,oBAAsB,EAAA,GAAK,CAAC,CAAA;AAChC,EAA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AAA;AACAC,QAAAA;AACAC,QAAAA;AACA,QAAA;AACqB,QAAA;AACvB,MAAA;AACF,IAAA;AACiB,IAAA;AACf,MAAA;AACAL,MAAAA;AACAK,MAAAA;AACAJ,MAAAA;AACAC,MAAAA;AACAC,MAAAA;AACkB,MAAA;AAClB,MAAA;AACD,IAAA;AACM,IAAA;AACLH,MAAAA;AACAC,MAAAA;AACAC,MAAAA;AACAC,MAAAA;AACAC,MAAAA;AACAC,MAAAA;AACG,MAAA;AACL,IAAA;AACyB,EAAA;AACD,EAAA;AACpB,EAAA;AACJ,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACE,EAAA;AACoB,EAAA;AACC,IAAA;AACC,IAAA;AACF,IAAA;AACf,IAAA;AACT,EAAA;AACwB,EAAA;AACC,IAAA;AACC,IAAA;AACF,IAAA;AACf,IAAA;AACT,EAAA;AACsB,EAAA;AACP,IAAA;AACA,IAAA;AACf,EAAA;AAIM,EAAA;AACe,IAAA;AACC,IAAA;AACA,IAAA;AACM,MAAA;AACjB,MAAA;AACC,MAAA;AACN,IAAA;AACN,EAAA;AACoBV,EAAAA;AACKW,IAAAA;AACrB,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACwB,MAAA;AACX,QAAA;AACO,MAAA;AACP,QAAA;AACO,MAAA;AACb,QAAA;AACA,QAAA;AACM,QAAA;AACE,QAAA;AACK,MAAA;AACb,QAAA;AACA,QAAA;AACM,QAAA;AACE,QAAA;AACgB,MAAA;AAClB,QAAA;AACR,QAAA;AACoB,QAAA;AACd,UAAA;AACG,UAAA;AACR,YAAA;AACA,YAAA;AACA,YAAA;AACA,YAAA;AACe,UAAA;AACf,YAAA;AACA,YAAA;AACD,UAAA;AACF,QAAA;AACeX,MAAAA;AACX,QAAA;AACkB,QAAA;AACrB,UAAA;AACA,UAAA;AACW,UAAA;AACR,UAAA;AACe,UAAA;AACF,UAAA;AACjB,QAAA;AACD,MAAA;AACH,IAAA;AACF,EAAA;AACH;AACO;AN4PuB;AACA;AOhgBrBC;AACAG;AACe;AACK,EAAA;AACP,EAAA;AACtB;AACwB;AACtB,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACI;AACE,EAAA;AACJ,IAAA;AACA,IAAA;AACwB,EAAA;AACF,EAAA;AACI,EAAA;AACD,EAAA;AACA,EAAA;AACA,EAAA;AACV,EAAA;AACQ,EAAA;AACN,EAAA;AACS,IAAA;AAC1B,IAAA;AACO,IAAA;AACP,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACD,EAAA;AACH;AACO;APkgBuB;AACA;ACphBR;AACD;AACM;AACL,EAAA;AACf,IAAA;AACQ,IAAA;AACZ,EAAA;AACH;AACwB;AACK,EAAA;AACP,EAAA;AACtB;AAS4B;AAEf,EAAA;AACU,IAAA;AACrB,EAAA;AAGc,EAAA;AACP,IAAA;AACI,MAAA;AACJ,IAAA;AACI,MAAA;AACJ,IAAA;AACI,MAAA;AACT,IAAA;AACS,MAAA;AACX,EAAA;AACF;AAC6B;AACrB,EAAA;AACJ,IAAA;AACE,EAAA;AACiB,EAAA;AACK,EAAA;AACJ,EAAA;AACpB,IAAA;AACM,EAAA;AACN,IAAA;AACa,IAAA;AACM,EAAA;AACDO,EAAAA;AACP,IAAA;AACa,IAAA;AACX,MAAA;AACY,MAAA;AACH,IAAA;AACT,MAAA;AACa,MAAA;AACX,QAAA;AACW,QAAA;AACPX,MAAAA;AACJ,QAAA;AACD,QAAA;AACV,MAAA;AACU,IAAA;AACf,EAAA;AACH;AACuB;AACC,EAAA;AACV,EAAA;AACJ,IAAA;AACP,EAAA;AACH;AACuB;AACC,EAAA;AACV,EAAA;AACH,IAAA;AACF,IAAA;AACN,EAAA;AACH;AACuB;AACC,EAAA;AACV,EAAA;AACJ,IAAA;AACE,IAAA;AACT,E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;AACJ,gBAAA;AACA,gBAAA;AACA,gBAAA;AACE,cAAA;AACI,gBAAA;AACN,gBAAA;AACD,cAAA;AACK,cAAA;AACI,gBAAA;AACL,gBAAA;AACL,cAAA;AACoB,cAAA;AACP,gBAAA;AACL,kBAAA;AACE,kBAAA;AACN,kBAAA;AACW,kBAAA;AACP,kBAAA;AACD,kBAAA;AACO,kBAAA;AACA,oBAAA;AACR,oBAAA;AACA,oBAAA;AACS,kBAAA;AACI,gBAAA;AACN,kBAAA;AACH,kBAAA;AACH,kBAAA;AACG,kBAAA;AACM,kBAAA;AACL,kBAAA;AACP,kBAAA;AACC,gBAAA;AACD,kBAAA;AACM,kBAAA;AACN,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACU,kBAAA;AACR,gBAAA;AACF,kBAAA;AACM,kBAAA;AACN,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACU,kBAAA;AACV,gBAAA;AACW,cAAA;AACb,YAAA;AACY,cAAA;AACd,cAAA;AACA,cAAA;AACA,cAAA;AACA,cAAA;AACa,cAAA;AACb,cAAA;AACA,cAAA;AACA,cAAA;AACA,cAAA;AACA,cAAA;AACA,cAAA;AACQ,cAAA;AACO,YAAA;AACL,cAAA;AACV,cAAA;AACA,cAAA;AACA,cAAA;AACA,YAAA;AACH,UAAA;AACF,QAAA;AACoB,MAAA;AACxB,IAAA;AACF,EAAA;AACF;AAI0C;AACjBP,EAAAA;AAGH,EAAA;AACCJ,IAAAA;AACf,MAAA;AACH,MAAA;AACD,IAAA;AACH,EAAA;AAGoBA,EAAAA;AACKA,IAAAA;AAClB,MAAA;AACH,MAAA;AACD,IAAA;AACF,EAAA;AACF;AACqB;AACJ;AAChB,EAAA;AACoB,EAAA;AACR,EAAA;AACb;AAC2B;AAC1B,EAAA;AACoB,EAAA;AACR,EAAA;AACb;ADge6B;AACA;AACA;AACA;AACA","file":"/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-CPPXJATQ.cjs","sourcesContent":[null,"import { formatNumberCompact, formatNumber } from '@automattic/number-formatters';\nimport { curveCatmullRom, curveLinear, curveMonotoneX } from '@visx/curve';\nimport { LinearGradient } from '@visx/gradient';\nimport { scaleTime } from '@visx/scale';\nimport { XYChart, AreaSeries, Grid, Axis, DataContext } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { differenceInHours, differenceInYears } from 'date-fns';\nimport { useMemo, useContext, forwardRef, useImperativeHandle, useState, useRef, createElement as _createElement } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport { useXYChartTheme, useChartDataTransform, useChartMargin, useElementSize, usePrefersReducedMotion } from '../../hooks';\nimport { GlobalChartsProvider, GlobalChartsContext, useChartId, useChartRegistration, useGlobalChartsContext, useGlobalChartsTheme } from '../../providers';\nimport { attachSubComponents } from '../../utils';\nimport { useChartChildren, renderLegendSlot } from '../private/chart-composition';\nimport { DefaultGlyph } from '../private/default-glyph';\nimport { SingleChartContext } from '../private/single-chart-context';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './line-chart.module.scss';\nimport { LineChartAnnotation, LineChartAnnotationsOverlay, LineChartGlyph } from './private';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst X_TICK_WIDTH = 60;\nconst defaultRenderGlyph = props => {\n return /*#__PURE__*/_createElement(DefaultGlyph, {\n ...props,\n key: props.key\n });\n};\nconst toNumber = val => {\n const num = typeof val === 'number' ? val : parseFloat(val);\n return isNaN(num) ? undefined : num;\n};\n\n/**\n * Determines the curve type for the line chart based on the provided type and smoothing parameters\n *\n * @param {CurveType} type - The explicit curve type to use\n * @param {boolean} smoothing - Legacy smoothing parameter\n * @return The curve function to use for the line\n */\nconst getCurveType = (type, smoothing) => {\n // If no type specified, use legacy smoothing behavior\n if (!type) {\n return smoothing ? curveCatmullRom : curveLinear;\n }\n\n // Handle explicit curve types\n switch (type) {\n case 'smooth':\n return curveCatmullRom;\n case 'monotone':\n return curveMonotoneX;\n case 'linear':\n return curveLinear;\n default:\n return curveLinear;\n }\n};\nconst renderDefaultTooltip = params => {\n const {\n tooltipData\n } = params;\n const nearestDatum = tooltipData?.nearestDatum?.datum;\n if (!nearestDatum) return null;\n const tooltipPoints = Object.entries(tooltipData?.datumByKey || {}).map(([key, {\n datum\n }]) => ({\n key,\n value: datum.value\n })).sort((a, b) => b.value - a.value);\n return /*#__PURE__*/_jsxs(\"div\", {\n className: styles['line-chart__tooltip'],\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: styles['line-chart__tooltip-date'],\n children: nearestDatum.date?.toLocaleDateString()\n }), tooltipPoints.map(point => /*#__PURE__*/_jsxs(\"div\", {\n className: styles['line-chart__tooltip-row'],\n children: [/*#__PURE__*/_jsxs(\"span\", {\n className: styles['line-chart__tooltip-label'],\n children: [point.key, \":\"]\n }), /*#__PURE__*/_jsx(\"span\", {\n className: styles['line-chart__tooltip-value'],\n children: formatNumber(point.value)\n })]\n }, point.key))]\n });\n};\nconst formatYearTick = timestamp => {\n const date = new Date(timestamp);\n return date.toLocaleDateString(undefined, {\n year: 'numeric'\n });\n};\nconst formatDateTick = timestamp => {\n const date = new Date(timestamp);\n return date.toLocaleDateString(undefined, {\n month: 'short',\n day: 'numeric'\n });\n};\nconst formatHourTick = timestamp => {\n const date = new Date(timestamp);\n return date.toLocaleTimeString(undefined, {\n hour: 'numeric',\n hour12: true\n });\n};\nconst getFormatter = sortedData => {\n const minX = Math.min(...sortedData.map(datom => datom.data.at(0)?.date));\n const maxX = Math.max(...sortedData.map(datom => datom.data.at(-1)?.date));\n const diffInHours = Math.abs(differenceInHours(maxX, minX));\n if (diffInHours <= 24) {\n return formatHourTick;\n }\n const diffInYears = Math.abs(differenceInYears(maxX, minX));\n if (diffInYears <= 1) {\n return formatDateTick;\n }\n return formatYearTick;\n};\nconst guessOptimalNumTicks = (data, chartWidth, tickFormatter) => {\n const minX = Math.min(...data.map(datom => datom.data.at(0)?.date));\n const maxX = Math.max(...data.map(datom => datom.data.at(-1)?.date));\n const xScale = scaleTime({\n domain: [minX, maxX]\n });\n\n // Calculate upper bound of tick numbers based on data points and chart width\n const upperBound = Math.min(data[0]?.data.length || 3,\n // A sane fallback to avoid NaN when no data is present\n Math.ceil(chartWidth / X_TICK_WIDTH));\n let secondBestGuess = 1; // a tick number that's no greater than upperBound\n\n for (let numTicks = upperBound; numTicks > 1; --numTicks) {\n const ticks = xScale.ticks(numTicks).map(d => tickFormatter(d.getTime()));\n\n // The .ticks() function doesn't properly respect the requested number of ticks, so we need to check the length\n if (ticks.length > upperBound) {\n continue;\n }\n secondBestGuess = Math.max(secondBestGuess, ticks.length);\n const uniqueTicks = Array.from(new Set(ticks));\n if (uniqueTicks.length === 1) {\n // All ticks are the same, so skip further processing\n return 1;\n }\n\n // Example: OCT 1 JAN 1 APR 1 JUL 1 OCT 1\n // Here, the two OCTs are not duplicates as they represent October of two different years.\n const hasConsecutiveDuplicate = ticks.some((tick, idx) => idx > 0 && tick === ticks[idx - 1]);\n if (hasConsecutiveDuplicate) {\n continue;\n }\n return ticks.length;\n }\n return secondBestGuess;\n};\nconst validateData = data => {\n if (!data?.length) return 'No data available';\n const hasInvalidData = data.some(series => series.data.some(point => isNaN(point.value) || point.value === null || point.value === undefined || 'date' in point && point.date && isNaN(point.date.getTime())));\n if (hasInvalidData) return 'Invalid data';\n return null;\n};\n\n// Inner component to access DataContext and provide scale data to ref\nconst LineChartScalesRef = ({\n chartRef,\n width,\n height,\n margin\n}) => {\n const context = useContext(DataContext);\n useImperativeHandle(chartRef, () => ({\n getScales: () => {\n if (!context?.xScale || !context?.yScale) {\n return null;\n }\n return {\n xScale: context.xScale,\n yScale: context.yScale\n };\n },\n getChartDimensions: () => ({\n width,\n height,\n margin: margin || {}\n })\n }), [context, width, height, margin]);\n return null; // This component only provides the ref interface\n};\nconst LineChartInternal = /*#__PURE__*/forwardRef(({\n data,\n chartId: providedChartId,\n width,\n height,\n className,\n margin,\n withTooltips = true,\n withTooltipCrosshairs,\n showLegend = false,\n legend = {},\n renderGlyph = defaultRenderGlyph,\n glyphStyle = {},\n withLegendGlyph = false,\n withGradientFill = false,\n smoothing = true,\n curveType,\n renderTooltip = renderDefaultTooltip,\n withStartGlyphs = false,\n withEndGlyphs = false,\n animation,\n options = {},\n onPointerDown = undefined,\n onPointerUp = undefined,\n onPointerMove = undefined,\n onPointerOut = undefined,\n children,\n gridVisibility,\n gap = 'md'\n}, ref) => {\n const legendInteractive = legend.interactive ?? false;\n const legendShape = legend.shape ?? 'line';\n const legendPosition = legend.position ?? 'bottom';\n const providerTheme = useGlobalChartsTheme();\n const theme = useXYChartTheme(data);\n const chartId = useChartId(providedChartId);\n const [svgWrapperRef,, svgWrapperHeight] = useElementSize();\n const chartRef = useRef(null);\n const [selectedIndex, setSelectedIndex] = useState(undefined);\n const [isNavigating, setIsNavigating] = useState(false);\n const internalChartRef = useRef(null);\n\n // Process children for composition API (Legend, etc.)\n const {\n legendChildren,\n nonLegendChildren\n } = useChartChildren(children, 'LineChart');\n const hasLegendChild = legendChildren.length > 0;\n\n // Use the measured SVG wrapper height, falling back to the passed height if provided.\n // When there's a legend (via prop or composition), we must wait for measurement because\n // the legend takes space and the svg-wrapper height will be less than the total height.\n const chartHeight = svgWrapperHeight > 0 ? svgWrapperHeight : height;\n const hasLegend = showLegend || hasLegendChild;\n const isWaitingForMeasurement = hasLegend ? svgWrapperHeight === 0 : !chartHeight;\n\n // Forward the external ref to the internal ref\n useImperativeHandle(ref, () => ({\n getScales: () => internalChartRef.current?.getScales() || null,\n getChartDimensions: () => internalChartRef.current?.getChartDimensions() || {\n width: 0,\n height: 0,\n margin: {}\n }\n }), [internalChartRef]);\n const dataSorted = useChartDataTransform(data);\n const {\n getElementStyles,\n isSeriesVisible\n } = useGlobalChartsContext();\n\n // Add visibility information to series when using interactive legends\n const seriesWithVisibility = useMemo(() => {\n if (!chartId || !legendInteractive) {\n return dataSorted.map((series, index) => ({\n series,\n index,\n isVisible: true\n }));\n }\n return dataSorted.map((series, index) => ({\n series,\n index,\n isVisible: isSeriesVisible(chartId, series.label)\n }));\n }, [dataSorted, chartId, isSeriesVisible, legendInteractive]);\n\n // Check if all series are hidden\n const allSeriesHidden = useMemo(() => {\n return seriesWithVisibility.every(({\n isVisible\n }) => !isVisible);\n }, [seriesWithVisibility]);\n\n // Use the keyboard navigation hook\n const {\n tooltipRef,\n onChartFocus,\n onChartBlur,\n onChartKeyDown\n } = useKeyboardNavigation({\n selectedIndex,\n setSelectedIndex,\n isNavigating,\n setIsNavigating,\n chartRef,\n totalPoints: dataSorted[0]?.data.length || 0\n });\n const chartOptions = useMemo(() => {\n const formatter = options?.axis?.x?.tickFormat || getFormatter(dataSorted);\n return {\n axis: {\n x: {\n orientation: 'bottom',\n numTicks: guessOptimalNumTicks(dataSorted, width, formatter),\n tickFormat: formatter,\n display: true,\n ...options?.axis?.x\n },\n y: {\n orientation: 'left',\n numTicks: 4,\n tickFormat: formatNumberCompact,\n display: true,\n ...options?.axis?.y\n }\n },\n xScale: {\n type: 'time',\n ...options?.xScale\n },\n yScale: {\n type: 'linear',\n nice: true,\n zero: false,\n ...options?.yScale\n }\n };\n }, [options, dataSorted, width]);\n const tooltipRenderGlyph = useMemo(() => {\n return props => {\n const seriesIndex = dataSorted.findIndex(series => series.label === props.key || series.data.includes(props.datum));\n const seriesData = dataSorted[seriesIndex];\n const {\n color,\n glyph: themeGlyph\n } = getElementStyles({\n data: seriesData,\n index: seriesIndex\n });\n const propsWithResolvedColor = {\n ...props,\n color\n };\n return themeGlyph ? themeGlyph(propsWithResolvedColor) : renderGlyph(propsWithResolvedColor);\n };\n }, [dataSorted, renderGlyph, getElementStyles]);\n const defaultMargin = useChartMargin(height, chartOptions, dataSorted, theme);\n const error = validateData(dataSorted);\n const isDataValid = !error;\n\n // Memoize legend options to prevent unnecessary re-calculations\n const legendOptions = useMemo(() => ({\n withGlyph: withLegendGlyph,\n glyphSize: Math.max(0, toNumber(glyphStyle?.radius) ?? 4),\n renderGlyph\n }), [withLegendGlyph, glyphStyle?.radius, renderGlyph]);\n\n // Create legend items using the reusable hook\n const legendItems = useChartLegendItems(dataSorted, legendOptions, legendShape);\n\n // Memoize metadata to prevent unnecessary re-registration\n const chartMetadata = useMemo(() => ({\n withGradientFill,\n smoothing,\n curveType,\n withStartGlyphs,\n withEndGlyphs,\n withLegendGlyph\n }), [withGradientFill, smoothing, curveType, withStartGlyphs, withEndGlyphs, withLegendGlyph]);\n\n // Register chart with context only if data is valid\n useChartRegistration({\n chartId,\n legendItems,\n chartType: 'line',\n isDataValid,\n metadata: chartMetadata\n });\n const prefersReducedMotion = usePrefersReducedMotion();\n const accessors = {\n xAccessor: d => d?.date,\n yAccessor: d => d?.value\n };\n\n // Create a custom renderTooltip that includes focus capability\n if (error) {\n return /*#__PURE__*/_jsx(\"div\", {\n className: clsx('line-chart', styles['line-chart']),\n children: error\n });\n }\n const legendElement = showLegend && /*#__PURE__*/_jsx(Legend, {\n orientation: legend.orientation ?? 'horizontal',\n alignment: legend.alignment ?? 'center',\n position: legendPosition,\n labelStyles: legend.labelStyles,\n itemClassName: legend.itemClassName,\n itemStyles: legend.itemStyles,\n shapeStyles: legend.shapeStyles,\n className: styles['line-chart__legend'],\n shape: legendShape,\n chartId: chartId,\n interactive: legendInteractive\n });\n return /*#__PURE__*/_jsx(SingleChartContext.Provider, {\n value: {\n chartId,\n chartRef: internalChartRef,\n chartWidth: width,\n chartHeight\n },\n children: /*#__PURE__*/_jsxs(Stack, {\n direction: \"column\",\n gap: gap,\n className: clsx('line-chart', styles['line-chart'], {\n [styles['line-chart--animated']]: animation && !prefersReducedMotion\n }, className),\n style: {\n width,\n height,\n visibility: isWaitingForMeasurement ? 'hidden' : 'visible'\n },\n children: [legendPosition === 'top' && legendElement, renderLegendSlot(legendChildren, 'top'), /*#__PURE__*/_jsx(\"div\", {\n className: styles['line-chart__svg-wrapper'],\n ref: svgWrapperRef,\n role: \"grid\",\n \"aria-label\": __('Line chart', 'jetpack-charts'),\n tabIndex: 0,\n onKeyDown: onChartKeyDown,\n onFocus: onChartFocus,\n onBlur: onChartBlur,\n children: !isWaitingForMeasurement && /*#__PURE__*/_jsx(\"div\", {\n ref: chartRef,\n children: /*#__PURE__*/_jsxs(XYChart, {\n theme: theme,\n width: width,\n height: chartHeight,\n margin: {\n ...defaultMargin,\n ...margin\n }\n // xScale and yScale could be set in Axis as well, but they are `scale` props there.\n ,\n xScale: chartOptions.xScale,\n yScale: chartOptions.yScale,\n onPointerDown: onPointerDown,\n onPointerUp: onPointerUp,\n onPointerMove: onPointerMove,\n onPointerOut: onPointerOut,\n pointerEventsDataKey: \"nearest\",\n children: [gridVisibility !== 'none' && /*#__PURE__*/_jsx(Grid, {\n columns: false,\n numTicks: 4\n }), chartOptions.axis.x.display && /*#__PURE__*/_jsx(Axis, {\n ...chartOptions.axis.x\n }), chartOptions.axis.y.display && /*#__PURE__*/_jsx(Axis, {\n ...chartOptions.axis.y\n }), allSeriesHidden ? /*#__PURE__*/_jsx(\"text\", {\n x: width / 2,\n y: chartHeight / 2,\n textAnchor: \"middle\",\n fill: providerTheme.gridStyles?.stroke || '#ccc',\n fontSize: \"14\",\n fontFamily: \"-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif\",\n children: __('All series are hidden. Click legend items to show data.', 'jetpack-charts')\n }) : null, seriesWithVisibility.map(({\n series: seriesData,\n index,\n isVisible\n }) => {\n // Skip rendering invisible series\n if (!isVisible) {\n return null;\n }\n const {\n color,\n lineStyles,\n glyph\n } = getElementStyles({\n data: seriesData,\n index\n });\n const lineProps = {\n stroke: color,\n ...lineStyles\n };\n return /*#__PURE__*/_jsxs(\"g\", {\n children: [withGradientFill && /*#__PURE__*/_jsx(LinearGradient, {\n id: `area-gradient-${chartId}-${index + 1}`,\n from: color,\n fromOpacity: 0.4,\n toOpacity: 0.1,\n to: providerTheme.backgroundColor,\n ...seriesData.options?.gradient,\n children: seriesData.options?.gradient?.stops?.map((stop, stopIndex) => /*#__PURE__*/_jsx(\"stop\", {\n offset: stop.offset,\n stopColor: stop.color || color,\n stopOpacity: stop.opacity ?? 1\n }, `${stop.offset}-${stop.color || color}`))\n }), /*#__PURE__*/_jsx(AreaSeries, {\n dataKey: seriesData?.label,\n data: seriesData.data,\n ...accessors,\n fill: withGradientFill ? `url(#area-gradient-${chartId}-${index + 1})` : 'transparent',\n renderLine: true,\n curve: getCurveType(curveType, smoothing),\n lineProps: lineProps\n }, seriesData?.label), withStartGlyphs && /*#__PURE__*/_jsx(LineChartGlyph, {\n index: index,\n data: seriesData,\n color: color,\n renderGlyph: glyph ?? renderGlyph,\n accessors: accessors,\n glyphStyle: glyphStyle,\n position: \"start\"\n }), withEndGlyphs && /*#__PURE__*/_jsx(LineChartGlyph, {\n index: index,\n data: seriesData,\n color: color,\n renderGlyph: glyph ?? renderGlyph,\n accessors: accessors,\n glyphStyle: glyphStyle,\n position: \"end\"\n })]\n }, seriesData?.label || index);\n }), withTooltips && /*#__PURE__*/_jsx(AccessibleTooltip, {\n detectBounds: true,\n snapTooltipToDatumX: true,\n snapTooltipToDatumY: true,\n showSeriesGlyphs: true,\n renderTooltip: renderTooltip,\n renderGlyph: tooltipRenderGlyph,\n glyphStyle: glyphStyle,\n showVerticalCrosshair: withTooltipCrosshairs?.showVertical,\n showHorizontalCrosshair: withTooltipCrosshairs?.showHorizontal,\n selectedIndex: selectedIndex,\n tooltipRef: tooltipRef,\n keyboardFocusedClassName: styles['line-chart__tooltip--keyboard-focused'],\n series: dataSorted\n }), /*#__PURE__*/_jsx(LineChartScalesRef, {\n chartRef: internalChartRef,\n width: width,\n height: height,\n margin: margin\n })]\n })\n })\n }), legendPosition === 'bottom' && legendElement, renderLegendSlot(legendChildren, 'bottom'), nonLegendChildren]\n })\n });\n});\n\n// Component type definitions for composition API\n\nconst LineChartWithProvider = /*#__PURE__*/forwardRef((props, ref) => {\n const existingContext = useContext(GlobalChartsContext);\n\n // If we're already in a GlobalChartsProvider context, render the core component directly\n if (existingContext) {\n return /*#__PURE__*/_jsx(LineChartInternal, {\n ...props,\n ref: ref\n });\n }\n\n // Otherwise, wrap with our own GlobalChartsProvider\n return /*#__PURE__*/_jsx(GlobalChartsProvider, {\n children: /*#__PURE__*/_jsx(LineChartInternal, {\n ...props,\n ref: ref\n })\n });\n});\nLineChartWithProvider.displayName = 'LineChart';\nconst LineChart = attachSubComponents(LineChartWithProvider, {\n Legend: Legend,\n AnnotationsOverlay: LineChartAnnotationsOverlay,\n Annotation: LineChartAnnotation\n});\nconst LineChartResponsive = attachSubComponents(withResponsive(LineChartWithProvider), {\n Legend: Legend,\n AnnotationsOverlay: LineChartAnnotationsOverlay,\n Annotation: LineChartAnnotation\n});\nexport { LineChartResponsive as default, LineChart as LineChartUnresponsive };","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const DefaultGlyph = props => {\n const {\n theme\n } = useContext(DataContext) || {};\n const position = props.position || 'start';\n return /*#__PURE__*/_jsx(\"circle\", {\n cx: props.x,\n cy: props.y,\n r: props.size,\n fill: props.color,\n stroke: theme?.backgroundColor,\n strokeWidth: 1.5,\n paintOrder: \"fill\",\n ...props.glyphStyle\n });\n};","import 'css-chunk:src/charts/line-chart/line-chart.module.scss';export default {\n \"line-chart\": \"a8ccharts-v-oO8E\",\n \"line-chart__svg-wrapper\": \"a8ccharts-cpMNjj\",\n \"line-chart--animated\": \"a8ccharts-QrkuTW\",\n \"rise\": \"a8ccharts--rxDU3\",\n \"line-chart__tooltip\": \"a8ccharts-Tu0rR-\",\n \"line-chart__annotation-label-popover\": \"a8ccharts--RSWXi\",\n \"line-chart__tooltip-date\": \"a8ccharts-Q-b5A1\",\n \"line-chart__tooltip-row\": \"a8ccharts-19N7T9\",\n \"line-chart__tooltip-label\": \"a8ccharts-HOAXrD\",\n \"line-chart__annotations-overlay\": \"a8ccharts-rQiY8O\",\n \"line-chart__annotation-label\": \"a8ccharts-8AKWOe\",\n \"line-chart__annotation-label-trigger-button\": \"a8ccharts-7mh3Cl\",\n \"line-chart__annotation-label-popover--visible\": \"a8ccharts-VAeVuJ\",\n \"line-chart__annotation-label-popover--safari\": \"a8ccharts-TEe-iV\",\n \"line-chart__annotation-label-popover-header\": \"a8ccharts-LAUpx7\",\n \"line-chart__annotation-label-popover-content\": \"a8ccharts-b76gEu\",\n \"line-chart__annotation-label-popover-close-button\": \"a8ccharts-LIpFoS\"\n};","import { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport Gridicon from 'gridicons';\nimport { useEffect, useId, useRef, useState } from 'react';\nimport { isSafari } from '../../../utils';\nimport styles from '../line-chart.module.scss';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const POPOVER_BUTTON_SIZE = 44;\nconst LineChartAnnotationLabelWithPopover = ({\n title,\n subtitle,\n renderLabel,\n renderLabelPopover\n}) => {\n const popoverId = useId();\n const buttonRef = useRef(null);\n const popoverRef = useRef(null);\n const [isPositioned, setIsPositioned] = useState(false);\n const isBrowserSafari = isSafari();\n useEffect(() => {\n const button = buttonRef.current;\n const popover = popoverRef.current;\n if (!button || !popover) return;\n const positionPopover = () => {\n // Popover positioning in Safari is complicated due to issues with SVG foreign objects (https://bugs.webkit.org/show_bug.cgi?id=23113), so let it be positioned in the centre of the viewport.\n if (!isBrowserSafari) {\n const buttonRect = button.getBoundingClientRect();\n popover.style.left = `${buttonRect.right}px`;\n popover.style.top = `${buttonRect.top}px`;\n }\n setIsPositioned(true);\n };\n\n // Position when popover shows\n popover.addEventListener('toggle', e => {\n if (e.newState === 'open') {\n positionPopover();\n }\n });\n\n // Initial positioning if already open\n try {\n if (popover.matches(':popover-open')) {\n positionPopover();\n }\n } catch {\n // Ignore errors in test environments (e.g., JSDOM does not support :popover-open)\n }\n }, [isBrowserSafari]);\n return /*#__PURE__*/_jsxs(\"div\", {\n className: styles['line-chart__annotation-label'],\n children: [/*#__PURE__*/_jsx(\"button\", {\n ref: buttonRef,\n popovertarget: popoverId,\n className: styles['line-chart__annotation-label-trigger-button'],\n style: {\n width: `${POPOVER_BUTTON_SIZE}px`,\n height: `${POPOVER_BUTTON_SIZE}px`,\n transform: `translate(${POPOVER_BUTTON_SIZE / 2}px, 0)`\n },\n \"aria-label\": title || __('View details', 'jetpack-charts'),\n children: renderLabel({\n title,\n subtitle\n })\n }), /*#__PURE__*/_jsx(\"div\", {\n ref: popoverRef,\n id: popoverId,\n popover: 'auto',\n className: clsx(styles['line-chart__annotation-label-popover'], isPositioned && styles['line-chart__annotation-label-popover--visible'], isBrowserSafari && styles['line-chart__annotation-label-popover--safari']),\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: styles['line-chart__annotation-label-popover-header'],\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: styles['line-chart__annotation-label-popover-content'],\n children: renderLabelPopover({\n title,\n subtitle\n })\n }), /*#__PURE__*/_jsx(\"button\", {\n popovertarget: popoverId,\n popovertargetaction: 'hide',\n className: styles['line-chart__annotation-label-popover-close-button'],\n \"aria-label\": __('Close', 'jetpack-charts'),\n children: /*#__PURE__*/_jsx(Gridicon, {\n icon: \"cross\",\n size: 16\n })\n })]\n })\n })]\n });\n};\nexport default LineChartAnnotationLabelWithPopover;","import { DataContext } from '@visx/xychart';\nimport { useEffect, useState, useCallback } from 'react';\nimport { useSingleChartContext } from '../../private/single-chart-context';\nimport styles from '../line-chart.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst LineChartAnnotationsOverlay = ({\n children\n}) => {\n const {\n chartRef,\n chartWidth,\n chartHeight\n } = useSingleChartContext();\n const [scales, setScales] = useState(null);\n const [scalesStable, setScalesStable] = useState(false);\n\n // Create a signature for scale data to enable easy comparison\n const createScaleSignature = useCallback(scaleData => {\n const xDomain = scaleData.xScale.domain();\n const yDomain = scaleData.yScale.domain();\n const xRange = scaleData.xScale.range();\n const yRange = scaleData.yScale.range();\n return `${xDomain.join(',')}-${yDomain.join(',')}-${xRange.join(',')}-${yRange.join(',')}`;\n }, []);\n\n // Get scales from chart ref and return them with signature for comparison\n const getScalesData = useCallback(() => {\n if (chartRef?.current) {\n const scaleData = chartRef.current.getScales();\n if (scaleData) {\n const scaleInfo = {\n xScale: scaleData.xScale,\n yScale: scaleData.yScale\n };\n return {\n scales: scaleInfo,\n signature: createScaleSignature(scaleInfo)\n };\n }\n }\n return null;\n }, [chartRef, createScaleSignature]);\n\n // The chart resizes on render so we need to monitor the scales until they stabilize\n useEffect(() => {\n let timeoutId = null;\n let lastSignature = null;\n let retryCount = 0;\n const maxRetries = 20; // 20 * 50ms = 1 second max\n const checkInterval = 50; // Check every 50ms\n\n // Reset stability state when monitoring starts\n setScalesStable(false);\n const monitorScales = () => {\n const currentScaleData = getScalesData();\n\n // If we got scales, compare signatures\n if (currentScaleData) {\n // Check if scales have settled by comparing signatures\n const scalesSettled = lastSignature && currentScaleData.signature === lastSignature;\n if (scalesSettled) {\n // Scales have stabilized, mark as stable\n setScalesStable(true);\n return;\n }\n\n // Update scales and remember signature for next comparison\n setScales(currentScaleData.scales);\n lastSignature = currentScaleData.signature;\n }\n\n // Continue monitoring if we haven't exceeded max retries\n if (retryCount < maxRetries) {\n retryCount++;\n timeoutId = setTimeout(monitorScales, checkInterval);\n }\n };\n monitorScales();\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n }, [getScalesData, chartWidth, chartHeight]);\n\n // Early return if no chart data available\n if (!chartRef || !children) {\n return null;\n }\n if (!scales || !scalesStable) {\n return null;\n }\n\n // Create a DataContext value that mimics what visx provides\n // We're intentionally providing minimal context for annotations to work\n const dataContextValue = {\n xScale: scales.xScale,\n yScale: scales.yScale,\n margin: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n },\n width: chartWidth,\n height: chartHeight\n };\n return /*#__PURE__*/_jsx(DataContext.Provider, {\n value: dataContextValue,\n children: /*#__PURE__*/_jsx(\"svg\", {\n width: chartWidth,\n height: chartHeight,\n className: styles['line-chart__annotations-overlay'],\n children: children\n })\n });\n};\nexport default LineChartAnnotationsOverlay;","import { Annotation, CircleSubject, Connector, HtmlLabel, Label, LineSubject } from '@visx/annotation';\nimport { DataContext } from '@visx/xychart';\nimport merge from 'deepmerge';\nimport { useContext, useRef, useEffect, useState, useMemo } from 'react';\nimport { useGlobalChartsTheme } from '../../../providers';\nimport { isSafari } from '../../../utils';\nimport LineChartAnnotationLabelWithPopover, { POPOVER_BUTTON_SIZE } from './line-chart-annotation-label-popover';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst ANNOTATION_MAX_WIDTH = 125; // visx default\nconst ANNOTATION_INIT_HEIGHT = 100;\nexport const getLabelPosition = ({\n subjectType,\n x,\n xMax,\n y,\n yMin,\n yMax,\n maxWidth,\n height\n}) => {\n const annotationMaxWidth = maxWidth ?? ANNOTATION_MAX_WIDTH;\n const annotationHeight = height ?? ANNOTATION_INIT_HEIGHT;\n let dx = 15;\n let dy = 15;\n let isFlippedHorizontally = false;\n let isFlippedVertically = false;\n if (subjectType === 'line-horizontal') {\n dx = 0;\n dy = 20;\n }\n if (subjectType === 'line-vertical') {\n dx = 20;\n dy = 0;\n }\n\n // Smart horizontal positioning: if annotation would extend beyond right edge, position it to the left\n // Account for the connector offset (dx) in boundary calculations\n const effectiveX = x + dx;\n if (effectiveX + annotationMaxWidth > xMax) {\n isFlippedHorizontally = true;\n if (subjectType === 'circle') {\n dx = -dx; // Just flip to the left side with same offset\n } else if (subjectType === 'line-vertical') {\n dx = -20; // Position to the left of the line\n }\n }\n\n // Smart vertical positioning: check both top and bottom edges\n // For circle annotations, they are positioned below by default (dy > 0)\n // Only flip when close to bottom edge to position above\n if (subjectType === 'circle') {\n // Check if positioning below would extend beyond bottom edge\n if (y + dy + annotationHeight > yMin) {\n // Too close to bottom edge, position above\n isFlippedVertically = true;\n dy = -Math.abs(dy); // Ensure negative value to position above the point\n }\n // When close to top edge, keep default below positioning (no flip needed)\n } else if (y - annotationHeight < yMax) {\n // Too close to top edge, position below\n if (subjectType === 'line-horizontal') {\n isFlippedVertically = true;\n dy = Math.abs(dy); // Ensure positive value to position below the point\n } else if (subjectType === 'line-vertical') {\n isFlippedVertically = true; // For anchor adjustment only\n }\n } else if (y + annotationHeight > yMin) {\n // Too close to bottom edge, position above\n if (subjectType === 'line-horizontal') {\n isFlippedVertically = true;\n dy = -Math.abs(dy); // Ensure negative value to position above the point\n } else if (subjectType === 'line-vertical') {\n isFlippedVertically = true; // For anchor adjustment only\n }\n }\n return {\n dx,\n dy,\n isFlippedHorizontally,\n isFlippedVertically\n };\n};\nconst getHorizontalAnchor = (subjectType, isFlippedHorizontally) => {\n if (subjectType === 'line-horizontal') {\n return isFlippedHorizontally ? 'end' : 'start';\n }\n return undefined;\n};\nconst getVerticalAnchor = (subjectType, isFlippedVertically, y, yMax, height) => {\n if (subjectType === 'line-vertical') {\n if (isFlippedVertically) {\n // If flipped due to top edge, anchor to top; if flipped due to bottom edge, anchor to bottom\n return y - height < yMax ? 'start' : 'end';\n }\n return 'start';\n }\n return undefined;\n};\nconst LineChartAnnotation = ({\n datum,\n title,\n subtitle,\n subjectType = 'circle',\n styles: datumStyles,\n testId,\n renderLabel,\n renderLabelPopover\n}) => {\n const providerTheme = useGlobalChartsTheme();\n const {\n xScale,\n yScale\n } = useContext(DataContext) || {};\n const labelRef = useRef(null);\n const [height, setHeight] = useState(null);\n\n // Deep merge styles to preserve nested object properties\n const styles = merge(providerTheme.annotationStyles ?? {}, datumStyles ?? {});\n\n // Measure the label height once after initial render\n useEffect(() => {\n if (labelRef.current?.getBBox) {\n const bbox = labelRef.current.getBBox();\n setHeight(bbox.height);\n }\n }, []);\n const positionData = useMemo(() => {\n if (!datum || !datum.date || datum.value == null || !xScale || !yScale) return null;\n const x = xScale(datum.date);\n const y = yScale(datum.value);\n if (typeof x !== 'number' || typeof y !== 'number') return null;\n const [yMin, yMax] = yScale.range().map(Number);\n const [xMin, xMax] = xScale.range().map(Number);\n\n // If a custom label is provided, use the provided position\n if (renderLabel) {\n return {\n x,\n dx: 0,\n y,\n dy: 0,\n yMin,\n yMax,\n xMin,\n xMax,\n isFlippedHorizontally: false,\n isFlippedVertically: false\n };\n }\n const position = getLabelPosition({\n subjectType,\n x,\n xMax,\n y,\n yMin,\n yMax,\n maxWidth: styles?.label?.maxWidth,\n height\n });\n return {\n x,\n y,\n yMin,\n yMax,\n xMin,\n xMax,\n ...position\n };\n }, [datum, xScale, yScale, subjectType, styles?.label?.maxWidth, height, renderLabel]);\n if (!positionData) return null;\n const {\n x,\n y,\n yMin,\n yMax,\n xMin,\n xMax,\n dx,\n dy,\n isFlippedHorizontally,\n isFlippedVertically\n } = positionData;\n const getLabelY = () => {\n const labelY = styles?.label?.y;\n if (labelY === 'start') return yMax;\n if (labelY === 'end') return yMin;\n return labelY;\n };\n const getLabelX = () => {\n const labelX = styles?.label?.x;\n if (labelX === 'start') return xMin;\n if (labelX === 'end') return xMax;\n return labelX;\n };\n const labelPosition = {\n x: getLabelX(),\n y: getLabelY()\n };\n\n // Safari has a bug where children of an SVG foreignObject are not positioned correctly https://bugs.webkit.org/show_bug.cgi?id=23113\n // This is a workaround to position the label correctly\n const getSafariHTMLLabelPosition = () => {\n const labelWidth = POPOVER_BUTTON_SIZE;\n const labelHeight = POPOVER_BUTTON_SIZE;\n return isSafari() ? {\n transform: `translate(${x + (dx || 0) + (typeof labelPosition.x === 'number' ? labelPosition.x - x : 0) - labelWidth}px, ${y + (dy || 0) + (typeof labelPosition.y === 'number' ? labelPosition.y - y : 0) - labelHeight}px)`,\n width: labelWidth,\n height: labelHeight\n } : undefined;\n };\n return /*#__PURE__*/_jsx(\"g\", {\n children: /*#__PURE__*/_jsxs(Annotation, {\n x: x,\n y: y,\n dx: dx,\n dy: dy,\n children: [/*#__PURE__*/_jsx(Connector, {\n ...styles?.connector\n }), subjectType === 'circle' && /*#__PURE__*/_jsx(CircleSubject, {\n ...styles?.circleSubject\n }), subjectType === 'line-vertical' && /*#__PURE__*/_jsx(LineSubject, {\n min: yMax,\n max: yMin,\n ...styles?.lineSubject,\n orientation: 'vertical'\n }), subjectType === 'line-horizontal' && /*#__PURE__*/_jsx(LineSubject, {\n min: xMin,\n max: xMax,\n ...styles?.lineSubject,\n orientation: 'horizontal'\n }), renderLabel ? /*#__PURE__*/_jsx(HtmlLabel, {\n ...styles?.label,\n ...labelPosition,\n children: /*#__PURE__*/_jsx(\"div\", {\n style: getSafariHTMLLabelPosition(),\n children: renderLabelPopover ? /*#__PURE__*/_jsx(LineChartAnnotationLabelWithPopover, {\n title: title,\n subtitle: subtitle,\n renderLabel: renderLabel,\n renderLabelPopover: renderLabelPopover\n }) : renderLabel({\n title,\n subtitle\n })\n })\n }) : /*#__PURE__*/_jsx(\"g\", {\n ref: labelRef,\n children: /*#__PURE__*/_jsx(Label, {\n title: title,\n subtitle: subtitle,\n ...styles?.label,\n ...labelPosition,\n horizontalAnchor: getHorizontalAnchor(subjectType, isFlippedHorizontally),\n verticalAnchor: getVerticalAnchor(subjectType, isFlippedVertically, y, yMax, height ?? ANNOTATION_INIT_HEIGHT)\n })\n })]\n })\n });\n};\nexport default LineChartAnnotation;","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nconst toNumber = val => {\n const num = typeof val === 'number' ? val : parseFloat(val);\n return isNaN(num) ? undefined : num;\n};\nconst LineChartGlyph = ({\n data,\n index,\n color,\n glyphStyle,\n renderGlyph,\n accessors,\n position\n}) => {\n const {\n xScale,\n yScale\n } = useContext(DataContext) || {};\n if (!xScale || !yScale) return null;\n if (data.data.length === 0) return null;\n const point = position === 'start' ? data.data[0] : data.data[data.data.length - 1];\n const x = xScale(accessors.xAccessor(point));\n const y = yScale(accessors.yAccessor(point));\n if (typeof x !== 'number' || typeof y !== 'number') return null;\n const size = Math.max(0, toNumber(glyphStyle?.radius) ?? 4);\n return renderGlyph({\n key: `${position}-glyph-${data.label}`,\n index,\n datum: point,\n color,\n size,\n x,\n y,\n glyphStyle,\n position\n });\n};\nexport default LineChartGlyph;"]}
@@ -1,219 +0,0 @@
1
- import {
2
- BarChart
3
- } from "./chunk-B6NLZFRW.js";
4
- import {
5
- withResponsive
6
- } from "./chunk-OP6PHB2U.js";
7
- import {
8
- GlobalChartsContext,
9
- GlobalChartsProvider
10
- } from "./chunk-2I67QUIV.js";
11
-
12
- // src/charts/bar-list-chart/bar-list-chart.tsx
13
- import { formatNumberCompact } from "@automattic/number-formatters";
14
- import { Group } from "@visx/group";
15
- import { createScale, scaleBand } from "@visx/scale";
16
- import { Text } from "@visx/text";
17
- import { useContext, useMemo } from "react";
18
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
- var getScaleBandwidth = (scale) => {
20
- const s = scale;
21
- return s && "bandwidth" in s ? s?.bandwidth() ?? 0 : 0;
22
- };
23
- var DefaultLabelComponent = ({
24
- textProps,
25
- x,
26
- y,
27
- label,
28
- formatter
29
- }) => {
30
- return /* @__PURE__ */ _jsx(Text, {
31
- ...textProps,
32
- textAnchor: "start",
33
- x,
34
- y,
35
- children: formatter(label)
36
- });
37
- };
38
- var DefaultValueComponent = ({
39
- textProps,
40
- x,
41
- y,
42
- value,
43
- formatter
44
- }) => {
45
- return /* @__PURE__ */ _jsx(Text, {
46
- ...textProps,
47
- textAnchor: "end",
48
- x,
49
- y,
50
- fontWeight: 500,
51
- children: formatter(value)
52
- });
53
- };
54
- var AxisRenderer = ({
55
- ticks,
56
- tickLabelProps,
57
- yOffset,
58
- labelPosition,
59
- valuePosition,
60
- data,
61
- labelFormatter,
62
- valueFormatter,
63
- LabelComponent = DefaultLabelComponent,
64
- ValueComponent = DefaultValueComponent
65
- }) => {
66
- if (ticks.length === 0) {
67
- return null;
68
- }
69
- const allTickLabelProps = ticks.map(({
70
- value,
71
- index
72
- }) => typeof tickLabelProps === "function" ? tickLabelProps(value, index, ticks) : {});
73
- return ticks.map(({
74
- from,
75
- formattedValue
76
- }, index) => {
77
- const textProps = allTickLabelProps[index] ?? {};
78
- delete textProps.textAnchor;
79
- delete textProps.dx;
80
- const sum = data.reduce((acc, {
81
- data: seriesData
82
- }) => acc + (seriesData[index]?.value ?? 0), 0);
83
- const y = from.y + yOffset;
84
- return /* @__PURE__ */ _jsxs(Group, {
85
- children: [/* @__PURE__ */ _jsx(LabelComponent, {
86
- textProps,
87
- x: labelPosition,
88
- y,
89
- label: formattedValue,
90
- formatter: labelFormatter
91
- }), /* @__PURE__ */ _jsx(ValueComponent, {
92
- textProps,
93
- x: valuePosition,
94
- y,
95
- value: sum,
96
- formatter: valueFormatter,
97
- data,
98
- index
99
- })]
100
- }, index);
101
- });
102
- };
103
- var getDefaultYOffset = (data, yScaleConfig, height, isMultiSeries) => {
104
- if (!isMultiSeries) {
105
- return 0;
106
- }
107
- const dataKeys = data.map(({
108
- label
109
- }) => label);
110
- const yScale = createScale({
111
- type: "band",
112
- range: [0, height],
113
- domain: dataKeys,
114
- ...yScaleConfig
115
- });
116
- const groupScale = scaleBand({
117
- domain: dataKeys,
118
- range: [0, getScaleBandwidth(yScale)],
119
- padding: yScaleConfig.paddingInner
120
- });
121
- const GAP_BETWEEN_BARS = 6;
122
- const barThickness = getScaleBandwidth(groupScale);
123
- return -(barThickness + GAP_BETWEEN_BARS);
124
- };
125
- var BarListChartInternal = ({
126
- data,
127
- width,
128
- height,
129
- options = {},
130
- margin = {
131
- left: 0,
132
- right: 20,
133
- bottom: 0,
134
- top: 0
135
- },
136
- ...rest
137
- }) => {
138
- const chartOptions = useMemo(() => {
139
- const isMultiSeries = data.length > 1;
140
- const defaultYScale = {
141
- // For multi series, set default padding larger to look better.
142
- paddingInner: isMultiSeries ? 0.3 : 0.1,
143
- padding: isMultiSeries ? 0.3 : 0.1
144
- };
145
- const defaultXScale = {
146
- // Always begin at zero since the x axis is hidden.
147
- zero: true
148
- };
149
- const yScale = {
150
- ...defaultYScale,
151
- ...options.yScale ?? {}
152
- };
153
- const xScale = {
154
- ...defaultXScale,
155
- ...options.xScale ?? {}
156
- };
157
- return {
158
- yScale,
159
- xScale,
160
- labelPosition: options.labelPosition ?? (isMultiSeries ? 0 : 10),
161
- valueFormatter: options.valueFormatter ?? ((value) => formatNumberCompact(value)),
162
- labelFormatter: options.labelFormatter ?? ((value) => String(value)),
163
- valuePosition: options.valuePosition ?? width,
164
- yOffset: options.yOffset ?? getDefaultYOffset(data, yScale, height, isMultiSeries)
165
- };
166
- }, [options, width, data, height]);
167
- return /* @__PURE__ */ _jsx(BarChart, {
168
- orientation: "horizontal",
169
- gridVisibility: "none",
170
- data,
171
- width,
172
- height,
173
- margin,
174
- options: {
175
- axis: {
176
- y: {
177
- children: (renderProps) => /* @__PURE__ */ _jsx(AxisRenderer, {
178
- ...renderProps,
179
- data,
180
- yOffset: chartOptions.yOffset,
181
- labelPosition: chartOptions.labelPosition,
182
- valuePosition: chartOptions.valuePosition,
183
- labelFormatter: chartOptions.labelFormatter,
184
- valueFormatter: chartOptions.valueFormatter,
185
- LabelComponent: options.labelComponent,
186
- ValueComponent: options.valueComponent
187
- })
188
- },
189
- x: {
190
- children: () => null
191
- }
192
- },
193
- xScale: chartOptions.xScale,
194
- yScale: chartOptions.yScale
195
- },
196
- ...rest
197
- });
198
- };
199
- var BarListChart = (props) => {
200
- const existingContext = useContext(GlobalChartsContext);
201
- if (existingContext) {
202
- return /* @__PURE__ */ _jsx(BarListChartInternal, {
203
- ...props
204
- });
205
- }
206
- return /* @__PURE__ */ _jsx(GlobalChartsProvider, {
207
- children: /* @__PURE__ */ _jsx(BarListChartInternal, {
208
- ...props
209
- })
210
- });
211
- };
212
- BarListChart.displayName = "BarListChart";
213
- var BarListChartResponsive = withResponsive(BarListChart);
214
-
215
- export {
216
- BarListChart,
217
- BarListChartResponsive
218
- };
219
- //# sourceMappingURL=chunk-DKU775VC.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/charts/bar-list-chart/bar-list-chart.tsx"],"sourcesContent":["import { formatNumberCompact } from '@automattic/number-formatters';\nimport { Group } from '@visx/group';\nimport { createScale, scaleBand } from '@visx/scale';\nimport { Text } from '@visx/text';\nimport { useContext, useMemo } from 'react';\nimport { GlobalChartsContext, GlobalChartsProvider } from '../../providers';\nimport { BarChartUnresponsive } from '../bar-chart';\nimport { withResponsive } from '../private/with-responsive';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/**\n * Get the bandwidth of a scale\n * @param scale - The scale to get the bandwidth of\n * @return The bandwidth of the scale\n */\nconst getScaleBandwidth = scale => {\n // Broaden type before using 'xxx' in s as typeguard.\n const s = scale;\n return s && 'bandwidth' in s ? s?.bandwidth() ?? 0 : 0;\n};\nconst DefaultLabelComponent = ({\n textProps,\n x,\n y,\n label,\n formatter\n}) => {\n return /*#__PURE__*/_jsx(Text, {\n ...textProps,\n textAnchor: \"start\",\n x: x,\n y: y,\n children: formatter(label)\n });\n};\nconst DefaultValueComponent = ({\n textProps,\n x,\n y,\n value,\n formatter\n}) => {\n return /*#__PURE__*/_jsx(Text, {\n ...textProps,\n textAnchor: \"end\",\n x: x,\n y: y,\n fontWeight: 500,\n children: formatter(value)\n });\n};\nconst AxisRenderer = ({\n ticks,\n tickLabelProps,\n yOffset,\n labelPosition,\n valuePosition,\n data,\n labelFormatter,\n valueFormatter,\n LabelComponent = DefaultLabelComponent,\n ValueComponent = DefaultValueComponent\n}) => {\n if (ticks.length === 0) {\n return null;\n }\n\n // compute the max tick label size to compute label offset\n const allTickLabelProps = ticks.map(({\n value,\n index\n }) => typeof tickLabelProps === 'function' ? tickLabelProps(value, index, ticks) : {});\n return ticks.map(({\n from,\n formattedValue\n }, index) => {\n const textProps = allTickLabelProps[index] ?? {};\n // No need to pass textAnchor and dx. It will be handled by the component.\n delete textProps.textAnchor;\n delete textProps.dx;\n const sum = data.reduce((acc, {\n data: seriesData\n }) => acc + (seriesData[index]?.value ?? 0), 0);\n const y = from.y + yOffset;\n return /*#__PURE__*/_jsxs(Group, {\n children: [/*#__PURE__*/_jsx(LabelComponent, {\n textProps: textProps,\n x: labelPosition,\n y: y,\n label: formattedValue,\n formatter: labelFormatter\n }), /*#__PURE__*/_jsx(ValueComponent, {\n textProps: textProps,\n x: valuePosition,\n y: y,\n value: sum,\n formatter: valueFormatter,\n data: data,\n index: index\n })]\n }, index);\n });\n};\n\n/**\n * Calculate the default y offset for the bar list chart.\n * @param data - The data to calculate the default y offset for.\n * @param yScaleConfig - The y scale configuration.\n * @param height - The height of the chart.\n * @param isMultiSeries - Whether the chart is a multi series chart.\n * @return The default y offset.\n */\nconst getDefaultYOffset = (data, yScaleConfig, height, isMultiSeries) => {\n if (!isMultiSeries) {\n return 0;\n }\n const dataKeys = data.map(({\n label\n }) => label);\n const yScale = createScale({\n type: 'band',\n range: [0, height],\n domain: dataKeys,\n ...yScaleConfig\n });\n const groupScale = scaleBand({\n domain: dataKeys,\n range: [0, getScaleBandwidth(yScale)],\n padding: yScaleConfig.paddingInner\n });\n const GAP_BETWEEN_BARS = 6;\n const barThickness = getScaleBandwidth(groupScale);\n\n // Use negative value to move the label up.\n return -(barThickness + GAP_BETWEEN_BARS);\n};\nconst BarListChartInternal = ({\n data,\n width,\n height,\n options = {},\n margin = {\n left: 0,\n right: 20,\n bottom: 0,\n top: 0\n },\n ...rest\n}) => {\n const chartOptions = useMemo(() => {\n const isMultiSeries = data.length > 1;\n const defaultYScale = {\n // For multi series, set default padding larger to look better.\n paddingInner: isMultiSeries ? 0.3 : 0.1,\n padding: isMultiSeries ? 0.3 : 0.1\n };\n const defaultXScale = {\n // Always begin at zero since the x axis is hidden.\n zero: true\n };\n const yScale = {\n ...defaultYScale,\n ...(options.yScale ?? {})\n };\n const xScale = {\n ...defaultXScale,\n ...(options.xScale ?? {})\n };\n return {\n yScale,\n xScale,\n labelPosition: options.labelPosition ?? (isMultiSeries ? 0 : 10),\n valueFormatter: options.valueFormatter ?? (value => formatNumberCompact(value)),\n labelFormatter: options.labelFormatter ?? (value => String(value)),\n valuePosition: options.valuePosition ?? width,\n yOffset: options.yOffset ?? getDefaultYOffset(data, yScale, height, isMultiSeries)\n };\n }, [options, width, data, height]);\n return /*#__PURE__*/_jsx(BarChartUnresponsive, {\n orientation: \"horizontal\",\n gridVisibility: 'none',\n data: data,\n width: width,\n height: height,\n margin: margin,\n options: {\n axis: {\n y: {\n children: renderProps => /*#__PURE__*/_jsx(AxisRenderer, {\n ...renderProps,\n data: data,\n yOffset: chartOptions.yOffset,\n labelPosition: chartOptions.labelPosition,\n valuePosition: chartOptions.valuePosition,\n labelFormatter: chartOptions.labelFormatter,\n valueFormatter: chartOptions.valueFormatter,\n LabelComponent: options.labelComponent,\n ValueComponent: options.valueComponent\n })\n },\n x: {\n children: () => null\n }\n },\n xScale: chartOptions.xScale,\n yScale: chartOptions.yScale\n },\n ...rest\n });\n};\nconst BarListChart = props => {\n const existingContext = useContext(GlobalChartsContext);\n\n // If we're already in a GlobalChartsProvider context, render the core component directly\n if (existingContext) {\n return /*#__PURE__*/_jsx(BarListChartInternal, {\n ...props\n });\n }\n\n // Otherwise, wrap with our own GlobalChartsProvider\n return /*#__PURE__*/_jsx(GlobalChartsProvider, {\n children: /*#__PURE__*/_jsx(BarListChartInternal, {\n ...props\n })\n });\n};\nBarListChart.displayName = 'BarListChart';\nconst BarListChartResponsive = withResponsive(BarListChart);\nexport { BarListChartResponsive as default, BarListChart as BarListChartUnresponsive };"],"mappings":";;;;;;;;;;;;AAAA,SAAS,2BAA2B;AACpC,SAAS,aAAa;AACtB,SAAS,aAAa,iBAAiB;AACvC,SAAS,YAAY;AACrB,SAAS,YAAY,eAAe;AAIpC,SAAS,OAAO,MAAM,QAAQ,aAAa;AAM3C,IAAM,oBAAoB,WAAS;AAEjC,QAAM,IAAI;AACV,SAAO,KAAK,eAAe,IAAI,GAAG,UAAU,KAAK,IAAI;AACvD;AACA,IAAM,wBAAwB,CAAC;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ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