@octanejs/recharts 0.1.41 → 0.1.42

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 (375) hide show
  1. package/{LICENSE → LICENSE.recharts} +3 -2
  2. package/README.md +12 -0
  3. package/package.json +10 -9
  4. package/src/animation/AnimatedItems.tsrx +36 -3
  5. package/src/animation/AnimationController.ts +17 -65
  6. package/src/animation/{AnimationControllerImpl.js → AnimationControllerImpl.ts} +19 -12
  7. package/src/animation/{AnimationHandle.js → AnimationHandle.ts} +82 -65
  8. package/src/animation/CSSTransitionAnimate.tsrx +3 -2
  9. package/src/animation/JavascriptAnimate.tsrx +18 -2
  10. package/src/animation/easing.ts +235 -0
  11. package/src/animation/{matchBy.js → matchBy.ts} +76 -120
  12. package/src/animation/timeoutController.ts +71 -0
  13. package/src/animation/useAnimationController.ts +4 -1
  14. package/src/animation/useAnimationStartSnapshot.ts +3 -3
  15. package/src/animation/util.ts +12 -0
  16. package/src/cartesian/Area.tsrx +33 -31
  17. package/src/cartesian/AreaRevealShape.tsrx +4 -3
  18. package/src/cartesian/Bar.ts +1 -0
  19. package/src/cartesian/Bar.tsrx +293 -39
  20. package/src/cartesian/BarStack.tsrx +31 -9
  21. package/src/cartesian/CartesianAxis.tsrx +154 -22
  22. package/src/cartesian/CartesianGrid.tsrx +5 -6
  23. package/src/cartesian/ErrorBar.tsrx +9 -8
  24. package/src/cartesian/Funnel.tsrx +40 -37
  25. package/src/cartesian/GraphicalItemClipPath.tsrx +11 -4
  26. package/src/cartesian/Line.ts +1 -0
  27. package/src/cartesian/Line.tsrx +206 -28
  28. package/src/cartesian/LineDrawShape.tsrx +23 -10
  29. package/src/cartesian/ReferenceLine.tsrx +8 -8
  30. package/src/cartesian/Scatter.tsrx +61 -66
  31. package/src/cartesian/XAxis.tsrx +78 -9
  32. package/src/cartesian/YAxis.tsrx +85 -12
  33. package/src/cartesian/getCartesianPosition.ts +265 -0
  34. package/src/cartesian/getEquidistantTicks.ts +144 -0
  35. package/src/cartesian/getTicks.ts +221 -0
  36. package/src/chart/AreaChart.tsrx +5 -1
  37. package/src/chart/BarChart.tsrx +8 -2
  38. package/src/chart/CartesianChart.tsrx +17 -4
  39. package/src/chart/CategoricalChart.tsrx +4 -1
  40. package/src/chart/ComposedChart.tsrx +5 -1
  41. package/src/chart/FunnelChart.tsrx +5 -1
  42. package/src/chart/LineChart.tsrx +8 -2
  43. package/src/chart/PieChart.tsrx +6 -2
  44. package/src/chart/PolarChart.tsrx +5 -4
  45. package/src/chart/RadarChart.tsrx +6 -2
  46. package/src/chart/RadialBarChart.tsrx +6 -2
  47. package/src/chart/RechartsWrapper.tsrx +57 -21
  48. package/src/chart/Sankey.tsrx +89 -91
  49. package/src/chart/ScatterChart.tsrx +5 -1
  50. package/src/chart/SunburstChart.tsrx +21 -14
  51. package/src/chart/types.ts +0 -1
  52. package/src/component/ActivePoints.tsrx +30 -5
  53. package/src/component/Cell.ts +19 -1
  54. package/src/component/Cursor.tsrx +11 -10
  55. package/src/component/DefaultLegendContent.tsrx +15 -10
  56. package/src/component/DefaultTooltipContent.tsrx +11 -9
  57. package/src/component/Dots.tsrx +37 -6
  58. package/src/component/Label.tsrx +99 -19
  59. package/src/component/LabelList.tsrx +54 -5
  60. package/src/component/Legend.tsrx +9 -5
  61. package/src/component/ResponsiveContainer.tsrx +13 -10
  62. package/src/component/Text.tsrx +95 -32
  63. package/src/component/Tooltip.tsrx +11 -10
  64. package/src/component/TooltipBoundingBox.tsrx +4 -5
  65. package/src/component/{responsiveContainerUtils.js → responsiveContainerUtils.ts} +59 -36
  66. package/src/container/ClipPathProvider.tsrx +6 -2
  67. package/src/container/Layer.tsrx +8 -1
  68. package/src/container/RootSurface.tsrx +15 -4
  69. package/src/container/Surface.tsrx +15 -1
  70. package/src/context/CellsContext.ts +6 -5
  71. package/src/context/ErrorBarContext.tsrx +23 -4
  72. package/src/context/RegisterGraphicalItemId.tsrx +10 -2
  73. package/src/context/accessibilityContext.ts +5 -0
  74. package/src/context/brushUpdateContext.ts +11 -0
  75. package/src/context/chartDataContext.ts +5 -4
  76. package/src/context/chartLayoutContext.ts +22 -8
  77. package/src/context/legendPayloadContext.tsrx +1 -1
  78. package/src/context/tooltipContext.ts +83 -0
  79. package/src/{hooks.js → hooks.ts} +88 -66
  80. package/src/index.ts +37 -37
  81. package/src/legacy-props.ts +129 -0
  82. package/src/polar/Pie.tsrx +91 -69
  83. package/src/polar/PolarAngleAxis.tsrx +47 -47
  84. package/src/polar/PolarGrid.tsrx +7 -6
  85. package/src/polar/PolarRadiusAxis.tsrx +29 -21
  86. package/src/polar/Radar.tsrx +26 -19
  87. package/src/polar/RadialBar.tsrx +59 -42
  88. package/src/polar/{defaultPolarAngleAxisProps.js → defaultPolarAngleAxisProps.ts} +6 -6
  89. package/src/polar/{defaultPolarRadiusAxisProps.js → defaultPolarRadiusAxisProps.ts} +5 -4
  90. package/src/shape/Cross.tsrx +14 -2
  91. package/src/shape/Curve.tsrx +111 -23
  92. package/src/shape/Dot.tsrx +12 -1
  93. package/src/shape/Polygon.tsrx +28 -6
  94. package/src/shape/Rectangle.tsrx +30 -3
  95. package/src/shape/Sector.tsrx +48 -6
  96. package/src/shape/Symbols.tsrx +24 -6
  97. package/src/shape/Trapezoid.tsrx +33 -3
  98. package/src/state/RechartsStoreProvider.tsrx +11 -2
  99. package/src/state/ReportChartProps.ts +2 -2
  100. package/src/state/ReportMainChartProps.ts +2 -1
  101. package/src/state/SetGraphicalItem.ts +6 -4
  102. package/src/state/SetLegendPayload.ts +7 -4
  103. package/src/state/SetTooltipEntrySettings.ts +5 -2
  104. package/src/state/brushSlice.ts +40 -0
  105. package/src/state/cartesianAxisSlice.ts +291 -0
  106. package/src/state/chartDataSlice.ts +87 -0
  107. package/src/state/errorBarSlice.ts +78 -0
  108. package/src/state/eventSettingsSlice.ts +30 -0
  109. package/src/state/{externalEventsMiddleware.js → externalEventsMiddleware.ts} +55 -34
  110. package/src/state/graphicalItemsSlice.ts +180 -0
  111. package/src/state/{keyboardEventsMiddleware.js → keyboardEventsMiddleware.ts} +72 -57
  112. package/src/state/layoutSlice.ts +50 -0
  113. package/src/state/legendSlice.ts +109 -0
  114. package/src/state/{mouseEventsMiddleware.js → mouseEventsMiddleware.ts} +45 -35
  115. package/src/state/optionsSlice.ts +65 -0
  116. package/src/state/polarAxisSlice.ts +42 -0
  117. package/src/state/polarOptionsSlice.ts +43 -0
  118. package/src/state/reduxDevtoolsJsonStringifyReplacer.ts +13 -0
  119. package/src/state/referenceElementsSlice.ts +100 -0
  120. package/src/state/renderedTicksSlice.ts +60 -0
  121. package/src/state/rootPropsSlice.ts +72 -0
  122. package/src/state/selectors/areaSelectors.ts +1 -2
  123. package/src/state/selectors/{arrayEqualityCheck.js → arrayEqualityCheck.ts} +4 -5
  124. package/src/state/selectors/axisSelectors.ts +2502 -0
  125. package/src/state/selectors/barSelectors.ts +373 -0
  126. package/src/state/selectors/barStackSelectors.ts +99 -0
  127. package/src/state/selectors/brushSelectors.ts +28 -0
  128. package/src/state/selectors/combiners/combineActiveLabel.ts +16 -0
  129. package/src/state/selectors/combiners/{combineActiveTooltipIndex.js → combineActiveTooltipIndex.ts} +45 -23
  130. package/src/state/selectors/combiners/combineAllBarPositions.ts +130 -0
  131. package/src/state/selectors/combiners/combineAxisRangeWithReverse.ts +16 -0
  132. package/src/state/selectors/combiners/combineBarPosition.ts +23 -0
  133. package/src/state/selectors/combiners/combineBarSizeList.ts +79 -0
  134. package/src/state/selectors/combiners/{combineCheckedDomain.js → combineCheckedDomain.ts} +9 -6
  135. package/src/state/selectors/combiners/combineConfiguredScale.ts +100 -0
  136. package/src/state/selectors/combiners/combineCoordinateForDefaultIndex.ts +46 -0
  137. package/src/state/selectors/combiners/{combineDisplayedStackedData.js → combineDisplayedStackedData.ts} +23 -19
  138. package/src/state/selectors/combiners/combineInverseScaleFunction.ts +16 -0
  139. package/src/state/selectors/combiners/{combineRealScaleType.js → combineRealScaleType.ts} +16 -8
  140. package/src/state/selectors/combiners/combineStackedData.ts +27 -0
  141. package/src/state/selectors/combiners/combineTooltipInteractionState.ts +86 -0
  142. package/src/state/selectors/combiners/combineTooltipPayload.ts +201 -0
  143. package/src/state/selectors/combiners/{combineTooltipPayloadConfigurations.js → combineTooltipPayloadConfigurations.ts} +17 -18
  144. package/src/state/selectors/containerSelectors.ts +12 -0
  145. package/src/state/selectors/{dataSelectors.js → dataSelectors.ts} +43 -41
  146. package/src/state/selectors/funnelSelectors.ts +5 -5
  147. package/src/state/selectors/graphicalItemSelectors.ts +22 -0
  148. package/src/state/selectors/legendSelectors.ts +25 -0
  149. package/src/state/selectors/lineSelectors.ts +159 -0
  150. package/src/state/selectors/numberDomainEqualityCheck.ts +15 -0
  151. package/src/state/selectors/pickAxisId.ts +6 -0
  152. package/src/state/selectors/pickAxisType.ts +4 -0
  153. package/src/state/selectors/pieSelectors.ts +14 -13
  154. package/src/state/selectors/polarAxisSelectors.ts +223 -0
  155. package/src/state/selectors/polarSelectors.ts +1 -1
  156. package/src/state/selectors/radarSelectors.ts +1 -1
  157. package/src/state/selectors/radialBarSelectors.ts +17 -16
  158. package/src/state/selectors/rootPropsSelectors.ts +26 -0
  159. package/src/state/selectors/scatterSelectors.ts +11 -10
  160. package/src/state/selectors/{selectActivePropsFromChartPointer.js → selectActivePropsFromChartPointer.ts} +11 -4
  161. package/src/state/selectors/selectAllAxes.ts +20 -0
  162. package/src/state/selectors/selectChartOffset.ts +17 -0
  163. package/src/state/selectors/selectChartOffsetInternal.ts +147 -0
  164. package/src/state/selectors/{selectPlotArea.js → selectPlotArea.ts} +4 -3
  165. package/src/state/selectors/selectTooltipAxisId.ts +6 -0
  166. package/src/state/selectors/{selectTooltipAxisType.js → selectTooltipAxisType.ts} +10 -4
  167. package/src/state/selectors/selectTooltipEventType.ts +39 -0
  168. package/src/state/selectors/selectTooltipPayloadSearcher.ts +6 -0
  169. package/src/state/selectors/selectTooltipSettings.ts +6 -0
  170. package/src/state/selectors/selectTooltipState.ts +5 -0
  171. package/src/state/selectors/selectors.ts +315 -0
  172. package/src/state/selectors/tooltipSelectors.ts +611 -0
  173. package/src/state/selectors/touchSelectors.ts +52 -0
  174. package/src/state/{store.js → store.ts} +46 -36
  175. package/src/state/tooltipSlice.ts +507 -0
  176. package/src/state/{touchEventsMiddleware.js → touchEventsMiddleware.ts} +54 -42
  177. package/src/state/types/AreaSettings.ts +15 -0
  178. package/src/state/types/BarSettings.ts +15 -0
  179. package/src/state/types/LineSettings.ts +10 -0
  180. package/src/state/types/PieSettings.ts +32 -0
  181. package/src/state/types/RadarSettings.ts +6 -0
  182. package/src/state/types/RadialBarSettings.ts +10 -0
  183. package/src/state/types/ScatterSettings.ts +13 -0
  184. package/src/state/types/StackedGraphicalItem.ts +34 -0
  185. package/src/state/zIndexSlice.ts +137 -0
  186. package/src/synchronisation/syncSelectors.ts +7 -0
  187. package/src/synchronisation/types.ts +42 -0
  188. package/src/synchronisation/useChartSynchronisation.tsrx +26 -11
  189. package/src/types.ts +55 -0
  190. package/src/util/ActiveShapeUtils.tsrx +34 -10
  191. package/src/util/BarUtils.tsrx +43 -3
  192. package/src/util/{CartesianUtils.js → CartesianUtils.ts} +22 -39
  193. package/src/util/ChartUtils.ts +759 -0
  194. package/src/util/{Constants.js → Constants.ts} +6 -6
  195. package/src/util/DOMUtils.ts +135 -0
  196. package/src/util/{DataUtils.js → DataUtils.ts} +120 -47
  197. package/src/util/Events.ts +22 -0
  198. package/src/util/FunnelUtils.tsrx +3 -3
  199. package/src/util/Global.ts +13 -0
  200. package/src/util/IfOverflow.ts +16 -0
  201. package/src/util/LRUCache.ts +42 -0
  202. package/src/util/{LogUtils.js → LogUtils.ts} +7 -12
  203. package/src/util/OctaneTypes.ts +51 -0
  204. package/src/util/PolarUtils.ts +132 -0
  205. package/src/util/RadialBarUtils.tsrx +3 -3
  206. package/src/util/ReduceCSSCalc.ts +186 -0
  207. package/src/util/ScatterUtils.tsrx +9 -7
  208. package/src/util/{TickUtils.js → TickUtils.ts} +30 -13
  209. package/src/util/{YAxisUtils.js → YAxisUtils.ts} +27 -17
  210. package/src/util/axisPropsAreEqual.ts +49 -0
  211. package/src/util/createEventProxy.ts +20 -0
  212. package/src/util/{excludeEventProps.js → excludeEventProps.ts} +8 -6
  213. package/src/util/getActiveCoordinate.ts +210 -0
  214. package/src/util/{getAxisTypeBasedOnLayout.js → getAxisTypeBasedOnLayout.ts} +7 -3
  215. package/src/util/getClassNameFromUnknown.ts +7 -0
  216. package/src/util/{getEveryNth.js → getEveryNth.ts} +5 -6
  217. package/src/util/getRadiusAndStrokeWidthFromDot.ts +31 -0
  218. package/src/util/{getRelativeCoordinate.js → getRelativeCoordinate.ts} +26 -9
  219. package/src/util/getSliced.ts +14 -0
  220. package/src/util/{isDomainSpecifiedByUser.js → isDomainSpecifiedByUser.ts} +46 -100
  221. package/src/util/isWellBehavedNumber.ts +8 -0
  222. package/src/util/payload/getUniqPayload.ts +1 -1
  223. package/src/util/{propsAreEqual.js → propsAreEqual.ts} +10 -8
  224. package/src/util/{resolveDefaultProps.js → resolveDefaultProps.ts} +35 -57
  225. package/src/util/round.ts +33 -0
  226. package/src/util/scale/CustomScaleDefinition.ts +82 -0
  227. package/src/util/scale/RechartsScale.ts +131 -0
  228. package/src/util/scale/{createCategoricalInverse.js → createCategoricalInverse.ts} +24 -29
  229. package/src/util/scale/{getNiceTickValues.js → getNiceTickValues.ts} +125 -146
  230. package/src/util/scale/index.ts +2 -0
  231. package/src/util/scale/util/{arithmetic.js → arithmetic.ts} +12 -8
  232. package/src/util/stacks/getStackSeriesIdentifier.ts +21 -0
  233. package/src/util/stacks/stackTypes.ts +58 -0
  234. package/src/util/{svgPropertiesNoEvents.js → svgPropertiesNoEvents.ts} +52 -27
  235. package/src/util/tooltip/translate.ts +2 -1
  236. package/src/util/typedDataKey.ts +49 -0
  237. package/src/util/types.ts +1265 -7
  238. package/src/util/{useUniqueId.js → useUniqueId.ts} +9 -5
  239. package/src/zIndex/{DefaultZIndexes.js → DefaultZIndexes.ts} +13 -4
  240. package/src/zIndex/ZIndexLayer.tsrx +13 -4
  241. package/src/zIndex/ZIndexPortal.tsrx +14 -4
  242. package/src/zIndex/{getZIndexFromUnknown.js → getZIndexFromUnknown.ts} +3 -3
  243. package/src/zIndex/{zIndexSelectors.js → zIndexSelectors.ts} +17 -11
  244. package/src/animation/easing.js +0 -193
  245. package/src/animation/timeoutController.js +0 -49
  246. package/src/animation/util.js +0 -11
  247. package/src/cartesian/Area.tsrx.d.ts +0 -340
  248. package/src/cartesian/Bar.tsrx.d.ts +0 -4
  249. package/src/cartesian/BarStack.tsrx.d.ts +0 -6
  250. package/src/cartesian/CartesianAxis.tsrx.d.ts +0 -3
  251. package/src/cartesian/CartesianGrid.tsrx.d.ts +0 -219
  252. package/src/cartesian/ErrorBar.tsrx.d.ts +0 -131
  253. package/src/cartesian/Funnel.tsrx.d.ts +0 -274
  254. package/src/cartesian/Line.tsrx.d.ts +0 -4
  255. package/src/cartesian/LineDrawShape.tsrx.d.ts +0 -2
  256. package/src/cartesian/ReferenceLine.tsrx.d.ts +0 -178
  257. package/src/cartesian/Scatter.tsrx.d.ts +0 -351
  258. package/src/cartesian/XAxis.tsrx.d.ts +0 -3
  259. package/src/cartesian/YAxis.tsrx.d.ts +0 -3
  260. package/src/cartesian/ZAxis.tsrx.d.ts +0 -102
  261. package/src/cartesian/getCartesianPosition.js +0 -277
  262. package/src/cartesian/getEquidistantTicks.js +0 -133
  263. package/src/cartesian/getTicks.js +0 -280
  264. package/src/chart/AreaChart.tsrx.d.ts +0 -12
  265. package/src/chart/BarChart.tsrx.d.ts +0 -2
  266. package/src/chart/CartesianChart.tsrx.d.ts +0 -10
  267. package/src/chart/ComposedChart.tsrx.d.ts +0 -12
  268. package/src/chart/FunnelChart.tsrx.d.ts +0 -12
  269. package/src/chart/LineChart.tsrx.d.ts +0 -2
  270. package/src/chart/PieChart.tsrx.d.ts +0 -31
  271. package/src/chart/RadarChart.tsrx.d.ts +0 -31
  272. package/src/chart/RadialBarChart.tsrx.d.ts +0 -31
  273. package/src/chart/Sankey.tsrx.d.ts +0 -253
  274. package/src/chart/ScatterChart.tsrx.d.ts +0 -12
  275. package/src/chart/SunburstChart.tsrx.d.ts +0 -146
  276. package/src/component/DefaultLegendContent.tsrx.d.ts +0 -125
  277. package/src/component/DefaultTooltipContent.tsrx.d.ts +0 -87
  278. package/src/component/Label.tsrx.d.ts +0 -12
  279. package/src/component/LabelList.tsrx.d.ts +0 -8
  280. package/src/component/Legend.tsrx.d.ts +0 -88
  281. package/src/component/ResponsiveContainer.tsrx.d.ts +0 -81
  282. package/src/component/Text.tsrx.d.ts +0 -9
  283. package/src/component/Tooltip.tsrx.d.ts +0 -246
  284. package/src/container/Layer.tsrx.d.ts +0 -6
  285. package/src/container/Surface.tsrx.d.ts +0 -12
  286. package/src/context/accessibilityContext.js +0 -10
  287. package/src/context/tooltipContext.js +0 -55
  288. package/src/index.d.ts +0 -281
  289. package/src/polar/Pie.tsrx.d.ts +0 -436
  290. package/src/polar/PolarAngleAxis.tsrx.d.ts +0 -215
  291. package/src/polar/PolarGrid.tsrx.d.ts +0 -117
  292. package/src/polar/PolarRadiusAxis.tsrx.d.ts +0 -209
  293. package/src/polar/Radar.tsrx.d.ts +0 -215
  294. package/src/polar/RadialBar.tsrx.d.ts +0 -340
  295. package/src/shape/Cross.tsrx.d.ts +0 -12
  296. package/src/shape/Curve.tsrx.d.ts +0 -42
  297. package/src/shape/Dot.tsrx.d.ts +0 -9
  298. package/src/shape/Polygon.tsrx.d.ts +0 -13
  299. package/src/shape/Rectangle.tsrx.d.ts +0 -31
  300. package/src/shape/Sector.tsrx.d.ts +0 -29
  301. package/src/shape/Symbols.tsrx.d.ts +0 -15
  302. package/src/shape/Trapezoid.tsrx.d.ts +0 -29
  303. package/src/state/brushSlice.js +0 -36
  304. package/src/state/cartesianAxisSlice.js +0 -256
  305. package/src/state/chartDataSlice.js +0 -67
  306. package/src/state/errorBarSlice.js +0 -53
  307. package/src/state/eventSettingsSlice.js +0 -25
  308. package/src/state/graphicalItemsSlice.js +0 -91
  309. package/src/state/layoutSlice.js +0 -57
  310. package/src/state/legendSlice.js +0 -83
  311. package/src/state/optionsSlice.js +0 -45
  312. package/src/state/polarAxisSlice.js +0 -33
  313. package/src/state/polarOptionsSlice.js +0 -26
  314. package/src/state/reduxDevtoolsJsonStringifyReplacer.js +0 -14
  315. package/src/state/referenceElementsSlice.js +0 -51
  316. package/src/state/renderedTicksSlice.js +0 -41
  317. package/src/state/rootPropsSlice.js +0 -48
  318. package/src/state/selectors/axisSelectors.js +0 -2113
  319. package/src/state/selectors/barSelectors.js +0 -263
  320. package/src/state/selectors/barStackSelectors.js +0 -65
  321. package/src/state/selectors/brushSelectors.js +0 -21
  322. package/src/state/selectors/combiners/combineActiveLabel.js +0 -18
  323. package/src/state/selectors/combiners/combineAllBarPositions.js +0 -169
  324. package/src/state/selectors/combiners/combineAxisRangeWithReverse.js +0 -11
  325. package/src/state/selectors/combiners/combineBarPosition.js +0 -17
  326. package/src/state/selectors/combiners/combineBarSizeList.js +0 -115
  327. package/src/state/selectors/combiners/combineConfiguredScale.js +0 -46
  328. package/src/state/selectors/combiners/combineCoordinateForDefaultIndex.js +0 -48
  329. package/src/state/selectors/combiners/combineInverseScaleFunction.js +0 -12
  330. package/src/state/selectors/combiners/combineStackedData.js +0 -22
  331. package/src/state/selectors/combiners/combineTooltipInteractionState.js +0 -121
  332. package/src/state/selectors/combiners/combineTooltipPayload.js +0 -248
  333. package/src/state/selectors/containerSelectors.js +0 -6
  334. package/src/state/selectors/graphicalItemSelectors.js +0 -25
  335. package/src/state/selectors/legendSelectors.js +0 -18
  336. package/src/state/selectors/lineSelectors.js +0 -106
  337. package/src/state/selectors/numberDomainEqualityCheck.js +0 -11
  338. package/src/state/selectors/pickAxisId.js +0 -3
  339. package/src/state/selectors/pickAxisType.js +0 -3
  340. package/src/state/selectors/polarAxisSelectors.js +0 -237
  341. package/src/state/selectors/rootPropsSelectors.js +0 -13
  342. package/src/state/selectors/selectAllAxes.js +0 -15
  343. package/src/state/selectors/selectChartOffset.js +0 -12
  344. package/src/state/selectors/selectChartOffsetInternal.js +0 -174
  345. package/src/state/selectors/selectTooltipAxisId.js +0 -3
  346. package/src/state/selectors/selectTooltipEventType.js +0 -27
  347. package/src/state/selectors/selectTooltipPayloadSearcher.js +0 -3
  348. package/src/state/selectors/selectTooltipSettings.js +0 -3
  349. package/src/state/selectors/selectTooltipState.js +0 -3
  350. package/src/state/selectors/selectors.js +0 -222
  351. package/src/state/selectors/tooltipSelectors.js +0 -471
  352. package/src/state/selectors/touchSelectors.js +0 -31
  353. package/src/state/tooltipSlice.js +0 -237
  354. package/src/state/types/StackedGraphicalItem.js +0 -18
  355. package/src/state/zIndexSlice.js +0 -167
  356. package/src/synchronisation/syncSelectors.js +0 -5
  357. package/src/util/ChartUtils.js +0 -630
  358. package/src/util/DOMUtils.js +0 -180
  359. package/src/util/Events.js +0 -7
  360. package/src/util/Global.js +0 -13
  361. package/src/util/LRUCache.js +0 -58
  362. package/src/util/PolarUtils.js +0 -190
  363. package/src/util/ReduceCSSCalc.js +0 -260
  364. package/src/util/axisPropsAreEqual.js +0 -63
  365. package/src/util/createEventProxy.js +0 -18
  366. package/src/util/getActiveCoordinate.js +0 -253
  367. package/src/util/getClassNameFromUnknown.js +0 -8
  368. package/src/util/getRadiusAndStrokeWidthFromDot.js +0 -28
  369. package/src/util/getSliced.js +0 -11
  370. package/src/util/isWellBehavedNumber.js +0 -8
  371. package/src/util/round.js +0 -39
  372. package/src/util/scale/RechartsScale.js +0 -68
  373. package/src/util/scale/index.js +0 -3
  374. package/src/util/stacks/getStackSeriesIdentifier.js +0 -10
  375. package/src/zIndex/ZIndexLayer.tsrx.d.ts +0 -2
@@ -1,3 +1,92 @@
1
+ import type { Ref, RefObject, SVGProps } from '../util/OctaneTypes.ts';
2
+ import type { Props as TextProps, TextAnchor, TextVerticalAnchor } from '../component/Text.tsrx';
3
+ import type { ImplicitLabelType } from '../component/Label.tsrx';
4
+ import type {
5
+ CartesianViewBoxRequired,
6
+ PresentationAttributesAdaptChildEvent,
7
+ CartesianTickItem,
8
+ AxisInterval,
9
+ TickProp,
10
+ BaseTickContentProps,
11
+ TickItem as TickItemType,
12
+ } from '../util/types';
13
+ import type {
14
+ AxisId,
15
+ XAxisOrientation,
16
+ XAxisPadding,
17
+ YAxisOrientation,
18
+ YAxisPadding,
19
+ } from '../state/cartesianAxisSlice';
20
+ import type { RequiresDefaultProps } from '../util/resolveDefaultProps';
21
+ import type { ZIndexable } from '../zIndex/ZIndexLayer.tsrx';
22
+
23
+ export type Orientation = XAxisOrientation | YAxisOrientation;
24
+ export type Unit = string | number;
25
+ export type TickFormatter = (value: any, index: number) => string;
26
+ export interface CartesianAxisProps extends ZIndexable {
27
+ className?: SVGProps<SVGElement>['className'];
28
+ axisType?: 'xAxis' | 'yAxis';
29
+ axisId?: AxisId;
30
+ x?: number;
31
+ y?: number;
32
+ width?: number;
33
+ height?: number;
34
+ unit?: Unit;
35
+ orientation?: Orientation;
36
+ viewBox?: CartesianViewBoxRequired;
37
+ tick?: TickProp<unknown>;
38
+ tickTextProps?: TextProps;
39
+ axisLine?: boolean | SVGProps<SVGLineElement>;
40
+ tickLine?: boolean | SVGProps<SVGLineElement>;
41
+ mirror?: boolean;
42
+ tickMargin?: number;
43
+ hide?: boolean;
44
+ label?: ImplicitLabelType;
45
+ padding?: XAxisPadding | YAxisPadding;
46
+ minTickGap?: number;
47
+ ticks?: ReadonlyArray<CartesianTickItem>;
48
+ tickSize?: number;
49
+ tickFormatter?: TickFormatter;
50
+ interval?: AxisInterval;
51
+ angle?: number;
52
+ scale?: unknown;
53
+ labelRef?: RefObject<SVGTextElement | null> | null;
54
+ ref?: Ref<CartesianAxisRef>;
55
+ }
56
+ export interface CartesianAxisRef {
57
+ getCalculatedWidth(): number;
58
+ }
59
+ export type Props =
60
+ Omit<
61
+ PresentationAttributesAdaptChildEvent<any, SVGElement>,
62
+ 'viewBox' | 'scale' | 'ref'
63
+ > & CartesianAxisProps;
64
+ type InternalProps = RequiresDefaultProps<Props, typeof defaultCartesianAxisProps>;
65
+ type TicksProps = {
66
+ ref?: Ref<SVGGElement>;
67
+ axisType: 'xAxis' | 'yAxis' | undefined;
68
+ events: Omit<PresentationAttributesAdaptChildEvent<any, SVGElement>, 'scale' | 'viewBox'>;
69
+ fontSize: string;
70
+ getTicksConfig: Omit<InternalProps, 'ticks' | 'ref'>;
71
+ height: number;
72
+ letterSpacing: string;
73
+ mirror: boolean;
74
+ orientation: Orientation;
75
+ padding?: Props['padding'];
76
+ stroke?: Props['stroke'];
77
+ tick?: Props['tick'];
78
+ tickFormatter?: Props['tickFormatter'];
79
+ tickLine?: Props['tickLine'];
80
+ tickMargin: number;
81
+ tickSize: number;
82
+ tickTextProps?: Props['tickTextProps'];
83
+ ticks?: ReadonlyArray<CartesianTickItem>;
84
+ unit?: Props['unit'];
85
+ width: number;
86
+ x: number;
87
+ y: number;
88
+ axisId: AxisId | undefined;
89
+ };
1
90
  // Port of cartesian/CartesianAxis.tsx — the axis renderer: axis line, tick
2
91
  // lines, tick labels (measured for font metrics via a callback ref), the
3
92
  // rendered-ticks store reporter, and the imperative getCalculatedWidth handle
@@ -55,9 +144,18 @@ export const defaultCartesianAxisProps = {
55
144
  tickMargin: 2,
56
145
  interval: 'preserveEnd',
57
146
  zIndex: DefaultZIndexes.axis,
58
- };
147
+ } as const satisfies Partial<Props>;
59
148
 
60
- function AxisLine(axisLineProps) {
149
+ function AxisLine(axisLineProps: {
150
+ x: number;
151
+ y: number;
152
+ width: number;
153
+ height: number;
154
+ orientation: Orientation;
155
+ mirror: boolean;
156
+ axisLine: boolean | SVGProps<SVGLineElement>;
157
+ otherSvgProps: SVGProps<SVGLineElement> | null;
158
+ }) {
61
159
  const { x, y, width, height, orientation, mirror, axisLine, otherSvgProps } = axisLineProps;
62
160
  if (!axisLine) {
63
161
  return null;
@@ -92,7 +190,17 @@ function AxisLine(axisLineProps) {
92
190
  * Calculate the coordinates of endpoints in ticks: `line` for the tick line,
93
191
  * `tick` for the tick text.
94
192
  */
95
- function getTickLineCoord(data, x, y, width, height, orientation, tickSize, mirror, tickMargin) {
193
+ function getTickLineCoord(
194
+ data: CartesianTickItem,
195
+ x: number,
196
+ y: number,
197
+ width: number,
198
+ height: number,
199
+ orientation: Orientation,
200
+ tickSize: number,
201
+ mirror: boolean,
202
+ tickMargin: number,
203
+ ) {
96
204
  let x1, x2, y1, y2, tx, ty;
97
205
  const sign = mirror ? -1 : 1;
98
206
  const finalTickSize = data.tickSize || tickSize;
@@ -133,7 +241,7 @@ function getTickLineCoord(data, x, y, width, height, orientation, tickSize, mirr
133
241
  };
134
242
  }
135
243
 
136
- function getTickTextAnchor(orientation, mirror) {
244
+ function getTickTextAnchor(orientation: Orientation, mirror: boolean) {
137
245
  switch (orientation) {
138
246
  case 'left':
139
247
  return mirror ? 'start' : 'end';
@@ -144,7 +252,7 @@ function getTickTextAnchor(orientation, mirror) {
144
252
  }
145
253
  }
146
254
 
147
- function getTickVerticalAnchor(orientation, mirror) {
255
+ function getTickVerticalAnchor(orientation: Orientation, mirror: boolean) {
148
256
  switch (orientation) {
149
257
  case 'left':
150
258
  case 'right':
@@ -156,7 +264,11 @@ function getTickVerticalAnchor(orientation, mirror) {
156
264
  }
157
265
  }
158
266
 
159
- function TickItem(props) {
267
+ function TickItem(props: {
268
+ option: Props['tick'];
269
+ tickProps: TextProps;
270
+ value: string;
271
+ }) {
160
272
  const { option, tickProps, value } = props;
161
273
  let tickItem;
162
274
  const combinedClassName = clsx(tickProps.className, 'recharts-cartesian-axis-tick-value');
@@ -174,7 +286,11 @@ function TickItem(props) {
174
286
  return tickItem;
175
287
  }
176
288
 
177
- function RenderedTicksReporter(props) {
289
+ function RenderedTicksReporter(props: {
290
+ ticks: ReadonlyArray<TickItemType>;
291
+ axisType: 'xAxis' | 'yAxis' | undefined;
292
+ axisId: AxisId | undefined;
293
+ }) {
178
294
  const { ticks, axisType, axisId } = props;
179
295
  const dispatch = useAppDispatch();
180
296
  useEffect(() => {
@@ -198,7 +314,7 @@ function RenderedTicksReporter(props) {
198
314
  return null;
199
315
  }
200
316
 
201
- function Ticks(props) {
317
+ function Ticks(props: TicksProps) {
202
318
  const {
203
319
  ticks = [],
204
320
  tick,
@@ -228,18 +344,22 @@ function Ticks(props) {
228
344
  const axisProps = svgPropertiesNoEvents(getTicksConfig);
229
345
  const customTickProps = svgPropertiesNoEventsFromUnknown(tick);
230
346
  // Use user-provided textAnchor if available, otherwise calculate from orientation/mirror
231
- const textAnchor =
347
+ const textAnchor: TextAnchor =
232
348
  isValidTextAnchor(axisProps.textAnchor)
233
349
  ? axisProps.textAnchor
234
350
  : getTickTextAnchor(orientation, mirror);
235
- const verticalAnchor = getTickVerticalAnchor(orientation, mirror);
236
- let tickLinePropsObject = {};
351
+ const verticalAnchor: TextVerticalAnchor = getTickVerticalAnchor(orientation, mirror);
352
+ let tickLinePropsObject: SVGProps<SVGLineElement> = {};
237
353
  if (typeof tickLine === 'object') {
238
354
  tickLinePropsObject = tickLine;
239
355
  }
240
- const tickLineProps = { ...axisProps, fill: 'none', ...tickLinePropsObject };
356
+ const tickLineProps: SVGProps<SVGLineElement> = {
357
+ ...axisProps,
358
+ fill: 'none',
359
+ ...tickLinePropsObject,
360
+ };
241
361
  const tickLineCoords = finalTicks.map(
242
- (entry) => ({
362
+ (entry: CartesianTickItem) => ({
243
363
  entry,
244
364
  ...getTickLineCoord(entry, x, y, width, height, orientation, tickSize, mirror, tickMargin),
245
365
  }),
@@ -273,7 +393,7 @@ function Ticks(props) {
273
393
  ...tickTextProps,
274
394
  angle: tickTextProps?.angle ?? axisProps.angle ?? 0,
275
395
  };
276
- const finalTickProps = { ...tickProps, ...customTickProps };
396
+ const finalTickProps: BaseTickContentProps = { ...tickProps, ...customTickProps };
277
397
  return <Layer
278
398
  className="recharts-cartesian-axis-tick-label"
279
399
  key={'tick-label-' + entry.value + '-' + entry.coordinate + '-' + entry.tickCoord}
@@ -306,11 +426,23 @@ function Ticks(props) {
306
426
  </g>;
307
427
  }
308
428
 
309
- function CartesianAxisComponent(props) {
310
- const { axisLine, width, height, className, hide, ticks, axisType, axisId, ref, ...rest } = props;
429
+ function CartesianAxisComponent(props: InternalProps) {
430
+ // This ref receives the imperative axis handle, never an SVG line or tick.
431
+ const { ref, ...propsWithoutRef } = props;
432
+ const {
433
+ axisLine,
434
+ width,
435
+ height,
436
+ className,
437
+ hide,
438
+ ticks,
439
+ axisType,
440
+ axisId,
441
+ ...rest
442
+ } = propsWithoutRef;
311
443
  const [fontSize, setFontSize] = useState('');
312
444
  const [letterSpacing, setLetterSpacing] = useState('');
313
- const tickRefs = useRef(null);
445
+ const tickRefs = useRef<HTMLCollectionOf<Element> | null>(null);
314
446
  useImperativeHandle(
315
447
  ref,
316
448
  () => ({
@@ -325,11 +457,11 @@ function CartesianAxisComponent(props) {
325
457
  },
326
458
  }),
327
459
  );
328
- const layerRef = useCallback((el) => {
460
+ const layerRef = useCallback((el: SVGElement | null) => {
329
461
  if (el) {
330
462
  const tickNodes = el.getElementsByClassName('recharts-cartesian-axis-tick-value');
331
463
  tickRefs.current = tickNodes;
332
- const tick = tickNodes[0];
464
+ const tick: Element | undefined = tickNodes[0];
333
465
  if (tick) {
334
466
  const computedStyle = window.getComputedStyle(tick);
335
467
  const calculatedFontSize = computedStyle.fontSize;
@@ -359,14 +491,14 @@ function CartesianAxisComponent(props) {
359
491
  orientation={props.orientation}
360
492
  mirror={props.mirror}
361
493
  axisLine={axisLine}
362
- otherSvgProps={svgPropertiesNoEvents(props)}
494
+ otherSvgProps={svgPropertiesNoEvents(propsWithoutRef)}
363
495
  />
364
496
  <Ticks
365
497
  ref={layerRef}
366
498
  axisType={axisType}
367
499
  events={rest}
368
500
  fontSize={fontSize}
369
- getTicksConfig={props}
501
+ getTicksConfig={propsWithoutRef}
370
502
  height={props.height}
371
503
  letterSpacing={letterSpacing}
372
504
  mirror={props.mirror}
@@ -404,7 +536,7 @@ function CartesianAxisComponent(props) {
404
536
  /**
405
537
  * @deprecated not meant to be used directly in app code — use XAxis or YAxis.
406
538
  */
407
- export function CartesianAxis(outsideProps) {
539
+ export function CartesianAxis(outsideProps: Props) {
408
540
  const { ref, ...rest } = outsideProps;
409
541
  const props = resolveDefaultProps(rest, defaultCartesianAxisProps);
410
542
  return <CartesianAxisComponent {...props} ref={ref} />;
@@ -1,5 +1,5 @@
1
+ import type { OctaneElement, SVGProps } from '../util/OctaneTypes.ts';
1
2
  import * as React from 'octane';
2
- import { ReactElement, SVGProps } from 'octane';
3
3
 
4
4
  import { warn } from '../util/LogUtils';
5
5
  import { isNumber } from '../util/DataUtils';
@@ -11,7 +11,7 @@ import {
11
11
  getTicksOfAxis,
12
12
  } from '../util/ChartUtils';
13
13
  import { getTicks, GetTicksInput } from './getTicks';
14
- import { defaultCartesianAxisProps } from './CartesianAxis';
14
+ import { defaultCartesianAxisProps } from './CartesianAxis.tsrx';
15
15
  import { useChartHeight, useChartWidth, useOffsetInternal } from '../context/chartLayoutContext';
16
16
  import { AxisId } from '../state/cartesianAxisSlice';
17
17
  import {
@@ -22,7 +22,7 @@ import { useIsPanorama } from '../context/PanoramaContext';
22
22
  import { RequiresDefaultProps, resolveDefaultProps } from '../util/resolveDefaultProps';
23
23
  import { svgPropertiesNoEvents } from '../util/svgPropertiesNoEvents';
24
24
  import { isPositiveNumber } from '../util/isWellBehavedNumber';
25
- import { ZIndexable, ZIndexLayer } from '../zIndex/ZIndexLayer';
25
+ import { ZIndexable, ZIndexLayer } from '../zIndex/ZIndexLayer.tsrx';
26
26
  import { DefaultZIndexes } from '../zIndex/DefaultZIndexes';
27
27
 
28
28
  /**
@@ -41,8 +41,8 @@ export type AxisPropsForCartesianGridTicksGeneration =
41
41
 
42
42
  type GridLineType =
43
43
  | SVGProps<SVGLineElement>
44
- | ReactElement<SVGElement>
45
- | ((props: GridLineTypeFunctionProps) => ReactElement<SVGElement>)
44
+ | OctaneElement<SVGElement>
45
+ | ((props: GridLineTypeFunctionProps) => OctaneElement<SVGElement>)
46
46
  | boolean;
47
47
 
48
48
  export type HorizontalCoordinatesGenerator =
@@ -265,7 +265,6 @@ function LineItem({
265
265
  let lineItem;
266
266
 
267
267
  if (React.isValidElement(option)) {
268
- // @ts-expect-error typescript does not see the props type when cloning an element
269
268
  lineItem = React.cloneElement(option, lineItemProps);
270
269
  } else if (typeof option === 'function') {
271
270
  lineItem = option(lineItemProps);
@@ -1,25 +1,26 @@
1
+ import type { SVGProps } from '../util/OctaneTypes.ts';
1
2
  /**
2
3
  * @fileOverview Render a group of error bar
3
4
  */
4
5
  import * as React from 'octane';
5
- import { SVGProps } from 'octane';
6
- import { Layer } from '../container/Layer';
6
+
7
+ import { Layer } from '../container/Layer.tsrx';
7
8
  import { EasingInput, DataKey, RectangleCoordinate } from '../util/types';
8
9
  import { BarRectangleItem } from './Bar';
9
10
  import { LinePointItem } from './Line';
10
- import { ScatterPointItem } from './Scatter';
11
- import { ReportErrorBarSettings, useErrorBarContext } from '../context/ErrorBarContext';
11
+ import { ScatterPointItem } from './Scatter.tsrx';
12
+ import { ReportErrorBarSettings, useErrorBarContext } from '../context/ErrorBarContext.tsrx';
12
13
  import { useXAxis, useYAxis } from '../hooks';
13
14
  import { resolveDefaultProps } from '../util/resolveDefaultProps';
14
15
  import { svgPropertiesNoEvents } from '../util/svgPropertiesNoEvents';
15
16
  import { useChartLayout } from '../context/chartLayoutContext';
16
- import { CSSTransitionAnimate, extractCssEasing } from '../animation/CSSTransitionAnimate';
17
- import { ZIndexable, ZIndexLayer } from '../zIndex/ZIndexLayer';
17
+ import { CSSTransitionAnimate, extractCssEasing } from '../animation/CSSTransitionAnimate.tsrx';
18
+ import { ZIndexable, ZIndexLayer } from '../zIndex/ZIndexLayer.tsrx';
18
19
  import { DefaultZIndexes } from '../zIndex/DefaultZIndexes';
19
20
 
20
21
  export interface ErrorBarDataItem {
21
- x: number | undefined;
22
- y: number | undefined;
22
+ x: number | null | undefined;
23
+ y: number | null | undefined;
23
24
  value: number;
24
25
  errorVal?: number[] | number;
25
26
  }
@@ -1,19 +1,20 @@
1
+ import type { MutableRefObject, NativeMouseEvent, OctaneNode } from '../util/OctaneTypes.ts';
1
2
  import * as React from 'octane';
2
- import { MutableRefObject, ReactElement, ReactNode, useMemo, useRef } from 'octane';
3
+ import { useMemo, useRef } from 'octane';
3
4
  import { shallowEqual } from '@octanejs/redux';
4
5
  import omit from 'es-toolkit/compat/omit';
5
6
 
6
7
  import { clsx } from 'clsx';
7
8
  import { selectActiveIndex } from '../state/selectors/selectors';
8
9
  import { useAppSelector } from '../state/hooks';
9
- import { Layer } from '../container/Layer';
10
- import { Props as TrapezoidProps } from '../shape/Trapezoid';
10
+ import { Layer } from '../container/Layer.tsrx';
11
+ import { Props as TrapezoidProps } from '../shape/Trapezoid.tsrx';
11
12
  import {
12
13
  CartesianLabelListContextProvider,
13
14
  CartesianLabelListEntry,
14
15
  ImplicitLabelListType,
15
16
  LabelListFromLabelProp,
16
- } from '../component/LabelList';
17
+ } from '../component/LabelList.tsrx';
17
18
  import { getPercentValue, interpolate } from '../util/DataUtils';
18
19
  import { getValueByDataKey } from '../util/ChartUtils';
19
20
  import {
@@ -34,7 +35,11 @@ import {
34
35
  TrapezoidViewBox,
35
36
  CartesianLayout,
36
37
  } from '../util/types';
37
- import { defaultFunnelShape, FunnelTrapezoid, FunnelTrapezoidProps } from '../util/FunnelUtils';
38
+ import {
39
+ defaultFunnelShape,
40
+ FunnelTrapezoid,
41
+ FunnelTrapezoidProps,
42
+ } from '../util/FunnelUtils.tsrx';
38
43
  import {
39
44
  useMouseClickItemDispatch,
40
45
  useMouseEnterItemDispatch,
@@ -42,8 +47,8 @@ import {
42
47
  } from '../context/tooltipContext';
43
48
  import { TooltipPayload, TooltipPayloadConfiguration } from '../state/tooltipSlice';
44
49
  import { SetTooltipEntrySettings } from '../state/SetTooltipEntrySettings';
45
- import { Formatter } from '../component/DefaultTooltipContent';
46
- import type { LegendPayload } from '../component/DefaultLegendContent';
50
+ import { Formatter } from '../component/DefaultTooltipContent.tsrx';
51
+ import type { LegendPayload } from '../component/DefaultLegendContent.tsrx';
47
52
  import { ResolvedFunnelSettings, selectFunnelTrapezoids } from '../state/selectors/funnelSelectors';
48
53
  import { RequiresDefaultProps, resolveDefaultProps } from '../util/resolveDefaultProps';
49
54
  import { usePlotArea } from '../hooks';
@@ -52,10 +57,10 @@ import {
52
57
  AnimatedItems,
53
58
  AnimationInterpolateFn,
54
59
  useAnimationCallbacks,
55
- } from '../animation/AnimatedItems';
60
+ } from '../animation/AnimatedItems.tsrx';
56
61
  import { AnimationMatchByProp, matchAppend } from '../animation/matchBy';
57
62
  import { GraphicalItemId } from '../state/graphicalItemsSlice';
58
- import { RegisterGraphicalItemId } from '../context/RegisterGraphicalItemId';
63
+ import { RegisterGraphicalItemId } from '../context/RegisterGraphicalItemId.tsrx';
59
64
  import { WithIdRequired } from '../util/useUniqueId';
60
65
  import { SetLegendPayload } from '../state/SetLegendPayload';
61
66
  import { CellsContext, useCellRegistry } from '../context/CellsContext';
@@ -196,7 +201,7 @@ interface FunnelProps<DataPointType = any, DataValueType = any> extends DataProv
196
201
  onAnimationStart?: () => void;
197
202
  reversed?: boolean;
198
203
  /**
199
- * If set a ReactElement, the shape of funnel can be customized.
204
+ * If set a OctaneElement, the shape of funnel can be customized.
200
205
  * If set a function, the function will be called to render customized shape.
201
206
  * During animations, the function shape also receives `animationElapsedTime`, `isAnimating`, and `isEntrance`.
202
207
  * By default, renders a trapezoid.
@@ -211,48 +216,44 @@ interface FunnelProps<DataPointType = any, DataValueType = any> extends DataProv
211
216
  /**
212
217
  * The customized event handler of click on the area in this group
213
218
  */
214
- onClick?: (data: FunnelTrapezoidItem, index: number, e: React.MouseEvent<SVGPathElement>) => void;
219
+ onClick?: (data: FunnelTrapezoidItem, index: number, e: NativeMouseEvent<SVGGElement>) => void;
215
220
  /**
216
221
  * The customized event handler of mousedown on the area in this group
217
222
  */
218
- onMouseDown?: (data: FunnelTrapezoidItem, index: number, e: React.MouseEvent<
219
- SVGPathElement
223
+ onMouseDown?: (data: FunnelTrapezoidItem, index: number, e: NativeMouseEvent<
224
+ SVGGElement
220
225
  >) => void;
221
226
  /**
222
227
  * The customized event handler of mouseup on the area in this group
223
228
  */
224
- onMouseUp?: (data: FunnelTrapezoidItem, index: number, e: React.MouseEvent<
225
- SVGPathElement
226
- >) => void;
229
+ onMouseUp?: (data: FunnelTrapezoidItem, index: number, e: NativeMouseEvent<SVGGElement>) => void;
227
230
  /**
228
231
  * The customized event handler of mousemove on the area in this group
229
232
  */
230
- onMouseMove?: (data: FunnelTrapezoidItem, index: number, e: React.MouseEvent<
231
- SVGPathElement
233
+ onMouseMove?: (data: FunnelTrapezoidItem, index: number, e: NativeMouseEvent<
234
+ SVGGElement
232
235
  >) => void;
233
236
  /**
234
237
  * The customized event handler of mouseover on the area in this group
235
238
  */
236
- onMouseOver?: (data: FunnelTrapezoidItem, index: number, e: React.MouseEvent<
237
- SVGPathElement
239
+ onMouseOver?: (data: FunnelTrapezoidItem, index: number, e: NativeMouseEvent<
240
+ SVGGElement
238
241
  >) => void;
239
242
  /**
240
243
  * The customized event handler of mouseout on the area in this group
241
244
  */
242
- onMouseOut?: (data: FunnelTrapezoidItem, index: number, e: React.MouseEvent<
243
- SVGPathElement
244
- >) => void;
245
+ onMouseOut?: (data: FunnelTrapezoidItem, index: number, e: NativeMouseEvent<SVGGElement>) => void;
245
246
  /**
246
247
  * The customized event handler of mouseenter on the area in this group
247
248
  */
248
- onMouseEnter?: (data: FunnelTrapezoidItem, index: number, e: React.MouseEvent<
249
- SVGPathElement
249
+ onMouseEnter?: (data: FunnelTrapezoidItem, index: number, e: NativeMouseEvent<
250
+ SVGGElement
250
251
  >) => void;
251
252
  /**
252
253
  * The customized event handler of mouseleave on the area in this group
253
254
  */
254
- onMouseLeave?: (data: FunnelTrapezoidItem, index: number, e: React.MouseEvent<
255
- SVGPathElement
255
+ onMouseLeave?: (data: FunnelTrapezoidItem, index: number, e: NativeMouseEvent<
256
+ SVGGElement
256
257
  >) => void;
257
258
  }
258
259
 
@@ -299,11 +300,11 @@ const SetFunnelTooltipEntrySettings = React.memo(({
299
300
  | 'data'
300
301
  | 'id'
301
302
  > & {
302
- trapezoids: ReadonlyArray<FunnelTrapezoidItem>;
303
+ trapezoids: ReadonlyArray<FunnelTrapezoidItem> | undefined;
303
304
  }) => {
304
305
  const tooltipEntrySettings: TooltipPayloadConfiguration = {
305
306
  dataDefinedOnItem: data,
306
- getPosition: (index) => trapezoids[Number(index)]?.tooltipPosition,
307
+ getPosition: (index) => trapezoids?.[Number(index)]?.tooltipPosition,
307
308
  settings: {
308
309
  stroke,
309
310
  strokeWidth,
@@ -329,7 +330,7 @@ function FunnelLabelListProvider({
329
330
  }: {
330
331
  showLabels: boolean;
331
332
  trapezoids: ReadonlyArray<FunnelTrapezoidItem> | undefined;
332
- children: ReactNode;
333
+ children: OctaneNode;
333
334
  }) {
334
335
  const labelListEntries: ReadonlyArray<CartesianLabelListEntry> | undefined = useMemo(() => {
335
336
  if (!showLabels) {
@@ -818,16 +819,18 @@ export function computeFunnelTrapezoids({
818
819
  * @provides LabelListContext
819
820
  * @provides CellReader
820
821
  */
821
- function FunnelFn(outsideProps: Props) {
822
- const { id: externalId, ...props } = resolveDefaultProps(outsideProps, defaultFunnelProps);
822
+ function FunnelFn<DataPointType = any, DataValueType = any>(
823
+ outsideProps: Props<DataPointType, DataValueType>,
824
+ ) {
825
+ // Internal chart data also supports the built-in 'name' key when no nameKey is supplied.
826
+ const { id: externalId, ...props } = resolveDefaultProps<Props, typeof defaultFunnelProps>(
827
+ outsideProps,
828
+ defaultFunnelProps,
829
+ );
823
830
  return <RegisterGraphicalItemId id={externalId} type="funnel">
824
831
  {(id) => <FunnelImpl {...props} id={id} />}
825
832
  </RegisterGraphicalItemId>;
826
833
  }
827
834
 
828
- export const Funnel = FunnelFn as (outsideProps: Props<
829
- DataPointType,
830
- DataValueType
831
- >) => ReactElement;
832
- // @ts-expect-error we need to set the displayName for debugging purposes
835
+ export const Funnel = FunnelFn as typeof FunnelFn & { displayName?: string };
833
836
  Funnel.displayName = 'Funnel';
@@ -1,3 +1,10 @@
1
+ import type { AxisId } from '../state/cartesianAxisSlice';
2
+
3
+ type GraphicalItemClipPathProps = {
4
+ xAxisId: AxisId;
5
+ yAxisId: AxisId;
6
+ clipPathId: string;
7
+ };
1
8
  // Port of cartesian/GraphicalItemClipPath.tsx — the per-item clipPath used
2
9
  // when either axis has allowDataOverflow.
3
10
  import { useAppSelector } from '../state/hooks';
@@ -11,16 +18,16 @@ import {
11
18
  } from '../state/selectors/axisSelectors';
12
19
  import { usePlotArea } from '../hooks';
13
20
 
14
- export function useNeedsClip(xAxisId, yAxisId) {
21
+ export function useNeedsClip(xAxisId: AxisId, yAxisId: AxisId) {
15
22
  const xAxis = useAppSelector((state) => selectXAxisSettings(state, xAxisId));
16
23
  const yAxis = useAppSelector((state) => selectYAxisSettings(state, yAxisId));
17
- const needClipX = xAxis?.allowDataOverflow ?? implicitXAxis.allowDataOverflow;
18
- const needClipY = yAxis?.allowDataOverflow ?? implicitYAxis.allowDataOverflow;
24
+ const needClipX: boolean = xAxis?.allowDataOverflow ?? implicitXAxis.allowDataOverflow;
25
+ const needClipY: boolean = yAxis?.allowDataOverflow ?? implicitYAxis.allowDataOverflow;
19
26
  const needClip = needClipX || needClipY;
20
27
  return { needClip, needClipX, needClipY };
21
28
  }
22
29
 
23
- export function GraphicalItemClipPath(props) @{
30
+ export function GraphicalItemClipPath(props: GraphicalItemClipPathProps) @{
24
31
  const { xAxisId, yAxisId, clipPathId } = props;
25
32
  const plotArea = usePlotArea();
26
33
  const { needClipX, needClipY, needClip } = useNeedsClip(xAxisId, yAxisId);
@@ -2,3 +2,4 @@
2
2
  // lineSelectors.js) import `computeLinePoints` from '../../cartesian/Line' —
3
3
  // this .ts entry forwards to the .tsrx implementation.
4
4
  export { Line, computeLinePoints, defaultLineProps } from './Line.tsrx';
5
+ export type * from './Line.tsrx';