@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
@@ -1,16 +1,35 @@
1
1
  import * as React from "react";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useContext, useCallback, useMemo } from "react";
4
+ import { ThemeContext } from "@elliemae/ds-system";
4
5
  import { ChartContext } from "../../ChartContext.js";
6
+ import { useChartInteraction } from "../../config/chartInteractionStore.js";
5
7
  import { AxisBottom } from "../Axis/AxisBottom.js";
6
8
  import { SeriesFactory } from "../SeriesFactory.js";
7
9
  import { ScrollBarX } from "./ScrollBarX.js";
8
10
  import { Scrapper } from "../Scrapper/Scrapper.js";
9
11
  import { VerticalScrapper } from "../Scrapper/VerticalScrapper.js";
12
+ const ZoomSelection = () => {
13
+ const { innerHeight } = useContext(ChartContext);
14
+ const theme = useContext(ThemeContext);
15
+ const isZooming = useChartInteraction((state) => state.isZooming);
16
+ const start = useChartInteraction((state) => state.zoomStartingPosition);
17
+ const end = useChartInteraction((state) => state.movingPosition);
18
+ if (!isZooming || end === 0) return null;
19
+ return /* @__PURE__ */ jsx(
20
+ "rect",
21
+ {
22
+ x: Math.min(start, end),
23
+ width: Math.abs(end - start),
24
+ height: innerHeight,
25
+ fill: theme?.colors?.brand?.["500"] ?? "#1394E5",
26
+ style: { opacity: 0.15 }
27
+ }
28
+ );
29
+ };
10
30
  const ScrollableContainerX = () => {
11
31
  const {
12
32
  props: { scrapper },
13
- xScrollbarPosition,
14
33
  xScale,
15
34
  containerRatio,
16
35
  innerWidth,
@@ -19,16 +38,11 @@ const ScrollableContainerX = () => {
19
38
  setXScrollbarPosition,
20
39
  setContainerRatio,
21
40
  lastScrollbarPosition,
22
- innerHeight,
23
41
  internalMargin,
24
42
  chartId,
25
- isZooming,
26
- setIsZooming,
27
- zoomStartingPosition,
28
- setZoomStartingPosition,
29
- movingPosition,
30
- setMovingPosition
43
+ interactionStore
31
44
  } = useContext(ChartContext);
45
+ const xScrollbarPosition = useChartInteraction((state) => state.xScrollbarPosition);
32
46
  const getRealClientX = useCallback(
33
47
  (clientX) => clientX - internalMargin.left - (containerRef?.getBoundingClientRect().left || 0),
34
48
  [containerRef, internalMargin.left]
@@ -38,27 +52,36 @@ const ScrollableContainerX = () => {
38
52
  if (scrapper && scrapper?.type === "vertical") return /* @__PURE__ */ jsx(VerticalScrapper, {});
39
53
  return null;
40
54
  }, [scrapper]);
55
+ const content = useMemo(
56
+ () => /* @__PURE__ */ jsxs(Fragment, { children: [
57
+ /* @__PURE__ */ jsx(AxisBottom, {}),
58
+ /* @__PURE__ */ jsx(SeriesFactory, {}),
59
+ Scrappers
60
+ ] }),
61
+ [Scrappers]
62
+ );
41
63
  const handleOnMouseDown = useCallback(
42
64
  ({ clientX }) => {
43
65
  if (!isGrabbed && xScale?.type !== "BAND") {
44
- setIsZooming(true);
45
- setZoomStartingPosition(getRealClientX(clientX));
46
- setMovingPosition(0);
66
+ interactionStore.setIsZooming(true);
67
+ interactionStore.setZoomStartingPosition(getRealClientX(clientX));
68
+ interactionStore.setMovingPosition(0);
47
69
  }
48
70
  },
49
- [getRealClientX, isGrabbed, setIsZooming, setMovingPosition, setZoomStartingPosition, xScale?.type]
71
+ [getRealClientX, interactionStore, isGrabbed, xScale?.type]
50
72
  );
51
73
  const handleOnMouseMove = useCallback(
52
74
  ({ clientX }) => {
53
- if (isZooming) setMovingPosition(getRealClientX(clientX));
75
+ if (interactionStore.getState().isZooming) interactionStore.setMovingPosition(getRealClientX(clientX));
54
76
  },
55
- [getRealClientX, isZooming, setMovingPosition]
77
+ [getRealClientX, interactionStore]
56
78
  );
57
79
  const handleOnMouseUp = useCallback(
58
80
  (e) => {
81
+ const { isZooming, zoomStartingPosition } = interactionStore.getState();
59
82
  if (!isZooming) return;
60
- setIsZooming(false);
61
- setMovingPosition(0);
83
+ interactionStore.setIsZooming(false);
84
+ interactionStore.setMovingPosition(0);
62
85
  const endingPosition = getRealClientX(e.clientX);
63
86
  const diff = Math.abs(zoomStartingPosition - endingPosition);
64
87
  if (diff <= 0) return;
@@ -71,11 +94,8 @@ const ScrollableContainerX = () => {
71
94
  e.stopPropagation();
72
95
  },
73
96
  [
74
- isZooming,
75
- setIsZooming,
76
- setMovingPosition,
97
+ interactionStore,
77
98
  getRealClientX,
78
- zoomStartingPosition,
79
99
  innerWidth,
80
100
  containerRatio,
81
101
  lastScrollbarPosition,
@@ -92,21 +112,8 @@ const ScrollableContainerX = () => {
92
112
  onMouseUp: handleOnMouseUp,
93
113
  children: [
94
114
  /* @__PURE__ */ jsxs("g", { mask: `url(#mask-${chartId})`, children: [
95
- /* @__PURE__ */ jsxs("g", { transform: `translate(${-xScrollbarPosition * containerRatio},0)`, children: [
96
- /* @__PURE__ */ jsx(AxisBottom, {}),
97
- /* @__PURE__ */ jsx(SeriesFactory, {}),
98
- Scrappers
99
- ] }),
100
- isZooming && movingPosition !== 0 ? /* @__PURE__ */ jsx(
101
- "rect",
102
- {
103
- x: movingPosition < zoomStartingPosition ? movingPosition : zoomStartingPosition,
104
- width: Math.abs(movingPosition - zoomStartingPosition),
105
- height: innerHeight,
106
- fill: "orange",
107
- style: { opacity: 0.2 }
108
- }
109
- ) : null
115
+ /* @__PURE__ */ jsx("g", { transform: `translate(${-xScrollbarPosition * containerRatio},0)`, children: content }),
116
+ /* @__PURE__ */ jsx(ZoomSelection, {})
110
117
  ] }),
111
118
  /* @__PURE__ */ jsx(ScrollBarX, {})
112
119
  ]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scroller/ScrollableContainerX.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useCallback, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext.js';\nimport { AxisBottom } from '../Axis/AxisBottom.js';\nimport { SeriesFactory } from '../SeriesFactory.js';\nimport { ScrollBarX } from './ScrollBarX.js';\nimport { Scrapper } from '../Scrapper/Scrapper.js';\nimport { VerticalScrapper } from '../Scrapper/VerticalScrapper.js';\nexport const ScrollableContainerX = () => {\n const {\n props: { scrapper },\n xScrollbarPosition,\n xScale,\n containerRatio,\n innerWidth,\n isGrabbed,\n containerRef,\n setXScrollbarPosition,\n setContainerRatio,\n lastScrollbarPosition,\n innerHeight,\n internalMargin,\n chartId,\n isZooming,\n setIsZooming,\n zoomStartingPosition,\n setZoomStartingPosition,\n movingPosition,\n setMovingPosition,\n } = useContext(ChartContext);\n\n const getRealClientX = useCallback(\n (clientX: number) => clientX - internalMargin.left - (containerRef?.getBoundingClientRect().left || 0),\n [containerRef, internalMargin.left],\n );\n\n const Scrappers = useMemo(() => {\n if (scrapper && scrapper?.type === 'horizontal') return <Scrapper />;\n if (scrapper && scrapper?.type === 'vertical') return <VerticalScrapper />;\n return null;\n }, [scrapper]);\n\n const handleOnMouseDown: React.MouseEventHandler = useCallback(\n ({ clientX }) => {\n if (!isGrabbed && xScale?.type !== 'BAND') {\n setIsZooming(true);\n setZoomStartingPosition(getRealClientX(clientX));\n setMovingPosition(0);\n }\n },\n [getRealClientX, isGrabbed, setIsZooming, setMovingPosition, setZoomStartingPosition, xScale?.type],\n );\n\n const handleOnMouseMove: React.MouseEventHandler = useCallback(\n ({ clientX }) => {\n if (isZooming) setMovingPosition(getRealClientX(clientX));\n },\n [getRealClientX, isZooming, setMovingPosition],\n );\n const handleOnMouseUp: React.MouseEventHandler = useCallback(\n (e) => {\n if (!isZooming) return;\n setIsZooming(false);\n setMovingPosition(0);\n const endingPosition = getRealClientX(e.clientX);\n\n const diff = Math.abs(zoomStartingPosition - endingPosition);\n if (diff <= 0) return;\n const newRatio =\n innerWidth / ((innerWidth * containerRatio) / diff) < 40\n ? innerWidth / 40\n : (innerWidth * containerRatio) / diff;\n const newPosition =\n lastScrollbarPosition.current +\n (zoomStartingPosition > endingPosition ? endingPosition : zoomStartingPosition) / containerRatio;\n\n // if (newPosition < 0) setXScrollbarPosition(0);\n // if is bigger thant innerwidth possible we force the end\n if (newPosition > innerWidth - innerWidth / newRatio) setXScrollbarPosition(innerWidth - innerWidth / newRatio);\n else setXScrollbarPosition(newPosition);\n\n setContainerRatio(newRatio);\n lastScrollbarPosition.current = newPosition;\n e.stopPropagation();\n },\n [\n isZooming,\n setIsZooming,\n setMovingPosition,\n getRealClientX,\n zoomStartingPosition,\n innerWidth,\n containerRatio,\n lastScrollbarPosition,\n setXScrollbarPosition,\n setContainerRatio,\n ],\n );\n return (\n <g\n className=\"scrollable-container-x\"\n onMouseDown={handleOnMouseDown}\n onMouseMove={handleOnMouseMove}\n onMouseUp={handleOnMouseUp}\n >\n <g mask={`url(#mask-${chartId})`}>\n <g transform={`translate(${-xScrollbarPosition * containerRatio},0)`}>\n <AxisBottom />\n <SeriesFactory />\n {Scrappers}\n </g>\n {isZooming && movingPosition !== 0 ? (\n <rect\n x={movingPosition < zoomStartingPosition ? movingPosition : zoomStartingPosition}\n width={Math.abs(movingPosition - zoomStartingPosition)}\n height={innerHeight}\n fill=\"orange\"\n style={{ opacity: 0.2 }}\n />\n ) : null}\n </g>\n <ScrollBarX />\n </g>\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACsCqC,cAqEpD,YArEoD;AApC5D,SAAgB,YAAY,aAAa,eAAe;AACxD,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AAC1B,MAAM,uBAAuB,MAAM;AACxC,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,YAAY;AAE3B,QAAM,iBAAiB;AAAA,IACrB,CAAC,YAAoB,UAAU,eAAe,QAAQ,cAAc,sBAAsB,EAAE,QAAQ;AAAA,IACpG,CAAC,cAAc,eAAe,IAAI;AAAA,EACpC;AAEA,QAAM,YAAY,QAAQ,MAAM;AAC9B,QAAI,YAAY,UAAU,SAAS,aAAc,QAAO,oBAAC,YAAS;AAClE,QAAI,YAA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AAAA,MACC,WAAU;AAAA,MACV,aAAa;AAAA,MACb,aAAa;AAAA,MACb,WAAW;AAAA,MAEX;AAAA,6BAAC,OAAE,MAAM,aAAa,OAAO,KAC3B;AAAA,+BAAC,OAAE,WAAW,aAAa,CAAC,qBAAqB,cAAc,OAC7D;AAAA,gCAAC,cAAW;AAAA,YACZ,oBAAC,iBAAc;AAAA,YACd;AAAA,aACH;AAAA,UACC,aAAa,mBAAmB,IAC/B;AAAA,YAAC;AAAA;AAAA,cACC,GAAG,iBAAiB,uBAAuB,iBAAiB;AAAA,cAC5D,OAAO,KAAK,IAAI,iBAAiB,oBAAoB;AAAA,cACrD,QAAQ;AAAA,cACR,MAAK;AAAA,cACL,OAAO,EAAE,SAAS,IAAI;AAAA;AAAA,UACxB,IACE;AAAA,WACN;AAAA,QACA,oBAAC,cAAW;AAAA;AAAA;AAAA,EACd;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useCallback, useMemo } from 'react';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../../ChartContext.js';\nimport { useChartInteraction } from '../../config/chartInteractionStore.js';\nimport { AxisBottom } from '../Axis/AxisBottom.js';\nimport { SeriesFactory } from '../SeriesFactory.js';\nimport { ScrollBarX } from './ScrollBarX.js';\nimport { Scrapper } from '../Scrapper/Scrapper.js';\nimport { VerticalScrapper } from '../Scrapper/VerticalScrapper.js';\n\n// The range being dragged to zoom into, in the brand color. It is the only part of the chart that follows the pointer\n// during the drag: it subscribes to the selection, which moves on every pointer move.\nconst ZoomSelection = () => {\n const { innerHeight } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n const isZooming = useChartInteraction((state) => state.isZooming);\n const start = useChartInteraction((state) => state.zoomStartingPosition);\n const end = useChartInteraction((state) => state.movingPosition);\n if (!isZooming || end === 0) return null;\n return (\n <rect\n x={Math.min(start, end)}\n width={Math.abs(end - start)}\n height={innerHeight}\n fill={theme?.colors?.brand?.['500'] ?? '#1394E5'}\n style={{ opacity: 0.15 }}\n />\n );\n};\n\nexport const ScrollableContainerX = () => {\n const {\n props: { scrapper },\n xScale,\n containerRatio,\n innerWidth,\n isGrabbed,\n containerRef,\n setXScrollbarPosition,\n setContainerRatio,\n lastScrollbarPosition,\n internalMargin,\n chartId,\n interactionStore,\n } = useContext(ChartContext);\n const xScrollbarPosition = useChartInteraction((state) => state.xScrollbarPosition);\n\n const getRealClientX = useCallback(\n (clientX: number) => clientX - internalMargin.left - (containerRef?.getBoundingClientRect().left || 0),\n [containerRef, internalMargin.left],\n );\n\n const Scrappers = useMemo(() => {\n if (scrapper && scrapper?.type === 'horizontal') return <Scrapper />;\n if (scrapper && scrapper?.type === 'vertical') return <VerticalScrapper />;\n return null;\n }, [scrapper]);\n\n // built once per change of its inputs, not on every scroll step: a scroll step only moves it (the series, the\n // scrapper and the axis subscribe to what they need themselves)\n const content = useMemo(\n () => (\n <>\n <AxisBottom />\n <SeriesFactory />\n {Scrappers}\n </>\n ),\n [Scrappers],\n );\n\n // the selection is read from the store when the pointer moves, not subscribed to: this group holds the whole plot\n const handleOnMouseDown: React.MouseEventHandler = useCallback(\n ({ clientX }) => {\n if (!isGrabbed && xScale?.type !== 'BAND') {\n interactionStore.setIsZooming(true);\n interactionStore.setZoomStartingPosition(getRealClientX(clientX));\n interactionStore.setMovingPosition(0);\n }\n },\n [getRealClientX, interactionStore, isGrabbed, xScale?.type],\n );\n\n const handleOnMouseMove: React.MouseEventHandler = useCallback(\n ({ clientX }) => {\n if (interactionStore.getState().isZooming) interactionStore.setMovingPosition(getRealClientX(clientX));\n },\n [getRealClientX, interactionStore],\n );\n const handleOnMouseUp: React.MouseEventHandler = useCallback(\n (e) => {\n const { isZooming, zoomStartingPosition } = interactionStore.getState();\n if (!isZooming) return;\n interactionStore.setIsZooming(false);\n interactionStore.setMovingPosition(0);\n const endingPosition = getRealClientX(e.clientX);\n\n const diff = Math.abs(zoomStartingPosition - endingPosition);\n if (diff <= 0) return;\n const newRatio =\n innerWidth / ((innerWidth * containerRatio) / diff) < 40\n ? innerWidth / 40\n : (innerWidth * containerRatio) / diff;\n const newPosition =\n lastScrollbarPosition.current +\n (zoomStartingPosition > endingPosition ? endingPosition : zoomStartingPosition) / containerRatio;\n\n // if (newPosition < 0) setXScrollbarPosition(0);\n // if is bigger thant innerwidth possible we force the end\n if (newPosition > innerWidth - innerWidth / newRatio) setXScrollbarPosition(innerWidth - innerWidth / newRatio);\n else setXScrollbarPosition(newPosition);\n\n setContainerRatio(newRatio);\n lastScrollbarPosition.current = newPosition;\n e.stopPropagation();\n },\n [\n interactionStore,\n getRealClientX,\n innerWidth,\n containerRatio,\n lastScrollbarPosition,\n setXScrollbarPosition,\n setContainerRatio,\n ],\n );\n return (\n <g\n className=\"scrollable-container-x\"\n onMouseDown={handleOnMouseDown}\n onMouseMove={handleOnMouseMove}\n onMouseUp={handleOnMouseUp}\n >\n <g mask={`url(#mask-${chartId})`}>\n <g transform={`translate(${-xScrollbarPosition * containerRatio},0)`}>{content}</g>\n <ZoomSelection />\n </g>\n <ScrollBarX />\n </g>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACsBnB,SA0CE,UA1CF,KA0CE,YA1CF;AApBJ,SAAgB,YAAY,aAAa,eAAe;AACxD,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AACpC,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AAIjC,MAAM,gBAAgB,MAAM;AAC1B,QAAM,EAAE,YAAY,IAAI,WAAW,YAAY;AAC/C,QAAM,QAAQ,WAAW,YAAY;AACrC,QAAM,YAAY,oBAAoB,CAAC,UAAU,MAAM,SAAS;AAChE,QAAM,QAAQ,oBAAoB,CAAC,UAAU,MAAM,oBAAoB;AACvE,QAAM,MAAM,oBAAoB,CA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A,UAC/E,oBAAC,iBAAc;AAAA,WACjB;AAAA,QACA,oBAAC,cAAW;AAAA;AAAA;AAAA,EACd;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,8 @@
1
1
  import * as React from "react";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useContext, useMemo } from "react";
4
4
  import { ChartContext } from "../../ChartContext.js";
5
+ import { useChartInteraction } from "../../config/chartInteractionStore.js";
5
6
  import { SeriesFactory } from "../SeriesFactory.js";
6
7
  import { ScrollBarY } from "./ScrollBarY.js";
7
8
  import { Scrapper } from "../Scrapper/Scrapper.js";
@@ -10,21 +11,25 @@ import { AxisLeft } from "../Axis/AxisLeft.js";
10
11
  const ScrollableContainerY = () => {
11
12
  const {
12
13
  props: { scrapper },
13
- xScrollbarPosition,
14
14
  containerRatio,
15
15
  chartId
16
16
  } = useContext(ChartContext);
17
+ const xScrollbarPosition = useChartInteraction((state) => state.xScrollbarPosition);
17
18
  const Scrappers = useMemo(() => {
18
19
  if (scrapper?.type === "horizontal") return /* @__PURE__ */ jsx(Scrapper, {});
19
20
  if (scrapper?.type === "vertical") return /* @__PURE__ */ jsx(VerticalScrapper, {});
20
21
  return null;
21
22
  }, [scrapper?.type]);
22
- return /* @__PURE__ */ jsxs("g", { className: "scrollable-container-y", children: [
23
- /* @__PURE__ */ jsx("g", { mask: `url(#mask-y-${chartId})`, children: /* @__PURE__ */ jsxs("g", { transform: `translate(0,${-xScrollbarPosition * containerRatio})`, children: [
23
+ const content = useMemo(
24
+ () => /* @__PURE__ */ jsxs(Fragment, { children: [
24
25
  /* @__PURE__ */ jsx(SeriesFactory, {}),
25
26
  Scrappers,
26
27
  /* @__PURE__ */ jsx(AxisLeft, {})
27
- ] }) }),
28
+ ] }),
29
+ [Scrappers]
30
+ );
31
+ return /* @__PURE__ */ jsxs("g", { className: "scrollable-container-y", children: [
32
+ /* @__PURE__ */ jsx("g", { mask: `url(#mask-y-${chartId})`, children: /* @__PURE__ */ jsx("g", { transform: `translate(0,${-xScrollbarPosition * containerRatio})`, children: content }) }),
28
33
  /* @__PURE__ */ jsx(ScrollBarY, {})
29
34
  ] });
30
35
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scroller/ScrollableContainerY.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext.js';\nimport { SeriesFactory } from '../SeriesFactory.js';\nimport { ScrollBarY } from './ScrollBarY.js';\nimport { Scrapper } from '../Scrapper/Scrapper.js';\nimport { VerticalScrapper } from '../Scrapper/VerticalScrapper.js';\nimport { AxisLeft } from '../Axis/AxisLeft.js';\nexport const ScrollableContainerY = () => {\n const {\n props: { scrapper },\n xScrollbarPosition,\n containerRatio,\n chartId,\n } = useContext(ChartContext);\n\n const Scrappers = useMemo(() => {\n if (scrapper?.type === 'horizontal') return <Scrapper />;\n if (scrapper?.type === 'vertical') return <VerticalScrapper />;\n return null;\n }, [scrapper?.type]);\n\n return (\n <g className=\"scrollable-container-y\">\n <g mask={`url(#mask-y-${chartId})`}>\n <g transform={`translate(0,${-xScrollbarPosition * containerRatio})`}>\n <SeriesFactory />\n {Scrappers}\n <AxisLeft />\n </g>\n </g>\n <ScrollBarY />\n </g>\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACkByB,cAQxC,YARwC;AAhBhD,SAAgB,YAAY,eAAe;AAC3C,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAAS,gBAAgB;AAClB,MAAM,uBAAuB,MAAM;AACxC,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,YAAY;AAE3B,QAAM,YAAY,QAAQ,MAAM;AAC9B,QAAI,UAAU,SAAS,aAAc,QAAO,oBAAC,YAAS;AACtD,QAAI,UAAU,SAAS,WAAY,QAAO,oBAAC,oBAAiB;AAC5D,WAAO;AAAA,EACT,GAAG,CAAC,UAAU,IAAI,CAAC;AAEnB,SACE,qBAAC,OAAE,WAAU,0BACX;AAAA,wBAAC,OAAE,MAAM,eAAe,OAAO,KAC7B,+BAAC,OAAE,WAAW,eAAe,CAAC,qBAAqB,cAAc,KAC/D;AAAA,0BAAC,iBAAc;AAAA,MACd;AAAA,MACD,oBAAC,YAAS;AAAA,OACZ,GACF;AAAA,IACA,oBAAC,cAAW;AAAA,KACd;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext.js';\nimport { useChartInteraction } from '../../config/chartInteractionStore.js';\nimport { SeriesFactory } from '../SeriesFactory.js';\nimport { ScrollBarY } from './ScrollBarY.js';\nimport { Scrapper } from '../Scrapper/Scrapper.js';\nimport { VerticalScrapper } from '../Scrapper/VerticalScrapper.js';\nimport { AxisLeft } from '../Axis/AxisLeft.js';\nexport const ScrollableContainerY = () => {\n const {\n props: { scrapper },\n containerRatio,\n chartId,\n } = useContext(ChartContext);\n const xScrollbarPosition = useChartInteraction((state) => state.xScrollbarPosition);\n\n const Scrappers = useMemo(() => {\n if (scrapper?.type === 'horizontal') return <Scrapper />;\n if (scrapper?.type === 'vertical') return <VerticalScrapper />;\n return null;\n }, [scrapper?.type]);\n\n // built once per change of its inputs, not on every scroll step: a scroll step only moves it (the series, the\n // scrapper and the axis subscribe to what they need themselves)\n const content = useMemo(\n () => (\n <>\n <SeriesFactory />\n {Scrappers}\n <AxisLeft />\n </>\n ),\n [Scrappers],\n );\n\n return (\n <g className=\"scrollable-container-y\">\n <g mask={`url(#mask-y-${chartId})`}>\n <g transform={`translate(0,${-xScrollbarPosition * containerRatio})`}>{content}</g>\n </g>\n <ScrollBarY />\n </g>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACmByB,SAS1C,UAT0C,KAS1C,YAT0C;AAjBhD,SAAgB,YAAY,eAAe;AAC3C,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AACpC,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAAS,gBAAgB;AAClB,MAAM,uBAAuB,MAAM;AACxC,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS;AAAA,IAClB;AAAA,IACA;AAAA,EACF,IAAI,WAAW,YAAY;AAC3B,QAAM,qBAAqB,oBAAoB,CAAC,UAAU,MAAM,kBAAkB;AAElF,QAAM,YAAY,QAAQ,MAAM;AAC9B,QAAI,UAAU,SAAS,aAAc,QAAO,oBAAC,YAAS;AACtD,QAAI,UAAU,SAAS,WAAY,QAAO,oBAAC,oBAAiB;AAC5D,WAAO;AAAA,EACT,GAAG,CAAC,UAAU,IAAI,CAAC;AAInB,QAAM,UAAU;AAAA,IACd,MACE,iCACE;AAAA,0BAAC,iBAAc;AAAA,MACd;AAAA,MACD,oBAAC,YAAS;AAAA,OACZ;AAAA,IAEF,CAAC,SAAS;AAAA,EACZ;AAEA,SACE,qBAAC,OAAE,WAAU,0BACX;AAAA,wBAAC,OAAE,MAAM,eAAe,OAAO,KAC7B,8BAAC,OAAE,WAAW,eAAe,CAAC,qBAAqB,cAAc,KAAM,mBAAQ,GACjF;AAAA,IACA,oBAAC,cAAW;AAAA,KACd;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -1,46 +1,55 @@
1
1
  import * as React from "react";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useContext, useMemo } from "react";
4
4
  import { ChartContext } from "../ChartContext.js";
5
5
  import { Line, Points, Bars, StackedBar, Area, HorizontalBars, HorizontalStackedBars } from "../series/index.js";
6
6
  import { getStackedIndex } from "../helpers/index.js";
7
7
  import { useVirtualizedSeries } from "../helpers/useVirtualizedSeries.js";
8
+ import { HoverBand } from "./HoverBand.js";
9
+ import { ZeroLine } from "./ZeroLine.js";
10
+ import { ENTRANCE_ATTRIBUTE, getSerieEntrance, useEntranceAnimation } from "../config/useEntranceAnimation.js";
11
+ import { VALUE_AXIS_TRANSITION, useValueAxisTransition } from "../config/useValueAxisTransition.js";
12
+ const getSerieComponent = (serie, { groups, types, isHorizontal }) => {
13
+ const isStacked = Boolean(groups) && getStackedIndex(groups, serie.name) > -1;
14
+ if (serie.type === "bar" && isStacked) return isHorizontal ? HorizontalStackedBars : StackedBar;
15
+ if (serie.type === "bar") return isHorizontal ? HorizontalBars : Bars;
16
+ if (types === "scatter" && !serie.type || serie.type === "point") return Points;
17
+ if (serie.type === "line") return Line;
18
+ if (serie.type === "area") return Area;
19
+ return null;
20
+ };
8
21
  const SeriesFactory = () => {
9
22
  const {
10
- props: { groups, types },
23
+ props: { groups, types, y2Axis },
11
24
  isHorizontal
12
25
  } = useContext(ChartContext);
13
26
  const virtualizedSeries = useVirtualizedSeries();
27
+ const { setSeriesGroup, seriesGroup, withAnimation, transformOrigin } = useEntranceAnimation();
28
+ useValueAxisTransition(seriesGroup);
29
+ const eases = !isHorizontal;
14
30
  return useMemo(
15
- () => /* @__PURE__ */ jsx("g", { className: "content", children: virtualizedSeries.map((serie) => {
16
- const serieProps = {
17
- key: serie.key,
18
- serie
19
- };
20
- if (serie.type === "bar" && groups && getStackedIndex(groups, serie.name) > -1 && isHorizontal) {
21
- return /* @__PURE__ */ jsx(HorizontalStackedBars, { ...serieProps });
22
- }
23
- if (serie.type === "bar" && groups && getStackedIndex(groups, serie.name) > -1) {
24
- return /* @__PURE__ */ jsx(StackedBar, { ...serieProps });
25
- }
26
- if (serie.type === "bar" && isHorizontal) {
27
- return /* @__PURE__ */ jsx(HorizontalBars, { ...serieProps });
28
- }
29
- if (serie.type === "bar") {
30
- return /* @__PURE__ */ jsx(Bars, { ...serieProps });
31
- }
32
- if (types === "scatter" && !serie.type || serie.type === "point") {
33
- return /* @__PURE__ */ jsx(Points, { ...serieProps });
34
- }
35
- if (serie.type === "line") {
36
- return /* @__PURE__ */ jsx(Line, { ...serieProps });
37
- }
38
- if (serie.type === "area") {
39
- return /* @__PURE__ */ jsx(Area, { ...serieProps });
40
- }
41
- return null;
42
- }) }),
43
- [groups, isHorizontal, types, virtualizedSeries]
31
+ () => /* @__PURE__ */ jsxs("g", { className: "content", ref: setSeriesGroup, children: [
32
+ /* @__PURE__ */ jsx(HoverBand, {}),
33
+ eases ? /* @__PURE__ */ jsx("g", { ...{ [VALUE_AXIS_TRANSITION.ATTRIBUTE]: "y" }, children: /* @__PURE__ */ jsx(ZeroLine, {}) }) : /* @__PURE__ */ jsx(ZeroLine, {}),
34
+ virtualizedSeries.map((serie) => {
35
+ const Serie = getSerieComponent(serie, { groups, types, isHorizontal });
36
+ if (!Serie) return null;
37
+ const valueAxis = serie.scale === "y2" && y2Axis ? "y2" : "y";
38
+ const drawn = (key) => eases ? /* @__PURE__ */ jsx("g", { ...{ [VALUE_AXIS_TRANSITION.ATTRIBUTE]: valueAxis }, children: /* @__PURE__ */ jsx(Serie, { serie }) }, key) : /* @__PURE__ */ jsx(Serie, { serie }, key);
39
+ if (!withAnimation) return drawn(serie.key);
40
+ const entrance = getSerieEntrance(serie);
41
+ return /* @__PURE__ */ jsx(
42
+ "g",
43
+ {
44
+ ...{ [ENTRANCE_ATTRIBUTE]: entrance },
45
+ style: entrance === "grow" ? { transformOrigin } : void 0,
46
+ children: drawn()
47
+ },
48
+ serie.key
49
+ );
50
+ })
51
+ ] }),
52
+ [eases, groups, isHorizontal, setSeriesGroup, transformOrigin, types, virtualizedSeries, withAnimation, y2Axis]
44
53
  );
45
54
  };
46
55
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/parts/SeriesFactory.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../ChartContext.js';\nimport { Line, Points, Bars, StackedBar, Area, HorizontalBars, HorizontalStackedBars } from '../series/index.js';\nimport { getStackedIndex } from '../helpers/index.js';\nimport { useVirtualizedSeries } from '../helpers/useVirtualizedSeries.js';\n\nexport const SeriesFactory = () => {\n const {\n props: { groups, types },\n isHorizontal,\n } = useContext(ChartContext);\n\n const virtualizedSeries = useVirtualizedSeries();\n\n return useMemo(\n () => (\n <g className=\"content\">\n {/* <g className=\"content\"> */}\n {virtualizedSeries.map((serie) => {\n const serieProps = {\n key: serie.key,\n serie,\n };\n if (serie.type === 'bar' && groups && getStackedIndex(groups, serie.name) > -1 && isHorizontal) {\n return <HorizontalStackedBars {...serieProps} />;\n }\n if (serie.type === 'bar' && groups && getStackedIndex(groups, serie.name) > -1) {\n return <StackedBar {...serieProps} />;\n }\n if (serie.type === 'bar' && isHorizontal) {\n return <HorizontalBars {...serieProps} />;\n }\n if (serie.type === 'bar') {\n return <Bars {...serieProps} />;\n }\n if ((types === 'scatter' && !serie.type) || serie.type === 'point') {\n return <Points {...serieProps} />;\n }\n if (serie.type === 'line') {\n return <Line {...serieProps} />;\n }\n if (serie.type === 'area') {\n return <Area {...serieProps} />;\n }\n return null;\n })}\n </g>\n ),\n [groups, isHorizontal, types, virtualizedSeries],\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;AC2BJ;AAxBnB,SAAgB,YAAY,eAAe;AAC3C,SAAS,oBAAoB;AAC7B,SAAS,MAAM,QAAQ,MAAM,YAAY,MAAM,gBAAgB,6BAA6B;AAC5F,SAAS,uBAAuB;AAChC,SAAS,4BAA4B;AAE9B,MAAM,gBAAgB,MAAM;AACjC,QAAM;AAAA,IACJ,OAAO,EAAE,QAAQ,MAAM;AAAA,IACvB;AAAA,EACF,IAAI,WAAW,YAAY;AAE3B,QAAM,oBAAoB,qBAAqB;AAE/C,SAAO;AAAA,IACL,MACE,oBAAC,OAAE,WAAU,WAEV,4BAAkB,IAAI,CAAC,UAAU;AAChC,YAAM,aAAa;AAAA,QACjB,KAAK,MAAM;AAAA,QACX;AAAA,MACF;AACA,UAAI,MAAM,SAAS,SAAS,UAAU,gBAAgB,QAAQ,MAAM,IAAI,IAAI,MAAM,cAAc;AAC9F,eAAO,oBAAC,yBAAuB,GAAG,YAAY;AAAA,MAChD;AACA,UAAI,MAAM,SAAS,SAAS,UAAU,gBAAgB,QAAQ,MAAM,IAAI,IAAI,IAAI;AAC9E,eAAO,oBAAC,cAAY,GAAG,YAAY;AAAA,MACrC;AACA,UAAI,MAAM,SAAS,SAAS,cAAc;AACxC,eAAO,oBAAC,kBAAgB,GAAG,YAAY;AAAA,MACzC;AACA,UAAI,MAAM,SAAS,OAAO;AACxB,eAAO,oBAAC,QAAM,GAAG,YAAY;AAAA,MAC/B;AACA,UAAK,UAAU,aAAa,CAAC,MAAM,QAAS,MAAM,SAAS,SAAS;AAClE,eAAO,oBAAC,UAAQ,GAAG,YAAY;AAAA,MACjC;AACA,UAAI,MAAM,SAAS,QAAQ;AACzB,eAAO,oBAAC,QAAM,GAAG,YAAY;AAAA,MAC/B;AACA,UAAI,MAAM,SAAS,QAAQ;AACzB,eAAO,oBAAC,QAAM,GAAG,YAAY;AAAA,MAC/B;AACA,aAAO;AAAA,IACT,CAAC,GACH;AAAA,IAEF,CAAC,QAAQ,cAAc,OAAO,iBAAiB;AAAA,EACjD;AACF;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../ChartContext.js';\nimport { Line, Points, Bars, StackedBar, Area, HorizontalBars, HorizontalStackedBars } from '../series/index.js';\nimport { getStackedIndex } from '../helpers/index.js';\nimport { useVirtualizedSeries } from '../helpers/useVirtualizedSeries.js';\nimport { HoverBand } from './HoverBand.js';\nimport { ZeroLine } from './ZeroLine.js';\nimport { ENTRANCE_ATTRIBUTE, getSerieEntrance, useEntranceAnimation } from '../config/useEntranceAnimation.js';\nimport { VALUE_AXIS_TRANSITION, useValueAxisTransition } from '../config/useValueAxisTransition.js';\nimport type { DSChartT } from '../../../react-desc-prop-types.js';\n\ntype SerieComponentT = React.ComponentType<{ serie: DSChartT.InternalSerie }>;\n\nconst getSerieComponent = (\n serie: DSChartT.InternalSerie,\n { groups, types, isHorizontal }: { groups?: string[][]; types?: string; isHorizontal: boolean },\n): SerieComponentT | null => {\n const isStacked = Boolean(groups) && getStackedIndex(groups as string[][], serie.name) > -1;\n if (serie.type === 'bar' && isStacked) return isHorizontal ? HorizontalStackedBars : StackedBar;\n if (serie.type === 'bar') return isHorizontal ? HorizontalBars : Bars;\n if ((types === 'scatter' && !serie.type) || serie.type === 'point') return Points;\n if (serie.type === 'line') return Line;\n if (serie.type === 'area') return Area;\n return null;\n};\n\nexport const SeriesFactory = () => {\n const {\n props: { groups, types, y2Axis },\n isHorizontal,\n } = useContext(ChartContext);\n\n const virtualizedSeries = useVirtualizedSeries();\n const { setSeriesGroup, seriesGroup, withAnimation, transformOrigin } = useEntranceAnimation();\n useValueAxisTransition(seriesGroup);\n // on a vertical chart, the series of each vertical axis, and the zero line, have a group that eases them to a new\n // domain of the axis (see useValueAxisTransition)\n const eases = !isHorizontal;\n\n return useMemo(\n () => (\n <g className=\"content\" ref={setSeriesGroup}>\n <HoverBand />\n {eases ? (\n <g {...{ [VALUE_AXIS_TRANSITION.ATTRIBUTE]: 'y' }}>\n <ZeroLine />\n </g>\n ) : (\n <ZeroLine />\n )}\n {virtualizedSeries.map((serie) => {\n const Serie = getSerieComponent(serie, { groups, types, isHorizontal });\n if (!Serie) return null;\n const valueAxis = serie.scale === 'y2' && y2Axis ? 'y2' : 'y';\n const drawn = (key?: string) =>\n eases ? (\n <g key={key} {...{ [VALUE_AXIS_TRANSITION.ATTRIBUTE]: valueAxis }}>\n <Serie serie={serie} />\n </g>\n ) : (\n <Serie key={key} serie={serie} />\n );\n if (!withAnimation) return drawn(serie.key);\n // with withAnimation, each series has a group that tells how it enters (see useEntranceAnimation)\n const entrance = getSerieEntrance(serie);\n return (\n <g\n key={serie.key}\n {...{ [ENTRANCE_ATTRIBUTE]: entrance }}\n style={entrance === 'grow' ? { transformOrigin } : undefined}\n >\n {drawn()}\n </g>\n );\n })}\n </g>\n ),\n [eases, groups, isHorizontal, setSeriesGroup, transformOrigin, types, virtualizedSeries, withAnimation, y2Axis],\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC4CjB,SACE,KADF;AAzCN,SAAgB,YAAY,eAAe;AAC3C,SAAS,oBAAoB;AAC7B,SAAS,MAAM,QAAQ,MAAM,YAAY,MAAM,gBAAgB,6BAA6B;AAC5F,SAAS,uBAAuB;AAChC,SAAS,4BAA4B;AACrC,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,oBAAoB,kBAAkB,4BAA4B;AAC3E,SAAS,uBAAuB,8BAA8B;AAK9D,MAAM,oBAAoB,CACxB,OACA,EAAE,QAAQ,OAAO,aAAa,MACH;AAC3B,QAAM,YAAY,QAAQ,MAAM,KAAK,gBAAgB,QAAsB,MAAM,IAAI,IAAI;AACzF,MAAI,MAAM,SAAS,SAAS,UAAW,QAAO,eAAe,wBAAwB;AACrF,MAAI,MAAM,SAAS,MAAO,QAAO,eAAe,iBAAiB;AACjE,MAAK,UAAU,aAAa,CAAC,MAAM,QAAS,MAAM,SAAS,QAAS,QAAO;AAC3E,MAAI,MAAM,SAAS,OAAQ,QAAO;AAClC,MAAI,MAAM,SAAS,OAAQ,QAAO;AAClC,SAAO;AACT;AAEO,MAAM,gBAA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65 @@
1
1
  import * as React from "react";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useContext } from "react";
4
+ import { ThemeContext } from "@elliemae/ds-system";
4
5
  import { ChartContext } from "../ChartContext.js";
5
- const TrendHighlight = ({ currentDatum }) => {
6
- const { currentData, getXScaleValue, getY2ScaleValue, getYScaleValue } = useContext(ChartContext);
7
- const prevPoint = currentData?.find((serie) => serie.name === currentDatum.serie && serie.type === "line")?.data?.find((datum) => datum.position === currentDatum.position - 1);
8
- const currentYScale = prevPoint?.scale === "y2" ? getY2ScaleValue : getYScaleValue;
9
- if (!prevPoint) return null;
10
- const xCurrentPosition = getXScaleValue(currentDatum);
11
- const yCurrentPosition = currentYScale(currentDatum);
12
- const xPreviousPosition = getXScaleValue(prevPoint);
13
- const yPreviousPosition = currentYScale(prevPoint);
14
- return /* @__PURE__ */ jsx(
15
- "line",
16
- {
17
- strokeWidth: "4",
18
- stroke: (yPreviousPosition ?? 0) > (yCurrentPosition ?? 0) ? "green" : "red",
19
- x1: xPreviousPosition,
20
- x2: xCurrentPosition,
21
- y1: yPreviousPosition,
22
- y2: yCurrentPosition
6
+ import { getPointerScrapperPosX, useChartInteraction } from "../config/chartInteractionStore.js";
7
+ import { getTrend } from "../helpers/trend.js";
8
+ import { SCRAPPER } from "../../constants.js";
9
+ const TREND_STROKE_WIDTH = 3;
10
+ const TrendHighlight = ({ serie, linePath }) => {
11
+ const {
12
+ props: { withTrendHighlight, scrapper },
13
+ getXScaleValue,
14
+ getYValue,
15
+ innerHeight,
16
+ chartId
17
+ } = useContext(ChartContext);
18
+ const theme = useContext(ThemeContext);
19
+ const focusedIndex = useChartInteraction((state) => {
20
+ if (!withTrendHighlight) return -1;
21
+ if (state.activePoint?.serie === serie.name) {
22
+ return serie.data.findIndex((datum) => datum.key === state.activePoint?.key);
23
23
  }
24
- );
24
+ if (scrapper?.type !== SCRAPPER.TYPE_VERTICAL) return -1;
25
+ const scrapperX = state.activePoint ? getXScaleValue(state.activePoint) : getPointerScrapperPosX(state);
26
+ return serie.data.findIndex((datum) => getXScaleValue(datum) === scrapperX);
27
+ });
28
+ if (focusedIndex < 1 || !linePath) return null;
29
+ const previous = serie.data[focusedIndex - 1];
30
+ const current = serie.data[focusedIndex];
31
+ const trend = getTrend(getYValue(previous), getYValue(current), serie.higherIsBetter);
32
+ const colors = {
33
+ good: theme?.colors?.success?.["900"] ?? "#207E56",
34
+ bad: theme?.colors?.danger?.["900"] ?? "#C64252",
35
+ flat: theme?.colors?.neutral?.["500"] ?? "#697489"
36
+ };
37
+ const previousX = getXScaleValue(previous) ?? 0;
38
+ const currentX = getXScaleValue(current) ?? 0;
39
+ const clipId = `trend-highlight-${chartId}-${serie.key.replace(/[^\w-]/g, "_")}`;
40
+ return /* @__PURE__ */ jsxs("g", { className: "trend-highlight", "data-trend": trend, children: [
41
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: clipId, children: /* @__PURE__ */ jsx(
42
+ "rect",
43
+ {
44
+ x: Math.min(previousX, currentX) - TREND_STROKE_WIDTH / 2,
45
+ y: -TREND_STROKE_WIDTH,
46
+ width: Math.abs(currentX - previousX) + TREND_STROKE_WIDTH,
47
+ height: innerHeight + TREND_STROKE_WIDTH * 2
48
+ }
49
+ ) }) }),
50
+ /* @__PURE__ */ jsx(
51
+ "path",
52
+ {
53
+ d: linePath,
54
+ clipPath: `url(#${clipId})`,
55
+ fill: "none",
56
+ stroke: colors[trend],
57
+ strokeWidth: TREND_STROKE_WIDTH,
58
+ strokeLinecap: "round",
59
+ strokeLinejoin: "round"
60
+ }
61
+ )
62
+ ] });
25
63
  };
26
64
  export {
27
65
  TrendHighlight
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/parts/TrendHighlight.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { ChartContext } from '../ChartContext.js';\nimport { type DSChartT } from '../react-desc-prop-types.js';\ninterface TrendHighlightProps {\n currentDatum: DSChartT.InternalDatum;\n}\n\nexport const TrendHighlight: React.ComponentType<TrendHighlightProps> = ({ currentDatum }) => {\n const { currentData, getXScaleValue, getY2ScaleValue, getYScaleValue } = useContext(ChartContext);\n\n const prevPoint = currentData\n ?.find((serie) => serie.name === currentDatum.serie && serie.type === 'line')\n ?.data?.find((datum) => datum.position === currentDatum.position - 1);\n\n const currentYScale = prevPoint?.scale === 'y2' ? getY2ScaleValue : getYScaleValue;\n if (!prevPoint) return null;\n const xCurrentPosition = getXScaleValue(currentDatum);\n const yCurrentPosition = currentYScale(currentDatum);\n const xPreviousPosition = getXScaleValue(prevPoint);\n const yPreviousPosition = currentYScale(prevPoint);\n return (\n <line\n strokeWidth=\"4\"\n stroke={(yPreviousPosition ?? 0) > (yCurrentPosition ?? 0) ? 'green' : 'red'}\n x1={xPreviousPosition}\n x2={xCurrentPosition}\n y1={yPreviousPosition}\n y2={yCurrentPosition}\n />\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACqBnB;AArBJ,SAAgB,kBAAkB;AAClC,SAAS,oBAAoB;AAMtB,MAAM,iBAA2D,CAAC,EAAE,aAAa,MAAM;AAC5F,QAAM,EAAE,aAAa,gBAAgB,iBAAiB,eAAe,IAAI,WAAW,YAAY;AAEhG,QAAM,YAAY,aACd,KAAK,CAAC,UAAU,MAAM,SAAS,aAAa,SAAS,MAAM,SAAS,MAAM,GAC1E,MAAM,KAAK,CAAC,UAAU,MAAM,aAAa,aAAa,WAAW,CAAC;AAEtE,QAAM,gBAAgB,WAAW,UAAU,OAAO,kBAAkB;AACpE,MAAI,CAAC,UAAW,QAAO;AACvB,QAAM,mBAAmB,eAAe,YAAY;AACpD,QAAM,mBAAmB,cAAc,YAAY;AACnD,QAAM,oBAAoB,eAAe,SAAS;AAClD,QAAM,oBAAoB,cAAc,SAAS;AACjD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAY;AAAA,MACZ,SAAS,qBAAqB,MAAM,oBAAoB,KAAK,UAAU;AAAA,MACvE,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA;AAAA,EACN;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../ChartContext.js';\nimport { getPointerScrapperPosX, useChartInteraction } from '../config/chartInteractionStore.js';\nimport { getTrend, type TrendT } from '../helpers/trend.js';\nimport { SCRAPPER } from '../../constants.js';\nimport { type DSChartT } from '../../../react-desc-prop-types.js';\n\ninterface TrendHighlightProps {\n serie: DSChartT.InternalSerie;\n // the path of the line of the series, which the highlight follows\n linePath: string | null;\n}\n\nconst TREND_STROKE_WIDTH = 3;\n\n// With withTrendHighlight, the stretch of a line (or of the top of an area) that leads to its focused point, from the\n// previous point the line joins, is drawn over in the color of its trend: success when it goes the good way, danger\n// when it goes the bad way, neutral when the value does not change. The focused point is the active point of the\n// keyboard or of the pointer, or the point under the vertical scrapper. The stretch is the line itself, clipped between\n// the two points, so it follows a spline as well, and it is drawn under the markers.\nexport const TrendHighlight: React.ComponentType<TrendHighlightProps> = ({ serie, linePath }) => {\n const {\n props: { withTrendHighlight, scrapper },\n getXScaleValue,\n getYValue,\n innerHeight,\n chartId,\n } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n\n // the index of the focused point in the series, -1 when it has none\n const focusedIndex = useChartInteraction((state) => {\n if (!withTrendHighlight) return -1;\n if (state.activePoint?.serie === serie.name) {\n return serie.data.findIndex((datum) => datum.key === state.activePoint?.key);\n }\n if (scrapper?.type !== SCRAPPER.TYPE_VERTICAL) return -1;\n const scrapperX = state.activePoint ? getXScaleValue(state.activePoint) : getPointerScrapperPosX(state);\n return serie.data.findIndex((datum) => getXScaleValue(datum) === scrapperX);\n });\n\n // the first point has no stretch before it; the data has no gaps, as the line joins the points around a missing value\n if (focusedIndex < 1 || !linePath) return null;\n const previous = serie.data[focusedIndex - 1];\n const current = serie.data[focusedIndex];\n const trend = getTrend(getYValue(previous) as number, getYValue(current) as number, serie.higherIsBetter);\n const colors: Record<TrendT, string> = {\n good: theme?.colors?.success?.['900'] ?? '#207E56',\n bad: theme?.colors?.danger?.['900'] ?? '#C64252',\n flat: theme?.colors?.neutral?.['500'] ?? '#697489',\n };\n\n const previousX = getXScaleValue(previous) ?? 0;\n const currentX = getXScaleValue(current) ?? 0;\n const clipId = `trend-highlight-${chartId}-${serie.key.replace(/[^\\w-]/g, '_')}`;\n return (\n <g className=\"trend-highlight\" data-trend={trend}>\n <defs>\n <clipPath id={clipId}>\n {/* the round caps of the stroke reach a bit past each point */}\n <rect\n x={Math.min(previousX, currentX) - TREND_STROKE_WIDTH / 2}\n y={-TREND_STROKE_WIDTH}\n width={Math.abs(currentX - previousX) + TREND_STROKE_WIDTH}\n height={innerHeight + TREND_STROKE_WIDTH * 2}\n />\n </clipPath>\n </defs>\n <path\n d={linePath}\n clipPath={`url(#${clipId})`}\n fill=\"none\"\n stroke={colors[trend]}\n strokeWidth={TREND_STROKE_WIDTH}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </g>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACyDnB,SAIM,KAJN;AAzDJ,SAAgB,kBAAkB;AAClC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB,2BAA2B;AAC5D,SAAS,gBAA6B;AACtC,SAAS,gBAAgB;AASzB,MAAM,qBAAqB;AAOpB,MAAM,iBAA2D,CAAC,EAAE,OAAO,SAAS,MAAM;AAC/F,QAAM;AAAA,IACJ,OAAO,EAAE,oBAAoB,SAAS;AAAA,IACtC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,YAAY;AAC3B,QAAM,QAAQ,WAAW,YA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ACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,GAAG;AAAA,QACH,UAAU,QAAQ,MAAM;AAAA,QACxB,MAAK;AAAA,QACL,QAAQ,OAAO,KAAK;AAAA,QACpB,aAAa;AAAA,QACb,eAAc;AAAA,QACd,gBAAe;AAAA;AAAA,IACjB;AAAA,KACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,36 @@
1
+ import * as React from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useContext } from "react";
4
+ import { ThemeContext } from "@elliemae/ds-system";
5
+ import { ChartContext } from "../ChartContext.js";
6
+ import { getZeroLinePosition } from "../helpers/zeroLine.js";
7
+ const ZeroLine = () => {
8
+ const {
9
+ xScale,
10
+ yScale,
11
+ innerWidth,
12
+ innerHeight,
13
+ containerRatio,
14
+ props: { xScroll, yScroll }
15
+ } = useContext(ChartContext);
16
+ const theme = useContext(ThemeContext);
17
+ const yZero = getZeroLinePosition(yScale);
18
+ const xZero = getZeroLinePosition(xScale);
19
+ if (yZero === null && xZero === null) return null;
20
+ const width = innerWidth * (xScroll ? containerRatio : 1);
21
+ const height = innerHeight * (yScroll ? containerRatio : 1);
22
+ const lineProps = {
23
+ stroke: theme?.colors?.neutral?.["500"] ?? "#697489",
24
+ strokeWidth: 1,
25
+ shapeRendering: "crispEdges",
26
+ pointerEvents: "none"
27
+ };
28
+ return /* @__PURE__ */ jsxs("g", { className: "zero-line", children: [
29
+ yZero !== null ? /* @__PURE__ */ jsx("line", { x1: 0, x2: width, y1: yZero, y2: yZero, ...lineProps }) : null,
30
+ xZero !== null ? /* @__PURE__ */ jsx("line", { x1: xZero, x2: xZero, y1: 0, y2: height, ...lineProps }) : null
31
+ ] });
32
+ };
33
+ export {
34
+ ZeroLine
35
+ };
36
+ //# sourceMappingURL=ZeroLine.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/parts/ZeroLine.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../ChartContext.js';\nimport { getZeroLinePosition } from '../helpers/zeroLine.js';\n\n// The zero of the axes that go below it (see getZeroLinePosition): a hairline across the plot, stronger than the grid\n// and than the domain line of the axis, drawn under the series. A horizontal line for the vertical axis, a vertical one\n// for the horizontal axis, so a scatter plot with negative values on both axes shows its four quadrants. It spans the\n// whole content of a scrollable chart, as it scrolls with the series.\nexport const ZeroLine = () => {\n const {\n xScale,\n yScale,\n innerWidth,\n innerHeight,\n containerRatio,\n props: { xScroll, yScroll },\n } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n\n const yZero = getZeroLinePosition(yScale);\n const xZero = getZeroLinePosition(xScale);\n if (yZero === null && xZero === null) return null;\n\n const width = innerWidth * (xScroll ? containerRatio : 1);\n const height = innerHeight * (yScroll ? containerRatio : 1);\n const lineProps = {\n stroke: theme?.colors?.neutral?.['500'] ?? '#697489',\n strokeWidth: 1,\n shapeRendering: 'crispEdges',\n pointerEvents: 'none',\n } as const;\n\n return (\n <g className=\"zero-line\">\n {yZero !== null ? <line x1={0} x2={width} y1={yZero} y2={yZero} {...lineProps} /> : null}\n {xZero !== null ? <line x1={xZero} x2={xZero} y1={0} y2={height} {...lineProps} /> : null}\n </g>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACkCnB,SACoB,KADpB;AAlCJ,SAAgB,kBAAkB;AAClC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AAM7B,MAAM,WAAW,MAAM;AAC5B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,SAAS,QAAQ;AAAA,EAC5B,IAAI,WAAW,YAAY;AAC3B,QAAM,QAAQ,WAAW,YAAY;AAErC,QAAM,QAAQ,oBAAoB,MAAM;AACxC,QAAM,QAAQ,oBAAoB,MAAM;AACxC,MAAI,UAAU,QAAQ,UAAU,KAAM,QAAO;AAE7C,QAAM,QAAQ,cAAc,UAAU,iBAAiB;AACvD,QAAM,SAAS,eAAe,UAAU,iBAAiB;AACzD,QAAM,YAAY;AAAA,IAChB,QAAQ,OAAO,QAAQ,UAAU,KAAK,KAAK;AAAA,IAC3C,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,eAAe;AAAA,EACjB;AAEA,SACE,qBAAC,OAAE,WAAU,aACV;AAAA,cAAU,OAAO,oBAAC,UAAK,IAAI,GAAG,IAAI,OAAO,IAAI,OAAO,IAAI,OAAQ,GAAG,WAAW,IAAK;AAAA,IACnF,UAAU,OAAO,oBAAC,UAAK,IAAI,OAAO,IAAI,OAAO,IAAI,GAAG,IAAI,QAAS,GAAG,WAAW,IAAK;AAAA,KACvF;AAEJ;",
6
+ "names": []
7
+ }