@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
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-CMMHCTBX.cjs","../src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx","../src/charts/pie-semi-circle-chart/pie-semi-circle-chart.module.scss"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACrCA,oCAAsB;AACtB,oCAAoB;AACpB,kCAAqB;AACrB,wCAA+C;AAC/C,uCAAmB;AAEnB,wEAAiB;AACjB,8BAAiD;ADsCjD;AACA;AE9CsF,IAAO,qCAAA,EAAQ;AAAA,EACnG,mCAAA,EAAqC,kBAAA;AAAA,EACrC,oCAAA,EAAsC,kBAAA;AAAA,EACtC,uBAAA,EAAyB,kBAAA;AAAA,EACzB,OAAA,EAAS,kBAAA;AAAA,EACT,MAAA,EAAQ;AACV,CAAA;AFgDA;AACA;ACjCA,+CAAkE;AAQlE,IAAM,kCAAA,EAAoC,CAAC;AAAA,EACzC;AACF,CAAA,EAAA,GAAM;AACJ,EAAA,uBAAoB,6BAAA,6BAAK,EAAa;AAAA,IACpC,IAAA,EAA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sB,cAAA;AAC3B,YAAA;AACD,UAAA;AACH,QAAA;AACgC,MAAA;AACd,QAAA;AACE,QAAA;AACO,QAAA;AACpB,UAAA;AACkB,UAAA;AACtB,YAAA;AACD,UAAA;AACF,QAAA;AAC4B,MAAA;AAChC,IAAA;AACF,EAAA;AACH;AACuC;AACF,EAAA;AAGd,EAAA;AACM,IAAA;AACpB,MAAA;AACJ,IAAA;AACH,EAAA;AAGyB,EAAA;AACK,IAAA;AACvB,MAAA;AACJ,IAAA;AACF,EAAA;AACH;AAC+B;AAGJ;AACzB,EAAA;AACK,EAAA;AACC,EAAA;AACP;AAGoC;AACnC,EAAA;AACK,EAAA;AACC,EAAA;AACP;ADjCyC;AACA;AACA;AACA;AACA","file":"/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-CMMHCTBX.cjs","sourcesContent":[null,"import { Group } from '@visx/group';\nimport { Pie } from '@visx/shape';\nimport { Text } from '@visx/text';\nimport { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { BaseTooltip } from '../../components/tooltip';\nimport { useElementSize, useInteractiveLegendData, usePrefersReducedMotion } from '../../hooks';\nimport { GlobalChartsProvider, useChartId, useChartRegistration, useGlobalChartsContext, GlobalChartsContext } from '../../providers';\nimport { attachSubComponents } from '../../utils';\nimport { ChartSVG, ChartHTML, useChartChildren, renderLegendSlot } from '../private/chart-composition';\nimport { RadialWipeAnimation } from '../private/radial-wipe-animation';\nimport { SingleChartContext } from '../private/single-chart-context';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './pie-semi-circle-chart.module.scss';\n\n/**\n * Parameters passed to the renderTooltip function for semi-circle charts.\n */\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\n/**\n * Default tooltip renderer for semi-circle pie charts.\n * Renders a BaseTooltip with the hovered segment's data.\n *\n * @param {PieSemiCircleChartRenderTooltipParams} params - The tooltip parameters containing the hovered data point\n * @return {ReactNode} The rendered tooltip content\n */\nconst renderDefaultPieSemiCircleTooltip = ({\n tooltipData\n}) => {\n return /*#__PURE__*/_jsx(BaseTooltip, {\n data: tooltipData,\n top: 0,\n left: 0,\n renderContainer: false\n });\n};\nconst PAD_ANGLE = 0.03; // Padding between segments\nconst DEFAULT_WIDTH = 400;\n\n// Base props type with optional responsive properties\n\n// Composition API types\n\n/**\n * Validates the semi-circle pie chart data\n * @param data - The data to validate\n * @return Object containing validation result and error message\n */\nconst validateData = data => {\n if (!data.length) {\n return {\n isValid: false,\n message: 'No data available'\n };\n }\n\n // Check for negative values\n const hasNegativeValues = data.some(item => item.percentage < 0 || item.value < 0);\n if (hasNegativeValues) {\n return {\n isValid: false,\n message: 'Invalid data: Negative values are not allowed'\n };\n }\n\n // Validate total percentage is greater than 0\n const totalPercentage = data.reduce((sum, item) => sum + item.percentage, 0);\n if (totalPercentage <= 0) {\n return {\n isValid: false,\n message: 'Invalid percentage total: Must be greater than 0'\n };\n }\n return {\n isValid: true,\n message: ''\n };\n};\nconst PieSemiCircleChartInternal = ({\n data,\n chartId: providedChartId,\n width: propWidth,\n height: propHeight,\n thickness = 0.4,\n clockwise = true,\n withTooltips = false,\n showLegend = false,\n legend = {},\n legendValueDisplay = 'percentage',\n label,\n animation,\n note,\n className,\n children,\n tooltipOffsetX = 0,\n tooltipOffsetY = -15,\n renderTooltip = renderDefaultPieSemiCircleTooltip,\n gap = 'md'\n}) => {\n const legendInteractive = legend.interactive ?? false;\n const legendPosition = legend.position ?? 'bottom';\n const chartId = useChartId(providedChartId);\n // Measure the SVG wrapper to calculate constrained dimensions\n const [svgWrapperRef, svgWrapperWidth, svgWrapperHeight] = useElementSize();\n const {\n tooltipOpen,\n tooltipLeft,\n tooltipTop,\n tooltipData,\n hideTooltip,\n showTooltip\n } = useTooltip();\n\n // Set up portal tooltip for better z-index handling\n // We get containerBounds to cancel out stale offsets in the position calculation\n const {\n containerRef,\n TooltipInPortal,\n containerBounds\n } = useTooltipInPortal({\n detectBounds: true,\n scroll: true,\n debounce: 0\n });\n const handleMouseMove = useCallback((event, arc) => {\n // Don't show tooltip until container bounds are measured\n if (containerBounds.width === 0 || containerBounds.height === 0) {\n return;\n }\n\n // Use clientX/Y and subtract containerBounds to cancel out any stale offset.\n // TooltipInPortal calculates: tooltipLeft + containerBounds.left + scrollX\n // By passing (clientX - containerBounds.left), we get:\n // (clientX - containerBounds.left) + containerBounds.left + scrollX = clientX + scrollX\n // This gives correct page coordinates regardless of stale bounds.\n showTooltip({\n tooltipData: arc.data,\n tooltipLeft: event.clientX - containerBounds.left + tooltipOffsetX,\n tooltipTop: event.clientY - containerBounds.top + tooltipOffsetY\n });\n }, [containerBounds.width, containerBounds.height, containerBounds.left, containerBounds.top, showTooltip, tooltipOffsetX, tooltipOffsetY]);\n const handleMouseLeave = useCallback(() => {\n hideTooltip();\n }, [hideTooltip]);\n const handleArcMouseMove = useCallback(arc => event => {\n handleMouseMove(event, arc);\n }, [handleMouseMove]);\n\n // Validate data first to get validation result\n const {\n isValid,\n message\n } = validateData(data);\n const {\n getElementStyles,\n isSeriesVisible\n } = useGlobalChartsContext();\n\n // Filter and recalculate data for interactive legends\n const {\n visibleData,\n allSegmentsHidden,\n legendData\n } = useInteractiveLegendData({\n data,\n chartId,\n legendInteractive,\n isSeriesVisible\n });\n\n // Define accessors with useMemo to avoid changing dependencies\n const accessors = useMemo(() => ({\n value: d => d.value,\n sort: (a, b) => b.value - a.value,\n fill: d => getElementStyles({\n data: d,\n index: d.index\n }).color\n }), [getElementStyles]);\n\n // Memoize legend options to prevent unnecessary re-calculations\n const legendOptions = useMemo(() => ({\n showValues: true,\n legendValueDisplay\n }), [legendValueDisplay]);\n\n // Create legend items using legendData (has recalculated percentages for visible items)\n const legendItems = useChartLegendItems(legendData, legendOptions);\n\n // Process children to extract compound components\n const {\n svgChildren,\n htmlChildren,\n legendChildren,\n otherChildren\n } = useChartChildren(children, 'PieSemiCircleChart');\n\n // Memoize metadata to prevent unnecessary re-registration\n const chartMetadata = useMemo(() => ({\n thickness,\n clockwise\n }), [thickness, clockwise]);\n\n // Register chart with context only if data is valid\n useChartRegistration({\n chartId,\n legendItems,\n chartType: 'pie-semi-circle',\n isDataValid: isValid,\n metadata: chartMetadata\n });\n const prefersReducedMotion = usePrefersReducedMotion();\n const effectiveWidth = propWidth || DEFAULT_WIDTH;\n if (!isValid) {\n const errorWidth = propHeight ? Math.min(propWidth || propHeight * 2, propHeight * 2) : effectiveWidth;\n const errorHeight = errorWidth / 2;\n return /*#__PURE__*/_jsx(\"div\", {\n className: styles['pie-semi-circle-chart'],\n children: /*#__PURE__*/_jsx(\"svg\", {\n width: errorWidth,\n height: errorHeight,\n children: /*#__PURE__*/_jsx(\"text\", {\n x: \"50%\",\n y: \"50%\",\n textAnchor: \"middle\",\n className: styles.error,\n children: message\n })\n })\n });\n }\n\n // Calculate chart dimensions maintaining the 2:1 width-to-height ratio.\n // Use measured SVG wrapper dimensions to respect height constraints, falling back\n // to explicit props during initial render before measurement is available.\n const availableWidth = svgWrapperWidth > 0 ? svgWrapperWidth : effectiveWidth;\n const availableHeight = svgWrapperHeight > 0 ? svgWrapperHeight : propHeight || effectiveWidth / 2;\n // Constrain width so that height (= width / 2) never exceeds the available height\n const width = Math.min(availableWidth, availableHeight * 2);\n const height = width / 2;\n const radius = height; // For a semi-circle, radius equals the SVG height\n const innerRadius = radius * (1 - thickness);\n\n // Map data with index for color assignment\n // When interactive, we need to find the original index to maintain consistent colors\n const dataWithIndex = visibleData.map(d => {\n const originalIndex = data.findIndex(item => item.label === d.label);\n return {\n ...d,\n index: originalIndex >= 0 ? originalIndex : 0\n };\n });\n\n // Configure pie angles based on clockwise direction\n const startAngle = clockwise ? -Math.PI / 2 : Math.PI / 2;\n const endAngle = clockwise ? Math.PI / 2 : -Math.PI / 2;\n const legendElement = showLegend && /*#__PURE__*/_jsx(Legend, {\n orientation: legend.orientation ?? 'horizontal',\n position: legendPosition,\n alignment: legend.alignment ?? 'center',\n labelStyles: legend.labelStyles,\n itemClassName: legend.itemClassName,\n itemStyles: legend.itemStyles,\n shapeStyles: legend.shapeStyles,\n shape: legend.shape ?? 'circle',\n chartId: chartId,\n interactive: legendInteractive\n });\n return /*#__PURE__*/_jsx(SingleChartContext.Provider, {\n value: {\n chartId,\n chartWidth: width,\n chartHeight: height\n },\n children: /*#__PURE__*/_jsxs(Stack, {\n ref: containerRef,\n direction: \"column\",\n gap: gap,\n className: clsx('pie-semi-circle-chart', styles['pie-semi-circle-chart'], {\n [styles['pie-semi-circle-chart--responsive']]: !propWidth && !propHeight\n }, className),\n style: {\n width: propWidth || undefined,\n height: propHeight || undefined\n },\n children: [legendPosition === 'top' && legendElement, renderLegendSlot(legendChildren, 'top'), /*#__PURE__*/_jsx(\"div\", {\n ref: svgWrapperRef,\n className: styles['pie-semi-circle-chart__svg-wrapper'],\n children: /*#__PURE__*/_jsxs(\"svg\", {\n width: width,\n height: height,\n viewBox: `0 0 ${width} ${height}`,\n children: [/*#__PURE__*/_jsx(\"defs\", {\n children: /*#__PURE__*/_jsx(RadialWipeAnimation, {\n id: `radial-wipe-${chartId}`,\n radius: radius,\n innerRadius: innerRadius,\n startAngle: \"-180deg\",\n wipePercentage: 50\n })\n }), /*#__PURE__*/_jsx(Group, {\n top: height,\n left: width / 2,\n mask: animation && !prefersReducedMotion ? `url(#radial-wipe-${chartId})` : null,\n children: allSegmentsHidden ? /*#__PURE__*/_jsx(\"text\", {\n textAnchor: \"middle\",\n y: -radius / 2,\n fill: \"#ccc\",\n fontSize: \"14\",\n fontFamily: \"-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif\",\n children: __('All segments are hidden. Click legend items to show data.', 'jetpack-charts')\n }) : /*#__PURE__*/_jsxs(_Fragment, {\n children: [/*#__PURE__*/_jsx(Pie, {\n data: dataWithIndex,\n pieValue: accessors.value,\n outerRadius: radius,\n innerRadius: innerRadius,\n cornerRadius: 3,\n padAngle: PAD_ANGLE,\n startAngle: startAngle,\n endAngle: endAngle,\n pieSort: accessors.sort,\n children: pie => {\n return pie.arcs.map(arc => /*#__PURE__*/_jsx(\"g\", {\n onMouseMove: withTooltips ? handleArcMouseMove(arc) : undefined,\n onMouseLeave: withTooltips ? handleMouseLeave : undefined,\n children: /*#__PURE__*/_jsx(\"path\", {\n d: pie.path(arc) || '',\n fill: accessors.fill(arc.data)\n })\n }, arc.data.label));\n }\n }), /*#__PURE__*/_jsxs(Group, {\n children: [/*#__PURE__*/_jsx(Text, {\n textAnchor: \"middle\",\n verticalAnchor: \"start\",\n y: -40 // Position above the chart with space for note\n ,\n className: styles.label,\n children: label\n }), /*#__PURE__*/_jsx(Text, {\n textAnchor: \"middle\",\n verticalAnchor: \"start\",\n y: -20 // Position between label and chart\n ,\n className: styles.note,\n children: note\n })]\n }), !allSegmentsHidden && svgChildren]\n })\n })]\n })\n }), legendPosition === 'bottom' && legendElement, renderLegendSlot(legendChildren, 'bottom'), withTooltips && tooltipOpen && tooltipData && /*#__PURE__*/_jsx(TooltipInPortal, {\n top: tooltipTop || 0,\n left: tooltipLeft || 0,\n children: /*#__PURE__*/_jsx(\"div\", {\n role: \"tooltip\",\n children: renderTooltip({\n tooltipData\n })\n })\n }), htmlChildren, otherChildren]\n })\n });\n};\nconst PieSemiCircleChartWithProvider = props => {\n const existingContext = useContext(GlobalChartsContext);\n\n // If we're already in a GlobalChartsProvider context, don't create a new one\n if (existingContext) {\n return /*#__PURE__*/_jsx(PieSemiCircleChartInternal, {\n ...props\n });\n }\n\n // Otherwise, create our own GlobalChartsProvider\n return /*#__PURE__*/_jsx(GlobalChartsProvider, {\n children: /*#__PURE__*/_jsx(PieSemiCircleChartInternal, {\n ...props\n })\n });\n};\nPieSemiCircleChartWithProvider.displayName = 'PieSemiCircleChart';\n\n// Create PieSemiCircleChart with composition API\nconst PieSemiCircleChart = attachSubComponents(PieSemiCircleChartWithProvider, {\n Legend: Legend,\n SVG: ChartSVG,\n HTML: ChartHTML\n});\n\n// Create responsive PieSemiCircleChart with composition API\nconst PieSemiCircleChartResponsive = attachSubComponents(withResponsive(PieSemiCircleChartWithProvider), {\n Legend: Legend,\n SVG: ChartSVG,\n HTML: ChartHTML\n});\nexport { PieSemiCircleChartResponsive as default, PieSemiCircleChart as PieSemiCircleChartUnresponsive };","import 'css-chunk:src/charts/pie-semi-circle-chart/pie-semi-circle-chart.module.scss';export default {\n \"pie-semi-circle-chart--responsive\": \"a8ccharts-V0wiEb\",\n \"pie-semi-circle-chart__svg-wrapper\": \"a8ccharts-hGowej\",\n \"pie-semi-circle-chart\": \"a8ccharts-8tyaQj\",\n \"label\": \"a8ccharts-EKZS3j\",\n \"note\": \"a8ccharts-v85A8-\"\n};"]}
@@ -1,18 +1,23 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkY3NNQMAXcjs = require('./chunk-Y3NNQMAX.cjs');
4
+ var _chunkTZRUHQOHcjs = require('./chunk-TZRUHQOH.cjs');
5
5
 
6
6
 
7
- var _chunkUFRBUT2Dcjs = require('./chunk-UFRBUT2D.cjs');
8
7
 
9
8
 
10
- var _chunkASLARV7Lcjs = require('./chunk-ASLARV7L.cjs');
9
+
10
+ var _chunkXVBH5XHEcjs = require('./chunk-XVBH5XHE.cjs');
11
+
11
12
 
12
13
 
14
+ var _chunkY3NNQMAXcjs = require('./chunk-Y3NNQMAX.cjs');
15
+
13
16
 
17
+ var _chunkREZTQ4PHcjs = require('./chunk-REZTQ4PH.cjs');
14
18
 
15
19
 
20
+ var _chunkASLARV7Lcjs = require('./chunk-ASLARV7L.cjs');
16
21
 
17
22
 
18
23
 
@@ -25,11 +30,11 @@ var _chunkASLARV7Lcjs = require('./chunk-ASLARV7L.cjs');
25
30
 
26
31
 
27
32
 
28
- var _chunkYDVHT7GScjs = require('./chunk-YDVHT7GS.cjs');
33
+ var _chunkWYK7EL5Rcjs = require('./chunk-WYK7EL5R.cjs');
29
34
 
30
35
 
31
36
 
32
- var _chunkZVGEDXDPcjs = require('./chunk-ZVGEDXDP.cjs');
37
+ var _chunkMXGLYWVPcjs = require('./chunk-MXGLYWVP.cjs');
33
38
 
34
39
  // src/charts/line-chart/line-chart.tsx
35
40
  var _numberformatters = require('@automattic/number-formatters');
@@ -101,7 +106,7 @@ var LineChartAnnotationLabelWithPopover = ({
101
106
  const buttonRef = _react.useRef.call(void 0, null);
102
107
  const popoverRef = _react.useRef.call(void 0, null);
103
108
  const [isPositioned, setIsPositioned] = _react.useState.call(void 0, false);
104
- const isBrowserSafari = _chunkZVGEDXDPcjs.isSafari.call(void 0, );
109
+ const isBrowserSafari = _chunkMXGLYWVPcjs.isSafari.call(void 0, );
105
110
  _react.useEffect.call(void 0, () => {
106
111
  const button = buttonRef.current;
107
112
  const popover = popoverRef.current;
@@ -182,7 +187,7 @@ var LineChartAnnotationsOverlay = ({
182
187
  chartRef,
183
188
  chartWidth,
184
189
  chartHeight
185
- } = _chunkYDVHT7GScjs.useSingleChartContext.call(void 0, );
190
+ } = _chunkXVBH5XHEcjs.useSingleChartContext.call(void 0, );
186
191
  const [scales, setScales] = _react.useState.call(void 0, null);
187
192
  const [scalesStable, setScalesStable] = _react.useState.call(void 0, false);
188
193
  const createScaleSignature = _react.useCallback.call(void 0, (scaleData) => {
@@ -361,7 +366,7 @@ var LineChartAnnotation = ({
361
366
  renderLabel,
362
367
  renderLabelPopover
363
368
  }) => {
364
- const providerTheme = _chunkYDVHT7GScjs.useGlobalChartsTheme.call(void 0, );
369
+ const providerTheme = _chunkWYK7EL5Rcjs.useGlobalChartsTheme.call(void 0, );
365
370
  const {
366
371
  xScale,
367
372
  yScale
@@ -448,7 +453,7 @@ var LineChartAnnotation = ({
448
453
  const getSafariHTMLLabelPosition = () => {
449
454
  const labelWidth = POPOVER_BUTTON_SIZE;
450
455
  const labelHeight = POPOVER_BUTTON_SIZE;
451
- return _chunkZVGEDXDPcjs.isSafari.call(void 0, ) ? {
456
+ return _chunkMXGLYWVPcjs.isSafari.call(void 0, ) ? {
452
457
  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)`,
453
458
  width: labelWidth,
454
459
  height: labelHeight
@@ -707,15 +712,9 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
707
712
  withTooltips = true,
708
713
  withTooltipCrosshairs,
709
714
  showLegend = false,
710
- legendOrientation = "horizontal",
711
- legendAlignment = "center",
712
- legendPosition = "bottom",
713
- legendMaxWidth,
714
- legendTextOverflow = "wrap",
715
- legendItemClassName,
715
+ legend = {},
716
716
  renderGlyph = defaultRenderGlyph,
717
717
  glyphStyle = {},
718
- legendShape = "line",
719
718
  withLegendGlyph = false,
720
719
  withGradientFill = false,
721
720
  smoothing = true,
@@ -723,7 +722,6 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
723
722
  renderTooltip = renderDefaultTooltip,
724
723
  withStartGlyphs = false,
725
724
  withEndGlyphs = false,
726
- legendInteractive = false,
727
725
  animation,
728
726
  options = {},
729
727
  onPointerDown = void 0,
@@ -734,15 +732,22 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
734
732
  gridVisibility,
735
733
  gap = "md"
736
734
  }, ref) => {
737
- const providerTheme = _chunkYDVHT7GScjs.useGlobalChartsTheme.call(void 0, );
738
- const theme = _chunkYDVHT7GScjs.useXYChartTheme.call(void 0, data);
739
- const chartId = _chunkYDVHT7GScjs.useChartId.call(void 0, providedChartId);
740
- const [svgWrapperRef, , svgWrapperHeight] = _chunkYDVHT7GScjs.useElementSize.call(void 0, );
735
+ const legendInteractive = _nullishCoalesce(legend.interactive, () => ( false));
736
+ const legendShape = _nullishCoalesce(legend.shape, () => ( "line"));
737
+ const legendPosition = _nullishCoalesce(legend.position, () => ( "bottom"));
738
+ const providerTheme = _chunkWYK7EL5Rcjs.useGlobalChartsTheme.call(void 0, );
739
+ const theme = _chunkWYK7EL5Rcjs.useXYChartTheme.call(void 0, data);
740
+ const chartId = _chunkWYK7EL5Rcjs.useChartId.call(void 0, providedChartId);
741
+ const [svgWrapperRef, , svgWrapperHeight] = _chunkWYK7EL5Rcjs.useElementSize.call(void 0, );
741
742
  const chartRef = _react.useRef.call(void 0, null);
742
743
  const [selectedIndex, setSelectedIndex] = _react.useState.call(void 0, void 0);
743
744
  const [isNavigating, setIsNavigating] = _react.useState.call(void 0, false);
744
745
  const internalChartRef = _react.useRef.call(void 0, null);
745
- const hasLegendChild = _chunkYDVHT7GScjs.useHasLegendChild.call(void 0, children);
746
+ const {
747
+ legendChildren,
748
+ nonLegendChildren
749
+ } = _chunkTZRUHQOHcjs.useChartChildren.call(void 0, children, "LineChart");
750
+ const hasLegendChild = legendChildren.length > 0;
746
751
  const chartHeight = svgWrapperHeight > 0 ? svgWrapperHeight : height;
747
752
  const hasLegend = showLegend || hasLegendChild;
748
753
  const isWaitingForMeasurement = hasLegend ? svgWrapperHeight === 0 : !chartHeight;
@@ -754,11 +759,11 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
754
759
  margin: {}
755
760
  }
756
761
  }), [internalChartRef]);
757
- const dataSorted = _chunkYDVHT7GScjs.useChartDataTransform.call(void 0, data);
762
+ const dataSorted = _chunkWYK7EL5Rcjs.useChartDataTransform.call(void 0, data);
758
763
  const {
759
764
  getElementStyles,
760
765
  isSeriesVisible
761
- } = _chunkYDVHT7GScjs.useGlobalChartsContext.call(void 0, );
766
+ } = _chunkWYK7EL5Rcjs.useGlobalChartsContext.call(void 0, );
762
767
  const seriesWithVisibility = _react.useMemo.call(void 0, () => {
763
768
  if (!chartId || !legendInteractive) {
764
769
  return dataSorted.map((series, index) => ({
@@ -840,7 +845,7 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
840
845
  return themeGlyph ? themeGlyph(propsWithResolvedColor) : renderGlyph(propsWithResolvedColor);
841
846
  };
842
847
  }, [dataSorted, renderGlyph, getElementStyles]);
843
- const defaultMargin = _chunkYDVHT7GScjs.useChartMargin.call(void 0, height, chartOptions, dataSorted, theme);
848
+ const defaultMargin = _chunkWYK7EL5Rcjs.useChartMargin.call(void 0, height, chartOptions, dataSorted, theme);
844
849
  const error = validateData(dataSorted);
845
850
  const isDataValid = !error;
846
851
  const legendOptions = _react.useMemo.call(void 0, () => ({
@@ -848,7 +853,7 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
848
853
  glyphSize: Math.max(0, _nullishCoalesce(toNumber2(_optionalChain([glyphStyle, 'optionalAccess', _66 => _66.radius])), () => ( 4))),
849
854
  renderGlyph
850
855
  }), [withLegendGlyph, _optionalChain([glyphStyle, 'optionalAccess', _67 => _67.radius]), renderGlyph]);
851
- const legendItems = _chunkYDVHT7GScjs.useChartLegendItems.call(void 0, dataSorted, legendOptions, legendShape);
856
+ const legendItems = _chunkXVBH5XHEcjs.useChartLegendItems.call(void 0, dataSorted, legendOptions, legendShape);
852
857
  const chartMetadata = _react.useMemo.call(void 0, () => ({
853
858
  withGradientFill,
854
859
  smoothing,
@@ -857,14 +862,14 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
857
862
  withEndGlyphs,
858
863
  withLegendGlyph
859
864
  }), [withGradientFill, smoothing, curveType, withStartGlyphs, withEndGlyphs, withLegendGlyph]);
860
- _chunkYDVHT7GScjs.useChartRegistration.call(void 0, {
865
+ _chunkWYK7EL5Rcjs.useChartRegistration.call(void 0, {
861
866
  chartId,
862
867
  legendItems,
863
868
  chartType: "line",
864
869
  isDataValid,
865
870
  metadata: chartMetadata
866
871
  });
867
- const prefersReducedMotion = _chunkYDVHT7GScjs.usePrefersReducedMotion.call(void 0, );
872
+ const prefersReducedMotion = _chunkWYK7EL5Rcjs.usePrefersReducedMotion.call(void 0, );
868
873
  const accessors = {
869
874
  xAccessor: (d) => _optionalChain([d, 'optionalAccess', _68 => _68.date]),
870
875
  yAccessor: (d) => _optionalChain([d, 'optionalAccess', _69 => _69.value])
@@ -875,26 +880,27 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
875
880
  children: error
876
881
  });
877
882
  }
878
- const legendElement = showLegend && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYDVHT7GScjs.Legend, {
879
- orientation: legendOrientation,
880
- alignment: legendAlignment,
883
+ const legendElement = showLegend && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXVBH5XHEcjs.Legend, {
884
+ orientation: _nullishCoalesce(legend.orientation, () => ( "horizontal")),
885
+ alignment: _nullishCoalesce(legend.alignment, () => ( "center")),
881
886
  position: legendPosition,
882
- maxWidth: legendMaxWidth,
883
- textOverflow: legendTextOverflow,
884
- legendItemClassName,
887
+ labelStyles: legend.labelStyles,
888
+ itemClassName: legend.itemClassName,
889
+ itemStyles: legend.itemStyles,
890
+ shapeStyles: legend.shapeStyles,
885
891
  className: line_chart_module_default["line-chart__legend"],
886
892
  shape: legendShape,
887
893
  chartId,
888
894
  interactive: legendInteractive
889
895
  });
890
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYDVHT7GScjs.SingleChartContext.Provider, {
896
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXVBH5XHEcjs.SingleChartContext.Provider, {
891
897
  value: {
892
898
  chartId,
893
899
  chartRef: internalChartRef,
894
900
  chartWidth: width,
895
901
  chartHeight
896
902
  },
897
- children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUFRBUT2Dcjs.Stack, {
903
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkREZTQ4PHcjs.Stack, {
898
904
  direction: "column",
899
905
  gap,
900
906
  className: _clsx2.default.call(void 0, "line-chart", line_chart_module_default["line-chart"], {
@@ -905,7 +911,7 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
905
911
  height,
906
912
  visibility: isWaitingForMeasurement ? "hidden" : "visible"
907
913
  },
908
- children: [legendPosition === "top" && legendElement, /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
914
+ children: [legendPosition === "top" && legendElement, _chunkTZRUHQOHcjs.renderLegendSlot.call(void 0, legendChildren, "top"), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
909
915
  className: line_chart_module_default["line-chart__svg-wrapper"],
910
916
  ref: svgWrapperRef,
911
917
  role: "grid",
@@ -1027,19 +1033,19 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
1027
1033
  })]
1028
1034
  })
1029
1035
  })
1030
- }), legendPosition === "bottom" && legendElement, children]
1036
+ }), legendPosition === "bottom" && legendElement, _chunkTZRUHQOHcjs.renderLegendSlot.call(void 0, legendChildren, "bottom"), nonLegendChildren]
1031
1037
  })
1032
1038
  });
1033
1039
  });
1034
1040
  var LineChartWithProvider = /* @__PURE__ */ _react.forwardRef.call(void 0, (props, ref) => {
1035
- const existingContext = _react.useContext.call(void 0, _chunkYDVHT7GScjs.GlobalChartsContext);
1041
+ const existingContext = _react.useContext.call(void 0, _chunkWYK7EL5Rcjs.GlobalChartsContext);
1036
1042
  if (existingContext) {
1037
1043
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LineChartInternal, {
1038
1044
  ...props,
1039
1045
  ref
1040
1046
  });
1041
1047
  }
1042
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYDVHT7GScjs.GlobalChartsProvider, {
1048
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWYK7EL5Rcjs.GlobalChartsProvider, {
1043
1049
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LineChartInternal, {
1044
1050
  ...props,
1045
1051
  ref
@@ -1047,13 +1053,13 @@ var LineChartWithProvider = /* @__PURE__ */ _react.forwardRef.call(void 0, (prop
1047
1053
  });
1048
1054
  });
1049
1055
  LineChartWithProvider.displayName = "LineChart";
1050
- var LineChart = _chunkZVGEDXDPcjs.attachSubComponents.call(void 0, LineChartWithProvider, {
1051
- Legend: _chunkYDVHT7GScjs.Legend,
1056
+ var LineChart = _chunkMXGLYWVPcjs.attachSubComponents.call(void 0, LineChartWithProvider, {
1057
+ Legend: _chunkXVBH5XHEcjs.Legend,
1052
1058
  AnnotationsOverlay: line_chart_annotations_overlay_default,
1053
1059
  Annotation: line_chart_annotation_default
1054
1060
  });
1055
- var LineChartResponsive = _chunkZVGEDXDPcjs.attachSubComponents.call(void 0, _chunkASLARV7Lcjs.withResponsive.call(void 0, LineChartWithProvider), {
1056
- Legend: _chunkYDVHT7GScjs.Legend,
1061
+ var LineChartResponsive = _chunkMXGLYWVPcjs.attachSubComponents.call(void 0, _chunkASLARV7Lcjs.withResponsive.call(void 0, LineChartWithProvider), {
1062
+ Legend: _chunkXVBH5XHEcjs.Legend,
1057
1063
  AnnotationsOverlay: line_chart_annotations_overlay_default,
1058
1064
  Annotation: line_chart_annotation_default
1059
1065
  });
@@ -1062,4 +1068,4 @@ var LineChartResponsive = _chunkZVGEDXDPcjs.attachSubComponents.call(void 0, _ch
1062
1068
 
1063
1069
 
1064
1070
  exports.LineChart = LineChart; exports.LineChartResponsive = LineChartResponsive;
1065
- //# sourceMappingURL=chunk-O2JIANHK.cjs.map
1071
+ //# sourceMappingURL=chunk-CPPXJATQ.cjs.map
@@ -0,0 +1 @@
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,EAAA,MAAM,SAAA,EAAW,KAAA,CAAM,SAAA,GAAY,OAAA;AACnC,EAAA,uBAAoB,6BAAA,QAAK,EAAU;AAAA,IACjC,EAAA,EAAI,KAAA,CAAM,CAAA;AAAA,IACV,EAAA,EAAI,KAAA,CAAM,CAAA;AA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AA;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,EAAA;AACH;AACqB;AACM,EAAA;AACA,EAAA;AACA,EAAA;AACF,EAAA;AACd,IAAA;AACT,EAAA;AACyB,EAAA;AACH,EAAA;AACb,IAAA;AACT,EAAA;AACO,EAAA;AACT;AAC8B;AACH,EAAA;AACA,EAAA;AACA,E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A;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,13 +1,13 @@
1
1
  import {
2
2
  BarChart
3
- } from "./chunk-SSFFCBCF.js";
3
+ } from "./chunk-B6NLZFRW.js";
4
4
  import {
5
5
  withResponsive
6
6
  } from "./chunk-OP6PHB2U.js";
7
7
  import {
8
8
  GlobalChartsContext,
9
9
  GlobalChartsProvider
10
- } from "./chunk-RFSHE3HL.js";
10
+ } from "./chunk-2I67QUIV.js";
11
11
 
12
12
  // src/charts/bar-list-chart/bar-list-chart.tsx
13
13
  import { formatNumberCompact } from "@automattic/number-formatters";
@@ -216,4 +216,4 @@ export {
216
216
  BarListChart,
217
217
  BarListChartResponsive
218
218
  };
219
- //# sourceMappingURL=chunk-MDRCAGKZ.js.map
219
+ //# sourceMappingURL=chunk-DKU775VC.js.map