@elliemae/ds-dataviz 3.80.0-next.67 → 3.80.0-next.69

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 (398) hide show
  1. package/dist/cjs/constants/index.js +73 -0
  2. package/dist/cjs/constants/index.js.map +7 -0
  3. package/dist/cjs/graphs/Chart/Chart.js +6 -1
  4. package/dist/cjs/graphs/Chart/Chart.js.map +2 -2
  5. package/dist/cjs/graphs/Chart/ChartContext.js.map +2 -2
  6. package/dist/cjs/graphs/Chart/SingleStackedBar/SingleStackedBar.js +36 -24
  7. package/dist/cjs/graphs/Chart/SingleStackedBar/SingleStackedBar.js.map +3 -3
  8. package/dist/cjs/graphs/Chart/SingleStackedBar/styles.js +12 -5
  9. package/dist/cjs/graphs/Chart/SingleStackedBar/styles.js.map +2 -2
  10. package/dist/cjs/graphs/Chart/config/chartInteractionStore.js +98 -0
  11. package/dist/cjs/graphs/Chart/config/chartInteractionStore.js.map +7 -0
  12. package/dist/cjs/graphs/Chart/config/useChart.js +56 -40
  13. package/dist/cjs/graphs/Chart/config/useChart.js.map +2 -2
  14. package/dist/cjs/graphs/Chart/config/useChartDescription.js +62 -0
  15. package/dist/cjs/graphs/Chart/config/useChartDescription.js.map +7 -0
  16. package/dist/cjs/graphs/Chart/config/useEntranceAnimation.js +141 -0
  17. package/dist/cjs/graphs/Chart/config/useEntranceAnimation.js.map +7 -0
  18. package/dist/cjs/graphs/Chart/config/useGetters.js +10 -0
  19. package/dist/cjs/graphs/Chart/config/useGetters.js.map +2 -2
  20. package/dist/cjs/graphs/Chart/config/useInternalMargins.js +25 -5
  21. package/dist/cjs/graphs/Chart/config/useInternalMargins.js.map +2 -2
  22. package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js +35 -51
  23. package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
  24. package/dist/cjs/graphs/Chart/config/useScales.js +200 -67
  25. package/dist/cjs/graphs/Chart/config/useScales.js.map +2 -2
  26. package/dist/cjs/graphs/Chart/config/useValidateProps.js +53 -4
  27. package/dist/cjs/graphs/Chart/config/useValidateProps.js.map +2 -2
  28. package/dist/cjs/graphs/Chart/config/useValueAxisTransition.js +128 -0
  29. package/dist/cjs/graphs/Chart/config/useValueAxisTransition.js.map +7 -0
  30. package/dist/cjs/graphs/Chart/config/useWheelScroll.js +111 -0
  31. package/dist/cjs/graphs/Chart/config/useWheelScroll.js.map +7 -0
  32. package/dist/cjs/graphs/Chart/helpers/alignedTicks.js +56 -0
  33. package/dist/cjs/graphs/Chart/helpers/alignedTicks.js.map +7 -0
  34. package/dist/cjs/graphs/Chart/helpers/barPath.js +53 -0
  35. package/dist/cjs/graphs/Chart/helpers/barPath.js.map +7 -0
  36. package/dist/cjs/graphs/Chart/{react-desc-prop-types.js → helpers/dataInView.js} +26 -27
  37. package/dist/cjs/graphs/Chart/helpers/dataInView.js.map +7 -0
  38. package/dist/cjs/graphs/Chart/helpers/index.js +34 -0
  39. package/dist/cjs/graphs/Chart/helpers/index.js.map +2 -2
  40. package/dist/cjs/graphs/Chart/{SingleStackedBar/exported-related/theming.js → helpers/logAxis.js} +13 -9
  41. package/dist/cjs/graphs/Chart/helpers/logAxis.js.map +7 -0
  42. package/dist/cjs/graphs/Chart/helpers/tickRotation.js +54 -0
  43. package/dist/cjs/graphs/Chart/helpers/tickRotation.js.map +7 -0
  44. package/dist/cjs/graphs/Chart/helpers/timeTicks.js +56 -0
  45. package/dist/cjs/graphs/Chart/helpers/timeTicks.js.map +7 -0
  46. package/dist/cjs/graphs/Chart/helpers/trend.js +45 -0
  47. package/dist/cjs/graphs/Chart/helpers/trend.js.map +7 -0
  48. package/dist/cjs/graphs/Chart/{SingleStackedBar/exported-related/index.js → helpers/useSerieDimming.js} +20 -6
  49. package/dist/cjs/graphs/Chart/helpers/useSerieDimming.js.map +7 -0
  50. package/dist/cjs/graphs/Chart/helpers/useUniqueData.js +15 -18
  51. package/dist/cjs/graphs/Chart/helpers/useUniqueData.js.map +2 -2
  52. package/dist/cjs/graphs/Chart/helpers/useVirtualizedSeries.js +12 -5
  53. package/dist/cjs/graphs/Chart/helpers/useVirtualizedSeries.js.map +2 -2
  54. package/dist/cjs/graphs/Chart/{DataTestIds.js → helpers/zeroLine.js} +12 -9
  55. package/dist/cjs/graphs/Chart/helpers/zeroLine.js.map +7 -0
  56. package/dist/cjs/graphs/Chart/parts/A11yRegion.js +8 -2
  57. package/dist/cjs/graphs/Chart/parts/A11yRegion.js.map +2 -2
  58. package/dist/cjs/graphs/Chart/parts/Axis/Axis.js +40 -4
  59. package/dist/cjs/graphs/Chart/parts/Axis/Axis.js.map +2 -2
  60. package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js +18 -4
  61. package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js.map +2 -2
  62. package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js +14 -6
  63. package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
  64. package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js +14 -4
  65. package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
  66. package/dist/cjs/graphs/Chart/parts/Axis/GridLine.js +15 -1
  67. package/dist/cjs/graphs/Chart/parts/Axis/GridLine.js.map +2 -2
  68. package/dist/cjs/graphs/Chart/parts/Axis/Tick.js +10 -4
  69. package/dist/cjs/graphs/Chart/parts/Axis/Tick.js.map +2 -2
  70. package/dist/cjs/graphs/Chart/parts/Axis/useTickTransition.js +170 -0
  71. package/dist/cjs/graphs/Chart/parts/Axis/useTickTransition.js.map +7 -0
  72. package/dist/cjs/graphs/Chart/parts/ChartContainer.js +41 -19
  73. package/dist/cjs/graphs/Chart/parts/ChartContainer.js.map +2 -2
  74. package/dist/cjs/graphs/Chart/parts/FocusableRegion.js +6 -3
  75. package/dist/cjs/graphs/Chart/parts/FocusableRegion.js.map +2 -2
  76. package/dist/cjs/graphs/Chart/parts/HoverBand.js +86 -0
  77. package/dist/cjs/graphs/Chart/parts/HoverBand.js.map +7 -0
  78. package/dist/cjs/graphs/Chart/parts/Labels/Label.js +12 -1
  79. package/dist/cjs/graphs/Chart/parts/Labels/Label.js.map +2 -2
  80. package/dist/cjs/graphs/Chart/parts/Labels/index.js +12 -4
  81. package/dist/cjs/graphs/Chart/parts/Labels/index.js.map +2 -2
  82. package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js +6 -3
  83. package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js.map +2 -2
  84. package/dist/cjs/graphs/Chart/parts/Legend/LeftLegend.js +2 -6
  85. package/dist/cjs/graphs/Chart/parts/Legend/LeftLegend.js.map +2 -2
  86. package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js +91 -9
  87. package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js.map +2 -2
  88. package/dist/cjs/graphs/Chart/parts/Legend/RightLegend.js +3 -4
  89. package/dist/cjs/graphs/Chart/parts/Legend/RightLegend.js.map +2 -2
  90. package/dist/cjs/graphs/Chart/parts/Legend/TopLegend.js +8 -6
  91. package/dist/cjs/graphs/Chart/parts/Legend/TopLegend.js.map +2 -2
  92. package/dist/cjs/graphs/Chart/parts/Scrapper/Scrapper.js +29 -3
  93. package/dist/cjs/graphs/Chart/parts/Scrapper/Scrapper.js.map +2 -2
  94. package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js +82 -55
  95. package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +3 -3
  96. package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js +14 -6
  97. package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
  98. package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +67 -43
  99. package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
  100. package/dist/cjs/graphs/Chart/{SingleStackedBar/exported-related/data-test-ids.js → parts/ScreenReaderText.js} +17 -7
  101. package/dist/cjs/graphs/Chart/parts/ScreenReaderText.js.map +7 -0
  102. package/dist/cjs/graphs/Chart/parts/Scroller/BlurMask.js +14 -9
  103. package/dist/cjs/graphs/Chart/parts/Scroller/BlurMask.js.map +2 -2
  104. package/dist/cjs/graphs/Chart/parts/Scroller/Controllers.js +152 -49
  105. package/dist/cjs/graphs/Chart/parts/Scroller/Controllers.js.map +2 -2
  106. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarX.js +22 -6
  107. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
  108. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarY.js +13 -6
  109. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarY.js.map +2 -2
  110. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js +42 -35
  111. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
  112. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerY.js +9 -4
  113. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerY.js.map +2 -2
  114. package/dist/cjs/graphs/Chart/parts/SeriesFactory.js +39 -30
  115. package/dist/cjs/graphs/Chart/parts/SeriesFactory.js.map +2 -2
  116. package/dist/cjs/graphs/Chart/parts/TrendHighlight.js +57 -19
  117. package/dist/cjs/graphs/Chart/parts/TrendHighlight.js.map +2 -2
  118. package/dist/cjs/graphs/Chart/parts/ZeroLine.js +66 -0
  119. package/dist/cjs/graphs/Chart/parts/ZeroLine.js.map +7 -0
  120. package/dist/cjs/graphs/Chart/scales/index.js +50 -20
  121. package/dist/cjs/graphs/Chart/scales/index.js.map +3 -3
  122. package/dist/cjs/graphs/Chart/series/Area.js +76 -9
  123. package/dist/cjs/graphs/Chart/series/Area.js.map +2 -2
  124. package/dist/cjs/graphs/Chart/series/Bars.js +3 -1
  125. package/dist/cjs/graphs/Chart/series/Bars.js.map +2 -2
  126. package/dist/cjs/graphs/Chart/series/HorizontalBars.js +4 -1
  127. package/dist/cjs/graphs/Chart/series/HorizontalBars.js.map +2 -2
  128. package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js +14 -7
  129. package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js.map +2 -2
  130. package/dist/cjs/graphs/Chart/series/Line.js +9 -7
  131. package/dist/cjs/graphs/Chart/series/Line.js.map +2 -2
  132. package/dist/cjs/graphs/Chart/series/Point.js +114 -128
  133. package/dist/cjs/graphs/Chart/series/Point.js.map +3 -3
  134. package/dist/cjs/graphs/Chart/series/Points.js +8 -2
  135. package/dist/cjs/graphs/Chart/series/Points.js.map +2 -2
  136. package/dist/cjs/graphs/Chart/series/Rect.js +133 -122
  137. package/dist/cjs/graphs/Chart/series/Rect.js.map +3 -3
  138. package/dist/cjs/graphs/Chart/series/StackedBar.js +14 -6
  139. package/dist/cjs/graphs/Chart/series/StackedBar.js.map +2 -2
  140. package/dist/cjs/graphs/Chart/styles.js +65 -34
  141. package/dist/cjs/graphs/Chart/styles.js.map +2 -2
  142. package/dist/cjs/graphs/constants.js +24 -9
  143. package/dist/cjs/graphs/constants.js.map +2 -2
  144. package/dist/cjs/index.js +17 -6
  145. package/dist/cjs/index.js.map +3 -3
  146. package/dist/cjs/react-desc-prop-types.js +150 -0
  147. package/dist/cjs/react-desc-prop-types.js.map +7 -0
  148. package/dist/cjs/typescript-testing/slot-props.js +69 -0
  149. package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
  150. package/dist/cjs/typescript-testing/typescript-data-viz-valid.js +34 -2
  151. package/dist/cjs/typescript-testing/typescript-data-viz-valid.js.map +2 -2
  152. package/dist/cjs/typescript-testing/typescript-single-stacked-bar-valid.js +93 -0
  153. package/dist/cjs/typescript-testing/typescript-single-stacked-bar-valid.js.map +7 -0
  154. package/dist/esm/constants/index.js +43 -0
  155. package/dist/esm/constants/index.js.map +7 -0
  156. package/dist/esm/graphs/Chart/Chart.js +6 -1
  157. package/dist/esm/graphs/Chart/Chart.js.map +2 -2
  158. package/dist/esm/graphs/Chart/ChartContext.js.map +2 -2
  159. package/dist/esm/graphs/Chart/SingleStackedBar/SingleStackedBar.js +40 -23
  160. package/dist/esm/graphs/Chart/SingleStackedBar/SingleStackedBar.js.map +2 -2
  161. package/dist/esm/graphs/Chart/SingleStackedBar/styles.js +12 -5
  162. package/dist/esm/graphs/Chart/SingleStackedBar/styles.js.map +2 -2
  163. package/dist/esm/graphs/Chart/config/chartInteractionStore.js +68 -0
  164. package/dist/esm/graphs/Chart/config/chartInteractionStore.js.map +7 -0
  165. package/dist/esm/graphs/Chart/config/useChart.js +58 -42
  166. package/dist/esm/graphs/Chart/config/useChart.js.map +2 -2
  167. package/dist/esm/graphs/Chart/config/useChartDescription.js +32 -0
  168. package/dist/esm/graphs/Chart/config/useChartDescription.js.map +7 -0
  169. package/dist/esm/graphs/Chart/config/useEntranceAnimation.js +111 -0
  170. package/dist/esm/graphs/Chart/config/useEntranceAnimation.js.map +7 -0
  171. package/dist/esm/graphs/Chart/config/useGetters.js +10 -0
  172. package/dist/esm/graphs/Chart/config/useGetters.js.map +2 -2
  173. package/dist/esm/graphs/Chart/config/useInternalMargins.js +26 -6
  174. package/dist/esm/graphs/Chart/config/useInternalMargins.js.map +2 -2
  175. package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js +35 -51
  176. package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
  177. package/dist/esm/graphs/Chart/config/useScales.js +202 -69
  178. package/dist/esm/graphs/Chart/config/useScales.js.map +2 -2
  179. package/dist/esm/graphs/Chart/config/useValidateProps.js +53 -4
  180. package/dist/esm/graphs/Chart/config/useValidateProps.js.map +2 -2
  181. package/dist/esm/graphs/Chart/config/useValueAxisTransition.js +98 -0
  182. package/dist/esm/graphs/Chart/config/useValueAxisTransition.js.map +7 -0
  183. package/dist/esm/graphs/Chart/config/useWheelScroll.js +81 -0
  184. package/dist/esm/graphs/Chart/config/useWheelScroll.js.map +7 -0
  185. package/dist/esm/graphs/Chart/helpers/alignedTicks.js +26 -0
  186. package/dist/esm/graphs/Chart/helpers/alignedTicks.js.map +7 -0
  187. package/dist/esm/graphs/Chart/helpers/barPath.js +23 -0
  188. package/dist/esm/graphs/Chart/helpers/barPath.js.map +7 -0
  189. package/dist/esm/graphs/Chart/helpers/dataInView.js +28 -0
  190. package/dist/esm/graphs/Chart/helpers/dataInView.js.map +7 -0
  191. package/dist/esm/graphs/Chart/helpers/index.js +34 -0
  192. package/dist/esm/graphs/Chart/helpers/index.js.map +2 -2
  193. package/dist/esm/graphs/Chart/helpers/logAxis.js +14 -0
  194. package/dist/esm/graphs/Chart/helpers/logAxis.js.map +7 -0
  195. package/dist/esm/graphs/Chart/helpers/tickRotation.js +24 -0
  196. package/dist/esm/graphs/Chart/helpers/tickRotation.js.map +7 -0
  197. package/dist/esm/graphs/Chart/helpers/timeTicks.js +26 -0
  198. package/dist/esm/graphs/Chart/helpers/timeTicks.js.map +7 -0
  199. package/dist/esm/graphs/Chart/helpers/trend.js +15 -0
  200. package/dist/esm/graphs/Chart/helpers/trend.js.map +7 -0
  201. package/dist/esm/graphs/Chart/helpers/useSerieDimming.js +15 -0
  202. package/dist/esm/graphs/Chart/helpers/useSerieDimming.js.map +7 -0
  203. package/dist/esm/graphs/Chart/helpers/useUniqueData.js +15 -18
  204. package/dist/esm/graphs/Chart/helpers/useUniqueData.js.map +2 -2
  205. package/dist/esm/graphs/Chart/helpers/useVirtualizedSeries.js +12 -5
  206. package/dist/esm/graphs/Chart/helpers/useVirtualizedSeries.js.map +2 -2
  207. package/dist/esm/graphs/Chart/helpers/zeroLine.js +13 -0
  208. package/dist/esm/graphs/Chart/helpers/zeroLine.js.map +7 -0
  209. package/dist/esm/graphs/Chart/parts/A11yRegion.js +7 -1
  210. package/dist/esm/graphs/Chart/parts/A11yRegion.js.map +2 -2
  211. package/dist/esm/graphs/Chart/parts/Axis/Axis.js +40 -4
  212. package/dist/esm/graphs/Chart/parts/Axis/Axis.js.map +2 -2
  213. package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js +18 -4
  214. package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js.map +2 -2
  215. package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js +14 -6
  216. package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
  217. package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js +14 -4
  218. package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
  219. package/dist/esm/graphs/Chart/parts/Axis/GridLine.js +16 -2
  220. package/dist/esm/graphs/Chart/parts/Axis/GridLine.js.map +2 -2
  221. package/dist/esm/graphs/Chart/parts/Axis/Tick.js +11 -5
  222. package/dist/esm/graphs/Chart/parts/Axis/Tick.js.map +2 -2
  223. package/dist/esm/graphs/Chart/parts/Axis/useTickTransition.js +140 -0
  224. package/dist/esm/graphs/Chart/parts/Axis/useTickTransition.js.map +7 -0
  225. package/dist/esm/graphs/Chart/parts/ChartContainer.js +41 -19
  226. package/dist/esm/graphs/Chart/parts/ChartContainer.js.map +2 -2
  227. package/dist/esm/graphs/Chart/parts/FocusableRegion.js +7 -4
  228. package/dist/esm/graphs/Chart/parts/FocusableRegion.js.map +2 -2
  229. package/dist/esm/graphs/Chart/parts/HoverBand.js +56 -0
  230. package/dist/esm/graphs/Chart/parts/HoverBand.js.map +7 -0
  231. package/dist/esm/graphs/Chart/parts/Labels/Label.js +12 -1
  232. package/dist/esm/graphs/Chart/parts/Labels/Label.js.map +2 -2
  233. package/dist/esm/graphs/Chart/parts/Labels/index.js +12 -4
  234. package/dist/esm/graphs/Chart/parts/Labels/index.js.map +2 -2
  235. package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js +7 -4
  236. package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js.map +2 -2
  237. package/dist/esm/graphs/Chart/parts/Legend/LeftLegend.js +3 -7
  238. package/dist/esm/graphs/Chart/parts/Legend/LeftLegend.js.map +2 -2
  239. package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js +91 -9
  240. package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js.map +2 -2
  241. package/dist/esm/graphs/Chart/parts/Legend/RightLegend.js +4 -5
  242. package/dist/esm/graphs/Chart/parts/Legend/RightLegend.js.map +2 -2
  243. package/dist/esm/graphs/Chart/parts/Legend/TopLegend.js +9 -7
  244. package/dist/esm/graphs/Chart/parts/Legend/TopLegend.js.map +2 -2
  245. package/dist/esm/graphs/Chart/parts/Scrapper/Scrapper.js +29 -3
  246. package/dist/esm/graphs/Chart/parts/Scrapper/Scrapper.js.map +2 -2
  247. package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js +83 -56
  248. package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +3 -3
  249. package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js +14 -6
  250. package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
  251. package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +68 -44
  252. package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
  253. package/dist/esm/graphs/Chart/parts/ScreenReaderText.js +18 -0
  254. package/dist/esm/graphs/Chart/parts/ScreenReaderText.js.map +7 -0
  255. package/dist/esm/graphs/Chart/parts/Scroller/BlurMask.js +14 -9
  256. package/dist/esm/graphs/Chart/parts/Scroller/BlurMask.js.map +2 -2
  257. package/dist/esm/graphs/Chart/parts/Scroller/Controllers.js +154 -51
  258. package/dist/esm/graphs/Chart/parts/Scroller/Controllers.js.map +2 -2
  259. package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarX.js +22 -6
  260. package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
  261. package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarY.js +13 -6
  262. package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarY.js.map +2 -2
  263. package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js +43 -36
  264. package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
  265. package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerY.js +10 -5
  266. package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerY.js.map +2 -2
  267. package/dist/esm/graphs/Chart/parts/SeriesFactory.js +40 -31
  268. package/dist/esm/graphs/Chart/parts/SeriesFactory.js.map +2 -2
  269. package/dist/esm/graphs/Chart/parts/TrendHighlight.js +58 -20
  270. package/dist/esm/graphs/Chart/parts/TrendHighlight.js.map +2 -2
  271. package/dist/esm/graphs/Chart/parts/ZeroLine.js +36 -0
  272. package/dist/esm/graphs/Chart/parts/ZeroLine.js.map +7 -0
  273. package/dist/esm/graphs/Chart/scales/index.js +51 -21
  274. package/dist/esm/graphs/Chart/scales/index.js.map +3 -3
  275. package/dist/esm/graphs/Chart/series/Area.js +77 -10
  276. package/dist/esm/graphs/Chart/series/Area.js.map +2 -2
  277. package/dist/esm/graphs/Chart/series/Bars.js +3 -1
  278. package/dist/esm/graphs/Chart/series/Bars.js.map +2 -2
  279. package/dist/esm/graphs/Chart/series/HorizontalBars.js +4 -1
  280. package/dist/esm/graphs/Chart/series/HorizontalBars.js.map +2 -2
  281. package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js +15 -8
  282. package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js.map +2 -2
  283. package/dist/esm/graphs/Chart/series/Line.js +9 -7
  284. package/dist/esm/graphs/Chart/series/Line.js.map +2 -2
  285. package/dist/esm/graphs/Chart/series/Point.js +120 -130
  286. package/dist/esm/graphs/Chart/series/Point.js.map +3 -3
  287. package/dist/esm/graphs/Chart/series/Points.js +8 -2
  288. package/dist/esm/graphs/Chart/series/Points.js.map +2 -2
  289. package/dist/esm/graphs/Chart/series/Rect.js +134 -123
  290. package/dist/esm/graphs/Chart/series/Rect.js.map +3 -3
  291. package/dist/esm/graphs/Chart/series/StackedBar.js +15 -7
  292. package/dist/esm/graphs/Chart/series/StackedBar.js.map +2 -2
  293. package/dist/esm/graphs/Chart/styles.js +66 -35
  294. package/dist/esm/graphs/Chart/styles.js.map +2 -2
  295. package/dist/esm/graphs/constants.js +25 -10
  296. package/dist/esm/graphs/constants.js.map +2 -2
  297. package/dist/esm/index.js +19 -7
  298. package/dist/esm/index.js.map +2 -2
  299. package/dist/esm/react-desc-prop-types.js +125 -0
  300. package/dist/esm/react-desc-prop-types.js.map +7 -0
  301. package/dist/esm/typescript-testing/slot-props.js +46 -0
  302. package/dist/esm/typescript-testing/slot-props.js.map +7 -0
  303. package/dist/esm/typescript-testing/typescript-data-viz-valid.js +35 -3
  304. package/dist/esm/typescript-testing/typescript-data-viz-valid.js.map +2 -2
  305. package/dist/esm/typescript-testing/typescript-single-stacked-bar-valid.js +70 -0
  306. package/dist/esm/typescript-testing/typescript-single-stacked-bar-valid.js.map +7 -0
  307. package/dist/types/constants/index.d.ts +42 -0
  308. package/dist/types/graphs/Chart/Chart.d.ts +4 -2
  309. package/dist/types/graphs/Chart/ChartContext.d.ts +9 -11
  310. package/dist/types/graphs/Chart/SingleStackedBar/SingleStackedBar.d.ts +1 -1
  311. package/dist/types/graphs/Chart/config/chartInteractionStore.d.ts +32 -0
  312. package/dist/types/graphs/Chart/config/useChart.d.ts +9 -11
  313. package/dist/types/graphs/Chart/config/useChartDescription.d.ts +5 -0
  314. package/dist/types/graphs/Chart/config/useEntranceAnimation.d.ts +16 -0
  315. package/dist/types/graphs/Chart/config/useGetters.d.ts +1 -1
  316. package/dist/types/graphs/Chart/config/useInternalMargins.d.ts +4 -1
  317. package/dist/types/graphs/Chart/config/useKeyboardNavigation.d.ts +1 -1
  318. package/dist/types/graphs/Chart/config/useScales.d.ts +8 -2
  319. package/dist/types/graphs/Chart/config/useValidateProps.d.ts +7 -1
  320. package/dist/types/graphs/Chart/config/useValueAxisTransition.d.ts +6 -0
  321. package/dist/types/graphs/Chart/config/useWheelScroll.d.ts +2 -0
  322. package/dist/types/graphs/Chart/helpers/alignedTicks.d.ts +1 -0
  323. package/dist/types/graphs/Chart/helpers/barPath.d.ts +11 -0
  324. package/dist/types/graphs/Chart/helpers/dataInView.d.ts +6 -0
  325. package/dist/types/graphs/Chart/helpers/index.d.ts +10 -1
  326. package/dist/types/graphs/Chart/helpers/logAxis.d.ts +8 -0
  327. package/dist/types/graphs/Chart/helpers/tickRotation.d.ts +2 -0
  328. package/dist/types/graphs/Chart/helpers/timeTicks.d.ts +2 -0
  329. package/dist/types/graphs/Chart/helpers/trend.d.ts +3 -0
  330. package/dist/types/graphs/Chart/helpers/useSerieDimming.d.ts +3 -0
  331. package/dist/types/graphs/Chart/helpers/useUniqueData.d.ts +1 -1
  332. package/dist/types/graphs/Chart/helpers/useVirtualizedSeries.d.ts +1 -1
  333. package/dist/types/graphs/Chart/helpers/zeroLine.d.ts +2 -0
  334. package/dist/types/graphs/Chart/parts/Axis/Axis.d.ts +4 -1
  335. package/dist/types/graphs/Chart/parts/Axis/Tick.d.ts +1 -0
  336. package/dist/types/graphs/Chart/parts/Axis/useTickTransition.d.ts +24 -0
  337. package/dist/types/graphs/Chart/parts/HoverBand.d.ts +2 -0
  338. package/dist/types/graphs/Chart/parts/Labels/Label.d.ts +3 -0
  339. package/dist/types/graphs/Chart/parts/Scrapper/ScrapperLine.d.ts +11 -1
  340. package/dist/types/graphs/Chart/parts/Scrapper/VerticalScrapperLine.d.ts +6 -7
  341. package/dist/types/graphs/Chart/parts/ScreenReaderText.d.ts +5 -0
  342. package/dist/types/graphs/Chart/parts/TrendHighlight.d.ts +3 -2
  343. package/dist/types/graphs/Chart/parts/ZeroLine.d.ts +2 -0
  344. package/dist/types/graphs/Chart/scales/index.d.ts +10 -3
  345. package/dist/types/graphs/Chart/series/Area.d.ts +1 -1
  346. package/dist/types/graphs/Chart/series/Bars.d.ts +1 -1
  347. package/dist/types/graphs/Chart/series/HorizontalBars.d.ts +1 -1
  348. package/dist/types/graphs/Chart/series/HorizontalStackedBars.d.ts +1 -1
  349. package/dist/types/graphs/Chart/series/Line.d.ts +1 -1
  350. package/dist/types/graphs/Chart/series/Point.d.ts +3 -2
  351. package/dist/types/graphs/Chart/series/Points.d.ts +1 -1
  352. package/dist/types/graphs/Chart/series/Rect.d.ts +3 -2
  353. package/dist/types/graphs/Chart/series/StackedBar.d.ts +1 -1
  354. package/dist/types/graphs/Chart/styles.d.ts +18 -5
  355. package/dist/types/graphs/constants.d.ts +13 -1
  356. package/dist/types/index.d.ts +6 -1
  357. package/dist/types/react-desc-prop-types.d.ts +228 -0
  358. package/package.json +8 -7
  359. package/dist/cjs/graphs/Chart/DataTestIds.js.map +0 -7
  360. package/dist/cjs/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.js.map +0 -7
  361. package/dist/cjs/graphs/Chart/SingleStackedBar/exported-related/index.js.map +0 -7
  362. package/dist/cjs/graphs/Chart/SingleStackedBar/exported-related/theming.js.map +0 -7
  363. package/dist/cjs/graphs/Chart/SingleStackedBar/index.js +0 -31
  364. package/dist/cjs/graphs/Chart/SingleStackedBar/index.js.map +0 -7
  365. package/dist/cjs/graphs/Chart/SingleStackedBar/react-desc-prop-types.js +0 -51
  366. package/dist/cjs/graphs/Chart/SingleStackedBar/react-desc-prop-types.js.map +0 -7
  367. package/dist/cjs/graphs/Chart/index.js +0 -33
  368. package/dist/cjs/graphs/Chart/index.js.map +0 -7
  369. package/dist/cjs/graphs/Chart/react-desc-prop-types.js.map +0 -7
  370. package/dist/cjs/graphs/index.js +0 -31
  371. package/dist/cjs/graphs/index.js.map +0 -7
  372. package/dist/esm/graphs/Chart/DataTestIds.js +0 -10
  373. package/dist/esm/graphs/Chart/DataTestIds.js.map +0 -7
  374. package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.js +0 -8
  375. package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.js.map +0 -7
  376. package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/index.js +0 -4
  377. package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/index.js.map +0 -7
  378. package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/theming.js +0 -10
  379. package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/theming.js.map +0 -7
  380. package/dist/esm/graphs/Chart/SingleStackedBar/index.js +0 -4
  381. package/dist/esm/graphs/Chart/SingleStackedBar/index.js.map +0 -7
  382. package/dist/esm/graphs/Chart/SingleStackedBar/react-desc-prop-types.js +0 -21
  383. package/dist/esm/graphs/Chart/SingleStackedBar/react-desc-prop-types.js.map +0 -7
  384. package/dist/esm/graphs/Chart/index.js +0 -6
  385. package/dist/esm/graphs/Chart/index.js.map +0 -7
  386. package/dist/esm/graphs/Chart/react-desc-prop-types.js +0 -29
  387. package/dist/esm/graphs/Chart/react-desc-prop-types.js.map +0 -7
  388. package/dist/esm/graphs/index.js +0 -4
  389. package/dist/esm/graphs/index.js.map +0 -7
  390. package/dist/types/graphs/Chart/DataTestIds.d.ts +0 -5
  391. package/dist/types/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.d.ts +0 -3
  392. package/dist/types/graphs/Chart/SingleStackedBar/exported-related/index.d.ts +0 -2
  393. package/dist/types/graphs/Chart/SingleStackedBar/exported-related/theming.d.ts +0 -4
  394. package/dist/types/graphs/Chart/SingleStackedBar/index.d.ts +0 -3
  395. package/dist/types/graphs/Chart/SingleStackedBar/react-desc-prop-types.d.ts +0 -44
  396. package/dist/types/graphs/Chart/index.d.ts +0 -4
  397. package/dist/types/graphs/Chart/react-desc-prop-types.d.ts +0 -510
  398. package/dist/types/graphs/index.d.ts +0 -2
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var useValueAxisTransition_exports = {};
30
+ __export(useValueAxisTransition_exports, {
31
+ VALUE_AXIS_TRANSITION: () => VALUE_AXIS_TRANSITION,
32
+ useValueAxisTransition: () => useValueAxisTransition
33
+ });
34
+ module.exports = __toCommonJS(useValueAxisTransition_exports);
35
+ var React = __toESM(require("react"));
36
+ var import_react = require("react");
37
+ var import_ChartContext = require("../ChartContext.js");
38
+ var import_scales = require("../scales/index.js");
39
+ const VALUE_AXIS_TRANSITION = {
40
+ DURATION: 300,
41
+ // a quick start that settles softly, for the series and the ticks alike
42
+ EASING: "cubic-bezier(0.22, 1, 0.36, 1)",
43
+ // the attribute that marks the group of a series, and of the zero line, with the vertical axis it is read on
44
+ ATTRIBUTE: "data-value-axis"
45
+ };
46
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
47
+ const CLIP_OVERFLOW = 8;
48
+ const setTransitionClip = (seriesGroup, clipId, height) => {
49
+ let clipPath = seriesGroup.querySelector(`#${clipId}`);
50
+ if (!clipPath) {
51
+ clipPath = document.createElementNS(SVG_NAMESPACE, "clipPath");
52
+ clipPath.setAttribute("id", clipId);
53
+ clipPath.append(document.createElementNS(SVG_NAMESPACE, "rect"));
54
+ seriesGroup.prepend(clipPath);
55
+ }
56
+ const rect = clipPath.firstElementChild;
57
+ rect?.setAttribute("x", "-100000");
58
+ rect?.setAttribute("width", "200000");
59
+ rect?.setAttribute("y", String(-CLIP_OVERFLOW));
60
+ rect?.setAttribute("height", String(Math.max(0, height + CLIP_OVERFLOW * 2)));
61
+ seriesGroup.setAttribute("clip-path", `url(#${clipId})`);
62
+ };
63
+ const removeTransitionClip = (seriesGroup, clipId) => {
64
+ seriesGroup.removeAttribute("clip-path");
65
+ seriesGroup.querySelector(`#${clipId}`)?.remove();
66
+ };
67
+ const easeOut = (t) => 1 - (1 - t) ** 3;
68
+ const getAffineAt = (transition, now) => {
69
+ if (!transition) return [1, 0];
70
+ const left = 1 - easeOut(Math.min(1, (now - transition.start) / VALUE_AXIS_TRANSITION.DURATION));
71
+ return [1 + (transition.from[0] - 1) * left, transition.from[1] * left];
72
+ };
73
+ const getLinearMapping = (scale) => scale instanceof import_scales.LinearScale && !(scale instanceof import_scales.LogScale) ? { domain: scale.scale.domain(), range: scale.scale.range() } : null;
74
+ const isSameMapping = (a, b) => a.domain.every((value, index) => value === b.domain[index]) && a.range.every((value, index) => value === b.range[index]);
75
+ const getMapToPrevious = (previous, next) => {
76
+ const toPrevious = (value) => previous.range[0] + (value - previous.domain[0]) / (previous.domain[1] - previous.domain[0]) * (previous.range[1] - previous.range[0]);
77
+ const [r0, r1] = next.range;
78
+ const p0 = toPrevious(next.domain[0]);
79
+ const p1 = toPrevious(next.domain[1]);
80
+ const a = (p1 - p0) / (r1 - r0);
81
+ return [a, p0 - a * r0];
82
+ };
83
+ const useValueAxisTransition = (seriesGroup) => {
84
+ const { yScale, y2Scale, chartId, innerHeight } = (0, import_react.useContext)(import_ChartContext.ChartContext);
85
+ const clipId = `value-axis-transition-${chartId}`;
86
+ const previous = (0, import_react.useRef)({});
87
+ const running = (0, import_react.useRef)({});
88
+ (0, import_react.useLayoutEffect)(() => {
89
+ const scales = { y: yScale, y2: y2Scale };
90
+ const prefersReducedMotion = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
91
+ ["y", "y2"].forEach((axis) => {
92
+ const next = getLinearMapping(scales[axis]);
93
+ const before = previous.current[axis];
94
+ previous.current[axis] = next;
95
+ if (!seriesGroup || !before || !next || prefersReducedMotion) return;
96
+ if (isSameMapping(before, next) || before.range.some((value, index) => value !== next.range[index])) return;
97
+ const now = performance.now();
98
+ const [ta, tb] = getAffineAt(running.current[axis], now);
99
+ const [ma, mb] = getMapToPrevious(before, next);
100
+ const from = [ta * ma, ta * mb + tb];
101
+ cancelAnimationFrame(running.current[axis]?.frame ?? 0);
102
+ const getGroups = () => seriesGroup.querySelectorAll(`[${VALUE_AXIS_TRANSITION.ATTRIBUTE}="${axis}"]`);
103
+ const step = () => {
104
+ const time = performance.now();
105
+ const transition = running.current[axis];
106
+ const [a, b] = getAffineAt(transition, time);
107
+ const isDone = !transition || time - transition.start >= VALUE_AXIS_TRANSITION.DURATION;
108
+ getGroups().forEach(
109
+ (group) => isDone ? group.removeAttribute("transform") : group.setAttribute("transform", `matrix(1 0 0 ${a} 0 ${b})`)
110
+ );
111
+ if (isDone) delete running.current[axis];
112
+ else if (transition) transition.frame = requestAnimationFrame(step);
113
+ if (!Object.keys(running.current).length) removeTransitionClip(seriesGroup, clipId);
114
+ };
115
+ running.current[axis] = { from, start: now, frame: 0 };
116
+ setTransitionClip(seriesGroup, clipId, innerHeight);
117
+ step();
118
+ });
119
+ }, [clipId, innerHeight, seriesGroup, y2Scale, yScale]);
120
+ (0, import_react.useEffect)(
121
+ () => () => {
122
+ Object.values(running.current).forEach((transition) => cancelAnimationFrame(transition?.frame ?? 0));
123
+ if (seriesGroup) removeTransitionClip(seriesGroup, clipId);
124
+ },
125
+ [clipId, seriesGroup]
126
+ );
127
+ };
128
+ //# sourceMappingURL=useValueAxisTransition.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/graphs/Chart/config/useValueAxisTransition.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { useContext, useEffect, useLayoutEffect, useRef } from 'react';\nimport { ChartContext } from '../ChartContext.js';\nimport { LinearScale, LogScale, type ScaleT } from '../scales/index.js';\n\nexport const VALUE_AXIS_TRANSITION = {\n DURATION: 300,\n // a quick start that settles softly, for the series and the ticks alike\n EASING: 'cubic-bezier(0.22, 1, 0.36, 1)',\n // the attribute that marks the group of a series, and of the zero line, with the vertical axis it is read on\n ATTRIBUTE: 'data-value-axis',\n};\n\ntype ValueAxisT = 'y' | 'y2';\n// an affine map of the vertical position: y' = a * y + b\ntype AffineT = [number, number];\n\ninterface TransitionT {\n from: AffineT;\n start: number;\n frame: number;\n}\n\nconst SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n// how far the marks may reach out of the plot during a transition: their markers and their focus rings\nconst CLIP_OVERFLOW = 8;\n\n// While a transition draws the marks with the previous domain, the ones out of it (a series shown again from the\n// legend, with values above the previous top) would reach out of the plot, over the legend: the series are clipped to\n// the height of the plot meanwhile, with room for the markers. Not otherwise, as the markers and the focus rings at the\n// edges reach out of the plot on purpose. On the group of the series, which the transform does not move.\nconst setTransitionClip = (seriesGroup: SVGGElement, clipId: string, height: number) => {\n let clipPath = seriesGroup.querySelector(`#${clipId}`);\n if (!clipPath) {\n clipPath = document.createElementNS(SVG_NAMESPACE, 'clipPath');\n clipPath.setAttribute('id', clipId);\n clipPath.append(document.createElementNS(SVG_NAMESPACE, 'rect'));\n seriesGroup.prepend(clipPath);\n }\n const rect = clipPath.firstElementChild;\n // as wide as a scrollable plot can be: the clip is on the height only\n rect?.setAttribute('x', '-100000');\n rect?.setAttribute('width', '200000');\n rect?.setAttribute('y', String(-CLIP_OVERFLOW));\n rect?.setAttribute('height', String(Math.max(0, height + CLIP_OVERFLOW * 2)));\n seriesGroup.setAttribute('clip-path', `url(#${clipId})`);\n};\n\nconst removeTransitionClip = (seriesGroup: SVGGElement, clipId: string) => {\n seriesGroup.removeAttribute('clip-path');\n seriesGroup.querySelector(`#${clipId}`)?.remove();\n};\n\n// a quick start that settles softly\nconst easeOut = (t: number) => 1 - (1 - t) ** 3;\n\n// the transform a transition shows at a time: from its first map to none\nconst getAffineAt = (transition: TransitionT | undefined, now: number): AffineT => {\n if (!transition) return [1, 0];\n const left = 1 - easeOut(Math.min(1, (now - transition.start) / VALUE_AXIS_TRANSITION.DURATION));\n return [1 + (transition.from[0] - 1) * left, transition.from[1] * left];\n};\n\n// the domain and the range of a linear axis; a log axis does not map from one domain to another with an affine map\nconst getLinearMapping = (scale: ScaleT | null) =>\n scale instanceof LinearScale && !(scale instanceof LogScale)\n ? { domain: scale.scale.domain(), range: scale.scale.range() }\n : null;\n\ntype MappingT = NonNullable<ReturnType<typeof getLinearMapping>>;\n\nconst isSameMapping = (a: MappingT, b: MappingT) =>\n a.domain.every((value, index) => value === b.domain[index]) &&\n a.range.every((value, index) => value === b.range[index]);\n\n// the map from the position of a value with the new domain to its position with the previous one\nconst getMapToPrevious = (previous: MappingT, next: MappingT): AffineT => {\n const toPrevious = (value: number) =>\n previous.range[0] +\n ((value - previous.domain[0]) / (previous.domain[1] - previous.domain[0])) *\n (previous.range[1] - previous.range[0]);\n const [r0, r1] = next.range;\n const p0 = toPrevious(next.domain[0]);\n const p1 = toPrevious(next.domain[1]);\n const a = (p1 - p0) / (r1 - r0);\n return [a, p0 - a * r0];\n};\n\n// When the domain of a vertical axis changes (new data, a series hidden from the legend, or the view of a scrollable\n// chart, see fitToView), every mark it holds moved to its new height at once. The chart renders once with the new\n// domain; the series of the axis are then drawn where they were with the previous one, through an affine transform of\n// their groups, which eases to none (FLIP), as its ticks slide to their new places (see useTickTransition). No render\n// runs per frame: the transform attribute of a few groups. A change during a transition starts from where the marks\n// are, so nothing jumps. Skipped when the user prefers reduced motion, for a log axis, and when the size of the plot\n// changes.\nexport const useValueAxisTransition = (seriesGroup: SVGGElement | null) => {\n const { yScale, y2Scale, chartId, innerHeight } = useContext(ChartContext);\n const clipId = `value-axis-transition-${chartId}`;\n const previous = useRef<Partial<Record<ValueAxisT, MappingT | null>>>({});\n const running = useRef<Partial<Record<ValueAxisT, TransitionT>>>({});\n\n useLayoutEffect(() => {\n const scales: Record<ValueAxisT, ScaleT | null> = { y: yScale, y2: y2Scale };\n const prefersReducedMotion = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches;\n (['y', 'y2'] as const).forEach((axis) => {\n const next = getLinearMapping(scales[axis]);\n const before = previous.current[axis];\n previous.current[axis] = next;\n if (!seriesGroup || !before || !next || prefersReducedMotion) return;\n if (isSameMapping(before, next) || before.range.some((value, index) => value !== next.range[index])) return;\n const now = performance.now();\n const [ta, tb] = getAffineAt(running.current[axis], now);\n const [ma, mb] = getMapToPrevious(before, next);\n const from: AffineT = [ta * ma, ta * mb + tb];\n cancelAnimationFrame(running.current[axis]?.frame ?? 0);\n // read every frame: the groups of the series that come into the view mount during the transition\n const getGroups = () =>\n seriesGroup.querySelectorAll<SVGGElement>(`[${VALUE_AXIS_TRANSITION.ATTRIBUTE}=\"${axis}\"]`);\n const step = () => {\n const time = performance.now();\n const transition = running.current[axis];\n const [a, b] = getAffineAt(transition, time);\n const isDone = !transition || time - transition.start >= VALUE_AXIS_TRANSITION.DURATION;\n getGroups().forEach((group) =>\n isDone ? group.removeAttribute('transform') : group.setAttribute('transform', `matrix(1 0 0 ${a} 0 ${b})`),\n );\n if (isDone) delete running.current[axis];\n else if (transition) transition.frame = requestAnimationFrame(step);\n if (!Object.keys(running.current).length) removeTransitionClip(seriesGroup, clipId);\n };\n running.current[axis] = { from, start: now, frame: 0 };\n setTransitionClip(seriesGroup, clipId, innerHeight);\n // the first frame before the paint, so the marks never show at their new height first\n step();\n });\n }, [clipId, innerHeight, seriesGroup, y2Scale, yScale]);\n\n useEffect(\n () => () => {\n Object.values(running.current).forEach((transition) => cancelAnimationFrame(transition?.frame ?? 0));\n if (seriesGroup) removeTransitionClip(seriesGroup, clipId);\n },\n [clipId, seriesGroup],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA+D;AAC/D,0BAA6B;AAC7B,oBAAmD;AAE5C,MAAM,wBAAwB;AAAA,EACnC,UAAU;AAAA;AAAA,EAEV,QAAQ;AAAA;AAAA,EAER,WAAW;AACb;AAYA,MAAM,gBAAgB;AAEtB,MAAM,gBAAgB;AAMtB,MAAM,oBAAoB,CAAC,aAA0B,QAAgB,WAAmB;AACtF,MAAI,WAAW,YAAY,cAAc,IAAI,MAAM,EAAE;AACrD,MAAI,CAAC,UAAU;AACb,eAAW,SAAS,gBAAgB,eAAe,UAAU;AAC7D,aAAS,aAAa,MAAM,MAAM;AAClC,aAAS,OAAO,SAAS,gBAAgB,eAAe,MAAM,CAAC;AAC/D,gBAAY,QAAQ,QAAQ;AAAA,EAC9B;AACA,QAAM,OAAO,SAAS;AAEtB,QAAM,aAAa,KAAK,SAAS;AACjC,QAAM,aAAa,SAAS,QAAQ;AACpC,QAAM,aAAa,KAAK,OAAO,CAAC,aAAa,CAAC;AAC9C,QAAM,aAAa,UAAU,OAAO,KAAK,IAAI,GAAG,SAAS,gBAAgB,CAAC,CAAC,CAAC;AAC5E,cAAY,aAAa,aAAa,QAAQ,MAAM,GAAG;AACzD;AAEA,MAAM,uBAAuB,CAAC,aAA0B,WAAmB;AACzE,cAAY,gBAAgB,WAAW;AACvC,cAAY,cAAc,IAAI,MAAM,EAAE,GAAG,OAAO;AAClD;AAGA,MAAM,UAAU,CAAC,MAAc,KAAK,IAAI,MAAM;AAG9C,MAAM,cAAc,CAAC,YAAqC,QAAyB;AACjF,MAAI,CAAC,WAAY,QAAO,CAAC,GAAG,CAAC;AAC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,sBAAqB,aAAa,MAAM;AAAA,MACpF;AACA,cAAQ,QAAQ,IAAI,IAAI,EAAE,MAAM,OAAO,KAAK,OAAO,EAAE;AACrD,wBAAkB,aAAa,QAAQ,WAAW;AAElD,WAAK;AAAA,IACP,CAAC;AAAA,EACH,GAAG,CAAC,QAAQ,aAAa,aAAa,SAAS,MAAM,CAAC;AAEtD;AAAA,IACE,MAAM,MAAM;AACV,aAAO,OAAO,QAAQ,OAAO,EAAE,QAAQ,CAAC,eAAe,qBAAqB,YAAY,SAAS,CAAC,CAAC;AACnG,UAAI,YAAa,sBAAqB,aAAa,MAAM;AAAA,IAC3D;AAAA,IACA,CAAC,QAAQ,WAAW;AAAA,EACtB;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var useWheelScroll_exports = {};
30
+ __export(useWheelScroll_exports, {
31
+ SCROLL_IDLE_DELAY: () => SCROLL_IDLE_DELAY,
32
+ useWheelScroll: () => useWheelScroll
33
+ });
34
+ module.exports = __toCommonJS(useWheelScroll_exports);
35
+ var React = __toESM(require("react"));
36
+ var import_react = require("react");
37
+ var import_ChartContext = require("../ChartContext.js");
38
+ const LINE_HEIGHT = 16;
39
+ const SCROLL_IDLE_DELAY = 150;
40
+ const getWheelDelta = (e, isHorizontal, pageSize) => {
41
+ let delta = 0;
42
+ if (isHorizontal) {
43
+ if (e.deltaX !== 0) delta = e.deltaX;
44
+ else if (e.shiftKey) delta = e.deltaY;
45
+ } else delta = e.deltaY;
46
+ if (e.deltaMode === 1) return delta * LINE_HEIGHT;
47
+ if (e.deltaMode === 2) return delta * pageSize;
48
+ return delta;
49
+ };
50
+ const useWheelScroll = () => {
51
+ const {
52
+ containerRef,
53
+ containerRatio,
54
+ innerWidth,
55
+ innerHeight,
56
+ setXScrollbarPosition,
57
+ interactionStore,
58
+ lastScrollbarPosition,
59
+ setScrapperPosX,
60
+ setScrapperPosY,
61
+ props: { xScroll, yScroll }
62
+ } = (0, import_react.useContext)(import_ChartContext.ChartContext);
63
+ const idleTimer = (0, import_react.useRef)();
64
+ (0, import_react.useEffect)(
65
+ () => () => {
66
+ clearTimeout(idleTimer.current);
67
+ interactionStore.setIsScrolling(false);
68
+ },
69
+ [interactionStore]
70
+ );
71
+ (0, import_react.useEffect)(() => {
72
+ if (!containerRef || !(xScroll || yScroll) || containerRatio <= 1) return () => {
73
+ };
74
+ const observeTarget = containerRef;
75
+ const isHorizontal = Boolean(xScroll);
76
+ const viewportSize = isHorizontal ? innerWidth : innerHeight;
77
+ const maxPosition = viewportSize - viewportSize / containerRatio;
78
+ const handleWheel = (e) => {
79
+ const delta = getWheelDelta(e, isHorizontal, viewportSize);
80
+ if (delta === 0) return;
81
+ const { xScrollbarPosition } = interactionStore.getState();
82
+ const nextPosition = Math.min(maxPosition, Math.max(0, xScrollbarPosition + delta / containerRatio));
83
+ if (nextPosition === xScrollbarPosition) return;
84
+ e.preventDefault();
85
+ setScrapperPosX(-1);
86
+ setScrapperPosY(-1);
87
+ lastScrollbarPosition.current = nextPosition;
88
+ setXScrollbarPosition(nextPosition);
89
+ interactionStore.setIsScrolling(true);
90
+ clearTimeout(idleTimer.current);
91
+ idleTimer.current = setTimeout(() => interactionStore.setIsScrolling(false), SCROLL_IDLE_DELAY);
92
+ };
93
+ observeTarget.addEventListener("wheel", handleWheel, { passive: false });
94
+ return () => {
95
+ observeTarget.removeEventListener("wheel", handleWheel);
96
+ };
97
+ }, [
98
+ containerRef,
99
+ containerRatio,
100
+ innerHeight,
101
+ innerWidth,
102
+ interactionStore,
103
+ lastScrollbarPosition,
104
+ setScrapperPosX,
105
+ setScrapperPosY,
106
+ setXScrollbarPosition,
107
+ xScroll,
108
+ yScroll
109
+ ]);
110
+ };
111
+ //# sourceMappingURL=useWheelScroll.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/graphs/Chart/config/useWheelScroll.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { useContext, useEffect, useRef } from 'react';\nimport { ChartContext } from '../ChartContext.js';\n\n// pixels per line and per page for the wheel events that report lines (Firefox) or pages instead of pixels\nconst LINE_HEIGHT = 16;\n// how long after the last wheel event the scroll counts as stopped, and the scrapper shows again\nexport const SCROLL_IDLE_DELAY = 150;\n\nconst getWheelDelta = (e: WheelEvent, isHorizontal: boolean, pageSize: number) => {\n // a horizontally scrollable chart follows the horizontal intent only (a trackpad swipe, or Shift + wheel), so the\n // plain wheel keeps scrolling the page; a vertically scrollable chart follows the wheel\n let delta = 0;\n if (isHorizontal) {\n if (e.deltaX !== 0) delta = e.deltaX;\n else if (e.shiftKey) delta = e.deltaY;\n } else delta = e.deltaY;\n if (e.deltaMode === 1) return delta * LINE_HEIGHT;\n if (e.deltaMode === 2) return delta * pageSize;\n return delta;\n};\n\n// Scrolls a scrollable chart (xScroll / yScroll) with the mouse wheel and the trackpad. When the chart is already at\n// the start or the end in that direction, the event is left alone and the page scrolls, as with any nested scroll\n// container. A native listener because React registers onWheel as passive: from there the page would always scroll\n// along with the chart.\nexport const useWheelScroll = () => {\n const {\n containerRef,\n containerRatio,\n innerWidth,\n innerHeight,\n setXScrollbarPosition,\n interactionStore,\n lastScrollbarPosition,\n setScrapperPosX,\n setScrapperPosY,\n props: { xScroll, yScroll },\n } = useContext(ChartContext);\n\n // the scroll counts as stopped a moment after the last wheel event; the timer outlives the listener, which is added\n // again when the size of the plot changes (the axes of a scrollable chart follow the view, and their labels resize it)\n const idleTimer = useRef<ReturnType<typeof setTimeout>>();\n useEffect(\n () => () => {\n clearTimeout(idleTimer.current);\n interactionStore.setIsScrolling(false);\n },\n [interactionStore],\n );\n\n useEffect(() => {\n if (!containerRef || !(xScroll || yScroll) || containerRatio <= 1) return () => {};\n const observeTarget = containerRef;\n const isHorizontal = Boolean(xScroll);\n const viewportSize = isHorizontal ? innerWidth : innerHeight;\n // the scrollbar position is the thumb offset in the viewport; the content moves containerRatio times as much\n const maxPosition = viewportSize - viewportSize / containerRatio;\n\n const handleWheel = (e: WheelEvent) => {\n const delta = getWheelDelta(e, isHorizontal, viewportSize);\n if (delta === 0) return;\n const { xScrollbarPosition } = interactionStore.getState();\n const nextPosition = Math.min(maxPosition, Math.max(0, xScrollbarPosition + delta / containerRatio));\n if (nextPosition === xScrollbarPosition) return;\n e.preventDefault();\n // the guide line points at the value that was under the pointer before the content moved\n setScrapperPosX(-1);\n setScrapperPosY(-1);\n lastScrollbarPosition.current = nextPosition;\n setXScrollbarPosition(nextPosition);\n // the scrapper hides while the wheel scrolls: the content moving under the pointer changed it on every step\n interactionStore.setIsScrolling(true);\n clearTimeout(idleTimer.current);\n idleTimer.current = setTimeout(() => interactionStore.setIsScrolling(false), SCROLL_IDLE_DELAY);\n };\n\n observeTarget.addEventListener('wheel', handleWheel, { passive: false });\n return () => {\n observeTarget.removeEventListener('wheel', handleWheel);\n };\n }, [\n containerRef,\n containerRatio,\n innerHeight,\n innerWidth,\n interactionStore,\n lastScrollbarPosition,\n setScrapperPosX,\n setScrapperPosY,\n setXScrollbarPosition,\n xScroll,\n yScroll,\n ]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8C;AAC9C,0BAA6B;AAG7B,MAAM,cAAc;AAEb,MAAM,oBAAoB;AAEjC,MAAM,gBAAgB,CAAC,GAAe,cAAuB,aAAqB;AAGhF,MAAI,QAAQ;AACZ,MAAI,cAAc;AAChB,QAAI,EAAE,WAAW,EAAG,SAAQ,EAAE;AAAA,aACrB,EAAE,SAAU,SAAQ,EAAE;AAAA,EACjC,MAAO,SAAQ,EAAE;AACjB,MAAI,EAAE,cAAc,EAAG,QAAO,QAAQ;AACtC,MAAI,EAAE,cAAc,EAAG,QAAO,QAAQ;AACtC,SAAO;AACT;AAMO,MAAM,iBAAiB,MAAM;AAClC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,SAAS,QAAQ;AAAA,EAC5B,QAAI,yBAAW,gCAAY;AAI3B,QAAM,gBAAY,qBAAsC;AACxD;AAAA,IACE,MAAM,MAAM;AACV,mBAAa,UAAU,OAAO;AAC9B,uBAAiB,eAAe,KAAK;AAAA,IACvC;AAAA,IACA,CAAC,gBAAgB;AAAA,EACnB;AAEA,8BAAU,MAAM;AACd,QAAI,CAAC,gBAAgB,EAAE,WAAW,YAAY,kBAAkB,EAAG,QAAO,MAAM;AAAA,IAAC;AACjF,UAAM,gBAAgB;AACtB,UAAM,eAAe,QAAQ,OAAO;AACpC,UAAM,eAAe,eAAe,aAAa;AAEjD,UAAM,cAAc,eAAe,eAAe;AAElD,UAAM,cAAc,CAAC,MAAkB;AACrC,YAAM,QAAQ,cAAc,GAAG,cAAc,YAAY;AACzD,UAAI,UAAU,EAAG;AACjB,YAAM,EAAE,mBAAmB,IAAI,iBAAiB,SAAS;AACzD,YAAM,eAAe,KAAK,IAAI,aAAa,KAAK,IAAI,GAAG,qBAAqB,QAAQ,cAAc,CAAC;AACnG,UAAI,iBAAiB,mBAAoB;AACzC,QAAE,eAAe;AAEjB,sBAAgB,EAAE;AAClB,sBAAgB,EAAE;AAClB,4BAAsB,UAAU;AAChC,4BAAsB,YAAY;AAElC,uBAAiB,eAAe,IAAI;AACpC,mBAAa,UAAU,OAAO;AAC9B,gBAAU,UAAU,WAAW,MAAM,iBAAiB,eAAe,KAAK,GAAG,iBAAiB;AAAA,IAChG;AAEA,kBAAc,iBAAiB,SAAS,aAAa,EAAE,SAAS,MAAM,CAAC;AACvE,WAAO,MAAM;AACX,oBAAc,oBAAoB,SAAS,WAAW;AAAA,IACxD;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var alignedTicks_exports = {};
30
+ __export(alignedTicks_exports, {
31
+ getAlignedTicks: () => getAlignedTicks
32
+ });
33
+ module.exports = __toCommonJS(alignedTicks_exports);
34
+ var React = __toESM(require("react"));
35
+ const STEP_MULTIPLES = [1, 2, 2.5, 5];
36
+ const SEARCHED_POWERS = 4;
37
+ const tickAt = (k, multiple, power) => power < 0 ? k * multiple / 10 ** -power : k * multiple * 10 ** power;
38
+ const getSteps = (lowest) => {
39
+ const firstPower = Math.floor(Math.log10(lowest));
40
+ const powers = Array.from({ length: SEARCHED_POWERS }, (_, index) => firstPower + index);
41
+ return powers.flatMap((power) => STEP_MULTIPLES.map((multiple) => ({ multiple, power }))).filter(({ multiple, power }) => multiple * 10 ** power >= lowest);
42
+ };
43
+ const isValidRange = (intervals, low, high) => intervals >= 1 && Number.isFinite(low) && Number.isFinite(high) && high > low;
44
+ const getAlignedTicks = (intervals, [low, high], zeroIndex) => {
45
+ if (!isValidRange(intervals, low, high)) return null;
46
+ const zero = zeroIndex !== null && zeroIndex > 0 && zeroIndex < intervals && low < 0 && high > 0 ? zeroIndex : null;
47
+ const lowest = zero !== null ? Math.max(-low / zero, high / (intervals - zero)) : (high - low) / intervals;
48
+ const firstTick = (step) => zero !== null ? -zero : Math.floor(low / step);
49
+ const fitting = getSteps(lowest).find(
50
+ ({ multiple, power }) => tickAt(firstTick(multiple * 10 ** power) + intervals, multiple, power) >= high
51
+ );
52
+ if (!fitting) return null;
53
+ const first = firstTick(fitting.multiple * 10 ** fitting.power);
54
+ return Array.from({ length: intervals + 1 }, (_, index) => tickAt(first + index, fitting.multiple, fitting.power));
55
+ };
56
+ //# sourceMappingURL=alignedTicks.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/graphs/Chart/helpers/alignedTicks.ts", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["// the multiples of a power of ten an aligned axis steps by, the ones of Highcharts: 2.5 keeps an axis from doubling its\n// span when 2 is too short, at the cost of a decimal on a small axis (0, 2.5, 5, 7.5, 10)\nconst STEP_MULTIPLES = [1, 2, 2.5, 5];\nconst SEARCHED_POWERS = 4;\n\n// the tick k steps of `step` away from 0: a decimal step divides by its power of ten, so 0.1 * 3 reads 0.3\nconst tickAt = (k: number, multiple: number, power: number) =>\n power < 0 ? (k * multiple) / 10 ** -power : k * multiple * 10 ** power;\n\nconst getSteps = (lowest: number) => {\n const firstPower = Math.floor(Math.log10(lowest));\n const powers = Array.from({ length: SEARCHED_POWERS }, (_, index) => firstPower + index);\n return powers\n .flatMap((power) => STEP_MULTIPLES.map((multiple) => ({ multiple, power })))\n .filter(({ multiple, power }) => multiple * 10 ** power >= lowest);\n};\n\nconst isValidRange = (intervals: number, low: number, high: number) =>\n intervals >= 1 && Number.isFinite(low) && Number.isFinite(high) && high > low;\n\n// The ticks of an axis that spans `intervals` intervals of a nice step and holds the values from `low` to `high`, with\n// the smallest step that fits, so the axis wastes the least of the plot. When `zeroIndex` is given and the values cross\n// zero, 0 is the tick at that index: two axes that cross zero share the height of their zero. Null when no step fits.\nexport const getAlignedTicks = (\n intervals: number,\n [low, high]: [number, number],\n zeroIndex: number | null,\n): number[] | null => {\n if (!isValidRange(intervals, low, high)) return null;\n const zero = zeroIndex !== null && zeroIndex > 0 && zeroIndex < intervals && low < 0 && high > 0 ? zeroIndex : null;\n const lowest = zero !== null ? Math.max(-low / zero, high / (intervals - zero)) : (high - low) / intervals;\n const firstTick = (step: number) => (zero !== null ? -zero : Math.floor(low / step));\n const fitting = getSteps(lowest).find(\n ({ multiple, power }) => tickAt(firstTick(multiple * 10 ** power) + intervals, multiple, power) >= high,\n );\n if (!fitting) return null;\n const first = firstTick(fitting.multiple * 10 ** fitting.power);\n return Array.from({ length: intervals + 1 }, (_, index) => tickAt(first + index, fitting.multiple, fitting.power));\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,MAAM,iBAAiB,CAAC,GAAG,GAAG,KAAK,CAAC;AACpC,MAAM,kBAAkB;AAGxB,MAAM,SAAS,CAAC,GAAW,UAAkB,UAC3C,QAAQ,IAAK,IAAI,WAAY,MAAM,CAAC,QAAQ,IAAI,WAAW,MAAM;AAEnE,MAAM,WAAW,CAAC,WAAmB;AACnC,QAAM,aAAa,KAAK,MAAM,KAAK,MAAM,MAAM,CAAC;AAChD,QAAM,SAAS,MAAM,KAAK,EAAE,QAAQ,gBAAgB,GAAG,CAAC,GAAG,UAAU,aAAa,KAAK;AACvF,SAAO,OACJ,QAAQ,CAAC,UAAU,eAAe,IAAI,CAAC,cAAc,EAAE,UAAU,MAAM,EAAE,CAAC,EAC1E,OAAO,CAAC,EAAE,UAAU,MAAM,MAAM,WAAW,MAAM,SAAS,MAAM;AACrE;AAEA,MAAM,eAAe,CAAC,WAAmB,KAAa,SACpD,aAAa,KAAK,OAAO,SAAS,GAAG,KAAK,OAAO,SAAS,IAAI,KAAK,OAAO;AAKrE,MAAM,kBAAkB,CAC7B,WACA,CAAC,KAAK,IAAI,GACV,cACoB;AACpB,MAAI,CAAC,aAAa,WAAW,KAAK,IAAI,EAAG,QAAO;AAChD,QAAM,OAAO,cAAc,QAAQ,YAAY,KAAK,YAAY,aAAa,MAAM,KAAK,OAAO,IAAI,YAAY;AAC/G,QAAM,SAAS,SAAS,OAAO,KAAK,IAAI,CAAC,MAAM,MAAM,QAAQ,YAAY,KAAK,KAAK,OAAO,OAAO;AACjG,QAAM,YAAY,CAAC,SAAkB,SAAS,OAAO,CAAC,OAAO,KAAK,MAAM,MAAM,IAAI;AAClF,QAAM,UAAU,SAAS,MAAM,EAAE;AAAA,IAC/B,CAAC,EAAE,UAAU,MAAM,MAAM,OAAO,UAAU,WAAW,MAAM,KAAK,IAAI,WAAW,UAAU,KAAK,KAAK;AAAA,EACrG;AACA,MAAI,CAAC,QAAS,QAAO;AACrB,QAAM,QAAQ,UAAU,QAAQ,WAAW,MAAM,QAAQ,KAAK;AAC9D,SAAO,MAAM,KAAK,EAAE,QAAQ,YAAY,EAAE,GAAG,CAAC,GAAG,UAAU,OAAO,QAAQ,OAAO,QAAQ,UAAU,QAAQ,KAAK,CAAC;AACnH;",
6
+ "names": []
7
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var barPath_exports = {};
30
+ __export(barPath_exports, {
31
+ getBarPath: () => getBarPath
32
+ });
33
+ module.exports = __toCommonJS(barPath_exports);
34
+ var React = __toESM(require("react"));
35
+ const getBarPath = ({ x, y, width, height, radius, dataEnd }) => {
36
+ if (!(width > 0) || !(height > 0)) return "";
37
+ const right = x + width;
38
+ const bottom = y + height;
39
+ if (dataEnd === "top" || dataEnd === "bottom") {
40
+ const r = Math.max(0, Math.min(radius, width / 2, height));
41
+ if (dataEnd === "top")
42
+ return `M${x},${bottom}V${y + r}A${r},${r} 0 0 1 ${x + r},${y}H${right - r}A${r},${r} 0 0 1 ${right},${y + r}V${bottom}Z`;
43
+ return `M${x},${y}H${right}V${bottom - r}A${r},${r} 0 0 1 ${right - r},${bottom}H${x + r}A${r},${r} 0 0 1 ${x},${bottom - r}Z`;
44
+ }
45
+ if (dataEnd === "left" || dataEnd === "right") {
46
+ const r = Math.max(0, Math.min(radius, height / 2, width));
47
+ if (dataEnd === "right")
48
+ return `M${x},${y}H${right - r}A${r},${r} 0 0 1 ${right},${y + r}V${bottom - r}A${r},${r} 0 0 1 ${right - r},${bottom}H${x}Z`;
49
+ return `M${right},${y}V${bottom}H${x + r}A${r},${r} 0 0 1 ${x},${bottom - r}V${y + r}A${r},${r} 0 0 1 ${x + r},${y}Z`;
50
+ }
51
+ return `M${x},${y}H${right}V${bottom}H${x}Z`;
52
+ };
53
+ //# sourceMappingURL=barPath.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/graphs/Chart/helpers/barPath.ts", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["export type BarDataEndT = 'top' | 'bottom' | 'left' | 'right' | 'none';\n\ninterface BarGeometryT {\n x: number;\n y: number;\n width: number;\n height: number;\n radius: number;\n dataEnd: BarDataEndT;\n}\n\n// The path of a bar whose data end is rounded and whose baseline end stays square, so the bar keeps growing from\n// its axis. 'none' draws a plain rectangle (the inner segments of a stack).\nexport const getBarPath = ({ x, y, width, height, radius, dataEnd }: BarGeometryT): string => {\n if (!(width > 0) || !(height > 0)) return '';\n const right = x + width;\n const bottom = y + height;\n if (dataEnd === 'top' || dataEnd === 'bottom') {\n const r = Math.max(0, Math.min(radius, width / 2, height));\n if (dataEnd === 'top')\n return `M${x},${bottom}V${y + r}A${r},${r} 0 0 1 ${x + r},${y}H${right - r}A${r},${r} 0 0 1 ${right},${y + r}V${bottom}Z`;\n return `M${x},${y}H${right}V${bottom - r}A${r},${r} 0 0 1 ${right - r},${bottom}H${x + r}A${r},${r} 0 0 1 ${x},${bottom - r}Z`;\n }\n if (dataEnd === 'left' || dataEnd === 'right') {\n const r = Math.max(0, Math.min(radius, height / 2, width));\n if (dataEnd === 'right')\n return `M${x},${y}H${right - r}A${r},${r} 0 0 1 ${right},${y + r}V${bottom - r}A${r},${r} 0 0 1 ${right - r},${bottom}H${x}Z`;\n return `M${right},${y}V${bottom}H${x + r}A${r},${r} 0 0 1 ${x},${bottom - r}V${y + r}A${r},${r} 0 0 1 ${x + r},${y}Z`;\n }\n return `M${x},${y}H${right}V${bottom}H${x}Z`;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADahB,MAAM,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,QAA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AC,IAAI,KAAK,IAAI,MAAM,IAAI,CAAC;AAC3C;",
6
+ "names": []
7
+ }
@@ -26,34 +26,33 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var react_desc_prop_types_exports = {};
30
- __export(react_desc_prop_types_exports, {
31
- defaultProps: () => defaultProps,
32
- propTypes: () => propTypes
29
+ var dataInView_exports = {};
30
+ __export(dataInView_exports, {
31
+ fitsToView: () => fitsToView,
32
+ getDataInView: () => getDataInView
33
33
  });
34
- module.exports = __toCommonJS(react_desc_prop_types_exports);
34
+ module.exports = __toCommonJS(dataInView_exports);
35
35
  var React = __toESM(require("react"));
36
- var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
37
- const defaultProps = {
38
- series: [
39
- {
40
- name: "1",
41
- data: [0],
42
- color: "grey-100",
43
- type: "bar"
36
+ const fitsToView = (axis, xScroll) => Boolean(xScroll && axis && axis.fitToView !== false);
37
+ const getDataInView = (data, getX, [start, end]) => {
38
+ const positions = /* @__PURE__ */ new Set();
39
+ const dataInView = data.map((serie) => {
40
+ const xs = serie.data.map(getX);
41
+ const inView = xs.flatMap((x, index) => x !== void 0 && x >= start && x <= end ? [index] : []);
42
+ let from;
43
+ let to;
44
+ if (inView.length) {
45
+ from = Math.max(0, inView[0] - 1);
46
+ to = Math.min(xs.length - 1, inView[inView.length - 1] + 1);
47
+ } else {
48
+ const after = xs.findIndex((x) => x !== void 0 && x > end);
49
+ from = Math.max(0, (after === -1 ? xs.length : after) - 1);
50
+ to = after === -1 ? xs.length - 1 : after;
44
51
  }
45
- ]
52
+ const points = serie.data.slice(from, to + 1);
53
+ points.forEach((datum) => positions.add(datum.position));
54
+ return { ...serie, data: points };
55
+ });
56
+ return { data: dataInView, positions };
46
57
  };
47
- const propTypes = {
48
- ...import_ds_props_helpers.globalAttributesPropTypes,
49
- height: import_ds_props_helpers.PropTypes.number.isRequired.description("height").defaultValue(""),
50
- width: import_ds_props_helpers.PropTypes.number.isRequired.description("height").defaultValue(""),
51
- margin: import_ds_props_helpers.PropTypes.shape({
52
- top: import_ds_props_helpers.PropTypes.number,
53
- bottom: import_ds_props_helpers.PropTypes.number,
54
- left: import_ds_props_helpers.PropTypes.number,
55
- right: import_ds_props_helpers.PropTypes.number
56
- }).isRequired.description("margin").defaultValue(""),
57
- series: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.object).description("yValue").defaultValue("")
58
- };
59
- //# sourceMappingURL=react-desc-prop-types.js.map
58
+ //# sourceMappingURL=dataInView.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/graphs/Chart/helpers/dataInView.ts", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import type { DSChartT } from '../../../react-desc-prop-types.js';\n\n// Whether a vertical axis follows the view (fitToView): on a horizontally scrollable chart, unless it sets fitToView\n// false. On by default, as a scrollable chart shows a part of its data at a time, and the domain of the whole data\n// flattened the stretches of small values.\nexport const fitsToView = (axis: DSChartT.AxisT | undefined, xScroll: boolean | undefined) =>\n Boolean(xScroll && axis && axis.fitToView !== false);\n\n// The data of a horizontally scrollable chart in view, for the vertical axes with fitToView: of each series, the\n// points between the edges of the view, and the first point out of it on each side, as the line from it crosses the\n// edge (a value out of the domain would draw the line out of the plot). The series keep the order of their points.\nexport const getDataInView = (\n data: DSChartT.InternalData,\n getX: (datum: DSChartT.InternalDatum) => number | undefined,\n [start, end]: [number, number],\n): { data: DSChartT.InternalData; positions: Set<number> } => {\n const positions = new Set<number>();\n const dataInView = data.map((serie) => {\n const xs = serie.data.map(getX);\n const inView = xs.flatMap((x, index) => (x !== undefined && x >= start && x <= end ? [index] : []));\n let from: number;\n let to: number;\n if (inView.length) {\n from = Math.max(0, inView[0] - 1);\n to = Math.min(xs.length - 1, inView[inView.length - 1] + 1);\n } else {\n // no point in view: the two points the line crosses the view between, if any\n const after = xs.findIndex((x) => x !== undefined && x > end);\n from = Math.max(0, (after === -1 ? xs.length : after) - 1);\n to = after === -1 ? xs.length - 1 : after;\n }\n const points = serie.data.slice(from, to + 1);\n points.forEach((datum) => positions.add(datum.position));\n return { ...serie, data: points };\n });\n return { data: dataInView, positions };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKhB,MAAM,aAAa,CAAC,MAAkC,YAC3D,QAAQ,WAAW,QAAQ,KAAK,cAAc,KAAK;AAK9C,MAAM,gBAAgB,CAC3B,MACA,MACA,CAAC,OAAO,GAAG,MACiD;AAC5D,QAAM,YAAY,oBAAI,IAAY;AAClC,QAAM,aAAa,KAAK,IAAI,CAAC,UAAU;AACrC,UAAM,KAAK,MAAM,KAAK,IAAI,IAAI;AAC9B,UAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,UAAW,MAAM,UAAa,KAAK,SAAS,KAAK,MAAM,CAAC,KAAK,IAAI,CAAC,CAAE;AAClG,QAAI;AACJ,QAAI;AACJ,QAAI,OAAO,QAAQ;AACjB,aAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;AAChC,WAAK,KAAK,IAAI,GAAG,SAAS,GAAG,OAAO,OAAO,SAAS,CAAC,IAAI,CAAC;AAAA,IAC5D,OAAO;AAEL,YAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,MAAM,UAAa,IAAI,GAAG;AAC5D,aAAO,KAAK,IAAI,IAAI,UAAU,KAAK,GAAG,SAAS,SAAS,CAAC;AACzD,WAAK,UAAU,KAAK,GAAG,SAAS,IAAI;AAAA,IACtC;AACA,UAAM,SAAS,MAAM,KAAK,MAAM,MAAM,KAAK,CAAC;AAC5C,WAAO,QAAQ,CAAC,UAAU,UAAU,IAAI,MAAM,QAAQ,CAAC;AACvD,WAAO,EAAE,GAAG,OAAO,MAAM,OAAO;AAAA,EAClC,CAAC;AACD,SAAO,EAAE,MAAM,YAAY,UAAU;AACvC;",
6
+ "names": []
7
+ }
@@ -28,8 +28,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var helpers_exports = {};
30
30
  __export(helpers_exports, {
31
+ getChartDefaultName: () => getChartDefaultName,
32
+ getDatumLabel: () => getDatumLabel,
33
+ getKeyboardInstructions: () => getKeyboardInstructions,
34
+ getSVGBoxWidth: () => getSVGBoxWidth,
31
35
  getStackedData: () => getStackedData,
32
36
  getStackedIndex: () => getStackedIndex,
37
+ isStackedSegmentEdge: () => isStackedSegmentEdge,
33
38
  stackData: () => stackData
34
39
  });
35
40
  module.exports = __toCommonJS(helpers_exports);
@@ -83,4 +88,33 @@ const stackData = (groupsStacked, series, hiddenSeries, isHorizontal) => {
83
88
  });
84
89
  return { stackedData: allSeriesStackedByGroups, scalesStackedDataMap };
85
90
  };
91
+ const isStackedSegmentEdge = (stackedData, serie, position) => {
92
+ const group = stackedData?.find(
93
+ (stackedGroup) => stackedGroup.some((stackedSerie) => stackedSerie.key === serie.name)
94
+ );
95
+ const segment = group?.find((stackedSerie) => stackedSerie.key === serie.name)?.[position];
96
+ if (!group || !segment || segment[0] === segment[1]) return false;
97
+ const segments = group.map((stackedSerie) => stackedSerie[position]).filter((d) => d && d[0] !== d[1]);
98
+ const isNegative = segment[1] <= 0 && segment[0] < 0;
99
+ if (isNegative) return segment[0] === Math.min(...segments.map((d) => d[0]));
100
+ return segment[1] === Math.max(...segments.map((d) => d[1]));
101
+ };
102
+ const getSVGBoxWidth = (node) => node && typeof node.getBBox === "function" ? node.getBBox().width : 0;
103
+ const getDatumLabel = (parts) => parts.filter((part) => part !== void 0 && part !== null && part !== "").map(String).join(" ");
104
+ const getChartDefaultName = (valueLabel, categoryLabel) => {
105
+ if (valueLabel && categoryLabel) return `${valueLabel} by ${categoryLabel}`;
106
+ return valueLabel || categoryLabel || void 0;
107
+ };
108
+ const getKeyboardInstructions = ({
109
+ isHorizontal,
110
+ hasSeveralSeries,
111
+ canZoom
112
+ }) => {
113
+ const along = isHorizontal ? "up and down" : "left and right";
114
+ const across = isHorizontal ? "left and right" : "up and down";
115
+ const sentences = [`Use the ${along} arrow keys to move between the data points of a series.`];
116
+ if (hasSeveralSeries) sentences.push(`Use the ${across} arrow keys to move to the same point of another series.`);
117
+ if (canZoom) sentences.push("Hold Shift while moving with the arrow keys to select a range to zoom into.");
118
+ return sentences.join(" ");
119
+ };
86
120
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/graphs/Chart/helpers/index.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable max-params */\nimport { stack, stackOffsetDiverging } from 'd3';\nimport type { DSChartT } from '../react-desc-prop-types.js';\n\nexport const getStackedIndex = (groups?: string[][], serie?: string) => {\n if (!groups) return -1;\n for (let i = 0; i < groups.length; i += 1) {\n for (let j = 0; j < groups[i].length; j += 1) {\n if (groups[i][j] === serie) return i;\n }\n }\n return -1;\n};\n\nexport const getStackedData = (stackedData: DSChartT.StackedSeriesByGroupT, serie: DSChartT.InternalSerie) => {\n for (let i = 0; i < stackedData?.length; i += 1) {\n const data = stackedData[i].find((d) => d.key === serie.name);\n if (data) return data;\n }\n return false;\n};\n\n// this function check if the series that are stacked share the same scale.\n// return the scale or false if they dont share it\n//\n// si serie.scale === undefined ... la scala es Y\n\nconst checkSharedScale = (series: DSChartT.SeriesT[], isHorizontal: boolean) => {\n const scales = series\n .map((serie) => serie.scale || (isHorizontal ? 'x' : 'y'))\n .filter((value, index, self) => self.indexOf(value) === index);\n if (scales.length > 1) {\n return false;\n }\n return scales[0];\n};\n\n// transform series grouped in stack into what d3 stack function need to read\nexport const stackData = (\n groupsStacked: string[][] | undefined,\n series: DSChartT.SeriesT[],\n hiddenSeries: string[],\n isHorizontal: boolean,\n) => {\n const allSeriesStackedByGroups: DSChartT.StackedSeriesByGroupT = [];\n const scalesStackedDataMap: string[] = [];\n if (!groupsStacked) return { stackedData: allSeriesStackedByGroups, scalesStackedDataMap };\n\n groupsStacked?.forEach((g) => {\n const seriesFilteredByStackGroup = series.filter(\n (serie) => g.includes(serie.name) && !hiddenSeries.includes(serie.name),\n );\n const sharedScale = checkSharedScale(seriesFilteredByStackGroup, isHorizontal);\n if (!sharedScale) return;\n scalesStackedDataMap.push(sharedScale);\n const keys = seriesFilteredByStackGroup.map((serie) => serie.name);\n const stackedData: Array<{ [serieName: string]: number }> = [];\n seriesFilteredByStackGroup.forEach((serie) => {\n serie.data.forEach((d, i) => {\n stackedData[i] = {\n ...stackedData[i],\n [serie.name]: typeof d === 'number' ? d : d?.y || 0,\n };\n });\n });\n\n allSeriesStackedByGroups.push(stack().offset(stackOffsetDiverging).keys(keys)(stackedData));\n });\n\n return { stackedData: allSeriesStackedByGroups, scalesStackedDataMap };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,gBAA4C;AAGrC,MAAM,kBAAkB,CAAC,QAAqB,UAAmB;AACtE,MAAI,CAAC,OAAQ,QAAO;AACpB,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK,GAAG;AACzC,aAAS,IAAI,GAAG,IAAI,OAAO,CAAC,EAAE,QAAQ,KAAK,GAAG;AAC5C,UAAI,OAAO,CAAC,EAAE,CAAC,MAAM,MAAO,QAAO;AAAA,IACrC;AAAA,EACF;AACA,SAAO;AACT;AAEO,MAAM,iBAAiB,CAAC,aAA6C,UAAkC;AAC5G,WAAS,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK,GAAG;AAC/C,UAAM,OAAO,YAAY,CAAC,E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BAA0B,qBAAqB;AACvE;",
4
+ "sourcesContent": ["/* eslint-disable max-params */\nimport { stack, stackOffsetDiverging } from 'd3';\nimport type { DSChartT } from '../../../react-desc-prop-types.js';\n\nexport const getStackedIndex = (groups?: string[][], serie?: string) => {\n if (!groups) return -1;\n for (let i = 0; i < groups.length; i += 1) {\n for (let j = 0; j < groups[i].length; j += 1) {\n if (groups[i][j] === serie) return i;\n }\n }\n return -1;\n};\n\nexport const getStackedData = (stackedData: DSChartT.StackedSeriesByGroupT, serie: DSChartT.InternalSerie) => {\n for (let i = 0; i < stackedData?.length; i += 1) {\n const data = stackedData[i].find((d) => d.key === serie.name);\n if (data) return data;\n }\n return false;\n};\n\n// this function check if the series that are stacked share the same scale.\n// return the scale or false if they dont share it\n//\n// si serie.scale === undefined ... la scala es Y\n\nconst checkSharedScale = (series: DSChartT.SeriesT[], isHorizontal: boolean) => {\n const scales = series\n .map((serie) => serie.scale || (isHorizontal ? 'x' : 'y'))\n .filter((value, index, self) => self.indexOf(value) === index);\n if (scales.length > 1) {\n return false;\n }\n return scales[0];\n};\n\n// transform series grouped in stack into what d3 stack function need to read\nexport const stackData = (\n groupsStacked: string[][] | undefined,\n series: DSChartT.SeriesT[],\n hiddenSeries: string[],\n isHorizontal: boolean,\n) => {\n const allSeriesStackedByGroups: DSChartT.StackedSeriesByGroupT = [];\n const scalesStackedDataMap: string[] = [];\n if (!groupsStacked) return { stackedData: allSeriesStackedByGroups, scalesStackedDataMap };\n\n groupsStacked?.forEach((g) => {\n const seriesFilteredByStackGroup = series.filter(\n (serie) => g.includes(serie.name) && !hiddenSeries.includes(serie.name),\n );\n const sharedScale = checkSharedScale(seriesFilteredByStackGroup, isHorizontal);\n if (!sharedScale) return;\n scalesStackedDataMap.push(sharedScale);\n const keys = seriesFilteredByStackGroup.map((serie) => serie.name);\n const stackedData: Array<{ [serieName: string]: number }> = [];\n seriesFilteredByStackGroup.forEach((serie) => {\n serie.data.forEach((d, i) => {\n stackedData[i] = {\n ...stackedData[i],\n [serie.name]: typeof d === 'number' ? d : d?.y || 0,\n };\n });\n });\n\n allSeriesStackedByGroups.push(stack().offset(stackOffsetDiverging).keys(keys)(stackedData));\n });\n\n return { stackedData: allSeriesStackedByGroups, scalesStackedDataMap };\n};\n\n// Whether the segment of a serie at a position is the outer end of its stack: the highest one of the positive values,\n// or the lowest one of the negative values. Only that segment gets the rounded data end.\nexport const isStackedSegmentEdge = (\n stackedData: DSChartT.StackedSeriesByGroupT,\n serie: DSChartT.InternalSerie,\n position: number,\n) => {\n const group = stackedData?.find((stackedGroup) =>\n stackedGroup.some((stackedSerie) => stackedSerie.key === serie.name),\n );\n const segment = group?.find((stackedSerie) => stackedSerie.key === serie.name)?.[position];\n if (!group || !segment || segment[0] === segment[1]) return false;\n const segments = group.map((stackedSerie) => stackedSerie[position]).filter((d) => d && d[0] !== d[1]);\n const isNegative = segment[1] <= 0 && segment[0] < 0;\n if (isNegative) return segment[0] === Math.min(...segments.map((d) => d[0]));\n return segment[1] === Math.max(...segments.map((d) => d[1]));\n};\n\n// The width of an SVG element's bounding box, 0 where SVG layout is not available (jsdom has no getBBox)\nexport const getSVGBoxWidth = (node: SVGGraphicsElement | null | undefined) =>\n node && typeof node.getBBox === 'function' ? node.getBBox().width : 0;\n\n// The accessible name of a data point: its series, then each axis label with its value. The parts that are missing (an\n// axis without label) are left out instead of leaving double spaces.\nexport const getDatumLabel = (parts: Array<string | number | null | undefined>) =>\n parts\n .filter((part) => part !== undefined && part !== null && part !== '')\n .map(String)\n .join(' ');\n\n// The default accessible name of a chart, from its axis labels: \"<value axis> by <category axis>\". A chart without axis\n// labels gets none (consumers name it through the dsDatavizRoot slot), rather than a generic \"Chart\".\nexport const getChartDefaultName = (valueLabel?: string, categoryLabel?: string) => {\n if (valueLabel && categoryLabel) return `${valueLabel} by ${categoryLabel}`;\n return valueLabel || categoryLabel || undefined;\n};\n\n// The keyboard instructions of a chart with data: the arrows along a series follow the category axis (left and right,\n// up and down on horizontal charts), the other pair moves between series when there is more than one.\nexport const getKeyboardInstructions = ({\n isHorizontal,\n hasSeveralSeries,\n canZoom,\n}: {\n isHorizontal: boolean;\n hasSeveralSeries: boolean;\n canZoom: boolean;\n}) => {\n const along = isHorizontal ? 'up and down' : 'left and right';\n const across = isHorizontal ? 'left and right' : 'up and down';\n const sentences = [`Use the ${along} arrow keys to move between the data points of a series.`];\n if (hasSeveralSeries) sentences.push(`Use the ${across} arrow keys to move to the same point of another series.`);\n if (canZoom) sentences.push('Hold Shift while moving with the arrow keys to select a range to zoom into.');\n return sentences.join(' ');\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,gBAA4C;AAGrC,MAAM,kBAAkB,CAAC,QAAqB,UAAmB;AACtE,MAAI,CAAC,OAAQ,QAAO;AACpB,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK,GAAG;AACzC,aAAS,IAAI,GAAG,IAAI,OAAO,CAAC,EAAE,QAAQ,KAAK,GAAG;AAC5C,UAAI,OAAO,CAAC,EAAE,CAAC,MAAM,MAAO,QAAO;AAAA,IACrC;AAAA,EACF;AACA,SAAO;AACT;AAEO,MAAM,iBAAiB,CAAC,aAA6C,UAAkC;AAC5G,WAAS,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK,GAAG;AAC/C,UAAM,OAAO,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,MAAM,IAAI;AAC5D,QAAI,KAAM,QAAO;AAAA,EACnB;AACA,SAAO;AACT;AAOA,MAAM,mBAAmB,CAAC,QAA4B,iBAA0B;AAC9E,QAAM,SAAS,OACZ,IAAI,CAAC,UAAU,MAAM,UAAU,eAAe,MAAM,IAAI,EACxD,OAAO,CAAC,OAAO,OAAO,SAAS,KAAK,QAAQ,KAAK,MAAM,KA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));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var theming_exports = {};
30
- __export(theming_exports, {
31
- DSSingleStackedBarName: () => DSSingleStackedBarName,
32
- DSSingleStackedBarSlots: () => DSSingleStackedBarSlots
29
+ var logAxis_exports = {};
30
+ __export(logAxis_exports, {
31
+ isOutOfLogAxis: () => isOutOfLogAxis
33
32
  });
34
- module.exports = __toCommonJS(theming_exports);
33
+ module.exports = __toCommonJS(logAxis_exports);
35
34
  var React = __toESM(require("react"));
36
- const DSSingleStackedBarName = "DSSingleStackedBar";
37
- const DSSingleStackedBarSlots = {
38
- WRAPPER: "root"
35
+ const isOutOfLogAxis = (value, { xAxis, yAxis, isHorizontalChart }) => {
36
+ if (value === null || value === void 0) return false;
37
+ const isNotPositive = (number) => typeof number === "number" && number <= 0;
38
+ if (typeof value === "number") {
39
+ const valueAxis = isHorizontalChart ? xAxis : yAxis;
40
+ return valueAxis?.type === "log" && isNotPositive(value);
41
+ }
42
+ return yAxis?.type === "log" && isNotPositive(value.y) || xAxis?.type === "log" && isNotPositive(value.x);
39
43
  };
40
- //# sourceMappingURL=theming.js.map
44
+ //# sourceMappingURL=logAxis.js.map