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

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
@@ -36,18 +36,35 @@ var import_react = require("react");
36
36
  var import_uid = require("uid");
37
37
  var import_lodash_es = require("lodash-es");
38
38
  var import_resize_observer_polyfill = __toESM(require("resize-observer-polyfill"));
39
- var import_react_desc_prop_types = require("../react-desc-prop-types.js");
39
+ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
40
+ var import_chartInteractionStore = require("./chartInteractionStore.js");
40
41
  var import_useScales = require("./useScales.js");
41
42
  var import_helpers = require("../helpers/index.js");
42
43
  var import_useInternalMargins = require("./useInternalMargins.js");
43
44
  var import_useGetters = require("./useGetters.js");
44
45
  var import_useValidateProps = require("./useValidateProps.js");
45
46
  var import_colorPallet = require("../helpers/colorPallet.js");
47
+ var import_logAxis = require("../helpers/logAxis.js");
48
+ var import_dataInView = require("../helpers/dataInView.js");
49
+ const getContentBoxWidth = (node) => {
50
+ const style = getComputedStyle(node);
51
+ const width = parseFloat(style.width);
52
+ if (Number.isNaN(width)) return 0;
53
+ if (style.boxSizing !== "border-box") return width;
54
+ const horizontalPaddingAndBorder = [
55
+ style.paddingLeft,
56
+ style.paddingRight,
57
+ style.borderLeftWidth,
58
+ style.borderRightWidth
59
+ ].reduce((total, value) => total + (parseFloat(value) || 0), 0);
60
+ return width - horizontalPaddingAndBorder;
61
+ };
46
62
  const useResizeObserver = (ref) => {
47
63
  const [dimensions, setDimensions] = (0, import_react.useState)(0);
48
- (0, import_react.useEffect)(() => {
64
+ (0, import_react.useLayoutEffect)(() => {
49
65
  if (ref) {
50
66
  const observeTarget = ref;
67
+ setDimensions(Math.ceil(getContentBoxWidth(observeTarget)));
51
68
  const resizeObserver = new import_resize_observer_polyfill.default(
52
69
  (0, import_lodash_es.debounce)((entries) => {
53
70
  entries.forEach((entry) => {
@@ -67,31 +84,25 @@ const useResizeObserver = (ref) => {
67
84
  };
68
85
  const useChart = (props) => {
69
86
  (0, import_useValidateProps.useValidateProps)(props);
70
- const { series, yAxis, xAxis, width: userWidth, height: userHeight, groups: groupsStacked } = props;
87
+ const { series, yAxis, xAxis, y2Axis, width: userWidth, height: userHeight, groups: groupsStacked } = props;
71
88
  const userRatio = (0, import_react.useMemo)(
72
89
  () => props?.xAxis.advanced?.pointSpacing?.value ?? props?.yAxis.advanced?.pointSpacing?.value ?? 1,
73
90
  [props?.xAxis.advanced?.pointSpacing?.value, props?.yAxis.advanced?.pointSpacing?.value]
74
91
  );
75
92
  const originalSeries = (0, import_react.useMemo)(() => {
76
- if (series.length === 0) {
77
- return import_react_desc_prop_types.defaultProps.series;
78
- }
79
- return series;
80
- }, [series]);
93
+ const seriesOrEmpty = series ?? [];
94
+ if (y2Axis) return seriesOrEmpty;
95
+ return seriesOrEmpty.map((serie) => serie.scale === "y2" ? { ...serie, scale: void 0 } : serie);
96
+ }, [series, y2Axis]);
81
97
  const [containerRef, setContainerRef] = (0, import_react.useState)(null);
82
98
  const dimensionWidth = useResizeObserver(containerRef);
83
99
  const width = (0, import_react.useMemo)(() => userWidth ?? dimensionWidth ?? 0, [dimensionWidth, userWidth]);
84
100
  const height = (0, import_react.useMemo)(() => userHeight ?? 500, [userHeight]);
85
101
  const [isGrabbed, setIsGrabbed] = (0, import_react.useState)(false);
86
102
  const [startPosition, setStartPosition] = (0, import_react.useState)(0);
87
- const [isZooming, setIsZooming] = (0, import_react.useState)(false);
88
- const [zoomStartingPosition, setZoomStartingPosition] = (0, import_react.useState)(0);
89
- const [movingPosition, setMovingPosition] = (0, import_react.useState)(0);
90
- const [activePoint, setActivePoint] = (0, import_react.useState)(null);
103
+ const [interactionStore] = (0, import_react.useState)(import_chartInteractionStore.createChartInteractionStore);
104
+ const { setActivePoint, setScrapperPosX, setScrapperPosY, setXScrollbarPosition } = interactionStore;
91
105
  const [activeSerie, setActiveSerie] = (0, import_react.useState)("");
92
- const [scrapperPosY, setScrapperPosY] = (0, import_react.useState)(-1);
93
- const [scrapperPosX, setScrapperPosX] = (0, import_react.useState)(-1);
94
- const [xScrollbarPosition, setXScrollbarPosition] = (0, import_react.useState)(0);
95
106
  const [isScrollbarVisible, setIsScrollbarVisible] = (0, import_react.useState)(false);
96
107
  const [containerRatio, setContainerRatio] = (0, import_react.useState)(userRatio);
97
108
  const lastScrollbarPosition = (0, import_react.useRef)(0);
@@ -109,7 +120,7 @@ const useChart = (props) => {
109
120
  (0, import_react.useEffect)(() => {
110
121
  lastScrollbarPosition.current = 0;
111
122
  setXScrollbarPosition(0);
112
- }, [dimensionWidth]);
123
+ }, [dimensionWidth, setXScrollbarPosition]);
113
124
  (0, import_react.useEffect)(() => {
114
125
  setContainerRatio(userRatio);
115
126
  }, [userRatio]);
@@ -127,6 +138,7 @@ const useChart = (props) => {
127
138
  leftLabelWidth,
128
139
  axisLeftWidth,
129
140
  topLegendHeight,
141
+ topLegendWidth,
130
142
  leftLegendHeight
131
143
  } = (0, import_useInternalMargins.useInternalMargins)({
132
144
  axisLeftRef,
@@ -139,7 +151,10 @@ const useChart = (props) => {
139
151
  bottomLegend,
140
152
  rightLabel,
141
153
  bottomLabel,
142
- toolbarRef
154
+ toolbarRef,
155
+ // the vertical axes that follow the view keep their width while it scrolls (see useWidthThatDoesNotShrink)
156
+ keepLeftAxisWidth: containerRatio > 1 && (0, import_dataInView.fitsToView)(yAxis, props.xScroll),
157
+ keepRightAxisWidth: containerRatio > 1 && (0, import_dataInView.fitsToView)(y2Axis, props.xScroll)
143
158
  });
144
159
  const innerWidth = (0, import_react.useMemo)(
145
160
  () => width - internalMargin.left - internalMargin.right,
@@ -160,6 +175,7 @@ const useChart = (props) => {
160
175
  return "y";
161
176
  }, [xAxis.type, yAxis.type]);
162
177
  const [currentDataWithNullValues, currentData] = (0, import_react.useMemo)(() => {
178
+ const isHorizontalChart = yAxis?.type === "band";
163
179
  const baseData = originalSeries.filter((serie) => !hiddenSeries.includes(serie.name)).map((d, i) => ({
164
180
  ...d,
165
181
  // we set a default on the scale if the user do not pass it
@@ -167,7 +183,9 @@ const useChart = (props) => {
167
183
  key: `${d.name}-${i}`,
168
184
  data: d.data.map((value, index) => ({
169
185
  key: `${d.name}-${i}-${index}`,
170
- value,
186
+ // a log axis has no place for zero or a negative value: such a value is a gap in the series, like a missing
187
+ // one, instead of a NaN that breaks the whole chart (useValidateProps warns about it)
188
+ value: (0, import_logAxis.isOutOfLogAxis)(value, { xAxis, yAxis: d.scale === "y2" && y2Axis ? y2Axis : yAxis, isHorizontalChart }) ? null : value,
171
189
  position: index,
172
190
  serie: d.name,
173
191
  scale: d.scale,
@@ -179,14 +197,14 @@ const useChart = (props) => {
179
197
  data: data.data.filter((datum) => datum.value !== null && datum.value !== void 0)
180
198
  }));
181
199
  return [baseData, currentDataWithoutNulls];
182
- }, [defaultScale, hiddenSeries, originalSeries]);
200
+ }, [defaultScale, hiddenSeries, originalSeries, xAxis, y2Axis, yAxis]);
183
201
  const isHorizontal = (0, import_react.useMemo)(() => yAxis?.type === "band", [yAxis]);
184
202
  const { stackedData, scalesStackedDataMap } = (0, import_react.useMemo)(
185
203
  () => (0, import_helpers.stackData)(groupsStacked, originalSeries, hiddenSeries, isHorizontal),
186
204
  [groupsStacked, originalSeries, hiddenSeries, isHorizontal]
187
205
  );
188
206
  const groups = (0, import_react.useMemo)(() => currentData.map((serie) => serie.name), [currentData]);
189
- const { xScale, yScale, y2Scale, subGroupScale, colorScale, getBandwidth } = (0, import_useScales.useScales)({
207
+ const { xScale, yScale, y2Scale, subGroupScale, colorScale, getBandwidth, fullDataTicks } = (0, import_useScales.useScales)({
190
208
  props,
191
209
  originalSeries,
192
210
  innerHeight,
@@ -195,8 +213,10 @@ const useChart = (props) => {
195
213
  stackedData,
196
214
  scalesStackedDataMap,
197
215
  currentData,
198
- containerRatio
216
+ containerRatio,
217
+ interactionStore
199
218
  });
219
+ (0, import_useValidateProps.useValidateAxisEnds)(props, { xScale, yScale, y2Scale });
200
220
  const {
201
221
  getXValue,
202
222
  getY2ScaleValue,
@@ -214,16 +234,11 @@ const useChart = (props) => {
214
234
  y2Scale
215
235
  });
216
236
  const chartId = (0, import_react.useMemo)(() => (0, import_uid.uid)(6), []);
237
+ const { getOwnerProps } = (0, import_ds_props_helpers.useOwnerProps)(props);
217
238
  return (0, import_react.useMemo)(
218
239
  () => ({
219
240
  props,
220
241
  originalSeries,
221
- isZooming,
222
- setIsZooming,
223
- zoomStartingPosition,
224
- setZoomStartingPosition,
225
- setMovingPosition,
226
- movingPosition,
227
242
  innerHeight,
228
243
  innerWidth,
229
244
  groups,
@@ -234,17 +249,15 @@ const useChart = (props) => {
234
249
  xScale,
235
250
  yScale,
236
251
  y2Scale,
252
+ fullDataTicks,
237
253
  containerRef,
238
254
  getBandwidth,
239
- scrapperPosY,
255
+ interactionStore,
240
256
  setScrapperPosY,
241
- scrapperPosX,
242
257
  setScrapperPosX,
243
- activePoint,
244
258
  setActivePoint,
245
259
  activeSerie,
246
260
  setActiveSerie,
247
- xScrollbarPosition,
248
261
  setXScrollbarPosition,
249
262
  isGrabbed,
250
263
  setIsGrabbed,
@@ -298,15 +311,14 @@ const useChart = (props) => {
298
311
  leftLabelWidth,
299
312
  axisLeftWidth,
300
313
  topLegendHeight,
314
+ topLegendWidth,
301
315
  leftLegendHeight,
302
- currentDataWithNullValues
316
+ currentDataWithNullValues,
317
+ getOwnerProps
303
318
  }),
304
319
  [
305
320
  props,
306
321
  originalSeries,
307
- isZooming,
308
- zoomStartingPosition,
309
- movingPosition,
310
322
  innerHeight,
311
323
  innerWidth,
312
324
  groups,
@@ -317,14 +329,16 @@ const useChart = (props) => {
317
329
  xScale,
318
330
  yScale,
319
331
  y2Scale,
332
+ fullDataTicks,
320
333
  containerRef,
321
334
  getBandwidth,
322
- scrapperPosY,
335
+ interactionStore,
323
336
  getY2ScaleValue,
324
- scrapperPosX,
325
- activePoint,
337
+ setActivePoint,
338
+ setScrapperPosX,
339
+ setScrapperPosY,
326
340
  activeSerie,
327
- xScrollbarPosition,
341
+ setXScrollbarPosition,
328
342
  isGrabbed,
329
343
  startPosition,
330
344
  isScrollbarVisible,
@@ -358,8 +372,10 @@ const useChart = (props) => {
358
372
  leftLabelWidth,
359
373
  axisLeftWidth,
360
374
  topLegendHeight,
375
+ topLegendWidth,
361
376
  leftLegendHeight,
362
- currentDataWithNullValues
377
+ currentDataWithNullValues,
378
+ getOwnerProps
363
379
  ]
364
380
  );
365
381
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/graphs/Chart/config/useChart.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-nested-callbacks */\n/* eslint-disable max-statements */\n/* eslint-disable indent */\nimport { useMemo, useState, useEffect, useRef } from 'react';\nimport { uid } from 'uid';\nimport { debounce } from 'lodash-es';\nimport ResizeObserver from 'resize-observer-polyfill';\nimport type { DSChartT } from '../react-desc-prop-types.js';\nimport { defaultProps } from '../react-desc-prop-types.js';\nimport { useScales } from './useScales.js';\nimport { stackData } from '../helpers/index.js';\nimport { useInternalMargins } from './useInternalMargins.js';\nimport { useGetters } from './useGetters.js';\nimport { useValidateProps } from './useValidateProps.js';\nimport { COLOR_PALLET } from '../helpers/colorPallet.js';\ntype ResizeObserverConstructorEntries = Parameters<ConstructorParameters<typeof ResizeObserver>[0]>[0];\n\nconst useResizeObserver = (ref: HTMLElement | null | undefined) => {\n const [dimensions, setDimensions] = useState<number>(0);\n\n useEffect(() => {\n if (ref) {\n const observeTarget = ref;\n const resizeObserver = new ResizeObserver(\n debounce((entries: ResizeObserverConstructorEntries) => {\n entries.forEach((entry) => {\n setDimensions(Math.ceil(entry.contentRect.width));\n });\n }, 200),\n );\n resizeObserver.observe(observeTarget);\n\n return () => {\n resizeObserver.unobserve(observeTarget);\n };\n }\n return () => {};\n }, [ref]);\n return dimensions;\n};\n\nexport const useChart = (props: DSChartT.Props) => {\n useValidateProps(props);\n\n // const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);\n const { series, yAxis, xAxis, width: userWidth, height: userHeight, groups: groupsStacked } = props;\n const userRatio = useMemo(\n () => props?.xAxis.advanced?.pointSpacing?.value ?? props?.yAxis.advanced?.pointSpacing?.value ?? 1,\n [props?.xAxis.advanced?.pointSpacing?.value, props?.yAxis.advanced?.pointSpacing?.value],\n );\n const originalSeries = useMemo(() => {\n if (series.length === 0) {\n return defaultProps.series;\n }\n return series;\n }, [series]);\n const [containerRef, setContainerRef] = useState<HTMLDivElement | null>(null);\n\n const dimensionWidth = useResizeObserver(containerRef);\n\n const width = useMemo(() => userWidth ?? dimensionWidth ?? 0, [dimensionWidth, userWidth]);\n\n const height = useMemo(() => userHeight ?? 500, [userHeight]);\n\n const [isGrabbed, setIsGrabbed] = useState(false);\n const [startPosition, setStartPosition] = useState(0);\n\n // zoom\n\n const [isZooming, setIsZooming] = useState(false);\n const [zoomStartingPosition, setZoomStartingPosition] = useState(0);\n const [movingPosition, setMovingPosition] = useState(0);\n\n //\n\n const [activePoint, setActivePoint] = useState<DSChartT.InternalDatum | null>(null);\n const [activeSerie, setActiveSerie] = useState('');\n const [scrapperPosY, setScrapperPosY] = useState(-1);\n const [scrapperPosX, setScrapperPosX] = useState(-1);\n const [xScrollbarPosition, setXScrollbarPosition] = useState(0);\n const [isScrollbarVisible, setIsScrollbarVisible] = useState(false);\n const [containerRatio, setContainerRatio] = useState(userRatio);\n\n const lastScrollbarPosition = useRef(0);\n\n const [axisLeftRef, setAxisLeftRef] = useState<SVGGElement | null>(null);\n const [axisBottomRef, setAxisBottomRef] = useState<SVGGElement | null>(null);\n const [axisRightRef, setAxisRightRef] = useState<SVGGElement | null>(null);\n\n const [leftLegend, setLeftLegend] = useState<SVGGElement | null>(null);\n const [rightLegend, setRightLegend] = useState<SVGGElement | null>(null);\n const [topLegend, setTopLegend] = useState<SVGGElement | null>(null);\n const [bottomLegend, setBottomLegend] = useState<SVGGElement | null>(null);\n\n const [rightLabel, setRightLabel] = useState<SVGGElement | null>(null);\n const [leftLabel, setLeftLabel] = useState<SVGGElement | null>(null);\n const [bottomLabel, setBottomLabel] = useState<SVGGElement | null>(null);\n\n const [toolbarRef, setToolbarRef] = useState<SVGGElement | null>(null);\n\n // we reset the scrollbar position when the chart resize\n useEffect(() => {\n lastScrollbarPosition.current = 0;\n setXScrollbarPosition(0);\n }, [dimensionWidth]);\n\n useEffect(() => {\n setContainerRatio(userRatio);\n }, [userRatio]);\n\n const {\n toolbarHeight,\n axisBottomHeight,\n axisRightWidth,\n bottomLabelHeight,\n internalMargin,\n leftLegendWidth,\n rightLabelWidth,\n leftLabelHeight,\n rightLegendHeight,\n bottomLegendWidth,\n leftLabelWidth,\n axisLeftWidth,\n topLegendHeight,\n leftLegendHeight,\n } = useInternalMargins({\n axisLeftRef,\n axisBottomRef,\n axisRightRef,\n leftLabel,\n leftLegend,\n rightLegend,\n topLegend,\n bottomLegend,\n rightLabel,\n bottomLabel,\n toolbarRef,\n });\n\n const innerWidth = useMemo(\n () => width - internalMargin.left - internalMargin.right,\n [internalMargin.left, internalMargin.right, width],\n );\n const innerHeight = useMemo(\n () => height - internalMargin.top - internalMargin.bottom,\n [internalMargin.top, internalMargin.bottom, height],\n );\n\n const [hiddenSeries, setHiddenSeries] = useState<string[]>([]);\n\n const defaultScale = useMemo(() => {\n if (yAxis.type === 'band') {\n return 'x';\n }\n\n if ([undefined, 'band'].includes(xAxis.type)) {\n return 'y';\n }\n\n return 'y';\n }, [xAxis.type, yAxis.type]);\n\n const [currentDataWithNullValues, currentData] = useMemo(() => {\n const baseData = originalSeries\n .filter((serie) => !hiddenSeries.includes(serie.name))\n .map((d, i) => ({\n ...d,\n // we set a default on the scale if the user do not pass it\n scale: d.scale || defaultScale,\n key: `${d.name}-${i}`,\n data: d.data.map((value, index) => ({\n key: `${d.name}-${i}-${index}`,\n value,\n position: index,\n serie: d.name,\n scale: d.scale,\n color: COLOR_PALLET[d.color as keyof typeof COLOR_PALLET] ?? d.color,\n })),\n })) as DSChartT.InternalData;\n\n const currentDataWithoutNulls = baseData.map((data) => ({\n ...data,\n data: data.data.filter((datum) => datum.value !== null && datum.value !== undefined),\n }));\n\n return [baseData, currentDataWithoutNulls];\n }, [defaultScale, hiddenSeries, originalSeries]);\n\n const isHorizontal = useMemo(() => yAxis?.type === 'band', [yAxis]);\n\n const { stackedData, scalesStackedDataMap } = useMemo(\n () => stackData(groupsStacked, originalSeries, hiddenSeries, isHorizontal),\n [groupsStacked, originalSeries, hiddenSeries, isHorizontal],\n );\n\n // @TODO we need to create a logic to get this from both axis\n // const containerRatio = props?.xAxis.advanced?.pointSpacing?.value ?? props?.yAxis.advanced?.pointSpacing?.value ?? 1;\n\n const groups = useMemo(() => currentData.map((serie) => serie.name), [currentData]);\n\n const { xScale, yScale, y2Scale, subGroupScale, colorScale, getBandwidth } = useScales({\n props,\n originalSeries,\n innerHeight,\n innerWidth,\n groups,\n stackedData,\n scalesStackedDataMap,\n currentData,\n containerRatio,\n });\n\n const {\n getXValue,\n getY2ScaleValue,\n getYValue,\n getXScaleValue,\n getYScaleValue,\n getYValueFormatted,\n getXValueFormatted,\n } = useGetters({\n xAxis,\n yAxis,\n isHorizontal,\n xScale,\n yScale,\n y2Scale,\n });\n const chartId = useMemo(() => uid(6), []);\n\n return useMemo(\n () => ({\n props,\n originalSeries,\n isZooming,\n setIsZooming,\n zoomStartingPosition,\n setZoomStartingPosition,\n setMovingPosition,\n movingPosition,\n innerHeight,\n innerWidth,\n groups,\n currentData,\n colorScale,\n stackedData,\n subGroupScale,\n xScale,\n yScale,\n y2Scale,\n containerRef,\n getBandwidth,\n scrapperPosY,\n setScrapperPosY,\n scrapperPosX,\n setScrapperPosX,\n activePoint,\n setActivePoint,\n activeSerie,\n setActiveSerie,\n xScrollbarPosition,\n setXScrollbarPosition,\n isGrabbed,\n setIsGrabbed,\n setContainerRef,\n startPosition,\n setStartPosition,\n isScrollbarVisible,\n setIsScrollbarVisible,\n lastScrollbarPosition,\n containerRatio,\n internalMargin,\n axisLeftRef,\n leftLegendWidth,\n leftLegend,\n setAxisLeftRef,\n setLeftLegend,\n setRightLegend,\n rightLegend,\n setTopLegend,\n setBottomLegend,\n setAxisBottomRef,\n axisBottomHeight,\n setAxisRightRef,\n setRightLabel,\n setBottomLabel,\n getXScaleValue,\n getYScaleValue,\n getY2ScaleValue,\n getYValueFormatted,\n getXValueFormatted,\n bottomLabelHeight,\n rightLabelWidth,\n axisRightWidth,\n getXValue,\n getYValue,\n isHorizontal,\n setLeftLabel,\n leftLabel,\n chartId,\n hiddenSeries,\n setHiddenSeries,\n height,\n width,\n setContainerRatio,\n toolbarHeight,\n setToolbarRef,\n leftLabelHeight,\n rightLegendHeight,\n bottomLegendWidth,\n bottomLegend,\n leftLabelWidth,\n axisLeftWidth,\n topLegendHeight,\n leftLegendHeight,\n currentDataWithNullValues,\n }),\n [\n props,\n originalSeries,\n isZooming,\n zoomStartingPosition,\n movingPosition,\n innerHeight,\n innerWidth,\n groups,\n currentData,\n colorScale,\n stackedData,\n subGroupScale,\n xScale,\n yScale,\n y2Scale,\n containerRef,\n getBandwidth,\n scrapperPosY,\n getY2ScaleValue,\n scrapperPosX,\n activePoint,\n activeSerie,\n xScrollbarPosition,\n isGrabbed,\n startPosition,\n isScrollbarVisible,\n containerRatio,\n internalMargin,\n axisLeftRef,\n leftLegendWidth,\n leftLegend,\n rightLegend,\n axisBottomHeight,\n getXScaleValue,\n getYScaleValue,\n getYValueFormatted,\n getXValueFormatted,\n bottomLabelHeight,\n rightLabelWidth,\n axisRightWidth,\n getXValue,\n getYValue,\n isHorizontal,\n leftLabel,\n chartId,\n hiddenSeries,\n height,\n width,\n toolbarHeight,\n leftLabelHeight,\n rightLegendHeight,\n bottomLegendWidth,\n bottomLegend,\n leftLabelWidth,\n axisLeftWidth,\n topLegendHeight,\n leftLegendHeight,\n currentDataWithNullValues,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAAqD;AACrD,iBAAoB;AACpB,uBAAyB;AACzB,sCAA2B;AAE3B,mCAA6B;AAC7B,uBAA0B;AAC1B,qBAA0B;AAC1B,gCAAmC;AACnC,wBAA2B;AAC3B,8BAAiC;AACjC,yBAA6B;AAG7B,MAAM,oBAAoB,CAAC,QAAwC;AACjE,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAiB,CAAC;AAEtD,8BAAU,MAAM;AACd,QAAI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AAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-nested-callbacks */\n/* eslint-disable max-statements */\n/* eslint-disable indent */\nimport { useMemo, useState, useEffect, useLayoutEffect, useRef } from 'react';\nimport { uid } from 'uid';\nimport { debounce } from 'lodash-es';\nimport ResizeObserver from 'resize-observer-polyfill';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { createChartInteractionStore } from './chartInteractionStore.js';\nimport type { DSChartT } from '../../../react-desc-prop-types.js';\nimport { useScales } from './useScales.js';\nimport { stackData } from '../helpers/index.js';\nimport { useInternalMargins } from './useInternalMargins.js';\nimport { useGetters } from './useGetters.js';\nimport { useValidateAxisEnds, useValidateProps } from './useValidateProps.js';\nimport { COLOR_PALLET } from '../helpers/colorPallet.js';\nimport { isOutOfLogAxis } from '../helpers/logAxis.js';\nimport { fitsToView } from '../helpers/dataInView.js';\ntype ResizeObserverConstructorEntries = Parameters<ConstructorParameters<typeof ResizeObserver>[0]>[0];\n\n// the width the ResizeObserver reports: the content box, without padding or border\nconst getContentBoxWidth = (node: HTMLElement) => {\n const style = getComputedStyle(node);\n const width = parseFloat(style.width);\n if (Number.isNaN(width)) return 0;\n if (style.boxSizing !== 'border-box') return width;\n const horizontalPaddingAndBorder = [\n style.paddingLeft,\n style.paddingRight,\n style.borderLeftWidth,\n style.borderRightWidth,\n ].reduce((total, value) => total + (parseFloat(value) || 0), 0);\n return width - horizontalPaddingAndBorder;\n};\n\nconst useResizeObserver = (ref: HTMLElement | null | undefined) => {\n const [dimensions, setDimensions] = useState<number>(0);\n\n // a layout effect, so the first width is applied before the browser paints: the chart draws at its width on its\n // first frame instead of after the debounce, which only applies to the resizes that follow\n useLayoutEffect(() => {\n if (ref) {\n const observeTarget = ref;\n setDimensions(Math.ceil(getContentBoxWidth(observeTarget)));\n const resizeObserver = new ResizeObserver(\n debounce((entries: ResizeObserverConstructorEntries) => {\n entries.forEach((entry) => {\n setDimensions(Math.ceil(entry.contentRect.width));\n });\n }, 200),\n );\n resizeObserver.observe(observeTarget);\n\n return () => {\n resizeObserver.unobserve(observeTarget);\n };\n }\n return () => {};\n }, [ref]);\n return dimensions;\n};\n\nexport const useChart = (props: DSChartT.Props) => {\n useValidateProps(props);\n\n // const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);\n const { series, yAxis, xAxis, y2Axis, width: userWidth, height: userHeight, groups: groupsStacked } = props;\n const userRatio = useMemo(\n () => props?.xAxis.advanced?.pointSpacing?.value ?? props?.yAxis.advanced?.pointSpacing?.value ?? 1,\n [props?.xAxis.advanced?.pointSpacing?.value, props?.yAxis.advanced?.pointSpacing?.value],\n );\n // No series is a valid state (data still loading, a filter with no match): the chart renders its axes with no data.\n // A series on the secondary scale needs y2Axis: without it, it is plotted on the main scale (useValidateProps warns).\n const originalSeries = useMemo(() => {\n const seriesOrEmpty = series ?? [];\n if (y2Axis) return seriesOrEmpty;\n return seriesOrEmpty.map((serie) => (serie.scale === 'y2' ? { ...serie, scale: undefined } : serie));\n }, [series, y2Axis]);\n const [containerRef, setContainerRef] = useState<HTMLDivElement | null>(null);\n\n const dimensionWidth = useResizeObserver(containerRef);\n\n const width = useMemo(() => userWidth ?? dimensionWidth ?? 0, [dimensionWidth, userWidth]);\n\n const height = useMemo(() => userHeight ?? 500, [userHeight]);\n\n const [isGrabbed, setIsGrabbed] = useState(false);\n const [startPosition, setStartPosition] = useState(0);\n\n // the hover and scroll state (active point, scrapper positions, scroll position) lives in a store, so a hover or a\n // scroll step does not change this context\n const [interactionStore] = useState(createChartInteractionStore);\n const { setActivePoint, setScrapperPosX, setScrapperPosY, setXScrollbarPosition } = interactionStore;\n const [activeSerie, setActiveSerie] = useState('');\n const [isScrollbarVisible, setIsScrollbarVisible] = useState(false);\n const [containerRatio, setContainerRatio] = useState(userRatio);\n\n const lastScrollbarPosition = useRef(0);\n\n const [axisLeftRef, setAxisLeftRef] = useState<SVGGElement | null>(null);\n const [axisBottomRef, setAxisBottomRef] = useState<SVGGElement | null>(null);\n const [axisRightRef, setAxisRightRef] = useState<SVGGElement | null>(null);\n\n const [leftLegend, setLeftLegend] = useState<SVGGElement | null>(null);\n const [rightLegend, setRightLegend] = useState<SVGGElement | null>(null);\n const [topLegend, setTopLegend] = useState<SVGGElement | null>(null);\n const [bottomLegend, setBottomLegend] = useState<SVGGElement | null>(null);\n\n const [rightLabel, setRightLabel] = useState<SVGGElement | null>(null);\n const [leftLabel, setLeftLabel] = useState<SVGGElement | null>(null);\n const [bottomLabel, setBottomLabel] = useState<SVGGElement | null>(null);\n\n const [toolbarRef, setToolbarRef] = useState<SVGGElement | null>(null);\n\n // we reset the scrollbar position when the chart resize\n useEffect(() => {\n lastScrollbarPosition.current = 0;\n setXScrollbarPosition(0);\n // the store setter is stable: this still runs when the width changes only\n }, [dimensionWidth, setXScrollbarPosition]);\n\n useEffect(() => {\n setContainerRatio(userRatio);\n }, [userRatio]);\n\n const {\n toolbarHeight,\n axisBottomHeight,\n axisRightWidth,\n bottomLabelHeight,\n internalMargin,\n leftLegendWidth,\n rightLabelWidth,\n leftLabelHeight,\n rightLegendHeight,\n bottomLegendWidth,\n leftLabelWidth,\n axisLeftWidth,\n topLegendHeight,\n topLegendWidth,\n leftLegendHeight,\n } = useInternalMargins({\n axisLeftRef,\n axisBottomRef,\n axisRightRef,\n leftLabel,\n leftLegend,\n rightLegend,\n topLegend,\n bottomLegend,\n rightLabel,\n bottomLabel,\n toolbarRef,\n // the vertical axes that follow the view keep their width while it scrolls (see useWidthThatDoesNotShrink)\n keepLeftAxisWidth: containerRatio > 1 && fitsToView(yAxis, props.xScroll),\n keepRightAxisWidth: containerRatio > 1 && fitsToView(y2Axis, props.xScroll),\n });\n\n const innerWidth = useMemo(\n () => width - internalMargin.left - internalMargin.right,\n [internalMargin.left, internalMargin.right, width],\n );\n const innerHeight = useMemo(\n () => height - internalMargin.top - internalMargin.bottom,\n [internalMargin.top, internalMargin.bottom, height],\n );\n\n const [hiddenSeries, setHiddenSeries] = useState<string[]>([]);\n\n const defaultScale = useMemo(() => {\n if (yAxis.type === 'band') {\n return 'x';\n }\n\n if ([undefined, 'band'].includes(xAxis.type)) {\n return 'y';\n }\n\n return 'y';\n }, [xAxis.type, yAxis.type]);\n\n const [currentDataWithNullValues, currentData] = useMemo(() => {\n const isHorizontalChart = yAxis?.type === 'band';\n const baseData = originalSeries\n .filter((serie) => !hiddenSeries.includes(serie.name))\n .map((d, i) => ({\n ...d,\n // we set a default on the scale if the user do not pass it\n scale: d.scale || defaultScale,\n key: `${d.name}-${i}`,\n data: d.data.map((value, index) => ({\n key: `${d.name}-${i}-${index}`,\n // a log axis has no place for zero or a negative value: such a value is a gap in the series, like a missing\n // one, instead of a NaN that breaks the whole chart (useValidateProps warns about it)\n value: isOutOfLogAxis(value, { xAxis, yAxis: d.scale === 'y2' && y2Axis ? y2Axis : yAxis, isHorizontalChart })\n ? null\n : value,\n position: index,\n serie: d.name,\n scale: d.scale,\n color: COLOR_PALLET[d.color as keyof typeof COLOR_PALLET] ?? d.color,\n })),\n })) as DSChartT.InternalData;\n\n const currentDataWithoutNulls = baseData.map((data) => ({\n ...data,\n data: data.data.filter((datum) => datum.value !== null && datum.value !== undefined),\n }));\n\n return [baseData, currentDataWithoutNulls];\n }, [defaultScale, hiddenSeries, originalSeries, xAxis, y2Axis, yAxis]);\n\n const isHorizontal = useMemo(() => yAxis?.type === 'band', [yAxis]);\n\n const { stackedData, scalesStackedDataMap } = useMemo(\n () => stackData(groupsStacked, originalSeries, hiddenSeries, isHorizontal),\n [groupsStacked, originalSeries, hiddenSeries, isHorizontal],\n );\n\n // @TODO we need to create a logic to get this from both axis\n // const containerRatio = props?.xAxis.advanced?.pointSpacing?.value ?? props?.yAxis.advanced?.pointSpacing?.value ?? 1;\n\n const groups = useMemo(() => currentData.map((serie) => serie.name), [currentData]);\n\n const { xScale, yScale, y2Scale, subGroupScale, colorScale, getBandwidth, fullDataTicks } = useScales({\n props,\n originalSeries,\n innerHeight,\n innerWidth,\n groups,\n stackedData,\n scalesStackedDataMap,\n currentData,\n containerRatio,\n interactionStore,\n });\n useValidateAxisEnds(props, { xScale, yScale, y2Scale });\n\n const {\n getXValue,\n getY2ScaleValue,\n getYValue,\n getXScaleValue,\n getYScaleValue,\n getYValueFormatted,\n getXValueFormatted,\n } = useGetters({\n xAxis,\n yAxis,\n isHorizontal,\n xScale,\n yScale,\n y2Scale,\n });\n const chartId = useMemo(() => uid(6), []);\n\n // every slot of the chart reads the consumer slot props through the context\n const { getOwnerProps } = useOwnerProps(props);\n\n return useMemo(\n () => ({\n props,\n originalSeries,\n innerHeight,\n innerWidth,\n groups,\n currentData,\n colorScale,\n stackedData,\n subGroupScale,\n xScale,\n yScale,\n y2Scale,\n fullDataTicks,\n containerRef,\n getBandwidth,\n interactionStore,\n setScrapperPosY,\n setScrapperPosX,\n setActivePoint,\n activeSerie,\n setActiveSerie,\n setXScrollbarPosition,\n isGrabbed,\n setIsGrabbed,\n setContainerRef,\n startPosition,\n setStartPosition,\n isScrollbarVisible,\n setIsScrollbarVisible,\n lastScrollbarPosition,\n containerRatio,\n internalMargin,\n axisLeftRef,\n leftLegendWidth,\n leftLegend,\n setAxisLeftRef,\n setLeftLegend,\n setRightLegend,\n rightLegend,\n setTopLegend,\n setBottomLegend,\n setAxisBottomRef,\n axisBottomHeight,\n setAxisRightRef,\n setRightLabel,\n setBottomLabel,\n getXScaleValue,\n getYScaleValue,\n getY2ScaleValue,\n getYValueFormatted,\n getXValueFormatted,\n bottomLabelHeight,\n rightLabelWidth,\n axisRightWidth,\n getXValue,\n getYValue,\n isHorizontal,\n setLeftLabel,\n leftLabel,\n chartId,\n hiddenSeries,\n setHiddenSeries,\n height,\n width,\n setContainerRatio,\n toolbarHeight,\n setToolbarRef,\n leftLabelHeight,\n rightLegendHeight,\n bottomLegendWidth,\n bottomLegend,\n leftLabelWidth,\n axisLeftWidth,\n topLegendHeight,\n topLegendWidth,\n leftLegendHeight,\n currentDataWithNullValues,\n getOwnerProps,\n }),\n [\n props,\n originalSeries,\n innerHeight,\n innerWidth,\n groups,\n currentData,\n colorScale,\n stackedData,\n subGroupScale,\n xScale,\n yScale,\n y2Scale,\n fullDataTicks,\n containerRef,\n getBandwidth,\n interactionStore,\n getY2ScaleValue,\n setActivePoint,\n setScrapperPosX,\n setScrapperPosY,\n activeSerie,\n setXScrollbarPosition,\n isGrabbed,\n startPosition,\n isScrollbarVisible,\n containerRatio,\n internalMargin,\n axisLeftRef,\n leftLegendWidth,\n leftLegend,\n rightLegend,\n axisBottomHeight,\n getXScaleValue,\n getYScaleValue,\n getYValueFormatted,\n getXValueFormatted,\n bottomLabelHeight,\n rightLabelWidth,\n axisRightWidth,\n getXValue,\n getYValue,\n isHorizontal,\n leftLabel,\n chartId,\n hiddenSeries,\n height,\n width,\n toolbarHeight,\n leftLabelHeight,\n rightLegendHeight,\n bottomLegendWidth,\n bottomLegend,\n leftLabelWidth,\n axisLeftWidth,\n topLegendHeight,\n topLegendWidth,\n leftLegendHeight,\n currentDataWithNullValues,\n getOwnerProps,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAAsE;AACtE,iBAAoB;AACpB,uBAAyB;AACzB,sCAA2B;AAC3B,8BAA8B;AAC9B,mCAA4C;AAE5C,uBAA0B;AAC1B,qB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,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": ["ResizeObserver"]
7
7
  }
@@ -0,0 +1,62 @@
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 useChartDescription_exports = {};
30
+ __export(useChartDescription_exports, {
31
+ useChartDescription: () => useChartDescription
32
+ });
33
+ module.exports = __toCommonJS(useChartDescription_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_react = require("react");
36
+ var import_ChartContext = require("../ChartContext.js");
37
+ var import_helpers = require("../helpers/index.js");
38
+ const useChartDescription = () => {
39
+ const {
40
+ props: { xAxis, yAxis, xScroll },
41
+ isHorizontal,
42
+ xScale,
43
+ chartId,
44
+ currentData
45
+ } = (0, import_react.useContext)(import_ChartContext.ChartContext);
46
+ const hasData = currentData.length > 0;
47
+ const name = (0, import_helpers.getChartDefaultName)(isHorizontal ? xAxis.label : yAxis.label, isHorizontal ? yAxis.label : xAxis.label);
48
+ const instructions = (0, import_react.useMemo)(
49
+ () => (0, import_helpers.getKeyboardInstructions)({
50
+ isHorizontal,
51
+ hasSeveralSeries: currentData.length > 1,
52
+ canZoom: Boolean(xScroll) && xScale?.type !== "BAND"
53
+ }),
54
+ [currentData.length, isHorizontal, xScale?.type, xScroll]
55
+ );
56
+ return {
57
+ name,
58
+ instructionsId: hasData ? `ds-dataviz-instructions-${chartId}` : void 0,
59
+ instructions: hasData ? instructions : null
60
+ };
61
+ };
62
+ //# sourceMappingURL=useChartDescription.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/graphs/Chart/config/useChartDescription.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { useContext, useMemo } from 'react';\nimport { ChartContext } from '../ChartContext.js';\nimport { getChartDefaultName, getKeyboardInstructions } from '../helpers/index.js';\n\n// What the chart root tells a screen reader: a default name after its axis labels (consumers name it through the\n// dsDatavizRoot slot), and, while it has data to navigate, its keyboard instructions as description.\nexport const useChartDescription = () => {\n const {\n props: { xAxis, yAxis, xScroll },\n isHorizontal,\n xScale,\n chartId,\n currentData,\n } = useContext(ChartContext);\n const hasData = currentData.length > 0;\n\n const name = getChartDefaultName(isHorizontal ? xAxis.label : yAxis.label, isHorizontal ? yAxis.label : xAxis.label);\n const instructions = useMemo(\n () =>\n getKeyboardInstructions({\n isHorizontal,\n hasSeveralSeries: currentData.length > 1,\n canZoom: Boolean(xScroll) && xScale?.type !== 'BAND',\n }),\n [currentData.length, isHorizontal, xScale?.type, xScroll],\n );\n\n return {\n name,\n instructionsId: hasData ? `ds-dataviz-instructions-${chartId}` : undefined,\n instructions: hasData ? instructions : null,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAoC;AACpC,0BAA6B;AAC7B,qBAA6D;AAItD,MAAM,sBAAsB,MAAM;AACvC,QAAM;AAAA,IACJ,OAAO,EAAE,OAAO,OAAO,QAAQ;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gCAAY;AAC3B,QAAM,UAAU,YAAY,SAAS;AAErC,QAAM,WAAO,oCAAoB,eAAe,MAAM,QAAQ,MAAM,OAAO,eAAe,MAAM,QAAQ,MAAM,KAAK;AACnH,QAAM,mBAAe;AAAA,IACnB,UACE,wCAAwB;AAAA,MACtB;AAAA,MACA,kBAAkB,YAAY,SAAS;AAAA,MACvC,SAAS,QAAQ,OAAO,KAAK,QAAQ,SAAS;AAAA,IAChD,CAAC;AAAA,IACH,CAAC,YAAY,QAAQ,cAAc,QAAQ,MAAM,OAAO;AAAA,EAC1D;AAEA,SAAO;AAAA,IACL;AAAA,IACA,gBAAgB,UAAU,2BAA2B,OAAO,KAAK;AAAA,IACjE,cAAc,UAAU,eAAe;AAAA,EACzC;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,141 @@
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 useEntranceAnimation_exports = {};
30
+ __export(useEntranceAnimation_exports, {
31
+ ENTRANCE_ANIMATION: () => ENTRANCE_ANIMATION,
32
+ ENTRANCE_ATTRIBUTE: () => ENTRANCE_ATTRIBUTE,
33
+ getSerieEntrance: () => getSerieEntrance,
34
+ useEntranceAnimation: () => useEntranceAnimation
35
+ });
36
+ module.exports = __toCommonJS(useEntranceAnimation_exports);
37
+ var React = __toESM(require("react"));
38
+ var import_react = require("react");
39
+ var import_ChartContext = require("../ChartContext.js");
40
+ var import_scales = require("../scales/index.js");
41
+ const ENTRANCE_ANIMATION = {
42
+ DEFAULT_DURATION: 700,
43
+ // bars: a quick start that settles softly
44
+ EASING: "cubic-bezier(0.22, 1, 0.36, 1)",
45
+ // lines: an even pace, so their segments show up one after the other
46
+ REVEAL_EASING: "cubic-bezier(0.37, 0, 0.63, 1)",
47
+ // how far the reveal of a line reaches out of the plot, so its stroke and its markers are not cut at the edges
48
+ REVEAL_OVERFLOW: 12
49
+ };
50
+ const getSerieEntrance = (serie) => serie.type === "line" || serie.type === "area" ? "reveal" : "grow";
51
+ const ENTRANCE_ATTRIBUTE = "data-entrance-animation";
52
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
53
+ const clamp = (value, min, max) => Math.min(max, Math.max(min, value));
54
+ const getBaseline = (valueScale, edge, size) => {
55
+ if (!(valueScale instanceof import_scales.LinearScale) || valueScale instanceof import_scales.LogScale) return edge;
56
+ const zero = valueScale.get(0);
57
+ return Number.isFinite(zero) ? clamp(zero, 0, size) : edge;
58
+ };
59
+ const setRevealSize = (rect, innerWidth, innerHeight) => {
60
+ const overflow = ENTRANCE_ANIMATION.REVEAL_OVERFLOW;
61
+ rect.setAttribute("x", String(-overflow));
62
+ rect.setAttribute("y", String(-overflow));
63
+ rect.setAttribute("width", String(Math.max(0, innerWidth + overflow * 2)));
64
+ rect.setAttribute("height", String(Math.max(0, innerHeight + overflow * 2)));
65
+ };
66
+ const getDuration = (animationDuration) => (
67
+ // a negative or non numeric duration would make the Web Animation throw
68
+ Number.isFinite(animationDuration) ? Math.max(0, animationDuration) : ENTRANCE_ANIMATION.DEFAULT_DURATION
69
+ );
70
+ const getSeriesThatEnter = (seriesGroup, entrance) => Array.from(seriesGroup.querySelectorAll(`:scope > [${ENTRANCE_ATTRIBUTE}="${entrance}"]`));
71
+ const startReveal = (seriesGroup, drawn, {
72
+ clipId,
73
+ innerWidth,
74
+ innerHeight,
75
+ timing
76
+ }) => {
77
+ const clipPath = document.createElementNS(SVG_NAMESPACE, "clipPath");
78
+ clipPath.setAttribute("id", clipId);
79
+ const rect = document.createElementNS(SVG_NAMESPACE, "rect");
80
+ setRevealSize(rect, innerWidth, innerHeight);
81
+ clipPath.append(rect);
82
+ seriesGroup.prepend(clipPath);
83
+ drawn.forEach((serie) => serie.setAttribute("clip-path", `url(#${clipId})`));
84
+ const animation = rect.animate([{ transform: "scale(0, 1)" }, { transform: "scale(1, 1)" }], timing);
85
+ const remove = () => {
86
+ drawn.forEach((serie) => serie.removeAttribute("clip-path"));
87
+ clipPath.remove();
88
+ };
89
+ return { rect, animation, remove };
90
+ };
91
+ const useEntranceAnimation = () => {
92
+ const {
93
+ props: { withAnimation, animationDuration = ENTRANCE_ANIMATION.DEFAULT_DURATION },
94
+ chartId,
95
+ isHorizontal,
96
+ xScale,
97
+ yScale,
98
+ innerWidth,
99
+ innerHeight
100
+ } = (0, import_react.useContext)(import_ChartContext.ChartContext);
101
+ const [seriesGroup, setSeriesGroup] = (0, import_react.useState)(null);
102
+ const revealRef = (0, import_react.useRef)(null);
103
+ const transformOrigin = isHorizontal ? `${getBaseline(xScale, 0, innerWidth)}px 0px` : `0px ${getBaseline(yScale, innerHeight, innerHeight)}px`;
104
+ (0, import_react.useLayoutEffect)(() => {
105
+ if (!withAnimation || !seriesGroup || typeof seriesGroup.animate !== "function") return () => {
106
+ };
107
+ if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return () => {
108
+ };
109
+ const timing = { duration: getDuration(animationDuration), easing: ENTRANCE_ANIMATION.EASING };
110
+ const collapsed = isHorizontal ? "scale(0, 1)" : "scale(1, 0)";
111
+ const animations = getSeriesThatEnter(seriesGroup, "grow").map(
112
+ (serie) => serie.animate([{ transform: collapsed }, { transform: "scale(1, 1)" }], timing)
113
+ );
114
+ const drawn = getSeriesThatEnter(seriesGroup, "reveal");
115
+ const reveal = drawn.length ? startReveal(seriesGroup, drawn, {
116
+ clipId: `ds-dataviz-reveal-${chartId}`,
117
+ innerWidth,
118
+ innerHeight,
119
+ timing: { ...timing, easing: ENTRANCE_ANIMATION.REVEAL_EASING }
120
+ }) : null;
121
+ const removeReveal = () => {
122
+ reveal?.remove();
123
+ revealRef.current = null;
124
+ };
125
+ if (reveal) {
126
+ revealRef.current = reveal.rect;
127
+ animations.push(reveal.animation);
128
+ reveal.animation.finished?.then(removeReveal, () => {
129
+ });
130
+ }
131
+ return () => {
132
+ animations.forEach((animation) => animation.cancel());
133
+ removeReveal();
134
+ };
135
+ }, [seriesGroup]);
136
+ (0, import_react.useLayoutEffect)(() => {
137
+ if (revealRef.current) setRevealSize(revealRef.current, innerWidth, innerHeight);
138
+ });
139
+ return { setSeriesGroup, seriesGroup, withAnimation: Boolean(withAnimation), transformOrigin };
140
+ };
141
+ //# sourceMappingURL=useEntranceAnimation.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/graphs/Chart/config/useEntranceAnimation.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { useContext, useLayoutEffect, useRef, useState } from 'react';\nimport { ChartContext } from '../ChartContext.js';\nimport { LinearScale, LogScale, type ScaleT } from '../scales/index.js';\nimport type { DSChartT } from '../../../react-desc-prop-types.js';\n\nexport const ENTRANCE_ANIMATION = {\n DEFAULT_DURATION: 700,\n // bars: a quick start that settles softly\n EASING: 'cubic-bezier(0.22, 1, 0.36, 1)',\n // lines: an even pace, so their segments show up one after the other\n REVEAL_EASING: 'cubic-bezier(0.37, 0, 0.63, 1)',\n // how far the reveal of a line reaches out of the plot, so its stroke and its markers are not cut at the edges\n REVEAL_OVERFLOW: 12,\n};\n\n// How a series enters: bars and scatter points grow from the baseline, lines and areas are drawn from left to right\nexport type EntranceT = 'grow' | 'reveal';\nexport const getSerieEntrance = (serie: DSChartT.InternalSerie): EntranceT =>\n serie.type === 'line' || serie.type === 'area' ? 'reveal' : 'grow';\n\n// the attribute that marks the group of a series with the way it enters\nexport const ENTRANCE_ATTRIBUTE = 'data-entrance-animation';\n\nconst SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n\nconst clamp = (value: number, min: number, max: number) => Math.min(max, Math.max(min, value));\n\n// Where the marks grow from along the value axis: its zero, or the edge of the plot when zero is not on the axis (a log\n// axis, or a domain that does not reach it).\nconst getBaseline = (valueScale: ScaleT | null, edge: number, size: number) => {\n if (!(valueScale instanceof LinearScale) || valueScale instanceof LogScale) return edge;\n const zero = valueScale.get(0);\n return Number.isFinite(zero) ? clamp(zero, 0, size) : edge;\n};\n\nconst setRevealSize = (rect: SVGRectElement, innerWidth: number, innerHeight: number) => {\n const overflow = ENTRANCE_ANIMATION.REVEAL_OVERFLOW;\n rect.setAttribute('x', String(-overflow));\n rect.setAttribute('y', String(-overflow));\n rect.setAttribute('width', String(Math.max(0, innerWidth + overflow * 2)));\n rect.setAttribute('height', String(Math.max(0, innerHeight + overflow * 2)));\n};\n\nconst getDuration = (animationDuration: number) =>\n // a negative or non numeric duration would make the Web Animation throw\n Number.isFinite(animationDuration) ? Math.max(0, animationDuration) : ENTRANCE_ANIMATION.DEFAULT_DURATION;\n\nconst getSeriesThatEnter = (seriesGroup: SVGGElement, entrance: EntranceT) =>\n Array.from(seriesGroup.querySelectorAll<SVGGElement>(`:scope > [${ENTRANCE_ATTRIBUTE}=\"${entrance}\"]`));\n\n// Draws the series from left to right through a clip path that grows with the animation. Returns the rect of the clip,\n// so it can follow the size of the plot, the animation, and the cleanup that removes the clip path.\nconst startReveal = (\n seriesGroup: SVGGElement,\n drawn: SVGGElement[],\n {\n clipId,\n innerWidth,\n innerHeight,\n timing,\n }: { clipId: string; innerWidth: number; innerHeight: number; timing: KeyframeAnimationOptions },\n) => {\n const clipPath = document.createElementNS(SVG_NAMESPACE, 'clipPath');\n clipPath.setAttribute('id', clipId);\n const rect = document.createElementNS(SVG_NAMESPACE, 'rect');\n setRevealSize(rect, innerWidth, innerHeight);\n clipPath.append(rect);\n seriesGroup.prepend(clipPath);\n drawn.forEach((serie) => serie.setAttribute('clip-path', `url(#${clipId})`));\n const animation = rect.animate([{ transform: 'scale(0, 1)' }, { transform: 'scale(1, 1)' }], timing);\n const remove = () => {\n drawn.forEach((serie) => serie.removeAttribute('clip-path'));\n clipPath.remove();\n };\n return { rect, animation, remove };\n};\n\n// With withAnimation, the series enter when the chart mounts: bars and stacks grow from the baseline (they extend from it\n// on a horizontal chart) and scatter points rise from it, while lines and areas, with their points, are drawn from left\n// to right. Web Animations on the group of each series, so no render runs per frame. They run when the chart mounts\n// only: a new size, new data, a scroll step or a series shown again from the legend does not replay them. Skipped when\n// the user prefers reduced motion.\n//\n// The baseline is the transform origin of the groups that grow, a style that follows every render: the margins of the\n// chart are measured right after it mounts, and the baseline moves with them. Without a transform the origin has no\n// effect. The lines are drawn through a clip path that only exists while they are drawn, and that follows the size of\n// the plot in the same way.\nexport const useEntranceAnimation = () => {\n const {\n props: { withAnimation, animationDuration = ENTRANCE_ANIMATION.DEFAULT_DURATION },\n chartId,\n isHorizontal,\n xScale,\n yScale,\n innerWidth,\n innerHeight,\n } = useContext(ChartContext);\n const [seriesGroup, setSeriesGroup] = useState<SVGGElement | null>(null);\n const revealRef = useRef<SVGRectElement | null>(null);\n\n const transformOrigin = isHorizontal\n ? `${getBaseline(xScale, 0, innerWidth)}px 0px`\n : `0px ${getBaseline(yScale, innerHeight, innerHeight)}px`;\n\n useLayoutEffect(() => {\n if (!withAnimation || !seriesGroup || typeof seriesGroup.animate !== 'function') return () => {};\n if (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) return () => {};\n\n const timing = { duration: getDuration(animationDuration), easing: ENTRANCE_ANIMATION.EASING };\n const collapsed = isHorizontal ? 'scale(0, 1)' : 'scale(1, 0)';\n const animations = getSeriesThatEnter(seriesGroup, 'grow').map((serie) =>\n serie.animate([{ transform: collapsed }, { transform: 'scale(1, 1)' }], timing),\n );\n\n const drawn = getSeriesThatEnter(seriesGroup, 'reveal');\n const reveal = drawn.length\n ? startReveal(seriesGroup, drawn, {\n clipId: `ds-dataviz-reveal-${chartId}`,\n innerWidth,\n innerHeight,\n timing: { ...timing, easing: ENTRANCE_ANIMATION.REVEAL_EASING },\n })\n : null;\n const removeReveal = () => {\n reveal?.remove();\n revealRef.current = null;\n };\n if (reveal) {\n revealRef.current = reveal.rect;\n animations.push(reveal.animation);\n // the clip path is gone once the lines are drawn; a cancelled animation rejects, and the cleanup removes it then\n reveal.animation.finished?.then(removeReveal, () => {});\n }\n\n return () => {\n animations.forEach((animation) => animation.cancel());\n removeReveal();\n };\n // the group mounting is what starts them\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [seriesGroup]);\n\n // the reveal follows the size of the plot while the lines are drawn\n useLayoutEffect(() => {\n if (revealRef.current) setRevealSize(revealRef.current, innerWidth, innerHeight);\n });\n\n return { setSeriesGroup, seriesGroup, withAnimation: Boolean(withAnimation), transformOrigin };\n};\n", "import * as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;AAEnF,UAAM,SAAS,EAAE,UAAU,YAAY,iBAAiB,GAAG,QAAQ,mBAAmB,OAAO;AAC7F,UAAM,YAAY,eAAe,gBAAgB;AACjD,UAAM,aAAa,mBAAmB,aAAa,MAAM,EAAE;AAAA,MAAI,CAAC,UAC9D,MAAM,QAAQ,CAAC,EAAE,WAAW,UAAU,GAAG,EAAE,WAAW,cAAc,CAAC,GAAG,MAAM;AAAA,IAChF;AAEA,UAAM,QAAQ,mBAAmB,aAAa,QAAQ;AACtD,UAAM,SAAS,MAAM,SACjB,YAAY,aAAa,OAAO;AAAA,MAC9B,QAAQ,qBAAqB,OAAO;AAAA,MACpC;AAAA,MACA;AAAA,MACA,QAAQ,EAAE,GAAG,QAAQ,QAAQ,mBAAmB,cAAc;AAAA,IAChE,CAAC,IACD;AACJ,UAAM,eAAe,MAAM;AACzB,cAAQ,OAAO;AACf,gBAAU,UAAU;AAAA,IACtB;AACA,QAAI,QAAQ;AACV,gBAAU,UAAU,OAAO;AAC3B,iBAAW,KAAK,OAAO,SAAS;AAEhC,aAAO,UAAU,UAAU,KAAK,cAAc,MAAM;AAAA,MAAC,CAAC;AAAA,IACxD;AAEA,WAAO,MAAM;AACX,iBAAW,QAAQ,CAAC,cAAc,UAAU,OAAO,CAAC;AACpD,mBAAa;AAAA,IACf;AAAA,EAGF,GAAG,CAAC,WAAW,CAAC;AAGhB,oCAAgB,MAAM;AACpB,QAAI,UAAU,QAAS,eAAc,UAAU,SAAS,YAAY,WAAW;AAAA,EACjF,CAAC;AAED,SAAO,EAAE,gBAAgB,aAAa,eAAe,QAAQ,aAAa,GAAG,gBAAgB;AAC/F;",
6
+ "names": []
7
+ }
@@ -33,6 +33,14 @@ __export(useGetters_exports, {
33
33
  module.exports = __toCommonJS(useGetters_exports);
34
34
  var React = __toESM(require("react"));
35
35
  var import_react = require("react");
36
+ const formatDateInUtc = (date) => {
37
+ const hasTime = date.getUTCHours() !== 0 || date.getUTCMinutes() !== 0;
38
+ return date.toLocaleString("en-US", {
39
+ timeZone: "UTC",
40
+ dateStyle: "medium",
41
+ ...hasTime ? { timeStyle: "short" } : {}
42
+ });
43
+ };
36
44
  function isLinear(scale) {
37
45
  return scale.type !== "LINEAR";
38
46
  }
@@ -140,6 +148,8 @@ const useGetters = ({ xAxis, isHorizontal, yAxis, xScale, yScale, y2Scale }) =>
140
148
  if (!datum) return null;
141
149
  const value = getXValue(datum);
142
150
  if (typeof xAxis.tick?.tickFormat === "function") return xAxis.tick.tickFormat(value);
151
+ const rawValue = value;
152
+ if (rawValue instanceof Date) return formatDateInUtc(rawValue);
143
153
  return value;
144
154
  },
145
155
  [getXValue, xAxis.tick]