@automattic/charts 0.56.3 → 0.56.4

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 (184) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/charts/bar-chart/index.cjs +5 -5
  3. package/dist/charts/bar-chart/index.css +12 -0
  4. package/dist/charts/bar-chart/index.css.map +1 -1
  5. package/dist/charts/bar-chart/index.js +4 -4
  6. package/dist/charts/bar-list-chart/index.cjs +6 -6
  7. package/dist/charts/bar-list-chart/index.css +12 -0
  8. package/dist/charts/bar-list-chart/index.css.map +1 -1
  9. package/dist/charts/bar-list-chart/index.js +5 -5
  10. package/dist/charts/conversion-funnel-chart/index.cjs +5 -3
  11. package/dist/charts/conversion-funnel-chart/index.cjs.map +1 -1
  12. package/dist/charts/conversion-funnel-chart/index.css +14 -1
  13. package/dist/charts/conversion-funnel-chart/index.css.map +1 -1
  14. package/dist/charts/conversion-funnel-chart/index.d.cts +2 -0
  15. package/dist/charts/conversion-funnel-chart/index.d.ts +2 -0
  16. package/dist/charts/conversion-funnel-chart/index.js +4 -2
  17. package/dist/charts/geo-chart/index.cjs +4 -4
  18. package/dist/charts/geo-chart/index.css +12 -0
  19. package/dist/charts/geo-chart/index.css.map +1 -1
  20. package/dist/charts/geo-chart/index.js +3 -3
  21. package/dist/charts/leaderboard-chart/index.cjs +5 -5
  22. package/dist/charts/leaderboard-chart/index.css +12 -0
  23. package/dist/charts/leaderboard-chart/index.css.map +1 -1
  24. package/dist/charts/leaderboard-chart/index.js +4 -4
  25. package/dist/charts/line-chart/index.cjs +5 -5
  26. package/dist/charts/line-chart/index.css +12 -0
  27. package/dist/charts/line-chart/index.css.map +1 -1
  28. package/dist/charts/line-chart/index.js +4 -4
  29. package/dist/charts/pie-chart/index.cjs +7 -7
  30. package/dist/charts/pie-chart/index.css +12 -0
  31. package/dist/charts/pie-chart/index.css.map +1 -1
  32. package/dist/charts/pie-chart/index.js +6 -6
  33. package/dist/charts/pie-semi-circle-chart/index.cjs +7 -7
  34. package/dist/charts/pie-semi-circle-chart/index.css +12 -0
  35. package/dist/charts/pie-semi-circle-chart/index.css.map +1 -1
  36. package/dist/charts/pie-semi-circle-chart/index.js +6 -6
  37. package/dist/charts/sparkline/index.cjs +6 -6
  38. package/dist/charts/sparkline/index.css +12 -0
  39. package/dist/charts/sparkline/index.css.map +1 -1
  40. package/dist/charts/sparkline/index.js +5 -5
  41. package/dist/{chunk-OTZT3MC2.cjs → chunk-2A34OA5O.cjs} +19 -20
  42. package/dist/chunk-2A34OA5O.cjs.map +1 -0
  43. package/dist/chunk-4YYROZDJ.cjs +375 -0
  44. package/dist/chunk-4YYROZDJ.cjs.map +1 -0
  45. package/dist/{chunk-YYQ4IK5V.cjs → chunk-5N77S5N3.cjs} +103 -80
  46. package/dist/chunk-5N77S5N3.cjs.map +1 -0
  47. package/dist/chunk-66BXSWMW.cjs +1065 -0
  48. package/dist/chunk-66BXSWMW.cjs.map +1 -0
  49. package/dist/{chunk-CEZGL6YP.js → chunk-6CCZL2JJ.js} +15 -7
  50. package/dist/chunk-6CCZL2JJ.js.map +1 -0
  51. package/dist/{chunk-NW3RUYK2.cjs → chunk-7QDEU3KN.cjs} +15 -22
  52. package/dist/chunk-7QDEU3KN.cjs.map +1 -0
  53. package/dist/{chunk-H34CJSR6.js → chunk-AWNCAKZY.js} +367 -358
  54. package/dist/chunk-AWNCAKZY.js.map +1 -0
  55. package/dist/{chunk-5XI443YP.js → chunk-BPYKWMI7.js} +72 -64
  56. package/dist/chunk-BPYKWMI7.js.map +1 -0
  57. package/dist/{chunk-7UJPVCMB.cjs → chunk-CERFRCXD.cjs} +265 -262
  58. package/dist/chunk-CERFRCXD.cjs.map +1 -0
  59. package/dist/chunk-CMHPXSCI.js +351 -0
  60. package/dist/chunk-CMHPXSCI.js.map +1 -0
  61. package/dist/chunk-EBDUXL5K.js +421 -0
  62. package/dist/chunk-EBDUXL5K.js.map +1 -0
  63. package/dist/{chunk-2VPPTJS2.js → chunk-FZYJM5PN.js} +256 -253
  64. package/dist/chunk-FZYJM5PN.js.map +1 -0
  65. package/dist/chunk-GBDFC74U.cjs +165 -0
  66. package/dist/chunk-GBDFC74U.cjs.map +1 -0
  67. package/dist/{chunk-ODF5O5PV.cjs → chunk-HNEG3EFJ.cjs} +154 -170
  68. package/dist/chunk-HNEG3EFJ.cjs.map +1 -0
  69. package/dist/{chunk-SRXJLAKG.cjs → chunk-I2276W3I.cjs} +28 -37
  70. package/dist/chunk-I2276W3I.cjs.map +1 -0
  71. package/dist/chunk-KKPZ4MVF.js +375 -0
  72. package/dist/chunk-KKPZ4MVF.js.map +1 -0
  73. package/dist/chunk-KMYJJTSR.cjs +421 -0
  74. package/dist/chunk-KMYJJTSR.cjs.map +1 -0
  75. package/dist/{chunk-A3AEEGKR.js → chunk-KXRWNFQJ.js} +20 -21
  76. package/dist/chunk-KXRWNFQJ.js.map +1 -0
  77. package/dist/{chunk-TVV7ZI7C.cjs → chunk-LSV7F26B.cjs} +362 -353
  78. package/dist/chunk-LSV7F26B.cjs.map +1 -0
  79. package/dist/{chunk-T4J6TI55.js → chunk-M7PRGJFE.js} +102 -79
  80. package/dist/chunk-M7PRGJFE.js.map +1 -0
  81. package/dist/{chunk-TNRKEBTA.js → chunk-PGJAZN2H.js} +148 -164
  82. package/dist/{chunk-TNRKEBTA.js.map → chunk-PGJAZN2H.js.map} +1 -1
  83. package/dist/chunk-R23BFDIW.js +1065 -0
  84. package/dist/chunk-R23BFDIW.js.map +1 -0
  85. package/dist/{chunk-HIWNB5PK.cjs → chunk-RCY6XLGU.cjs} +13 -5
  86. package/dist/chunk-RCY6XLGU.cjs.map +1 -0
  87. package/dist/chunk-RSYD434G.cjs +351 -0
  88. package/dist/chunk-RSYD434G.cjs.map +1 -0
  89. package/dist/{chunk-C33AQZEC.js → chunk-TYIH5LMV.js} +16 -23
  90. package/dist/chunk-TYIH5LMV.js.map +1 -0
  91. package/dist/chunk-WMWAUOQ4.js +165 -0
  92. package/dist/chunk-WMWAUOQ4.js.map +1 -0
  93. package/dist/chunk-XWYZIFZW.js +66 -0
  94. package/dist/chunk-XWYZIFZW.js.map +1 -0
  95. package/dist/{chunk-7HROSZRS.cjs → chunk-Y3NNQMAX.cjs} +70 -62
  96. package/dist/chunk-Y3NNQMAX.cjs.map +1 -0
  97. package/dist/chunk-ZXEFMKVP.cjs +120 -0
  98. package/dist/chunk-ZXEFMKVP.cjs.map +1 -0
  99. package/dist/chunk-ZY4FXLMM.js +120 -0
  100. package/dist/chunk-ZY4FXLMM.js.map +1 -0
  101. package/dist/components/legend/index.cjs +2 -2
  102. package/dist/components/legend/index.css +12 -0
  103. package/dist/components/legend/index.css.map +1 -1
  104. package/dist/components/legend/index.js +1 -1
  105. package/dist/components/tooltip/index.cjs +2 -2
  106. package/dist/components/tooltip/index.js +1 -1
  107. package/dist/components/trend-indicator/index.cjs +2 -2
  108. package/dist/components/trend-indicator/index.js +1 -1
  109. package/dist/hooks/index.cjs +4 -2
  110. package/dist/hooks/index.cjs.map +1 -1
  111. package/dist/hooks/index.css +12 -0
  112. package/dist/hooks/index.css.map +1 -1
  113. package/dist/hooks/index.d.cts +28 -2
  114. package/dist/hooks/index.d.ts +28 -2
  115. package/dist/hooks/index.js +3 -1
  116. package/dist/index.cjs +18 -18
  117. package/dist/index.cjs.map +1 -1
  118. package/dist/index.css +14 -1
  119. package/dist/index.css.map +1 -1
  120. package/dist/index.d.cts +1 -1
  121. package/dist/index.d.ts +1 -1
  122. package/dist/index.js +17 -17
  123. package/dist/providers/index.cjs +2 -2
  124. package/dist/providers/index.css +12 -0
  125. package/dist/providers/index.css.map +1 -1
  126. package/dist/providers/index.d.cts +1 -1
  127. package/dist/providers/index.d.ts +1 -1
  128. package/dist/providers/index.js +1 -1
  129. package/dist/{themes-DQs9rbN5.d.cts → themes-BDVaIfBz.d.cts} +9 -0
  130. package/dist/{themes-CRV5fVzJ.d.ts → themes-mcS8QNkQ.d.ts} +9 -0
  131. package/package.json +5 -1
  132. package/src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss +2 -1
  133. package/src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx +16 -6
  134. package/src/charts/conversion-funnel-chart/test/conversion-funnel-chart.test.tsx +34 -0
  135. package/src/charts/conversion-funnel-chart/types.ts +2 -0
  136. package/src/charts/pie-chart/pie-chart.tsx +2 -3
  137. package/src/hooks/index.ts +1 -0
  138. package/src/hooks/test/use-tooltip-portal-relocator.test.ts +216 -0
  139. package/src/hooks/use-tooltip-portal-relocator.module.scss +10 -0
  140. package/src/hooks/use-tooltip-portal-relocator.ts +177 -0
  141. package/src/providers/chart-context/global-charts-provider.tsx +18 -1
  142. package/tsup.config.ts +11 -0
  143. package/dist/chunk-2VPPTJS2.js.map +0 -1
  144. package/dist/chunk-5XI443YP.js.map +0 -1
  145. package/dist/chunk-7HROSZRS.cjs.map +0 -1
  146. package/dist/chunk-7UJPVCMB.cjs.map +0 -1
  147. package/dist/chunk-A3AEEGKR.js.map +0 -1
  148. package/dist/chunk-C33AQZEC.js.map +0 -1
  149. package/dist/chunk-CEZGL6YP.js.map +0 -1
  150. package/dist/chunk-COOC2TVQ.js +0 -167
  151. package/dist/chunk-COOC2TVQ.js.map +0 -1
  152. package/dist/chunk-EJHLLXBV.js +0 -362
  153. package/dist/chunk-EJHLLXBV.js.map +0 -1
  154. package/dist/chunk-FWMJ2FR2.js +0 -121
  155. package/dist/chunk-FWMJ2FR2.js.map +0 -1
  156. package/dist/chunk-GRYNIPWH.cjs +0 -385
  157. package/dist/chunk-GRYNIPWH.cjs.map +0 -1
  158. package/dist/chunk-H34CJSR6.js.map +0 -1
  159. package/dist/chunk-HIWNB5PK.cjs.map +0 -1
  160. package/dist/chunk-IZWC33YN.cjs +0 -357
  161. package/dist/chunk-IZWC33YN.cjs.map +0 -1
  162. package/dist/chunk-KOF32DBL.cjs +0 -1058
  163. package/dist/chunk-KOF32DBL.cjs.map +0 -1
  164. package/dist/chunk-LHWRZMF7.cjs +0 -362
  165. package/dist/chunk-LHWRZMF7.cjs.map +0 -1
  166. package/dist/chunk-MFRS2PEY.cjs +0 -121
  167. package/dist/chunk-MFRS2PEY.cjs.map +0 -1
  168. package/dist/chunk-MMDLXS6O.js +0 -75
  169. package/dist/chunk-MMDLXS6O.js.map +0 -1
  170. package/dist/chunk-NW3RUYK2.cjs.map +0 -1
  171. package/dist/chunk-ODF5O5PV.cjs.map +0 -1
  172. package/dist/chunk-OTZT3MC2.cjs.map +0 -1
  173. package/dist/chunk-SBRMWDWM.js +0 -357
  174. package/dist/chunk-SBRMWDWM.js.map +0 -1
  175. package/dist/chunk-SRXJLAKG.cjs.map +0 -1
  176. package/dist/chunk-T4J6TI55.js.map +0 -1
  177. package/dist/chunk-TVV7ZI7C.cjs.map +0 -1
  178. package/dist/chunk-XVMXWV3C.cjs +0 -167
  179. package/dist/chunk-XVMXWV3C.cjs.map +0 -1
  180. package/dist/chunk-YYQ4IK5V.cjs.map +0 -1
  181. package/dist/chunk-ZDNCF642.js +0 -1058
  182. package/dist/chunk-ZDNCF642.js.map +0 -1
  183. package/dist/chunk-ZWBUEHKF.js +0 -385
  184. package/dist/chunk-ZWBUEHKF.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-7UJPVCMB.cjs","../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"],"names":["jsx","useMemo"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACjCA,iEAA6B;AAC7B,wC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AAA;AACD,4BAAA;AACA,4BAAA;AACD,0BAAA;AAAA,wBAAA;AAEE,sBAAA;AAEgB,sCAAA;AAGC,wBAAA;AACX,0BAAA;AACR,wBAAA;AAGCA,wBAAAA;AAAC,0BAAA;AAAA,0BAAA;AAEsB,4BAAA;AACJ,4BAAA;AACiB,4BAAA;AACA,4BAAA;AACK,4BAAA;AAAA,0BAAA;AALtB,0CAAA;AAMnB,wBAAA;AAGH,sBAAA;AAEwB,sCAAA;AACA,sCAAA;AAGvBA,sBAAAA;AAAC,wBAAA;AAAA,wBAAA;AACY,0BAAA;AACO,0BAAA;AACA,0BAAA;AACc,0BAAA;AACjC,0BAAA;AACA,0BAAA;AAC2B,0BAAA;AAClB,0BAAA;AACJ,0BAAA;AAAA,wBAAA;AACN,sBAAA;AAAA,oBAAA;AAAA,kBAAA;AAGH,gBAAA;AAAA,cAAA;AAEF,YAAA;AAEiC,YAAA;AAE/B,YAAA;AAAA,UAAA;AAAA,QAAA;AACH,MAAA;AAAA,IAAA;AACD,EAAA;AAEF;AAE2D;AACF,EAAA;AAGjC,EAAA;AACgB,IAAA;AACvC,EAAA;AAKE,EAAA;AAGH;AAEmC;AAGyB;AAC3D,EAAA;AACC;AAGyB;AAC4B,EAAA;AACtD,EAAA;AACC,IAAA;AACD,EAAA;AACD;AD2EuE;AACA;AACA;AACA;AACA","file":"/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-7UJPVCMB.cjs","sourcesContent":[null,"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 {\n\tuseXYChartTheme,\n\tuseChartDataTransform,\n\tuseZeroValueDisplay,\n\tuseChartMargin,\n\tuseElementHeight,\n\tuseHasLegendChild,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n\tGlobalChartsContext,\n} 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';\nimport type { BaseChartProps, DataPointDate, SeriesData, Optional } from '../../types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { RenderTooltipParams } from '@visx/xychart/lib/components/Tooltip';\nimport type { GapSize } from '@wordpress/theme';\nimport type { FC, ReactNode, ComponentType } from 'react';\n\nexport interface BarChartProps extends BaseChartProps< SeriesData[] > {\n\trenderTooltip?: ( params: RenderTooltipParams< DataPointDate > ) => ReactNode;\n\torientation?: 'horizontal' | 'vertical';\n\twithPatterns?: boolean;\n\tshowZeroValues?: boolean;\n\tlegendInteractive?: boolean;\n\tchildren?: ReactNode;\n\t/**\n\t * Gap between chart elements (SVG, legend, children).\n\t * Uses WordPress design system tokens.\n\t * @default 'md'\n\t */\n\tgap?: GapSize;\n}\n\n// Base props type with optional responsive properties\ntype BarChartBaseProps = Optional< BarChartProps, 'width' | 'height' | 'size' >;\n\n// Composition API types\ninterface BarChartSubComponents {\n\tLegend: ComponentType< React.ComponentProps< typeof Legend > >;\n}\n\ntype BarChartComponent = FC< BarChartBaseProps > & BarChartSubComponents;\ntype BarChartResponsiveComponent = FC< BarChartBaseProps & ResponsiveConfig > &\n\tBarChartSubComponents;\n\n// Validation function similar to LineChart\nconst validateData = ( data: SeriesData[] ) => {\n\tif ( ! data?.length ) return 'No data available';\n\n\tconst hasInvalidData = data.some( series =>\n\t\tseries.data.some(\n\t\t\tpoint =>\n\t\t\t\tisNaN( point.value as number ) ||\n\t\t\t\tpoint.value === null ||\n\t\t\t\tpoint.value === undefined ||\n\t\t\t\t( ! point.label &&\n\t\t\t\t\t( ! ( 'date' in point && point.date ) || isNaN( point.date.getTime() ) ) )\n\t\t)\n\t);\n\n\tif ( hasInvalidData ) return 'Invalid data';\n\treturn null;\n};\n\nconst getPatternId = ( chartId: string, index: number ) => `bar-pattern-${ chartId }-${ index }`;\n\nconst BarChartInternal: FC< BarChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth,\n\theight,\n\tclassName,\n\tmargin,\n\twithTooltips = false,\n\tshowLegend = false,\n\tlegendOrientation = 'horizontal',\n\tlegendPosition = 'bottom',\n\tlegendAlignment = 'center',\n\tlegendMaxWidth,\n\tlegendTextOverflow = 'wrap',\n\tlegendItemClassName,\n\tlegendShape = 'rect',\n\tgridVisibility: gridVisibilityProp,\n\trenderTooltip,\n\toptions = {},\n\torientation = 'vertical',\n\twithPatterns = false,\n\tshowZeroValues = false,\n\tlegendInteractive = false,\n\tanimation,\n\tchildren,\n\tgap = 'md',\n} ) => {\n\tconst horizontal = orientation === 'horizontal';\n\tconst chartId = useChartId( providedChartId );\n\tconst theme = useXYChartTheme( data );\n\n\tconst dataSorted = useChartDataTransform( data );\n\n\t// Transform data to add a small value for zero bars to make them visible\n\tconst dataWithVisibleZeros = useZeroValueDisplay( dataSorted, {\n\t\tenabled: showZeroValues,\n\t} );\n\n\t// Create legend items using the reusable hook\n\tconst legendItems = useChartLegendItems( dataSorted );\n\tconst chartOptions = useBarChartOptions( dataWithVisibleZeros, horizontal, options );\n\tconst defaultMargin = useChartMargin( height, chartOptions, dataSorted, theme, horizontal );\n\tconst [ svgWrapperRef, svgWrapperHeight ] = useElementHeight< HTMLDivElement >();\n\tconst chartRef = useRef< HTMLDivElement >( null );\n\n\t// Check if children contain a Legend component (composition pattern)\n\tconst hasLegendChild = useHasLegendChild( children );\n\n\t// Use the measured SVG wrapper height, falling back to the passed height if provided.\n\t// When there's a legend (via prop or composition), we must wait for measurement because\n\t// the legend takes space and the svg-wrapper height will be less than the total height.\n\tconst chartHeight = svgWrapperHeight > 0 ? svgWrapperHeight : height;\n\tconst hasLegend = showLegend || hasLegendChild;\n\tconst isWaitingForMeasurement = hasLegend ? svgWrapperHeight === 0 : ! chartHeight;\n\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >( undefined );\n\tconst [ isNavigating, setIsNavigating ] = useState( false );\n\n\tconst totalPoints =\n\t\tMath.max( 0, ...data.map( series => series.data?.length || 0 ) ) * data.length;\n\n\t// Use the keyboard navigation hook\n\tconst { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation( {\n\t\tselectedIndex,\n\t\tsetSelectedIndex,\n\t\tisNavigating,\n\t\tsetIsNavigating,\n\t\tchartRef,\n\t\ttotalPoints,\n\t} );\n\n\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\tconst providerTheme = useGlobalChartsTheme();\n\n\t// Add visibility information to series when using interactive legends\n\tconst seriesWithVisibility = useMemo( () => {\n\t\tif ( ! chartId || ! legendInteractive ) {\n\t\t\treturn dataWithVisibleZeros.map( ( series, index ) => ( {\n\t\t\t\tseries,\n\t\t\t\tindex,\n\t\t\t\tisVisible: true,\n\t\t\t} ) );\n\t\t}\n\t\treturn dataWithVisibleZeros.map( ( series, index ) => ( {\n\t\t\tseries,\n\t\t\tindex,\n\t\t\tisVisible: isSeriesVisible( chartId, series.label ),\n\t\t} ) );\n\t}, [ dataWithVisibleZeros, chartId, isSeriesVisible, legendInteractive ] );\n\n\t// Check if all series are hidden\n\tconst allSeriesHidden = useMemo( () => {\n\t\treturn seriesWithVisibility.every( ( { isVisible } ) => ! isVisible );\n\t}, [ seriesWithVisibility ] );\n\n\tconst getBarBackground = useCallback(\n\t\t( index: number ) => () =>\n\t\t\twithPatterns\n\t\t\t\t? `url(#${ getPatternId( chartId, index ) })`\n\t\t\t\t: getElementStyles( { data: dataSorted[ index ], index } ).color,\n\t\t[ withPatterns, getElementStyles, dataSorted, chartId ]\n\t);\n\n\tconst renderDefaultTooltip = useCallback(\n\t\t( { tooltipData }: RenderTooltipParams< DataPointDate > ) => {\n\t\t\tconst nearestDatum = tooltipData?.nearestDatum?.datum;\n\t\t\tif ( ! nearestDatum ) return null;\n\n\t\t\treturn (\n\t\t\t\t<div className={ styles[ 'bar-chart__tooltip' ] }>\n\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip-header' ] }>\n\t\t\t\t\t\t{ tooltipData?.nearestDatum?.key }\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip-row' ] }>\n\t\t\t\t\t\t<span className={ styles[ 'bar-chart__tooltip-label' ] }>\n\t\t\t\t\t\t\t{ chartOptions.tooltip.labelFormatter(\n\t\t\t\t\t\t\t\tnearestDatum.label || ( nearestDatum.date ? nearestDatum.date.getTime() : 0 ),\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t[]\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t:\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span className={ styles[ 'bar-chart__tooltip-value' ] }>\n\t\t\t\t\t\t\t{ formatNumber( nearestDatum.value as number ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t},\n\t\t[ chartOptions.tooltip ]\n\t);\n\n\tconst renderPattern = useCallback(\n\t\t( index: number, color: string ) => {\n\t\t\tconst patternType = index % 4;\n\t\t\tconst id = getPatternId( chartId, index );\n\t\t\tconst commonProps = {\n\t\t\t\tid,\n\t\t\t\tstroke: 'white',\n\t\t\t\tstrokeWidth: 1,\n\t\t\t\tbackground: color,\n\t\t\t};\n\n\t\t\tswitch ( patternType ) {\n\t\t\t\tcase 0:\n\t\t\t\tdefault:\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<PatternLines\n\t\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\t\t{ ...commonProps }\n\t\t\t\t\t\t\twidth={ 5 }\n\t\t\t\t\t\t\theight={ 5 }\n\t\t\t\t\t\t\torientation={ [ 'diagonal' ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\tcase 1:\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<PatternCircles key={ id } { ...commonProps } width={ 6 } height={ 6 } fill=\"white\" />\n\t\t\t\t\t);\n\t\t\t\tcase 2:\n\t\t\t\t\treturn <PatternWaves key={ id } { ...commonProps } width={ 4 } height={ 4 } />;\n\t\t\t\tcase 3:\n\t\t\t\t\treturn <PatternHexagons key={ id } { ...commonProps } size={ 8 } height={ 3 } />;\n\t\t\t}\n\t\t},\n\t\t[ chartId ]\n\t);\n\n\tconst createPatternBorderStyle = useCallback(\n\t\t( index: number, color: string ) => {\n\t\t\tconst patternId = getPatternId( chartId, index );\n\t\t\treturn `\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\t\t},\n\t\t[ chartId ]\n\t);\n\n\tconst createKeyboardHighlightStyle = useCallback( () => {\n\t\tif ( selectedIndex === undefined ) return '';\n\n\t\t// Calculate which bar should be highlighted based on selectedIndex\n\t\t// Pattern: [series1[0], series2[0], series3[0], series1[1], series2[1], series3[1], ...]\n\t\tconst maxDataPoints = Math.max( ...data.map( s => s.data.length ) );\n\t\tconst dataPointIndex = Math.floor( selectedIndex / data.length );\n\t\tconst seriesIndex = selectedIndex % data.length;\n\n\t\t// Only highlight if we're within valid bounds\n\t\tif ( dataPointIndex >= maxDataPoints || seriesIndex >= data.length ) {\n\t\t\treturn '';\n\t\t}\n\n\t\tconst seriesData = data[ seriesIndex ];\n\t\tif ( dataPointIndex >= seriesData.data.length ) {\n\t\t\treturn '';\n\t\t}\n\n\t\t// Based on the DOM structure analysis:\n\t\t// - All bars are in a single .visx-bar-group\n\t\t// - Bars are ordered as: [series1[0], series1[1], series2[0], series2[1], ...]\n\t\t// - So we need to calculate the actual bar index in the DOM\n\t\tconst actualBarIndex = seriesIndex * maxDataPoints + dataPointIndex;\n\n\t\t// Use a CSS class selector instead of ID since useId() generates invalid CSS ID characters\n\t\tconst generatedStyles = `\n\t\t\t.bar-chart[data-chart-id=\"bar-chart-${ chartId }\"] .visx-bar-group .visx-bar:nth-child(${\n\t\t\t\tactualBarIndex + 1\n\t\t\t}) {\n\t\t\t\tstroke: #005fcc;\n\t\t\t\tstroke-width: 2px;\n\t\t\t}\n\t\t`;\n\n\t\treturn generatedStyles;\n\t}, [ selectedIndex, data, chartId ] );\n\n\t// Validate data first\n\tconst error = validateData( dataSorted );\n\tconst isDataValid = ! error;\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\torientation,\n\t\t\twithPatterns,\n\t\t} ),\n\t\t[ orientation, withPatterns ]\n\t);\n\n\t// Register chart with context only if data is valid\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'bar',\n\t\tisDataValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\tif ( error ) {\n\t\treturn <div className={ clsx( 'bar-chart', styles[ 'bar-chart' ] ) }>{ error }</div>;\n\t}\n\n\tconst gridVisibility = gridVisibilityProp ?? chartOptions.gridVisibility;\n\tconst highlightedBarStyle = createKeyboardHighlightStyle();\n\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legendOrientation }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legendAlignment }\n\t\t\tmaxWidth={ legendMaxWidth }\n\t\t\ttextOverflow={ legendTextOverflow }\n\t\t\tlegendItemClassName={ legendItemClassName }\n\t\t\tclassName={ styles[ 'bar-chart__legend' ] }\n\t\t\tshape={ legendShape }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<SingleChartContext.Provider\n\t\t\tvalue={ {\n\t\t\t\tchartId,\n\t\t\t\tchartWidth: width,\n\t\t\t\tchartHeight,\n\t\t\t} }\n\t\t>\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\tgap={ gap }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'bar-chart',\n\t\t\t\t\tstyles[ 'bar-chart' ],\n\t\t\t\t\t{\n\t\t\t\t\t\t[ styles[ `bar-chart--animated${ horizontal ? '-horizontal' : '' }` ] ]:\n\t\t\t\t\t\t\tanimation && ! prefersReducedMotion,\n\t\t\t\t\t},\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tdata-testid=\"bar-chart\"\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth,\n\t\t\t\t\theight,\n\t\t\t\t\tvisibility: isWaitingForMeasurement ? 'hidden' : 'visible',\n\t\t\t\t} }\n\t\t\t\tdata-chart-id={ `bar-chart-${ chartId }` }\n\t\t\t>\n\t\t\t\t{ legendPosition === 'top' && legendElement }\n\n\t\t\t\t<div\n\t\t\t\t\tclassName={ styles[ 'bar-chart__svg-wrapper' ] }\n\t\t\t\t\tref={ svgWrapperRef }\n\t\t\t\t\trole=\"grid\"\n\t\t\t\t\taria-label={ __( 'Bar chart', 'jetpack-charts' ) }\n\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\tonFocus={ onChartFocus }\n\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t>\n\t\t\t\t\t{ ! isWaitingForMeasurement && (\n\t\t\t\t\t\t<div ref={ chartRef }>\n\t\t\t\t\t\t\t<XYChart\n\t\t\t\t\t\t\t\ttheme={ theme }\n\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\tmargin={ {\n\t\t\t\t\t\t\t\t\t...defaultMargin,\n\t\t\t\t\t\t\t\t\t...margin,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\txScale={ chartOptions.xScale }\n\t\t\t\t\t\t\t\tyScale={ chartOptions.yScale }\n\t\t\t\t\t\t\t\thorizontal={ horizontal }\n\t\t\t\t\t\t\t\tpointerEventsDataKey=\"nearest\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Grid\n\t\t\t\t\t\t\t\t\tcolumns={ gridVisibility.includes( 'y' ) }\n\t\t\t\t\t\t\t\t\trows={ gridVisibility.includes( 'x' ) }\n\t\t\t\t\t\t\t\t\tnumTicks={ 4 }\n\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t{ withPatterns && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<defs data-testid=\"bar-chart-patterns\">\n\t\t\t\t\t\t\t\t\t\t\t{ dataSorted.map( ( seriesData, index ) =>\n\t\t\t\t\t\t\t\t\t\t\t\trenderPattern(\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tgetElementStyles( { data: seriesData, index } ).color\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</defs>\n\t\t\t\t\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t\t\t\t\t{ dataSorted.map( ( seriesData, index ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tcreatePatternBorderStyle(\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tgetElementStyles( { data: seriesData, index } ).color\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</style>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t{ highlightedBarStyle && <style>{ highlightedBarStyle }</style> }\n\n\t\t\t\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t\t\t\t<text\n\t\t\t\t\t\t\t\t\t\tx={ width / 2 }\n\t\t\t\t\t\t\t\t\t\ty={ chartHeight / 2 }\n\t\t\t\t\t\t\t\t\t\ttextAnchor=\"middle\"\n\t\t\t\t\t\t\t\t\t\tfill={ providerTheme.gridStyles?.stroke || '#ccc' }\n\t\t\t\t\t\t\t\t\t\tfontSize=\"14\"\n\t\t\t\t\t\t\t\t\t\tfontFamily=\"-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'All series are hidden. Click legend items to show data.',\n\t\t\t\t\t\t\t\t\t\t\t'jetpack-charts'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</text>\n\t\t\t\t\t\t\t\t) : null }\n\n\t\t\t\t\t\t\t\t<BarGroup padding={ chartOptions.barGroup.padding }>\n\t\t\t\t\t\t\t\t\t{ seriesWithVisibility.map( ( { series: seriesData, index, isVisible } ) => {\n\t\t\t\t\t\t\t\t\t\t// Skip rendering invisible series\n\t\t\t\t\t\t\t\t\t\tif ( ! isVisible ) {\n\t\t\t\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<BarSeries\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\tdataKey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData.data as DataPointDate[] }\n\t\t\t\t\t\t\t\t\t\t\t\tyAccessor={ chartOptions.accessors.yAccessor }\n\t\t\t\t\t\t\t\t\t\t\t\txAccessor={ chartOptions.accessors.xAccessor }\n\t\t\t\t\t\t\t\t\t\t\t\tcolorAccessor={ getBarBackground( index ) }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t</BarGroup>\n\n\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.x } />\n\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.y } />\n\n\t\t\t\t\t\t\t\t{ withTooltips && (\n\t\t\t\t\t\t\t\t\t<AccessibleTooltip\n\t\t\t\t\t\t\t\t\t\tdetectBounds\n\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumX\n\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumY\n\t\t\t\t\t\t\t\t\t\trenderTooltip={ renderTooltip || renderDefaultTooltip }\n\t\t\t\t\t\t\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\t\t\t\t\t\t\ttooltipRef={ tooltipRef }\n\t\t\t\t\t\t\t\t\t\tkeyboardFocusedClassName={ styles[ 'bar-chart__tooltip--keyboard-focused' ] }\n\t\t\t\t\t\t\t\t\t\tseries={ data }\n\t\t\t\t\t\t\t\t\t\tmode=\"individual\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</XYChart>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\n\t\t\t\t{ legendPosition === 'bottom' && legendElement }\n\n\t\t\t\t{ children }\n\t\t\t</Stack>\n\t\t</SingleChartContext.Provider>\n\t);\n};\n\nconst BarChartWithProvider: FC< BarChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <BarChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<BarChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nBarChartWithProvider.displayName = 'BarChart';\n\n// Create BarChart with composition API\nconst BarChart = attachSubComponents( BarChartWithProvider, {\n\tLegend: Legend,\n} ) as BarChartComponent;\n\n// Create responsive BarChart with composition API\nconst BarChartResponsive = attachSubComponents(\n\twithResponsive< BarChartProps >( BarChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t}\n) as BarChartResponsiveComponent;\n\nexport { BarChartResponsive as default, BarChart as BarChartUnresponsive };\n","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 type { AxisScale, TickRendererProps } from '@visx/axis';\nimport type { FC, CSSProperties } from 'react';\n\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 extends AxisScale >( scale?: Scale ) => {\n\treturn scale && 'bandwidth' in scale ? scale.bandwidth() ?? 0 : 0;\n};\ninterface TruncatedTickComponentProps extends TickRendererProps {\n\t/** Which axis this tick belongs to */\n\taxis: 'x' | 'y';\n}\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: FC< TruncatedTickComponentProps > = ( {\n\tx,\n\ty,\n\tformattedValue,\n\taxis,\n\ttextAnchor,\n\tfill,\n\tdy,\n\t...textProps\n} ) => {\n\t// Get max width of the tick label\n\tconst { xScale, yScale } = useContext( DataContext ) || {};\n\tconst scale = axis === 'x' ? xScale : yScale;\n\tconst bandwidth = getScaleBandwidth( scale );\n\tconst maxWidth = Math.max( bandwidth, MIN_TICK_LABEL_WIDTH );\n\n\t// Map SVG textAnchor to CSS textAlign\n\tlet textAlign: 'left' | 'right' | 'center' = 'center';\n\tif ( textAnchor === 'start' ) {\n\t\ttextAlign = 'left';\n\t} else if ( textAnchor === 'end' ) {\n\t\ttextAlign = 'right';\n\t} else if ( textAnchor === 'middle' ) {\n\t\ttextAlign = 'center';\n\t}\n\n\t// Calculate x offset based on text alignment\n\tlet xOffset = 0;\n\tif ( textAlign === 'center' ) {\n\t\txOffset = -maxWidth / 2;\n\t} else if ( textAlign === 'right' ) {\n\t\txOffset = -maxWidth;\n\t}\n\n\t// Extract compatible style properties from SVG text props\n\tconst { fontSize, fontFamily, fontWeight, fontStyle, letterSpacing, opacity } = textProps as {\n\t\tfontSize?: CSSProperties[ 'fontSize' ];\n\t\tfontFamily?: CSSProperties[ 'fontFamily' ];\n\t\tfontWeight?: CSSProperties[ 'fontWeight' ];\n\t\tfontStyle?: CSSProperties[ 'fontStyle' ];\n\t\tletterSpacing?: CSSProperties[ 'letterSpacing' ];\n\t\topacity?: CSSProperties[ 'opacity' ];\n\t};\n\n\tconst textStyles: CSSProperties = {\n\t\t/**\n\t\t * SVG <text> elements are vertically aligned to the baseline by default, but HTML <div> elements inside <foreignObject>\n\t\t * are positioned relative to the top-left corner. To visually align the tick label like SVG text,\n\t\t * 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\t\t */\n\t\ttransform: `translateY(calc(-100% + ${ dy ?? '0' } * 2))`,\n\t\t// Safari doesn't work well with foreignObject positioning. Use position: fixed as a workaround.\n\t\t...( isSafari() ? { position: 'fixed' as const } : {} ),\n\t\t// Apply compatible SVG text styles\n\t\tfontSize,\n\t\tfontFamily,\n\t\tfontWeight,\n\t\tfontStyle,\n\t\tletterSpacing,\n\t\topacity,\n\t\t// Convert svg text styles to CSS styles for the div\n\t\tcolor: fill ?? 'inherit',\n\t\ttextAlign,\n\t\t// Ensure text is truncated with ellipsis, remains on one line, and shows the full value in a tooltip on hover.\n\t\t// The surrounding div uses CSS to handle overflow, and the 'title' attribute is set for accessibility.\n\t\twidth: maxWidth,\n\t\toverflow: 'hidden',\n\t\ttextOverflow: 'ellipsis',\n\t\twhiteSpace: 'nowrap',\n\t\tcursor: 'default',\n\t\tpointerEvents: 'auto',\n\t};\n\n\treturn (\n\t\t<foreignObject x={ x + xOffset } y={ y } width={ maxWidth } height={ 0 } overflow=\"visible\">\n\t\t\t<div style={ textStyles } title={ formattedValue }>\n\t\t\t\t{ formattedValue }\n\t\t\t</div>\n\t\t</foreignObject>\n\t);\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: 'x' | 'y' ) => ( props: TickRendererProps ) => {\n\treturn <TruncatedTickComponent { ...props } axis={ axis } />;\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' );\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/charts/private/radial-wipe-animation/radial-wipe-animation.tsx"],"sourcesContent":["/**\n * This animation uses the SVG self-drawing technique (source: https://www.joshwcomeau.com/svg/friendly-introduction-to-svg/),\n * leveraging stroke-dasharray and stroke-dashoffset properties to create the effect.\n *\n * Here, we reverse the animation to \"un-draw\" the circle for the revealing / radial wipe effect:\n * - Initially, the entire circle is drawn with a white mask.\n * - The circle's border (stroke) is drawn with a black stroke, wide enough to cover the circle.\n * - The stroke is then \"un-drawn,\" creating the wipe animation.\n * - A white mask makes the area visible, while a black mask makes the area invisible.\n */\n\ntype Angle = `${ number }deg` | `${ number }rad` | `${ number }grad` | `${ number }turn` | 0 | '0';\n\n/**\n * RadialWipeAnimationProps - SVG mask props that requires a radial wipe animation effect.\n *\n * @param {object} props - The properties object.\n * @param {string} props.id - The unique ID for the mask.\n * @param {number} props.radius - The outer radius of the radial wipe.\n * @param {number} [props.innerRadius=0] - The inner radius of the radial wipe.\n * @param {number} [props.durationMs=1000] - The duration of the animation in milliseconds.\n * @param {number} [props.wipePercentage=100] - The percentage of the wipe animation to complete.\n * @param {'clockwise' | 'counter-clockwise'} [props.direction='clockwise'] - The direction of the wipe animation.\n * @param {Angle} [props.startAngle='-90deg'] - The starting angle of the wipe animation.\n *\n * @return {JSX.Element} The radial wipe mask element.\n */\nexport type RadialWipeAnimationProps = {\n\tid: string;\n\tradius: number;\n\tinnerRadius?: number;\n\tdurationMs?: number;\n\tstartAngle?: Angle;\n\tdirection?: 'clockwise' | 'counter-clockwise';\n\twipePercentage?: number;\n};\n\n/**\n * Renders a SVG mask that creates a radial wipe animation effect.\n *\n * @param {RadialWipeAnimationProps} props - Component props\n * @return {JSX.Element} The rendered mask component\n */\nfunction RadialWipeAnimation( {\n\tid,\n\tradius,\n\tinnerRadius = 0,\n\tdurationMs = 1000,\n\twipePercentage = 100,\n\tdirection = 'clockwise',\n\tstartAngle = '-90deg',\n}: RadialWipeAnimationProps ) {\n\tconst strokeWidth =\n\t\t( radius - innerRadius ) * 2 + // The stroke is centered on the circumference, so we need to double the width.\n\t\t1; // Added 1 to prevent sub-pixel rendering issues.\n\n\tconst scaleY = direction === 'clockwise' ? -1 : 1;\n\n\tconst isValidWipePercentage = 0 < wipePercentage && wipePercentage <= 100;\n\tconst animationDuration = `${\n\t\t// If wipePercentage is invalid, set animation duration to 0 to disable animation.\n\t\tisValidWipePercentage ? durationMs * ( 100 / wipePercentage ) : 0\n\t}ms`;\n\n\treturn (\n\t\t<mask id={ id }>\n\t\t\t<circle\n\t\t\t\tcx={ 0 }\n\t\t\t\tcy={ 0 }\n\t\t\t\tr={ radius }\n\t\t\t\tpathLength=\"100\"\n\t\t\t\tfill=\"white\"\n\t\t\t\tstroke=\"black\" // The stroke will be un-drawn, hence 'black' mask.\n\t\t\t\tstrokeWidth={ strokeWidth }\n\t\t\t\tstrokeDasharray=\"100, 1000\"\n\t\t\t\tstrokeDashoffset=\"0\"\n\t\t\t\tstyle={ { transform: `rotate(${ startAngle }) scaleY(${ scaleY })` } }\n\t\t\t>\n\t\t\t\t<animate\n\t\t\t\t\tattributeName=\"stroke-dashoffset\"\n\t\t\t\t\tfrom=\"0\"\n\t\t\t\t\tto=\"100.1\"\n\t\t\t\t\tdur={ animationDuration }\n\t\t\t\t\tfill=\"freeze\" // Same as CSS 'forwards' to retain the final state after animation.\n\t\t\t\t\tcalcMode=\"spline\" // custom easing\n\t\t\t\t\tkeySplines=\"0.42 0 0.58 1;0 0 1 1\" // ease-in-out ; linear (unimportant)\n\t\t\t\t\tkeyTimes={ `0;${ wipePercentage / 100 };1` }\n\t\t\t\t/>\n\t\t\t</circle>\n\t\t</mask>\n\t);\n}\n\nexport default RadialWipeAnimation;\n"],"mappings":";AA8EI;AAnCJ,SAAS,oBAAqB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,aAAa;AACd,GAA8B;AAC7B,QAAM,eACH,SAAS,eAAgB;AAAA,EAC3B;AAED,QAAM,SAAS,cAAc,cAAc,KAAK;AAEhD,QAAM,wBAAwB,IAAI,kBAAkB,kBAAkB;AACtE,QAAM,oBAAoB;AAAA,EAEzB,wBAAwB,cAAe,MAAM,kBAAmB,CACjE;AAEA,SACC,oBAAC,UAAK,IACL;AAAA,IAAC;AAAA;AAAA,MACA,IAAK;AAAA,MACL,IAAK;AAAA,MACL,GAAI;AAAA,MACJ,YAAW;AAAA,MACX,MAAK;AAAA,MACL,QAAO;AAAA,MACP;AAAA,MACA,iBAAgB;AAAA,MAChB,kBAAiB;AAAA,MACjB,OAAQ,EAAE,WAAW,UAAW,UAAW,YAAa,MAAO,IAAI;AAAA,MAEnE;AAAA,QAAC;AAAA;AAAA,UACA,eAAc;AAAA,UACd,MAAK;AAAA,UACL,IAAG;AAAA,UACH,KAAM;AAAA,UACN,MAAK;AAAA,UACL,UAAS;AAAA,UACT,YAAW;AAAA,UACX,UAAW,KAAM,iBAAiB,GAAI;AAAA;AAAA,MACvC;AAAA;AAAA,EACD,GACD;AAEF;AAEA,IAAO,gCAAQ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/charts/private/with-responsive/with-responsive.tsx","../src/charts/private/with-responsive/with-responsive.module.scss"],"sourcesContent":["import { useParentSize } from '@visx/responsive';\nimport styles from './with-responsive.module.scss';\nimport type { BaseChartProps } from '../../../types';\nimport type { ComponentType } from 'react';\n\ntype DimensionProps = {\n\twidth?: number;\n\theight?: number;\n\tsize?: number;\n};\n\nexport type ResponsiveConfig = {\n\t/**\n\t * The maximum width of the chart. Defaults to 1200.\n\t */\n\tmaxWidth?: number;\n\t/**\n\t * The aspect ratio of the chart (height = width * aspectRatio).\n\t * When provided, height is calculated from width.\n\t * When omitted, the chart fills the parent container's height.\n\t */\n\taspectRatio?: number;\n\t/**\n\t * Child render updates upon resize are delayed until debounceTime milliseconds after the last resize event is observed.\n\t */\n\tresizeDebounceTime?: number;\n};\n\nconst useResponsiveDimensions = ( {\n\tresizeDebounceTime = 300,\n\tmaxWidth = 1200,\n\taspectRatio,\n}: ResponsiveConfig ) => {\n\tconst {\n\t\tparentRef,\n\t\twidth: parentWidth,\n\t\theight: parentHeight,\n\t} = useParentSize( {\n\t\tdebounceTime: resizeDebounceTime,\n\t\tenableDebounceLeadingCall: true,\n\t} );\n\n\tconst containerWidth = parentWidth > 0 ? Math.min( parentWidth, maxWidth ) : 0;\n\tconst containerHeight = aspectRatio !== undefined ? containerWidth * aspectRatio : parentHeight;\n\n\treturn {\n\t\tparentRef,\n\t\twidth: containerWidth,\n\t\theight: containerHeight,\n\t\t/**\n\t\t * Whether an aspectRatio was provided. Used to determine container\n\t\t * height styling: 'auto' when true (height derived from width),\n\t\t * '100%' when false (fill parent container).\n\t\t */\n\t\thasAspectRatio: aspectRatio !== undefined,\n\t};\n};\n\n/**\n * A higher-order component that provides responsive dimensions\n * to the wrapped chart component using useParentSize from `@visx/responsive`.\n *\n * @param WrappedComponent - The chart component to be wrapped.\n * @return A functional component that renders the wrapped component with responsive dimensions.\n */\nexport function withResponsive< T extends Exclude< BaseChartProps< unknown >, 'options' > >( // 'options' is excluded so that each chart can define its own options type\n\tWrappedComponent: ComponentType< T >\n) {\n\treturn function ResponsiveChart( {\n\t\tresizeDebounceTime = 300,\n\t\tmaxWidth = 1200,\n\t\taspectRatio,\n\t\tsize,\n\t\twidth,\n\t\theight,\n\t\t...chartProps\n\t}: Omit< T, 'width' | 'height' | 'size' > & DimensionProps & ResponsiveConfig ) {\n\t\tconst {\n\t\t\tparentRef,\n\t\t\twidth: measuredWidth,\n\t\t\theight: measuredHeight,\n\t\t\thasAspectRatio,\n\t\t} = useResponsiveDimensions( {\n\t\t\tresizeDebounceTime,\n\t\t\tmaxWidth,\n\t\t\taspectRatio,\n\t\t} );\n\n\t\t// Use measured dimensions, but fall back to explicit props if measurement returns 0\n\t\t// (e.g., during initial render or in test environments without DOM measurement)\n\t\tconst effectiveWidth = measuredWidth || size || width || 0;\n\t\tconst effectiveHeight = measuredHeight || size || height || 0;\n\n\t\tconst defaultHeight = hasAspectRatio ? 'auto' : '100%';\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ parentRef }\n\t\t\t\tdata-testid=\"responsive-wrapper\"\n\t\t\t\tclassName={ styles.container }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: size ?? width ?? '100%',\n\t\t\t\t\theight: size ?? height ?? defaultHeight,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<WrappedComponent\n\t\t\t\t\twidth={ effectiveWidth }\n\t\t\t\t\theight={ effectiveHeight }\n\t\t\t\t\tsize={ effectiveWidth }\n\t\t\t\t\t{ ...( chartProps as T ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t};\n}\n","import 'css-chunk:src/charts/private/with-responsive/with-responsive.module.scss';export default {\n \"container\": \"a8ccharts-GSKfBD\"\n};"],"mappings":";AAAA,SAAS,qBAAqB;;;ACAoD,IAAO,iCAAQ;AAAA,EAC/F,aAAa;AACf;;;ADuGI;AA7EJ,IAAM,0BAA0B,CAAE;AAAA,EACjC,qBAAqB;AAAA,EACrB,WAAW;AAAA,EACX;AACD,MAAyB;AACxB,QAAM;AAAA,IACL;AAAA,IACA,OAAO;AAAA,IACP,QAAQ;AAAA,EACT,IAAI,cAAe;AAAA,IAClB,cAAc;AAAA,IACd,2BAA2B;AAAA,EAC5B,CAAE;AAEF,QAAM,iBAAiB,cAAc,IAAI,KAAK,IAAK,aAAa,QAAS,IAAI;AAC7E,QAAM,kBAAkB,gBAAgB,SAAY,iBAAiB,cAAc;AAEnF,SAAO;AAAA,IACN;AAAA,IACA,OAAO;AAAA,IACP,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMR,gBAAgB,gBAAgB;AAAA,EACjC;AACD;AASO,SAAS,eACf,kBACC;AACD,SAAO,SAAS,gBAAiB;AAAA,IAChC,qBAAqB;AAAA,IACrB,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACJ,GAAgF;AAC/E,UAAM;AAAA,MACL;AAAA,MACA,OAAO;AAAA,MACP,QAAQ;AAAA,MACR;AAAA,IACD,IAAI,wBAAyB;AAAA,MAC5B;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAE;AAIF,UAAM,iBAAiB,iBAAiB,QAAQ,SAAS;AACzD,UAAM,kBAAkB,kBAAkB,QAAQ,UAAU;AAE5D,UAAM,gBAAgB,iBAAiB,SAAS;AAEhD,WACC;AAAA,MAAC;AAAA;AAAA,QACA,KAAM;AAAA,QACN,eAAY;AAAA,QACZ,WAAY,+BAAO;AAAA,QACnB,OAAQ;AAAA,UACP,OAAO,QAAQ,SAAS;AAAA,UACxB,QAAQ,QAAQ,UAAU;AAAA,QAC3B;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ;AAAA,YACR,QAAS;AAAA,YACT,MAAO;AAAA,YACL,GAAK;AAAA;AAAA,QACR;AAAA;AAAA,IACD;AAAA,EAEF;AACD;","names":[]}
@@ -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 type { FC, PropsWithChildren } from 'react';\n\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: FC< PropsWithChildren > = ( { children } ) => {\n\t// This component doesn't render directly - its children are extracted by the parent chart\n\t// We just return the children as-is\n\treturn <>{ children }</>;\n};\n\n// Set displayName for better debugging and type checking\nChartSVG.displayName = 'Chart.SVG';\n","import type { FC, PropsWithChildren } from 'react';\n\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: FC< PropsWithChildren > = ( { children } ) => {\n\t// This component doesn't render directly - its children are extracted by the parent chart\n\t// We just return the children as-is\n\treturn <>{ children }</>;\n};\n\n// Set displayName for better debugging and type checking\nChartHTML.displayName = 'Chart.HTML';\n","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":";AAcQ;AAHD,IAAM,WAAoC,CAAE,EAAE,SAAS,MAAO;AAGpE,SAAO,gCAAI,UAAU;AACtB;AAGA,SAAS,cAAc;;;ACJf,qBAAAA,WAAA,OAAAC,YAAA;AAHD,IAAM,YAAqC,CAAE,EAAE,SAAS,MAAO;AAGrE,SAAO,gBAAAA,KAAAD,WAAA,EAAI,UAAU;AACtB;AAGA,UAAU,cAAc;;;AClBxB,SAAS,aAAa;AACtB,SAAS,SAAS,UAAU,sBAAsB;AAkB3C,SAAS,iBAAkB,UAAqB,WAAmC;AACzF,SAAO,QAAS,MAAM;AACrB,UAAM,MAAmB,CAAC;AAC1B,UAAM,OAAoB,CAAC;AAC3B,UAAM,QAAqB,CAAC;AAE5B,aAAS,QAAS,UAAU,WAAS;AACpC,UAAK,eAAgB,KAAM,GAAI;AAE9B,cAAM,YAAY,MAAM;AACxB,cAAM,cAAc,WAAW;AAG/B,YAAK,gBAAgB,GAAI,SAAU,UAAU,gBAAgB,aAAc;AAE1E,cAAK,MAAM,OAAO,UAAW;AAC5B,qBAAS,QAAS,MAAM,MAAM,UAAU,cAAY;AACnD,kBAAI,KAAM,QAAS;AAAA,YACpB,CAAE;AAAA,UACH;AAAA,QACD,WAAY,gBAAgB,GAAI,SAAU,WAAW,gBAAgB,cAAe;AAEnF,cAAK,MAAM,OAAO,UAAW;AAC5B,qBAAS,QAAS,MAAM,MAAM,UAAU,eAAa;AACpD,mBAAK,KAAM,SAAU;AAAA,YACtB,CAAE;AAAA,UACH;AAAA,QACD,WAAY,MAAM,SAAS,OAAQ;AAElC,cAAI,KAAM,KAAM;AAAA,QACjB,OAAO;AACN,gBAAM,KAAM,KAAM;AAAA,QACnB;AAAA,MACD;AAAA,IACD,CAAE;AAEF,WAAO,EAAE,aAAa,KAAK,cAAc,MAAM,eAAe,MAAM;AAAA,EACrE,GAAG,CAAE,UAAU,SAAU,CAAE;AAC5B;","names":["Fragment","jsx"]}
@@ -1,167 +0,0 @@
1
- import {
2
- LineChart
3
- } from "./chunk-ZDNCF642.js";
4
- import {
5
- withResponsive
6
- } from "./chunk-C33AQZEC.js";
7
- import {
8
- useGlobalChartsTheme
9
- } from "./chunk-H34CJSR6.js";
10
-
11
- // src/charts/sparkline/sparkline.tsx
12
- import clsx from "clsx";
13
- import { useMemo, forwardRef } from "react";
14
-
15
- // src/charts/sparkline/sparkline.module.scss
16
- var sparkline_module_default = {
17
- "sparkline": "a8ccharts-o-3Z8B",
18
- "sparkline--empty": "a8ccharts-CbLbcd"
19
- };
20
-
21
- // src/charts/sparkline/sparkline.tsx
22
- import { jsx } from "react/jsx-runtime";
23
- var DEFAULT_WIDTH = 100;
24
- var DEFAULT_HEIGHT = 40;
25
- var transformToSeriesData = (data, color, strokeWidth) => {
26
- const baseDate = new Date(2e3, 0, 1);
27
- return [
28
- {
29
- label: "sparkline",
30
- data: data.map((value, index) => ({
31
- date: new Date(baseDate.getTime() + index * 864e5),
32
- // Add days
33
- value
34
- })),
35
- options: {
36
- stroke: color,
37
- seriesLineStyle: strokeWidth ? { strokeWidth } : void 0
38
- }
39
- }
40
- ];
41
- };
42
- var SparklineComponent = forwardRef(
43
- ({
44
- data,
45
- width = DEFAULT_WIDTH,
46
- height = DEFAULT_HEIGHT,
47
- color,
48
- strokeWidth: strokeWidthProp,
49
- withGradientFill = true,
50
- gradient,
51
- className,
52
- chartId,
53
- margin: marginProp,
54
- animation
55
- }, ref) => {
56
- const theme = useGlobalChartsTheme();
57
- const themeStrokeWidth = theme.sparkline?.strokeWidth ?? 1.5;
58
- const strokeWidth = strokeWidthProp ?? themeStrokeWidth;
59
- const seriesData = useMemo(() => {
60
- if (!data || data.length === 0) {
61
- return [];
62
- }
63
- return transformToSeriesData(data, color, strokeWidth);
64
- }, [data, color, strokeWidth]);
65
- const finalMargin = useMemo(() => {
66
- const themeMargin = theme.sparkline?.margin ?? { top: 2, right: 2, bottom: 2, left: 2 };
67
- const margin = marginProp ?? themeMargin;
68
- return {
69
- ...themeMargin,
70
- ...margin
71
- };
72
- }, [marginProp, theme.sparkline?.margin]);
73
- const seriesWithGradient = useMemo(() => {
74
- if (!gradient || seriesData.length === 0) {
75
- return seriesData;
76
- }
77
- return seriesData.map((series) => ({
78
- ...series,
79
- options: {
80
- ...series.options,
81
- gradient: {
82
- from: gradient.from || color || "#000000",
83
- to: gradient.to || "#ffffff",
84
- fromOpacity: gradient.fromOpacity ?? 0.5,
85
- toOpacity: gradient.toOpacity ?? 0
86
- }
87
- }
88
- }));
89
- }, [seriesData, gradient, color]);
90
- if (!data || data.length === 0) {
91
- return /* @__PURE__ */ jsx(
92
- "div",
93
- {
94
- ref,
95
- className: clsx(
96
- "sparkline",
97
- sparkline_module_default.sparkline,
98
- sparkline_module_default["sparkline--empty"],
99
- className
100
- ),
101
- style: { width, height },
102
- "data-testid": "sparkline-empty"
103
- }
104
- );
105
- }
106
- if (data.length === 1) {
107
- const cx = width / 2;
108
- const cy = height / 2;
109
- const resolvedColor = color || "#000000";
110
- return /* @__PURE__ */ jsx(
111
- "div",
112
- {
113
- ref,
114
- className: clsx(
115
- "sparkline",
116
- sparkline_module_default.sparkline,
117
- sparkline_module_default["sparkline--single-point"],
118
- className
119
- ),
120
- style: { width, height },
121
- "data-testid": "sparkline-single-point",
122
- children: /* @__PURE__ */ jsx("svg", { width, height, "aria-hidden": "true", children: /* @__PURE__ */ jsx("circle", { cx, cy, r: strokeWidth * 1.5, fill: resolvedColor }) })
123
- }
124
- );
125
- }
126
- return /* @__PURE__ */ jsx(
127
- "div",
128
- {
129
- ref,
130
- className: clsx("sparkline", sparkline_module_default.sparkline, className),
131
- "data-testid": "sparkline",
132
- children: /* @__PURE__ */ jsx(
133
- LineChart,
134
- {
135
- data: seriesWithGradient,
136
- width,
137
- height,
138
- margin: finalMargin,
139
- chartId,
140
- withGradientFill,
141
- withTooltips: false,
142
- showLegend: false,
143
- gridVisibility: "none",
144
- options: {
145
- axis: {
146
- x: { display: false },
147
- y: { display: false }
148
- }
149
- },
150
- curveType: "monotone",
151
- animation
152
- }
153
- )
154
- }
155
- );
156
- }
157
- );
158
- SparklineComponent.displayName = "SparklineComponent";
159
- var SparklineUnresponsive = SparklineComponent;
160
- SparklineUnresponsive.displayName = "SparklineUnresponsive";
161
- var Sparkline = withResponsive(SparklineUnresponsive);
162
-
163
- export {
164
- SparklineUnresponsive,
165
- Sparkline
166
- };
167
- //# sourceMappingURL=chunk-COOC2TVQ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/charts/sparkline/sparkline.tsx","../src/charts/sparkline/sparkline.module.scss"],"sourcesContent":["import clsx from 'clsx';\nimport { useMemo, forwardRef } from 'react';\nimport { useGlobalChartsTheme } from '../../providers';\nimport { LineChartUnresponsive } from '../line-chart';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './sparkline.module.scss';\nimport type { SparklineProps } from './types';\nimport type { SeriesData } from '../../types';\n\nconst DEFAULT_WIDTH = 100;\nconst DEFAULT_HEIGHT = 40;\n\n/**\n * Transforms a simple number array into SeriesData format for LineChart.\n * Uses index-based dates to create a linear x-axis.\n *\n * @param data - Array of numeric values to plot\n * @param color - Optional color for the line stroke\n * @param strokeWidth - Optional stroke width for the line\n * @return SeriesData array suitable for LineChart\n */\nconst transformToSeriesData = (\n\tdata: number[],\n\tcolor?: string,\n\tstrokeWidth?: number\n): SeriesData[] => {\n\t// Use a fixed base date and increment by index to create linear spacing\n\tconst baseDate = new Date( 2000, 0, 1 );\n\n\treturn [\n\t\t{\n\t\t\tlabel: 'sparkline',\n\t\t\tdata: data.map( ( value, index ) => ( {\n\t\t\t\tdate: new Date( baseDate.getTime() + index * 86400000 ), // Add days\n\t\t\t\tvalue,\n\t\t\t} ) ),\n\t\t\toptions: {\n\t\t\t\tstroke: color,\n\t\t\t\tseriesLineStyle: strokeWidth ? { strokeWidth } : undefined,\n\t\t\t},\n\t\t},\n\t];\n};\n\nconst SparklineComponent = forwardRef< HTMLDivElement, SparklineProps >(\n\t(\n\t\t{\n\t\t\tdata,\n\t\t\twidth = DEFAULT_WIDTH,\n\t\t\theight = DEFAULT_HEIGHT,\n\t\t\tcolor,\n\t\t\tstrokeWidth: strokeWidthProp,\n\t\t\twithGradientFill = true,\n\t\t\tgradient,\n\t\t\tclassName,\n\t\t\tchartId,\n\t\t\tmargin: marginProp,\n\t\t\tanimation,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst theme = useGlobalChartsTheme();\n\n\t\t// Get theme defaults for sparkline\n\t\tconst themeStrokeWidth = theme.sparkline?.strokeWidth ?? 1.5;\n\n\t\t// Use prop values or fall back to theme defaults\n\t\tconst strokeWidth = strokeWidthProp ?? themeStrokeWidth;\n\n\t\t// Transform number[] to SeriesData[] for LineChart\n\t\tconst seriesData = useMemo( () => {\n\t\t\tif ( ! data || data.length === 0 ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\treturn transformToSeriesData( data, color, strokeWidth );\n\t\t}, [ data, color, strokeWidth ] );\n\n\t\t// Merge margins with theme defaults\n\t\tconst finalMargin = useMemo( () => {\n\t\t\tconst themeMargin = theme.sparkline?.margin ?? { top: 2, right: 2, bottom: 2, left: 2 };\n\t\t\tconst margin = marginProp ?? themeMargin;\n\t\t\treturn {\n\t\t\t\t...themeMargin,\n\t\t\t\t...margin,\n\t\t\t};\n\t\t}, [ marginProp, theme.sparkline?.margin ] );\n\n\t\t// Build gradient options for the series if custom gradient is provided\n\t\t// Note: This must be called before any early returns to follow React hooks rules\n\t\tconst seriesWithGradient = useMemo( () => {\n\t\t\tif ( ! gradient || seriesData.length === 0 ) {\n\t\t\t\treturn seriesData;\n\t\t\t}\n\n\t\t\treturn seriesData.map( series => ( {\n\t\t\t\t...series,\n\t\t\t\toptions: {\n\t\t\t\t\t...series.options,\n\t\t\t\t\tgradient: {\n\t\t\t\t\t\tfrom: gradient.from || color || '#000000',\n\t\t\t\t\t\tto: gradient.to || '#ffffff',\n\t\t\t\t\t\tfromOpacity: gradient.fromOpacity ?? 0.5,\n\t\t\t\t\t\ttoOpacity: gradient.toOpacity ?? 0.0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} ) );\n\t\t}, [ seriesData, gradient, color ] );\n\n\t\t// Handle empty data\n\t\tif ( ! data || data.length === 0 ) {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'sparkline',\n\t\t\t\t\t\tstyles.sparkline,\n\t\t\t\t\t\tstyles[ 'sparkline--empty' ],\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"sparkline-empty\"\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Handle single data point - render a simple dot\n\t\tif ( data.length === 1 ) {\n\t\t\tconst cx = width / 2;\n\t\t\tconst cy = height / 2;\n\t\t\tconst resolvedColor = color || '#000000';\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'sparkline',\n\t\t\t\t\t\tstyles.sparkline,\n\t\t\t\t\t\tstyles[ 'sparkline--single-point' ],\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"sparkline-single-point\"\n\t\t\t\t>\n\t\t\t\t\t<svg width={ width } height={ height } aria-hidden=\"true\">\n\t\t\t\t\t\t<circle cx={ cx } cy={ cy } r={ strokeWidth * 1.5 } fill={ resolvedColor } />\n\t\t\t\t\t</svg>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ ref }\n\t\t\t\tclassName={ clsx( 'sparkline', styles.sparkline, className ) }\n\t\t\t\tdata-testid=\"sparkline\"\n\t\t\t>\n\t\t\t\t<LineChartUnresponsive\n\t\t\t\t\tdata={ seriesWithGradient }\n\t\t\t\t\twidth={ width }\n\t\t\t\t\theight={ height }\n\t\t\t\t\tmargin={ finalMargin }\n\t\t\t\t\tchartId={ chartId }\n\t\t\t\t\twithGradientFill={ withGradientFill }\n\t\t\t\t\twithTooltips={ false }\n\t\t\t\t\tshowLegend={ false }\n\t\t\t\t\tgridVisibility=\"none\"\n\t\t\t\t\toptions={ {\n\t\t\t\t\t\taxis: {\n\t\t\t\t\t\t\tx: { display: false },\n\t\t\t\t\t\t\ty: { display: false },\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t\tcurveType=\"monotone\"\n\t\t\t\t\tanimation={ animation }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nSparklineComponent.displayName = 'SparklineComponent';\n\n/**\n * Sparkline - A minimal line chart for inline data visualization.\n *\n * Sparklines are compact charts designed to be embedded inline with text or\n * displayed in small spaces like table cells or dashboards. They show trends\n * without axes, labels, or other chart chrome.\n *\n * This component is built on top of LineChart with preconfigured settings\n * for minimal display (no axes, grid, tooltips, or legend).\n */\nconst SparklineUnresponsive = SparklineComponent;\n\nSparklineUnresponsive.displayName = 'SparklineUnresponsive';\n\n/**\n * Responsive Sparkline chart component\n */\nconst Sparkline = withResponsive< SparklineProps >( SparklineUnresponsive );\n\nexport { Sparkline as default, SparklineUnresponsive };\n","import 'css-chunk:src/charts/sparkline/sparkline.module.scss';export default {\n \"sparkline\": \"a8ccharts-o-3Z8B\",\n \"sparkline--empty\": \"a8ccharts-CbLbcd\"\n};"],"mappings":";;;;;;;;;;;AAAA,OAAO,UAAU;AACjB,SAAS,SAAS,kBAAkB;;;ACD0B,IAAO,2BAAQ;AAAA,EAC3E,aAAa;AAAA,EACb,oBAAoB;AACtB;;;AD4GI;AAtGJ,IAAM,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