@automattic/charts 0.57.0 → 0.59.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 (267) hide show
  1. package/CHANGELOG.md +36 -2
  2. package/README.md +7 -54
  3. package/dist/index.cjs +9607 -21
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.css +32 -49
  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 -54
  10. package/dist/index.js.map +1 -1
  11. package/package.json +9 -126
  12. package/src/charts/bar-chart/bar-chart.module.scss +0 -5
  13. package/src/charts/bar-chart/bar-chart.tsx +142 -149
  14. package/src/charts/bar-chart/test/bar-chart.test.tsx +48 -31
  15. package/src/charts/leaderboard-chart/leaderboard-chart.tsx +54 -74
  16. package/src/charts/leaderboard-chart/test/leaderboard-chart.test.tsx +4 -5
  17. package/src/charts/leaderboard-chart/types.ts +1 -11
  18. package/src/charts/line-chart/line-chart.module.scss +0 -5
  19. package/src/charts/line-chart/line-chart.tsx +202 -193
  20. package/src/charts/line-chart/private/line-chart-annotations-overlay.tsx +1 -2
  21. package/src/charts/line-chart/test/line-chart.test.tsx +49 -27
  22. package/src/charts/line-chart/types.ts +0 -1
  23. package/src/charts/pie-chart/pie-chart.module.scss +2 -10
  24. package/src/charts/pie-chart/pie-chart.tsx +212 -212
  25. package/src/charts/pie-chart/test/composition-api.test.tsx +44 -3
  26. package/src/charts/pie-chart/test/pie-chart.test.tsx +51 -44
  27. package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.module.scss +2 -8
  28. package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx +166 -168
  29. package/src/charts/pie-semi-circle-chart/test/pie-semi-circle-chart.test.tsx +58 -30
  30. package/src/charts/private/chart-composition/index.ts +2 -0
  31. package/src/charts/private/chart-composition/render-legend-slot.ts +22 -0
  32. package/src/charts/private/chart-composition/test/render-legend-slot.test.tsx +60 -0
  33. package/src/charts/private/chart-composition/test/use-chart-children.test.tsx +91 -0
  34. package/src/charts/private/chart-composition/use-chart-children.ts +34 -2
  35. package/src/charts/private/chart-layout/chart-layout.module.scss +7 -0
  36. package/src/charts/private/chart-layout/chart-layout.tsx +106 -0
  37. package/src/charts/private/chart-layout/index.ts +2 -0
  38. package/src/charts/private/chart-layout/test/chart-layout.test.tsx +167 -0
  39. package/src/charts/private/single-chart-context/single-chart-context.tsx +2 -2
  40. package/src/charts/private/svg-empty-state/index.ts +1 -0
  41. package/src/charts/private/svg-empty-state/svg-empty-state.module.scss +7 -0
  42. package/src/charts/private/svg-empty-state/svg-empty-state.tsx +40 -0
  43. package/src/components/legend/hooks/test/use-chart-legend-items.test.tsx +12 -8
  44. package/src/components/legend/hooks/use-chart-legend-items.ts +12 -13
  45. package/src/components/legend/index.ts +1 -8
  46. package/src/components/legend/legend.tsx +33 -8
  47. package/src/components/legend/private/base-legend.module.scss +19 -37
  48. package/src/components/legend/private/base-legend.tsx +0 -2
  49. package/src/components/legend/test/legend.test.tsx +93 -1
  50. package/src/components/legend/types.ts +7 -34
  51. package/src/hooks/index.ts +1 -1
  52. package/src/hooks/use-data-with-percentages.ts +24 -0
  53. package/src/hooks/use-interactive-legend-data.ts +18 -15
  54. package/src/index.ts +66 -9
  55. package/src/providers/chart-context/global-charts-provider.tsx +7 -1
  56. package/src/providers/chart-context/hooks/use-chart-registration.ts +2 -1
  57. package/src/providers/chart-context/types.ts +2 -2
  58. package/src/types.ts +110 -45
  59. package/src/utils/date-parsing.ts +10 -1
  60. package/src/utils/test/date-parsing.test.ts +12 -0
  61. package/src/utils/test/resolve-css-var.test.ts +4 -2
  62. package/tsup.config.ts +1 -1
  63. package/dist/base-tooltip-DOq93wjU.d.cts +0 -38
  64. package/dist/base-tooltip-DOq93wjU.d.ts +0 -38
  65. package/dist/charts/bar-chart/index.cjs +0 -15
  66. package/dist/charts/bar-chart/index.cjs.map +0 -1
  67. package/dist/charts/bar-chart/index.css +0 -153
  68. package/dist/charts/bar-chart/index.css.map +0 -1
  69. package/dist/charts/bar-chart/index.d.cts +0 -37
  70. package/dist/charts/bar-chart/index.d.ts +0 -37
  71. package/dist/charts/bar-chart/index.js +0 -15
  72. package/dist/charts/bar-chart/index.js.map +0 -1
  73. package/dist/charts/bar-list-chart/index.cjs +0 -16
  74. package/dist/charts/bar-list-chart/index.cjs.map +0 -1
  75. package/dist/charts/bar-list-chart/index.css +0 -153
  76. package/dist/charts/bar-list-chart/index.css.map +0 -1
  77. package/dist/charts/bar-list-chart/index.d.cts +0 -92
  78. package/dist/charts/bar-list-chart/index.d.ts +0 -92
  79. package/dist/charts/bar-list-chart/index.js +0 -16
  80. package/dist/charts/bar-list-chart/index.js.map +0 -1
  81. package/dist/charts/conversion-funnel-chart/index.cjs +0 -11
  82. package/dist/charts/conversion-funnel-chart/index.cjs.map +0 -1
  83. package/dist/charts/conversion-funnel-chart/index.css +0 -251
  84. package/dist/charts/conversion-funnel-chart/index.css.map +0 -1
  85. package/dist/charts/conversion-funnel-chart/index.d.cts +0 -97
  86. package/dist/charts/conversion-funnel-chart/index.d.ts +0 -97
  87. package/dist/charts/conversion-funnel-chart/index.js +0 -11
  88. package/dist/charts/conversion-funnel-chart/index.js.map +0 -1
  89. package/dist/charts/geo-chart/index.cjs +0 -13
  90. package/dist/charts/geo-chart/index.cjs.map +0 -1
  91. package/dist/charts/geo-chart/index.css +0 -117
  92. package/dist/charts/geo-chart/index.css.map +0 -1
  93. package/dist/charts/geo-chart/index.d.cts +0 -67
  94. package/dist/charts/geo-chart/index.d.ts +0 -67
  95. package/dist/charts/geo-chart/index.js +0 -13
  96. package/dist/charts/geo-chart/index.js.map +0 -1
  97. package/dist/charts/leaderboard-chart/index.cjs +0 -20
  98. package/dist/charts/leaderboard-chart/index.cjs.map +0 -1
  99. package/dist/charts/leaderboard-chart/index.css +0 -172
  100. package/dist/charts/leaderboard-chart/index.css.map +0 -1
  101. package/dist/charts/leaderboard-chart/index.d.cts +0 -46
  102. package/dist/charts/leaderboard-chart/index.d.ts +0 -46
  103. package/dist/charts/leaderboard-chart/index.js +0 -20
  104. package/dist/charts/leaderboard-chart/index.js.map +0 -1
  105. package/dist/charts/line-chart/index.cjs +0 -15
  106. package/dist/charts/line-chart/index.cjs.map +0 -1
  107. package/dist/charts/line-chart/index.css +0 -225
  108. package/dist/charts/line-chart/index.css.map +0 -1
  109. package/dist/charts/line-chart/index.d.cts +0 -99
  110. package/dist/charts/line-chart/index.d.ts +0 -99
  111. package/dist/charts/line-chart/index.js +0 -15
  112. package/dist/charts/line-chart/index.js.map +0 -1
  113. package/dist/charts/pie-chart/index.cjs +0 -18
  114. package/dist/charts/pie-chart/index.cjs.map +0 -1
  115. package/dist/charts/pie-chart/index.css +0 -143
  116. package/dist/charts/pie-chart/index.css.map +0 -1
  117. package/dist/charts/pie-chart/index.d.cts +0 -97
  118. package/dist/charts/pie-chart/index.d.ts +0 -97
  119. package/dist/charts/pie-chart/index.js +0 -18
  120. package/dist/charts/pie-chart/index.js.map +0 -1
  121. package/dist/charts/pie-semi-circle-chart/index.cjs +0 -17
  122. package/dist/charts/pie-semi-circle-chart/index.cjs.map +0 -1
  123. package/dist/charts/pie-semi-circle-chart/index.css +0 -144
  124. package/dist/charts/pie-semi-circle-chart/index.css.map +0 -1
  125. package/dist/charts/pie-semi-circle-chart/index.d.cts +0 -94
  126. package/dist/charts/pie-semi-circle-chart/index.d.ts +0 -94
  127. package/dist/charts/pie-semi-circle-chart/index.js +0 -17
  128. package/dist/charts/pie-semi-circle-chart/index.js.map +0 -1
  129. package/dist/charts/sparkline/index.cjs +0 -16
  130. package/dist/charts/sparkline/index.cjs.map +0 -1
  131. package/dist/charts/sparkline/index.css +0 -242
  132. package/dist/charts/sparkline/index.css.map +0 -1
  133. package/dist/charts/sparkline/index.d.cts +0 -113
  134. package/dist/charts/sparkline/index.d.ts +0 -113
  135. package/dist/charts/sparkline/index.js +0 -16
  136. package/dist/charts/sparkline/index.js.map +0 -1
  137. package/dist/chunk-2A34OA5O.cjs +0 -51
  138. package/dist/chunk-2A34OA5O.cjs.map +0 -1
  139. package/dist/chunk-2NCY7R4G.js +0 -3897
  140. package/dist/chunk-2NCY7R4G.js.map +0 -1
  141. package/dist/chunk-32DH6JDF.js +0 -1263
  142. package/dist/chunk-32DH6JDF.js.map +0 -1
  143. package/dist/chunk-4OPFE4RM.js +0 -614
  144. package/dist/chunk-4OPFE4RM.js.map +0 -1
  145. package/dist/chunk-6CCZL2JJ.js +0 -63
  146. package/dist/chunk-6CCZL2JJ.js.map +0 -1
  147. package/dist/chunk-77OKCVQN.cjs +0 -421
  148. package/dist/chunk-77OKCVQN.cjs.map +0 -1
  149. package/dist/chunk-7FQX4ALL.cjs +0 -219
  150. package/dist/chunk-7FQX4ALL.cjs.map +0 -1
  151. package/dist/chunk-ASLARV7L.cjs +0 -81
  152. package/dist/chunk-ASLARV7L.cjs.map +0 -1
  153. package/dist/chunk-BCX5THDQ.js +0 -403
  154. package/dist/chunk-BCX5THDQ.js.map +0 -1
  155. package/dist/chunk-BPYKWMI7.js +0 -194
  156. package/dist/chunk-BPYKWMI7.js.map +0 -1
  157. package/dist/chunk-CZGYJKG6.js +0 -421
  158. package/dist/chunk-CZGYJKG6.js.map +0 -1
  159. package/dist/chunk-D2UH4CFE.cjs +0 -120
  160. package/dist/chunk-D2UH4CFE.cjs.map +0 -1
  161. package/dist/chunk-DAU3HNEG.js +0 -344
  162. package/dist/chunk-DAU3HNEG.js.map +0 -1
  163. package/dist/chunk-H2V4JMSA.js +0 -219
  164. package/dist/chunk-H2V4JMSA.js.map +0 -1
  165. package/dist/chunk-I2276W3I.cjs +0 -66
  166. package/dist/chunk-I2276W3I.cjs.map +0 -1
  167. package/dist/chunk-I35UYJJR.cjs +0 -468
  168. package/dist/chunk-I35UYJJR.cjs.map +0 -1
  169. package/dist/chunk-IU4DYUAV.js +0 -120
  170. package/dist/chunk-IU4DYUAV.js.map +0 -1
  171. package/dist/chunk-KXRWNFQJ.js +0 -51
  172. package/dist/chunk-KXRWNFQJ.js.map +0 -1
  173. package/dist/chunk-OP6PHB2U.js +0 -81
  174. package/dist/chunk-OP6PHB2U.js.map +0 -1
  175. package/dist/chunk-PXLEMUGJ.js +0 -165
  176. package/dist/chunk-PXLEMUGJ.js.map +0 -1
  177. package/dist/chunk-RCY6XLGU.cjs +0 -63
  178. package/dist/chunk-RCY6XLGU.cjs.map +0 -1
  179. package/dist/chunk-RHHVEJHJ.cjs +0 -1263
  180. package/dist/chunk-RHHVEJHJ.cjs.map +0 -1
  181. package/dist/chunk-TO3OQBXG.cjs +0 -165
  182. package/dist/chunk-TO3OQBXG.cjs.map +0 -1
  183. package/dist/chunk-V36ERY7Y.js +0 -375
  184. package/dist/chunk-V36ERY7Y.js.map +0 -1
  185. package/dist/chunk-VJM5XCB4.cjs +0 -614
  186. package/dist/chunk-VJM5XCB4.cjs.map +0 -1
  187. package/dist/chunk-VTS3PNMS.cjs +0 -344
  188. package/dist/chunk-VTS3PNMS.cjs.map +0 -1
  189. package/dist/chunk-WLODYNLB.js +0 -1067
  190. package/dist/chunk-WLODYNLB.js.map +0 -1
  191. package/dist/chunk-XKRJL2QT.cjs +0 -375
  192. package/dist/chunk-XKRJL2QT.cjs.map +0 -1
  193. package/dist/chunk-XWYZIFZW.js +0 -66
  194. package/dist/chunk-XWYZIFZW.js.map +0 -1
  195. package/dist/chunk-Y3NNQMAX.cjs +0 -194
  196. package/dist/chunk-Y3NNQMAX.cjs.map +0 -1
  197. package/dist/chunk-YE2T52VZ.cjs +0 -1067
  198. package/dist/chunk-YE2T52VZ.cjs.map +0 -1
  199. package/dist/chunk-Z26M4V2M.js +0 -468
  200. package/dist/chunk-Z26M4V2M.js.map +0 -1
  201. package/dist/chunk-Z45KX47P.cjs +0 -3897
  202. package/dist/chunk-Z45KX47P.cjs.map +0 -1
  203. package/dist/chunk-ZH4F5RMG.cjs +0 -403
  204. package/dist/chunk-ZH4F5RMG.cjs.map +0 -1
  205. package/dist/components/legend/index.cjs +0 -11
  206. package/dist/components/legend/index.cjs.map +0 -1
  207. package/dist/components/legend/index.css +0 -103
  208. package/dist/components/legend/index.css.map +0 -1
  209. package/dist/components/legend/index.d.cts +0 -37
  210. package/dist/components/legend/index.d.ts +0 -37
  211. package/dist/components/legend/index.js +0 -11
  212. package/dist/components/legend/index.js.map +0 -1
  213. package/dist/components/tooltip/index.cjs +0 -12
  214. package/dist/components/tooltip/index.cjs.map +0 -1
  215. package/dist/components/tooltip/index.css +0 -13
  216. package/dist/components/tooltip/index.css.map +0 -1
  217. package/dist/components/tooltip/index.d.cts +0 -71
  218. package/dist/components/tooltip/index.d.ts +0 -71
  219. package/dist/components/tooltip/index.js +0 -12
  220. package/dist/components/tooltip/index.js.map +0 -1
  221. package/dist/components/trend-indicator/index.cjs +0 -8
  222. package/dist/components/trend-indicator/index.cjs.map +0 -1
  223. package/dist/components/trend-indicator/index.css +0 -27
  224. package/dist/components/trend-indicator/index.css.map +0 -1
  225. package/dist/components/trend-indicator/index.d.cts +0 -44
  226. package/dist/components/trend-indicator/index.d.ts +0 -44
  227. package/dist/components/trend-indicator/index.js +0 -8
  228. package/dist/components/trend-indicator/index.js.map +0 -1
  229. package/dist/format-metric-value-MXm5DtQ_.d.cts +0 -24
  230. package/dist/format-metric-value-MXm5DtQ_.d.ts +0 -24
  231. package/dist/hooks/index.cjs +0 -31
  232. package/dist/hooks/index.cjs.map +0 -1
  233. package/dist/hooks/index.css +0 -103
  234. package/dist/hooks/index.css.map +0 -1
  235. package/dist/hooks/index.d.cts +0 -272
  236. package/dist/hooks/index.d.ts +0 -272
  237. package/dist/hooks/index.js +0 -31
  238. package/dist/hooks/index.js.map +0 -1
  239. package/dist/leaderboard-chart-BKYYXcg2.d.ts +0 -83
  240. package/dist/leaderboard-chart-DR7CGb0L.d.cts +0 -83
  241. package/dist/legend-C2grwnWk.d.cts +0 -9
  242. package/dist/legend-Cj0xM5dU.d.ts +0 -9
  243. package/dist/providers/index.cjs +0 -21
  244. package/dist/providers/index.cjs.map +0 -1
  245. package/dist/providers/index.css +0 -103
  246. package/dist/providers/index.css.map +0 -1
  247. package/dist/providers/index.d.cts +0 -28
  248. package/dist/providers/index.d.ts +0 -28
  249. package/dist/providers/index.js +0 -21
  250. package/dist/providers/index.js.map +0 -1
  251. package/dist/themes-BmVGrYnF.d.ts +0 -67
  252. package/dist/themes-CyjKm-P_.d.cts +0 -67
  253. package/dist/types-CuUEszrM.d.ts +0 -19
  254. package/dist/types-DZordNiO.d.cts +0 -505
  255. package/dist/types-DZordNiO.d.ts +0 -505
  256. package/dist/types-I67mddpr.d.cts +0 -78
  257. package/dist/types-I67mddpr.d.ts +0 -78
  258. package/dist/types-KtOPPzPX.d.cts +0 -19
  259. package/dist/utils/index.cjs +0 -44
  260. package/dist/utils/index.cjs.map +0 -1
  261. package/dist/utils/index.d.cts +0 -226
  262. package/dist/utils/index.d.ts +0 -226
  263. package/dist/utils/index.js +0 -44
  264. package/dist/utils/index.js.map +0 -1
  265. package/dist/with-responsive-CNfhzAUu.d.cts +0 -18
  266. package/dist/with-responsive-CNfhzAUu.d.ts +0 -18
  267. package/src/hooks/use-has-legend-child.ts +0 -22
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/charts/bar-chart/bar-chart.tsx","../src/charts/bar-chart/bar-chart.module.scss","../src/charts/bar-chart/private/use-bar-chart-options.ts","../src/charts/bar-chart/private/truncated-tick-component.tsx"],"sourcesContent":["import { formatNumber } from '@automattic/number-formatters';\nimport { PatternLines, PatternCircles, PatternWaves, PatternHexagons } from '@visx/pattern';\nimport { Axis, BarSeries, BarGroup, Grid, XYChart } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useState, useRef, useMemo } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport { useXYChartTheme, useChartDataTransform, useZeroValueDisplay, useChartMargin, useElementSize, useHasLegendChild, usePrefersReducedMotion } from '../../hooks';\nimport { GlobalChartsProvider, useChartId, useChartRegistration, useGlobalChartsContext, useGlobalChartsTheme, GlobalChartsContext } from '../../providers';\nimport { attachSubComponents } from '../../utils';\nimport { SingleChartContext } from '../private/single-chart-context';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './bar-chart.module.scss';\nimport { useBarChartOptions } from './private';\n\n// Base props type with optional responsive properties\n\n// Composition API types\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\n// Validation function similar to LineChart\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 || !point.label && (!('date' in point && point.date) || isNaN(point.date.getTime()))));\n if (hasInvalidData) return 'Invalid data';\n return null;\n};\nconst getPatternId = (chartId, index) => `bar-pattern-${chartId}-${index}`;\nconst BarChartInternal = ({\n data,\n chartId: providedChartId,\n width,\n height,\n className,\n margin,\n withTooltips = false,\n showLegend = false,\n legendOrientation = 'horizontal',\n legendPosition = 'bottom',\n legendAlignment = 'center',\n legendMaxWidth,\n legendTextOverflow = 'wrap',\n legendItemClassName,\n legendShape = 'rect',\n gridVisibility: gridVisibilityProp,\n renderTooltip,\n options = {},\n orientation = 'vertical',\n withPatterns = false,\n showZeroValues = false,\n legendInteractive = false,\n animation,\n children,\n gap = 'md'\n}) => {\n const horizontal = orientation === 'horizontal';\n const chartId = useChartId(providedChartId);\n const theme = useXYChartTheme(data);\n const dataSorted = useChartDataTransform(data);\n\n // Transform data to add a small value for zero bars to make them visible\n // For vertical bars, height determines bar pixel height; for horizontal bars, width does\n const dataWithVisibleZeros = useZeroValueDisplay(dataSorted, {\n enabled: showZeroValues,\n valueAxisLength: horizontal ? width : height\n });\n\n // Create legend items using the reusable hook\n const legendItems = useChartLegendItems(dataSorted);\n const chartOptions = useBarChartOptions(dataWithVisibleZeros, horizontal, options);\n const defaultMargin = useChartMargin(height, chartOptions, dataSorted, theme, horizontal);\n const [svgWrapperRef,, svgWrapperHeight] = useElementSize();\n const chartRef = useRef(null);\n\n // Check if children contain a Legend component (composition pattern)\n const hasLegendChild = useHasLegendChild(children);\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 const [selectedIndex, setSelectedIndex] = useState(undefined);\n const [isNavigating, setIsNavigating] = useState(false);\n const totalPoints = Math.max(0, ...data.map(series => series.data?.length || 0)) * data.length;\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\n });\n const {\n getElementStyles,\n isSeriesVisible\n } = useGlobalChartsContext();\n const providerTheme = useGlobalChartsTheme();\n\n // Add visibility information to series when using interactive legends\n const seriesWithVisibility = useMemo(() => {\n if (!chartId || !legendInteractive) {\n return dataWithVisibleZeros.map((series, index) => ({\n series,\n index,\n isVisible: true\n }));\n }\n return dataWithVisibleZeros.map((series, index) => ({\n series,\n index,\n isVisible: isSeriesVisible(chartId, series.label)\n }));\n }, [dataWithVisibleZeros, 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 const getBarBackground = useCallback(index => () => withPatterns ? `url(#${getPatternId(chartId, index)})` : getElementStyles({\n data: dataSorted[index],\n index\n }).color, [withPatterns, getElementStyles, dataSorted, chartId]);\n const renderDefaultTooltip = useCallback(({\n tooltipData\n }) => {\n const nearestDatum = tooltipData?.nearestDatum?.datum;\n if (!nearestDatum) return null;\n return /*#__PURE__*/_jsxs(\"div\", {\n className: styles['bar-chart__tooltip'],\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: styles['bar-chart__tooltip-header'],\n children: tooltipData?.nearestDatum?.key\n }), /*#__PURE__*/_jsxs(\"div\", {\n className: styles['bar-chart__tooltip-row'],\n children: [/*#__PURE__*/_jsxs(\"span\", {\n className: styles['bar-chart__tooltip-label'],\n children: [chartOptions.tooltip.labelFormatter(nearestDatum.label || (nearestDatum.date ? nearestDatum.date.getTime() : 0), 0, []), \":\"]\n }), /*#__PURE__*/_jsx(\"span\", {\n className: styles['bar-chart__tooltip-value'],\n children: formatNumber(nearestDatum.value)\n })]\n })]\n });\n }, [chartOptions.tooltip]);\n const renderPattern = useCallback((index, color) => {\n const patternType = index % 4;\n const id = getPatternId(chartId, index);\n const commonProps = {\n id,\n stroke: 'white',\n strokeWidth: 1,\n background: color\n };\n switch (patternType) {\n case 0:\n default:\n return /*#__PURE__*/_jsx(PatternLines, {\n ...commonProps,\n width: 5,\n height: 5,\n orientation: ['diagonal']\n }, id);\n case 1:\n return /*#__PURE__*/_jsx(PatternCircles, {\n ...commonProps,\n width: 6,\n height: 6,\n fill: \"white\"\n }, id);\n case 2:\n return /*#__PURE__*/_jsx(PatternWaves, {\n ...commonProps,\n width: 4,\n height: 4\n }, id);\n case 3:\n return /*#__PURE__*/_jsx(PatternHexagons, {\n ...commonProps,\n size: 8,\n height: 3\n }, id);\n }\n }, [chartId]);\n const createPatternBorderStyle = useCallback((index, color) => {\n const patternId = getPatternId(chartId, index);\n return `\n\t\t\t.visx-bar[fill=\"url(#${patternId})\"] {\n\t\t\t\tstroke: ${color};\n\t\t\t\tstroke-width: 1;\n\t\t\t\t}\n\t\t\t`;\n }, [chartId]);\n const createKeyboardHighlightStyle = useCallback(() => {\n if (selectedIndex === undefined) return '';\n\n // Calculate which bar should be highlighted based on selectedIndex\n // Pattern: [series1[0], series2[0], series3[0], series1[1], series2[1], series3[1], ...]\n const maxDataPoints = Math.max(...data.map(s => s.data.length));\n const dataPointIndex = Math.floor(selectedIndex / data.length);\n const seriesIndex = selectedIndex % data.length;\n\n // Only highlight if we're within valid bounds\n if (dataPointIndex >= maxDataPoints || seriesIndex >= data.length) {\n return '';\n }\n const seriesData = data[seriesIndex];\n if (dataPointIndex >= seriesData.data.length) {\n return '';\n }\n\n // Based on the DOM structure analysis:\n // - All bars are in a single .visx-bar-group\n // - Bars are ordered as: [series1[0], series1[1], series2[0], series2[1], ...]\n // - So we need to calculate the actual bar index in the DOM\n const actualBarIndex = seriesIndex * maxDataPoints + dataPointIndex;\n\n // Use a CSS class selector instead of ID since useId() generates invalid CSS ID characters\n const generatedStyles = `\n\t\t\t.bar-chart[data-chart-id=\"bar-chart-${chartId}\"] .visx-bar-group .visx-bar:nth-child(${actualBarIndex + 1}) {\n\t\t\t\tstroke: #005fcc;\n\t\t\t\tstroke-width: 2px;\n\t\t\t}\n\t\t`;\n return generatedStyles;\n }, [selectedIndex, data, chartId]);\n\n // Validate data first\n const error = validateData(dataSorted);\n const isDataValid = !error;\n\n // Memoize metadata to prevent unnecessary re-registration\n const chartMetadata = useMemo(() => ({\n orientation,\n withPatterns\n }), [orientation, withPatterns]);\n\n // Register chart with context only if data is valid\n useChartRegistration({\n chartId,\n legendItems,\n chartType: 'bar',\n isDataValid,\n metadata: chartMetadata\n });\n const prefersReducedMotion = usePrefersReducedMotion();\n if (error) {\n return /*#__PURE__*/_jsx(\"div\", {\n className: clsx('bar-chart', styles['bar-chart']),\n children: error\n });\n }\n const gridVisibility = gridVisibilityProp ?? chartOptions.gridVisibility;\n const highlightedBarStyle = createKeyboardHighlightStyle();\n const legendElement = showLegend && /*#__PURE__*/_jsx(Legend, {\n orientation: legendOrientation,\n position: legendPosition,\n alignment: legendAlignment,\n labelStyles: {\n maxWidth: legendMaxWidth,\n textOverflow: legendTextOverflow\n },\n itemClassName: legendItemClassName,\n className: styles['bar-chart__legend'],\n shape: legendShape,\n chartId: chartId,\n interactive: legendInteractive\n });\n return /*#__PURE__*/_jsx(SingleChartContext.Provider, {\n value: {\n chartId,\n chartWidth: width,\n chartHeight\n },\n children: /*#__PURE__*/_jsxs(Stack, {\n direction: \"column\",\n gap: gap,\n className: clsx('bar-chart', styles['bar-chart'], {\n [styles[`bar-chart--animated${horizontal ? '-horizontal' : ''}`]]: animation && !prefersReducedMotion\n }, className),\n style: {\n width,\n height,\n visibility: isWaitingForMeasurement ? 'hidden' : 'visible'\n },\n \"data-chart-id\": `bar-chart-${chartId}`,\n children: [legendPosition === 'top' && legendElement, /*#__PURE__*/_jsx(\"div\", {\n className: styles['bar-chart__svg-wrapper'],\n ref: svgWrapperRef,\n role: \"grid\",\n \"aria-label\": __('Bar 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: chartOptions.xScale,\n yScale: chartOptions.yScale,\n horizontal: horizontal,\n pointerEventsDataKey: \"nearest\",\n children: [/*#__PURE__*/_jsx(Grid, {\n columns: gridVisibility.includes('y'),\n rows: gridVisibility.includes('x'),\n numTicks: 4\n }), withPatterns && /*#__PURE__*/_jsxs(_Fragment, {\n children: [/*#__PURE__*/_jsx(\"defs\", {\n children: dataSorted.map((seriesData, index) => renderPattern(index, getElementStyles({\n data: seriesData,\n index\n }).color))\n }), /*#__PURE__*/_jsx(\"style\", {\n children: dataSorted.map((seriesData, index) => createPatternBorderStyle(index, getElementStyles({\n data: seriesData,\n index\n }).color))\n })]\n }), highlightedBarStyle && /*#__PURE__*/_jsx(\"style\", {\n children: highlightedBarStyle\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, /*#__PURE__*/_jsx(BarGroup, {\n padding: chartOptions.barGroup.padding,\n children: seriesWithVisibility.map(({\n series: seriesData,\n index,\n isVisible\n }) => {\n // Skip rendering invisible series\n if (!isVisible) {\n return null;\n }\n return /*#__PURE__*/_jsx(BarSeries, {\n dataKey: seriesData?.label,\n data: seriesData.data,\n yAccessor: chartOptions.accessors.yAccessor,\n xAccessor: chartOptions.accessors.xAccessor,\n colorAccessor: getBarBackground(index)\n }, seriesData?.label);\n })\n }), /*#__PURE__*/_jsx(Axis, {\n ...chartOptions.axis.x\n }), /*#__PURE__*/_jsx(Axis, {\n ...chartOptions.axis.y\n }), withTooltips && /*#__PURE__*/_jsx(AccessibleTooltip, {\n detectBounds: true,\n snapTooltipToDatumX: true,\n snapTooltipToDatumY: true,\n renderTooltip: renderTooltip || renderDefaultTooltip,\n selectedIndex: selectedIndex,\n tooltipRef: tooltipRef,\n keyboardFocusedClassName: styles['bar-chart__tooltip--keyboard-focused'],\n series: data,\n mode: \"individual\"\n })]\n })\n })\n }), legendPosition === 'bottom' && legendElement, children]\n })\n });\n};\nconst BarChartWithProvider = 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(BarChartInternal, {\n ...props\n });\n }\n\n // Otherwise, create our own GlobalChartsProvider\n return /*#__PURE__*/_jsx(GlobalChartsProvider, {\n children: /*#__PURE__*/_jsx(BarChartInternal, {\n ...props\n })\n });\n};\nBarChartWithProvider.displayName = 'BarChart';\n\n// Create BarChart with composition API\nconst BarChart = attachSubComponents(BarChartWithProvider, {\n Legend: Legend\n});\n\n// Create responsive BarChart with composition API\nconst BarChartResponsive = attachSubComponents(withResponsive(BarChartWithProvider), {\n Legend: Legend\n});\nexport { BarChartResponsive as default, BarChart as BarChartUnresponsive };","import 'css-chunk:src/charts/bar-chart/bar-chart.module.scss';export default {\n \"bar-chart__svg-wrapper\": \"a8ccharts-9CsqC0\",\n \"bar-chart\": \"a8ccharts-3gflnB\",\n \"bar-chart--animated\": \"a8ccharts-98W-yu\",\n \"rise\": \"a8ccharts-z6AsiQ\",\n \"bar-chart--animated-horizontal\": \"a8ccharts-HFA3FF\",\n \"stretch\": \"a8ccharts-DQp37O\"\n};","import { formatNumberCompact } from '@automattic/number-formatters';\nimport { useMemo } from 'react';\nimport { TruncatedXTickComponent, TruncatedYTickComponent } from './truncated-tick-component';\nimport type { EnhancedDataPoint } from '../../../hooks/use-zero-value-display';\nimport type { DataPointDate, BaseChartProps, SeriesData } from '../../../types';\nimport type { TickFormatter } from '@visx/axis';\n\nconst formatDateTick = ( timestamp: number ) => {\n\tconst date = new Date( timestamp );\n\treturn date.toLocaleDateString( undefined, {\n\t\tmonth: 'short',\n\t\tday: 'numeric',\n\t} );\n};\n\n/**\n * Get the group padding of a scale.\n *\n * @param scale - The scale to get the group padding of.\n * @return The group padding of the scale.\n */\nconst getGroupPadding = ( scale: Record< string, unknown > ): number => {\n\treturn typeof scale.paddingInner === 'number' ? ( scale.paddingInner as number ) : 0;\n};\n\n/**\n * Returns the merged options for the bar chart, including axis and scale configuration based on the orientation.\n *\n * @param data - The data to be displayed in the chart.\n * @param horizontal - Whether the chart is horizontal or vertical.\n * @param options - The options for the chart.\n * @return The merged options for the chart.\n */\nexport function useBarChartOptions(\n\tdata: SeriesData[],\n\thorizontal: boolean,\n\toptions: BaseChartProps[ 'options' ] = {}\n) {\n\tconst defaultOptions = useMemo( () => {\n\t\tconst bandScale = {\n\t\t\ttype: 'band' as const,\n\t\t\tpadding: 0.2,\n\t\t\tpaddingInner: 0.1,\n\t\t};\n\t\tconst linearScale = {\n\t\t\ttype: 'linear' as const,\n\t\t\tnice: true,\n\t\t\tzero: false,\n\t\t};\n\n\t\tconst labelFormatter = data?.[ 0 ]?.data?.[ 0 ]?.label\n\t\t\t? ( label: string ) => label\n\t\t\t: formatDateTick;\n\t\tconst valueFormatter = formatNumberCompact as TickFormatter< unknown >;\n\n\t\tconst labelAccessor = ( d: DataPointDate ) => d?.label || d?.date;\n\t\tconst valueAccessor = ( d: DataPointDate | EnhancedDataPoint ) => {\n\t\t\t// Use visualValue for bar rendering if available (for zero values), otherwise use value\n\t\t\tconst enhancedPoint = d as EnhancedDataPoint;\n\t\t\treturn enhancedPoint?.visualValue !== undefined ? enhancedPoint.visualValue : d?.value;\n\t\t};\n\n\t\treturn {\n\t\t\tvertical: {\n\t\t\t\txTickFormat: labelFormatter,\n\t\t\t\tyTickFormat: valueFormatter,\n\t\t\t\ttooltipLabelFormatter: labelFormatter,\n\t\t\t\txAccessor: labelAccessor,\n\t\t\t\tyAccessor: valueAccessor,\n\t\t\t\tgridVisibility: 'x',\n\t\t\t\txScale: bandScale,\n\t\t\t\tyScale: linearScale,\n\t\t\t},\n\t\t\thorizontal: {\n\t\t\t\txTickFormat: valueFormatter,\n\t\t\t\tyTickFormat: labelFormatter,\n\t\t\t\ttooltipLabelFormatter: labelFormatter,\n\t\t\t\txAccessor: valueAccessor,\n\t\t\t\tyAccessor: labelAccessor,\n\t\t\t\tgridVisibility: 'y',\n\t\t\t\txScale: linearScale,\n\t\t\t\tyScale: bandScale,\n\t\t\t},\n\t\t};\n\t}, [ data ] );\n\n\treturn useMemo( () => {\n\t\tconst orientationKey = horizontal ? 'horizontal' : 'vertical';\n\t\tconst {\n\t\t\txTickFormat,\n\t\t\tyTickFormat,\n\t\t\ttooltipLabelFormatter: defaultTooltipLabelFormatter,\n\t\t\txAccessor,\n\t\t\tyAccessor,\n\t\t\tgridVisibility,\n\t\t\txScale: baseXScale,\n\t\t\tyScale: baseYScale,\n\t\t} = defaultOptions[ orientationKey ];\n\n\t\tconst xScale = { ...baseXScale, ...( options.xScale || {} ) };\n\t\tconst yScale = { ...baseYScale, ...( options.yScale || {} ) };\n\t\tconst providedToolTipLabelFormatter = horizontal\n\t\t\t? options.axis?.y?.tickFormat\n\t\t\t: options.axis?.x?.tickFormat;\n\n\t\tconst { labelOverflow: xLabelOverflow, ...xAxisOptions } = options.axis?.x || {};\n\t\tconst { labelOverflow: yLabelOverflow, ...yAxisOptions } = options.axis?.y || {};\n\n\t\treturn {\n\t\t\tgridVisibility,\n\t\t\txScale,\n\t\t\tyScale,\n\t\t\taccessors: {\n\t\t\t\txAccessor,\n\t\t\t\tyAccessor,\n\t\t\t},\n\t\t\taxis: {\n\t\t\t\tx: {\n\t\t\t\t\torientation: 'bottom' as const,\n\t\t\t\t\tnumTicks: 4,\n\t\t\t\t\ttickFormat: xTickFormat,\n\t\t\t\t\t...( xLabelOverflow === 'ellipsis' ? { tickComponent: TruncatedXTickComponent } : {} ),\n\t\t\t\t\t...xAxisOptions,\n\t\t\t\t},\n\t\t\t\ty: {\n\t\t\t\t\torientation: 'left' as const,\n\t\t\t\t\tnumTicks: 4,\n\t\t\t\t\ttickFormat: yTickFormat,\n\t\t\t\t\t...( yLabelOverflow === 'ellipsis' ? { tickComponent: TruncatedYTickComponent } : {} ),\n\t\t\t\t\t...yAxisOptions,\n\t\t\t\t},\n\t\t\t},\n\t\t\tbarGroup: {\n\t\t\t\tpadding: getGroupPadding( horizontal ? yScale : xScale ),\n\t\t\t},\n\t\t\ttooltip: {\n\t\t\t\tlabelFormatter: providedToolTipLabelFormatter || defaultTooltipLabelFormatter,\n\t\t\t},\n\t\t};\n\t}, [ defaultOptions, options, horizontal ] );\n}\n","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport { isSafari } from '../../../utils';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Get the bandwidth of a scale\n *\n * @param scale - The scale to get the bandwidth of\n * @return The bandwidth of the scale\n */\nconst getScaleBandwidth = scale => {\n return scale && 'bandwidth' in scale ? scale.bandwidth() ?? 0 : 0;\n};\n/**\n * Minimum width in pixels for tick labels when scale bandwidth is very small.\n * Prevents labels from collapsing to unreadable widths on dense charts.\n *\n * Trade-off: When bandwidth is less than this minimum (e.g., many bars in a narrow chart),\n * adjacent labels may overlap since each label uses this minimum width regardless of\n * available space. This prioritizes label readability over preventing overlap.\n *\n * For very dense charts where overlap occurs, consider:\n * - Using `numTicks` option to reduce the number of displayed labels\n * - Using `tickFormat` to abbreviate label text\n * - Increasing chart width or reducing data points\n */\nconst MIN_TICK_LABEL_WIDTH = 20;\n\n/**\n * A tick component that renders labels with text truncation (ellipsis) when they exceed\n * the available bandwidth. Shows the full text on hover via native title attribute.\n *\n * Uses foreignObject to embed HTML within SVG, enabling CSS text-overflow: ellipsis.\n * Inherits text styles from tickLabelProps passed by visx Axis component.\n *\n * Note: A minimum label width (MIN_TICK_LABEL_WIDTH) is enforced to keep labels readable.\n * On very dense charts where bandwidth < 20px, this may cause label overlap.\n * See MIN_TICK_LABEL_WIDTH documentation for mitigation strategies.\n *\n * @param props - The props for the truncated tick component\n * @param props.x - The x position of the tick\n * @param props.y - The y position of the tick\n * @param props.formattedValue - The formatted value of the tick\n * @param props.axis - The axis this tick belongs to\n * @param props.textAnchor - The text anchor of the tick\n * @param props.fill - The fill color of the tick\n * @param props.dy - The dy offset of the tick\n *\n * @return The truncated tick component\n */\nexport const TruncatedTickComponent = ({\n x,\n y,\n formattedValue,\n axis,\n textAnchor,\n fill,\n dy,\n ...textProps\n}) => {\n // Get max width of the tick label\n const {\n xScale,\n yScale\n } = useContext(DataContext) || {};\n const scale = axis === 'x' ? xScale : yScale;\n const bandwidth = getScaleBandwidth(scale);\n const maxWidth = Math.max(bandwidth, MIN_TICK_LABEL_WIDTH);\n\n // Map SVG textAnchor to CSS textAlign\n let textAlign = 'center';\n if (textAnchor === 'start') {\n textAlign = 'left';\n } else if (textAnchor === 'end') {\n textAlign = 'right';\n } else if (textAnchor === 'middle') {\n textAlign = 'center';\n }\n\n // Calculate x offset based on text alignment\n let xOffset = 0;\n if (textAlign === 'center') {\n xOffset = -maxWidth / 2;\n } else if (textAlign === 'right') {\n xOffset = -maxWidth;\n }\n\n // Extract compatible style properties from SVG text props\n const {\n fontSize,\n fontFamily,\n fontWeight,\n fontStyle,\n letterSpacing,\n opacity\n } = textProps;\n const textStyles = {\n /**\n * SVG <text> elements are vertically aligned to the baseline by default, but HTML <div> elements inside <foreignObject>\n * are positioned relative to the top-left corner. To visually align the tick label like SVG text,\n * we shift the div up by 100% of its height and adjust by twice the SVG dy value (from visx) to approximate original placement.\n */\n transform: `translateY(calc(-100% + ${dy ?? '0'} * 2))`,\n // Safari doesn't work well with foreignObject positioning. Use position: fixed as a workaround.\n ...(isSafari() ? {\n position: 'fixed'\n } : {}),\n // Apply compatible SVG text styles\n fontSize,\n fontFamily,\n fontWeight,\n fontStyle,\n letterSpacing,\n opacity,\n // Convert svg text styles to CSS styles for the div\n color: fill ?? 'inherit',\n textAlign,\n // Ensure text is truncated with ellipsis, remains on one line, and shows the full value in a tooltip on hover.\n // The surrounding div uses CSS to handle overflow, and the 'title' attribute is set for accessibility.\n width: maxWidth,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n cursor: 'default',\n pointerEvents: 'auto'\n };\n return /*#__PURE__*/_jsx(\"foreignObject\", {\n x: x + xOffset,\n y: y,\n width: maxWidth,\n height: 0,\n overflow: \"visible\",\n children: /*#__PURE__*/_jsx(\"div\", {\n style: textStyles,\n title: formattedValue,\n children: formattedValue\n })\n });\n};\n\n/**\n * Factory function to create a truncated tick component for a specific axis.\n * Returns a component that can be passed to visx's tickComponent prop.\n *\n * @param axis - The axis this tick component is for ('x' or 'y')\n * @return A tick component function compatible with visx's TickRendererProps\n */\nconst createTruncatedTickComponent = axis => props => {\n return /*#__PURE__*/_jsx(TruncatedTickComponent, {\n ...props,\n axis: axis\n });\n};\n\n/**\n * Pre-created tick components for x and y axes.\n * These functions are created once at module initialization and reused,\n * avoiding repeated factory calls when configuring axes.\n */\nexport const TruncatedXTickComponent = createTruncatedTickComponent('x');\nexport const TruncatedYTickComponent = createTruncatedTickComponent('y');"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,oBAAoB;AAC7B,SAAS,cAAc,gBAAgB,cAAc,uBAAuB;AAC5E,SAAS,MAAM,WAAW,UAAU,MAAM,eAAe;AACzD,SAAS,UAAU;AAEnB,OAAO,UAAU;AACjB,SAAS,aAAa,cAAAA,aAAY,UAAU,QAAQ,WAAAC,gBAAe;;;ACNL,IAAO,2BAAQ;AAAA,EAC3E,0BAA0B;AAAA,EAC1B,aAAa;AAAA,EACb,uBAAuB;AAAA,EACvB,QAAQ;AAAA,EACR,kCAAkC;AAAA,EAClC,WAAW;AACb;;;ACPA,SAAS,2BAA2B;AACpC,SAAS,eAAe;;;ACDxB,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAE3B,SAAS,OAAO,YAAY;AAO5B,IAAM,oBAAoB,WAAS;AACjC,SAAO,SAAS,eAAe,QAAQ,MAAM,UAAU,KAAK,IAAI;AAClE;AAcA,IAAM,uBAAuB;AAwBtB,IAAM,yBAAyB,CAAC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AAEJ,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,IAAI,WAAW,WAAW,KAAK,CAAC;AAChC,QAAM,QAAQ,SAAS,MAAM,SAAS;AACtC,QAAM,YAAY,kBAAkB,KAAK;AACzC,QAAM,WAAW,KAAK,IAAI,WAAW,oBAAoB;AAGzD,MAAI,YAAY;AAChB,MAAI,eAAe,SAAS;AAC1B,gBAAY;AAAA,EACd,WAAW,eAAe,OAAO;AAC/B,gBAAY;AAAA,EACd,WAAW,eAAe,UAAU;AAClC,gBAAY;AAAA,EACd;AAGA,MAAI,UAAU;AACd,MAAI,cAAc,UA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B;AAAA,MAC5C,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH;AACA,qBAAqB,cAAc;AAGnC,IAAM,WAAW,oBAAoB,sBAAsB;AAAA,EACzD;AACF,CAAC;AAGD,IAAM,qBAAqB,oBAAoB,eAAe,oBAAoB,GAAG;AAAA,EACnF;AACF,CAAC;","names":["useContext","useMemo","_jsx","useMemo","useContext"]}
@@ -1,63 +0,0 @@
1
- // src/charts/private/chart-composition/chart-svg.tsx
2
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
- var ChartSVG = ({
4
- children
5
- }) => {
6
- return /* @__PURE__ */ _jsx(_Fragment, {
7
- children
8
- });
9
- };
10
- ChartSVG.displayName = "Chart.SVG";
11
-
12
- // src/charts/private/chart-composition/chart-html.tsx
13
- import { Fragment as _Fragment2, jsx as _jsx2 } from "react/jsx-runtime";
14
- var ChartHTML = ({
15
- children
16
- }) => {
17
- return /* @__PURE__ */ _jsx2(_Fragment2, {
18
- children
19
- });
20
- };
21
- ChartHTML.displayName = "Chart.HTML";
22
-
23
- // src/charts/private/chart-composition/use-chart-children.ts
24
- import { Group } from "@visx/group";
25
- import { useMemo, Children, isValidElement } from "react";
26
- function useChartChildren(children, chartType) {
27
- return useMemo(() => {
28
- const svg = [];
29
- const html = [];
30
- const other = [];
31
- Children.forEach(children, (child) => {
32
- if (isValidElement(child)) {
33
- const childType = child.type;
34
- const displayName = childType?.displayName;
35
- if (displayName === `${chartType}.SVG` || displayName === "Chart.SVG") {
36
- if (child.props?.children) {
37
- Children.forEach(child.props.children, (svgChild) => {
38
- svg.push(svgChild);
39
- });
40
- }
41
- } else if (displayName === `${chartType}.HTML` || displayName === "Chart.HTML") {
42
- if (child.props?.children) {
43
- Children.forEach(child.props.children, (htmlChild) => {
44
- html.push(htmlChild);
45
- });
46
- }
47
- } else if (child.type === Group) {
48
- svg.push(child);
49
- } else {
50
- other.push(child);
51
- }
52
- }
53
- });
54
- return { svgChildren: svg, htmlChildren: html, otherChildren: other };
55
- }, [children, chartType]);
56
- }
57
-
58
- export {
59
- ChartSVG,
60
- ChartHTML,
61
- useChartChildren
62
- };
63
- //# sourceMappingURL=chunk-6CCZL2JJ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/charts/private/chart-composition/chart-svg.tsx","../src/charts/private/chart-composition/chart-html.tsx","../src/charts/private/chart-composition/use-chart-children.ts"],"sourcesContent":["import { Fragment as _Fragment, jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Compound component for SVG children in charts.\n * This component serves as a marker for SVG content that should be rendered\n * inside the chart's SVG element. The actual rendering is handled by the parent chart.\n *\n * @param {PropsWithChildren} props - Component props\n * @param {ReactNode} props.children - Child elements to render inside the SVG\n * @return {JSX.Element} The children wrapped in a fragment\n */\nexport const ChartSVG = ({\n children\n}) => {\n // This component doesn't render directly - its children are extracted by the parent chart\n // We just return the children as-is\n return /*#__PURE__*/_jsx(_Fragment, {\n children: children\n });\n};\n\n// Set displayName for better debugging and type checking\nChartSVG.displayName = 'Chart.SVG';","import { Fragment as _Fragment, jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Compound component for HTML children in charts.\n * This component serves as a marker for HTML content that should be rendered\n * outside the chart's SVG element. The actual rendering is handled by the parent chart.\n *\n * @param {PropsWithChildren} props - Component props\n * @param {ReactNode} props.children - Child elements to render outside the SVG\n * @return {JSX.Element} The children wrapped in a fragment\n */\nexport const ChartHTML = ({\n children\n}) => {\n // This component doesn't render directly - its children are extracted by the parent chart\n // We just return the children as-is\n return /*#__PURE__*/_jsx(_Fragment, {\n children: children\n });\n};\n\n// Set displayName for better debugging and type checking\nChartHTML.displayName = 'Chart.HTML';","import { Group } from '@visx/group';\nimport { useMemo, Children, isValidElement } from 'react';\nimport type { ReactNode } from 'react';\n\ninterface ChartChildren {\n\tsvgChildren: ReactNode[];\n\thtmlChildren: ReactNode[];\n\totherChildren: ReactNode[];\n}\n\n/**\n * Custom hook to process and categorize chart children for composition API.\n * Extracts children from compound components (Chart.SVG, Chart.HTML) and\n * maintains backward compatibility with legacy Group components.\n *\n * @param {ReactNode} children - The children prop from the chart component\n * @param {string} chartType - The type of chart (e.g., 'PieChart', 'BarChart')\n * @return {ChartChildren} Categorized children for rendering\n */\nexport function useChartChildren( children: ReactNode, chartType: string ): ChartChildren {\n\treturn useMemo( () => {\n\t\tconst svg: ReactNode[] = [];\n\t\tconst html: ReactNode[] = [];\n\t\tconst other: ReactNode[] = [];\n\n\t\tChildren.forEach( children, child => {\n\t\t\tif ( isValidElement( child ) ) {\n\t\t\t\t// Check displayName for compound components\n\t\t\t\tconst childType = child.type as { displayName?: string };\n\t\t\t\tconst displayName = childType?.displayName;\n\n\t\t\t\t// Handle chart-specific compound components (e.g., PieChart.SVG)\n\t\t\t\tif ( displayName === `${ chartType }.SVG` || displayName === 'Chart.SVG' ) {\n\t\t\t\t\t// Extract children from Chart.SVG with safety checks\n\t\t\t\t\tif ( child.props?.children ) {\n\t\t\t\t\t\tChildren.forEach( child.props.children, svgChild => {\n\t\t\t\t\t\t\tsvg.push( svgChild );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( displayName === `${ chartType }.HTML` || displayName === 'Chart.HTML' ) {\n\t\t\t\t\t// Extract children from Chart.HTML with safety checks\n\t\t\t\t\tif ( child.props?.children ) {\n\t\t\t\t\t\tChildren.forEach( child.props.children, htmlChild => {\n\t\t\t\t\t\t\thtml.push( htmlChild );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( child.type === Group ) {\n\t\t\t\t\t// Legacy support: still check for Group type for backward compatibility\n\t\t\t\t\tsvg.push( child );\n\t\t\t\t} else {\n\t\t\t\t\tother.push( child );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\n\t\treturn { svgChildren: svg, htmlChildren: html, otherChildren: other };\n\t}, [ children, chartType ] );\n}\n"],"mappings":";AAAA,SAAS,YAAY,WAAW,OAAO,YAAY;AAU5C,IAAM,WAAW,CAA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 -1,421 +0,0 @@
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
-
3
- var _chunkI35UYJJRcjs = require('./chunk-I35UYJJR.cjs');
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
- var _chunkRHHVEJHJcjs = require('./chunk-RHHVEJHJ.cjs');
13
-
14
-
15
-
16
- var _chunkVTS3PNMScjs = require('./chunk-VTS3PNMS.cjs');
17
-
18
- // src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx
19
- var _tooltip = require('@visx/tooltip');
20
- var _clsx = require('clsx'); var _clsx2 = _interopRequireDefault(_clsx);
21
- var _react = require('react');
22
-
23
- // src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss
24
- var conversion_funnel_chart_module_default = {
25
- "conversionFunnelChart": "a8ccharts-lK-YNK",
26
- "loading": "a8ccharts-DbHKK5",
27
- "main-metric": "a8ccharts-61WPYr",
28
- "main-rate": "a8ccharts-RRRI6x",
29
- "change-indicator": "a8ccharts-661iwx",
30
- "funnel-container": "a8ccharts-Z7EGnW",
31
- "funnel-step": "a8ccharts-VqFY0l",
32
- "blurred": "a8ccharts-7dTRBs",
33
- "step-header": "a8ccharts-2JsQiV",
34
- "step-label": "a8ccharts-6OabC4",
35
- "step-rate": "a8ccharts-9wSZ6n",
36
- "bar-container": "a8ccharts-sSmCTi",
37
- "disabled": "a8ccharts-PLWVAW",
38
- "funnel-bar": "a8ccharts-EzczI-",
39
- "selected": "a8ccharts-wNpZEu",
40
- "funnel-bar--animated": "a8ccharts-68HQJl",
41
- "stretch": "a8ccharts-CmtieZ",
42
- "tooltip-wrapper": "a8ccharts-2TeoCn",
43
- "tooltip-title": "a8ccharts-jkRitH",
44
- "tooltip-content": "a8ccharts-8jgT-3",
45
- "empty-state": "a8ccharts-Ml6MMr"
46
- };
47
-
48
- // src/charts/conversion-funnel-chart/private/use-funnel-selection.ts
49
-
50
- var useFunnelSelection = (hideTooltip) => {
51
- const [clickedStep, setClickedStep] = _react.useState.call(void 0, null);
52
- const handleBarClick = _react.useCallback.call(void 0,
53
- (stepId) => {
54
- if (clickedStep === stepId) {
55
- setClickedStep(null);
56
- _optionalChain([hideTooltip, 'optionalCall', _ => _()]);
57
- } else {
58
- setClickedStep(stepId);
59
- }
60
- },
61
- [clickedStep, hideTooltip]
62
- );
63
- const handleBarKeyDown = _react.useCallback.call(void 0,
64
- (stepId, event) => {
65
- if (event.key === "Enter" || event.key === " ") {
66
- event.preventDefault();
67
- if (clickedStep === stepId) {
68
- setClickedStep(null);
69
- _optionalChain([hideTooltip, 'optionalCall', _2 => _2()]);
70
- } else {
71
- setClickedStep(stepId);
72
- }
73
- } else if (event.key === "Escape") {
74
- event.preventDefault();
75
- setClickedStep(null);
76
- _optionalChain([hideTooltip, 'optionalCall', _3 => _3()]);
77
- }
78
- },
79
- [clickedStep, hideTooltip]
80
- );
81
- const clearSelection = _react.useCallback.call(void 0, () => {
82
- setClickedStep(null);
83
- _optionalChain([hideTooltip, 'optionalCall', _4 => _4()]);
84
- }, [hideTooltip]);
85
- const getStepState = _react.useCallback.call(void 0,
86
- (stepId) => ({
87
- isClicked: clickedStep === stepId,
88
- isBlurred: clickedStep !== null && clickedStep !== stepId
89
- }),
90
- [clickedStep]
91
- );
92
- return {
93
- clickedStep,
94
- handleBarClick,
95
- handleBarKeyDown,
96
- clearSelection,
97
- getStepState
98
- };
99
- };
100
-
101
- // src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx
102
- var _jsxruntime = require('react/jsx-runtime');
103
- var ConversionFunnelChartInternal = ({
104
- mainRate,
105
- changeIndicator,
106
- steps,
107
- loading = false,
108
- animation,
109
- className,
110
- chartId: providedChartId,
111
- height,
112
- style,
113
- renderStepLabel,
114
- renderStepRate,
115
- renderMainMetric,
116
- renderTooltip
117
- }) => {
118
- const chartId = _chunkRHHVEJHJcjs.useChartId.call(void 0, providedChartId);
119
- const {
120
- conversionFunnelChart: conversionFunnelChartSettings
121
- } = _chunkRHHVEJHJcjs.useGlobalChartsTheme.call(void 0, );
122
- const {
123
- getElementStyles
124
- } = _chunkRHHVEJHJcjs.useGlobalChartsContext.call(void 0, );
125
- const chartRef = _react.useRef.call(void 0, null);
126
- const selectedBarRef = _react.useRef.call(void 0, null);
127
- const {
128
- tooltipData,
129
- tooltipLeft,
130
- tooltipTop,
131
- tooltipOpen,
132
- showTooltip,
133
- hideTooltip
134
- } = _tooltip.useTooltip.call(void 0, );
135
- const {
136
- handleBarClick,
137
- handleBarKeyDown,
138
- clearSelection,
139
- getStepState
140
- } = useFunnelSelection(hideTooltip);
141
- const {
142
- containerRef: portalContainerRef,
143
- TooltipInPortal,
144
- containerBounds
145
- } = _tooltip.useTooltipInPortal.call(void 0, {
146
- // use TooltipWithBounds for boundary detection
147
- detectBounds: true,
148
- // when tooltip containers are scrolled, this will correctly update the Tooltip position
149
- scroll: true
150
- });
151
- const clearSelectionAndRef = _react.useCallback.call(void 0, () => {
152
- clearSelection();
153
- selectedBarRef.current = null;
154
- hideTooltip();
155
- }, [clearSelection, hideTooltip]);
156
- const showTooltipAt = _react.useCallback.call(void 0, (step, x, y) => {
157
- showTooltip({
158
- tooltipData: step,
159
- tooltipLeft: x,
160
- tooltipTop: y - 10
161
- });
162
- }, [showTooltip]);
163
- const getMouseTooltipCoords = _react.useCallback.call(void 0, (event) => {
164
- if (containerBounds.width === 0 || containerBounds.height === 0) {
165
- return null;
166
- }
167
- return {
168
- x: event.clientX - containerBounds.left,
169
- y: event.clientY - containerBounds.top
170
- };
171
- }, [containerBounds.width, containerBounds.height, containerBounds.left, containerBounds.top]);
172
- const getKeyboardTooltipCoords = _react.useCallback.call(void 0, (event) => {
173
- if (containerBounds.width === 0 || containerBounds.height === 0) {
174
- return null;
175
- }
176
- const rect = event.currentTarget.getBoundingClientRect();
177
- const x = rect.left + rect.width / 2 - containerBounds.left;
178
- const y = rect.top - containerBounds.top;
179
- return {
180
- x,
181
- y
182
- };
183
- }, [containerBounds.width, containerBounds.height, containerBounds.left, containerBounds.top]);
184
- const handleStepInteraction = _react.useCallback.call(void 0, (step, event, interactionType) => {
185
- selectedBarRef.current = event.currentTarget;
186
- const {
187
- isClicked
188
- } = getStepState(step.id);
189
- if (isClicked) {
190
- if (interactionType === "click") {
191
- handleBarClick(step.id);
192
- } else {
193
- handleBarKeyDown(step.id, event);
194
- }
195
- return;
196
- }
197
- if (interactionType === "click") {
198
- handleBarClick(step.id);
199
- const coords = getMouseTooltipCoords(event);
200
- if (coords) {
201
- showTooltipAt(step, coords.x, coords.y);
202
- }
203
- } else {
204
- handleBarKeyDown(step.id, event);
205
- const coords = getKeyboardTooltipCoords(event);
206
- if (coords) {
207
- showTooltipAt(step, coords.x, coords.y);
208
- }
209
- }
210
- }, [getStepState, handleBarClick, handleBarKeyDown, showTooltipAt, getMouseTooltipCoords, getKeyboardTooltipCoords]);
211
- const stepHandlers = _react.useMemo.call(void 0, () => {
212
- const handlers = /* @__PURE__ */ new Map();
213
- steps.forEach((step) => {
214
- const onClick = (event) => {
215
- event.stopPropagation();
216
- handleStepInteraction(step, event, "click");
217
- };
218
- const onKeyDown = (event) => {
219
- if (event.key === "Enter" || event.key === " ") {
220
- handleStepInteraction(step, event, "keyboard");
221
- } else {
222
- selectedBarRef.current = event.currentTarget;
223
- handleBarKeyDown(step.id, event);
224
- }
225
- };
226
- handlers.set(step.id, {
227
- onClick,
228
- onKeyDown
229
- });
230
- });
231
- return handlers;
232
- }, [steps, handleStepInteraction, handleBarKeyDown]);
233
- _react.useEffect.call(void 0, () => {
234
- const handleDocumentClick = (event) => {
235
- if (selectedBarRef.current && !selectedBarRef.current.contains(event.target)) {
236
- clearSelectionAndRef();
237
- }
238
- };
239
- document.addEventListener("mousedown", handleDocumentClick);
240
- return () => {
241
- document.removeEventListener("mousedown", handleDocumentClick);
242
- };
243
- }, [clearSelectionAndRef]);
244
- const resolvedHeight = _nullishCoalesce(_nullishCoalesce(height, () => ( _optionalChain([style, 'optionalAccess', _5 => _5.height]))), () => ( "100%"));
245
- const {
246
- primaryColor,
247
- backgroundColor,
248
- positiveChangeColor,
249
- negativeChangeColor
250
- } = conversionFunnelChartSettings;
251
- const {
252
- color: barColor
253
- } = getElementStyles ? getElementStyles({
254
- index: 0,
255
- overrideColor: primaryColor
256
- }) : {
257
- color: primaryColor || "#000000"
258
- };
259
- const isPositiveChange = _optionalChain([changeIndicator, 'optionalAccess', _6 => _6.startsWith, 'call', _7 => _7("+")]);
260
- const changeColor = isPositiveChange ? positiveChangeColor : negativeChangeColor;
261
- const barBackgroundColor = backgroundColor || _chunkVTS3PNMScjs.hexToRgba.call(void 0, barColor, 0.08) || "rgba(0, 0, 0, 0.08)";
262
- const renderDefaultMainMetric = () => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
263
- children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", {
264
- className: conversion_funnel_chart_module_default["main-rate"],
265
- children: _chunkVTS3PNMScjs.formatPercentage.call(void 0, mainRate)
266
- }), changeIndicator && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", {
267
- className: conversion_funnel_chart_module_default["change-indicator"],
268
- style: {
269
- color: changeColor
270
- },
271
- children: changeIndicator
272
- })]
273
- });
274
- const renderDefaultTooltip = (step) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
275
- children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
276
- className: conversion_funnel_chart_module_default["tooltip-title"],
277
- children: step.label
278
- }), /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
279
- className: conversion_funnel_chart_module_default["tooltip-content"],
280
- children: [_chunkVTS3PNMScjs.formatPercentage.call(void 0, step.rate), ` \u2022 ${_nullishCoalesce(step.count, () => ( "no"))} items`]
281
- })]
282
- });
283
- const isDataValid = Boolean(steps && steps.length > 0);
284
- const chartMetadata = _react.useMemo.call(void 0, () => ({
285
- mainRate,
286
- changeIndicator,
287
- stepsCount: _optionalChain([steps, 'optionalAccess', _8 => _8.length]) || 0
288
- }), [mainRate, changeIndicator, _optionalChain([steps, 'optionalAccess', _9 => _9.length])]);
289
- _chunkRHHVEJHJcjs.useChartRegistration.call(void 0, {
290
- chartId,
291
- legendItems: [],
292
- chartType: "conversion-funnel",
293
- isDataValid,
294
- metadata: chartMetadata
295
- });
296
- const prefersReducedMotion = _chunkRHHVEJHJcjs.usePrefersReducedMotion.call(void 0, );
297
- if (!isDataValid) {
298
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkI35UYJJRcjs.Stack, {
299
- direction: "column",
300
- className: _clsx2.default.call(void 0, conversion_funnel_chart_module_default.conversionFunnelChart, loading && conversion_funnel_chart_module_default.loading, className),
301
- style: {
302
- ...style,
303
- height: resolvedHeight
304
- },
305
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
306
- className: conversion_funnel_chart_module_default["empty-state"],
307
- children: loading ? "Loading..." : "No data available"
308
- })
309
- });
310
- }
311
- const maxRate = Math.max(...steps.map((step) => step.rate));
312
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
313
- children: [/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkI35UYJJRcjs.Stack, {
314
- direction: "column",
315
- ref: (node) => {
316
- portalContainerRef(node);
317
- chartRef.current = node;
318
- },
319
- className: _clsx2.default.call(void 0, conversion_funnel_chart_module_default.conversionFunnelChart, loading && conversion_funnel_chart_module_default.loading, className),
320
- style: {
321
- ...style,
322
- height: resolvedHeight
323
- },
324
- children: [renderMainMetric ? renderMainMetric({
325
- mainRate,
326
- changeIndicator,
327
- className: conversion_funnel_chart_module_default["main-metric"],
328
- changeColor
329
- }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
330
- className: conversion_funnel_chart_module_default["main-metric"],
331
- children: renderDefaultMainMetric()
332
- }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
333
- className: conversion_funnel_chart_module_default["funnel-container"],
334
- children: steps.map((step, index) => {
335
- const barHeight = step.rate / maxRate * 100;
336
- const {
337
- isBlurred
338
- } = getStepState(step.id);
339
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
340
- className: _clsx2.default.call(void 0, conversion_funnel_chart_module_default["funnel-step"], isBlurred && conversion_funnel_chart_module_default.blurred),
341
- children: [/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
342
- className: conversion_funnel_chart_module_default["step-header"],
343
- children: [renderStepLabel ? renderStepLabel({
344
- step,
345
- index,
346
- className: conversion_funnel_chart_module_default["step-label"]
347
- }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", {
348
- className: conversion_funnel_chart_module_default["step-label"],
349
- children: step.label
350
- }), renderStepRate ? renderStepRate({
351
- step,
352
- index,
353
- className: conversion_funnel_chart_module_default["step-rate"]
354
- }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", {
355
- className: conversion_funnel_chart_module_default["step-rate"],
356
- children: _chunkVTS3PNMScjs.formatPercentage.call(void 0, step.rate)
357
- })]
358
- }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
359
- className: _clsx2.default.call(void 0, conversion_funnel_chart_module_default["bar-container"], isBlurred && conversion_funnel_chart_module_default.disabled),
360
- onClick: _optionalChain([stepHandlers, 'access', _10 => _10.get, 'call', _11 => _11(step.id), 'optionalAccess', _12 => _12.onClick]),
361
- onKeyDown: _optionalChain([stepHandlers, 'access', _13 => _13.get, 'call', _14 => _14(step.id), 'optionalAccess', _15 => _15.onKeyDown]),
362
- role: "button",
363
- tabIndex: isBlurred ? -1 : 0,
364
- "aria-label": step.label,
365
- style: {
366
- backgroundColor: barBackgroundColor
367
- },
368
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
369
- className: _clsx2.default.call(void 0, conversion_funnel_chart_module_default["funnel-bar"], {
370
- [conversion_funnel_chart_module_default["funnel-bar--animated"]]: animation && !loading && !prefersReducedMotion
371
- }),
372
- style: {
373
- height: `${barHeight}%`,
374
- backgroundColor: barColor
375
- }
376
- })
377
- })]
378
- }, step.id);
379
- })
380
- })]
381
- }), tooltipOpen && tooltipData && (() => {
382
- const tooltipContent = renderTooltip ? renderTooltip({
383
- step: tooltipData,
384
- index: steps.findIndex((s) => s.id === tooltipData.id),
385
- top: tooltipTop,
386
- left: tooltipLeft,
387
- className: conversion_funnel_chart_module_default["tooltip-wrapper"]
388
- }) : renderDefaultTooltip(tooltipData);
389
- if (!tooltipContent) return null;
390
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
391
- TooltipInPortal,
392
- {
393
- top: tooltipTop,
394
- left: tooltipLeft,
395
- className: conversion_funnel_chart_module_default["tooltip-wrapper"],
396
- children: tooltipContent
397
- },
398
- Math.random()
399
- );
400
- })()]
401
- });
402
- };
403
- var ConversionFunnelChartWithProvider = (props) => {
404
- const existingContext = _react.useContext.call(void 0, _chunkRHHVEJHJcjs.GlobalChartsContext);
405
- if (existingContext) {
406
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ConversionFunnelChartInternal, {
407
- ...props
408
- });
409
- }
410
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRHHVEJHJcjs.GlobalChartsProvider, {
411
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ConversionFunnelChartInternal, {
412
- ...props
413
- })
414
- });
415
- };
416
- ConversionFunnelChartWithProvider.displayName = "ConversionFunnelChart";
417
-
418
-
419
-
420
- exports.ConversionFunnelChartWithProvider = ConversionFunnelChartWithProvider;
421
- //# sourceMappingURL=chunk-77OKCVQN.cjs.map