@elliemae/ds-dataviz 3.80.0-next.67 → 3.80.0-next.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/constants/index.js +73 -0
- package/dist/cjs/constants/index.js.map +7 -0
- package/dist/cjs/graphs/Chart/Chart.js +6 -1
- package/dist/cjs/graphs/Chart/Chart.js.map +2 -2
- package/dist/cjs/graphs/Chart/ChartContext.js.map +2 -2
- package/dist/cjs/graphs/Chart/SingleStackedBar/SingleStackedBar.js +36 -24
- package/dist/cjs/graphs/Chart/SingleStackedBar/SingleStackedBar.js.map +3 -3
- package/dist/cjs/graphs/Chart/SingleStackedBar/styles.js +12 -5
- package/dist/cjs/graphs/Chart/SingleStackedBar/styles.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/chartInteractionStore.js +98 -0
- package/dist/cjs/graphs/Chart/config/chartInteractionStore.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useChart.js +56 -40
- package/dist/cjs/graphs/Chart/config/useChart.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useChartDescription.js +62 -0
- package/dist/cjs/graphs/Chart/config/useChartDescription.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useEntranceAnimation.js +141 -0
- package/dist/cjs/graphs/Chart/config/useEntranceAnimation.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useGetters.js +10 -0
- package/dist/cjs/graphs/Chart/config/useGetters.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useInternalMargins.js +25 -5
- package/dist/cjs/graphs/Chart/config/useInternalMargins.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js +35 -51
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useScales.js +200 -67
- package/dist/cjs/graphs/Chart/config/useScales.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useValidateProps.js +53 -4
- package/dist/cjs/graphs/Chart/config/useValidateProps.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useValueAxisTransition.js +128 -0
- package/dist/cjs/graphs/Chart/config/useValueAxisTransition.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useWheelScroll.js +111 -0
- package/dist/cjs/graphs/Chart/config/useWheelScroll.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/alignedTicks.js +56 -0
- package/dist/cjs/graphs/Chart/helpers/alignedTicks.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/barPath.js +53 -0
- package/dist/cjs/graphs/Chart/helpers/barPath.js.map +7 -0
- package/dist/cjs/graphs/Chart/{react-desc-prop-types.js → helpers/dataInView.js} +26 -27
- package/dist/cjs/graphs/Chart/helpers/dataInView.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/index.js +34 -0
- package/dist/cjs/graphs/Chart/helpers/index.js.map +2 -2
- package/dist/cjs/graphs/Chart/{SingleStackedBar/exported-related/theming.js → helpers/logAxis.js} +13 -9
- package/dist/cjs/graphs/Chart/helpers/logAxis.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/tickRotation.js +54 -0
- package/dist/cjs/graphs/Chart/helpers/tickRotation.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/timeTicks.js +56 -0
- package/dist/cjs/graphs/Chart/helpers/timeTicks.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/trend.js +45 -0
- package/dist/cjs/graphs/Chart/helpers/trend.js.map +7 -0
- package/dist/cjs/graphs/Chart/{SingleStackedBar/exported-related/index.js → helpers/useSerieDimming.js} +20 -6
- package/dist/cjs/graphs/Chart/helpers/useSerieDimming.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/useUniqueData.js +15 -18
- package/dist/cjs/graphs/Chart/helpers/useUniqueData.js.map +2 -2
- package/dist/cjs/graphs/Chart/helpers/useVirtualizedSeries.js +12 -5
- package/dist/cjs/graphs/Chart/helpers/useVirtualizedSeries.js.map +2 -2
- package/dist/cjs/graphs/Chart/{DataTestIds.js → helpers/zeroLine.js} +12 -9
- package/dist/cjs/graphs/Chart/helpers/zeroLine.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/A11yRegion.js +8 -2
- package/dist/cjs/graphs/Chart/parts/A11yRegion.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/Axis.js +40 -4
- package/dist/cjs/graphs/Chart/parts/Axis/Axis.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js +18 -4
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js +14 -6
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js +14 -4
- package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/GridLine.js +15 -1
- package/dist/cjs/graphs/Chart/parts/Axis/GridLine.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/Tick.js +10 -4
- package/dist/cjs/graphs/Chart/parts/Axis/Tick.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/useTickTransition.js +170 -0
- package/dist/cjs/graphs/Chart/parts/Axis/useTickTransition.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js +41 -19
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/FocusableRegion.js +6 -3
- package/dist/cjs/graphs/Chart/parts/FocusableRegion.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/HoverBand.js +86 -0
- package/dist/cjs/graphs/Chart/parts/HoverBand.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Labels/Label.js +12 -1
- package/dist/cjs/graphs/Chart/parts/Labels/Label.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Labels/index.js +12 -4
- package/dist/cjs/graphs/Chart/parts/Labels/index.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js +6 -3
- package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/LeftLegend.js +2 -6
- package/dist/cjs/graphs/Chart/parts/Legend/LeftLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js +91 -9
- package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/RightLegend.js +3 -4
- package/dist/cjs/graphs/Chart/parts/Legend/RightLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/TopLegend.js +8 -6
- package/dist/cjs/graphs/Chart/parts/Legend/TopLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/Scrapper.js +29 -3
- package/dist/cjs/graphs/Chart/parts/Scrapper/Scrapper.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js +82 -55
- package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +3 -3
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js +14 -6
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +67 -43
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
- package/dist/cjs/graphs/Chart/{SingleStackedBar/exported-related/data-test-ids.js → parts/ScreenReaderText.js} +17 -7
- package/dist/cjs/graphs/Chart/parts/ScreenReaderText.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Scroller/BlurMask.js +14 -9
- package/dist/cjs/graphs/Chart/parts/Scroller/BlurMask.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/Controllers.js +152 -49
- package/dist/cjs/graphs/Chart/parts/Scroller/Controllers.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarX.js +22 -6
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarY.js +13 -6
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarY.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js +42 -35
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerY.js +9 -4
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerY.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js +39 -30
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/TrendHighlight.js +57 -19
- package/dist/cjs/graphs/Chart/parts/TrendHighlight.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/ZeroLine.js +66 -0
- package/dist/cjs/graphs/Chart/parts/ZeroLine.js.map +7 -0
- package/dist/cjs/graphs/Chart/scales/index.js +50 -20
- package/dist/cjs/graphs/Chart/scales/index.js.map +3 -3
- package/dist/cjs/graphs/Chart/series/Area.js +76 -9
- package/dist/cjs/graphs/Chart/series/Area.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Bars.js +3 -1
- package/dist/cjs/graphs/Chart/series/Bars.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/HorizontalBars.js +4 -1
- package/dist/cjs/graphs/Chart/series/HorizontalBars.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js +14 -7
- package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Line.js +9 -7
- package/dist/cjs/graphs/Chart/series/Line.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Point.js +114 -128
- package/dist/cjs/graphs/Chart/series/Point.js.map +3 -3
- package/dist/cjs/graphs/Chart/series/Points.js +8 -2
- package/dist/cjs/graphs/Chart/series/Points.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Rect.js +133 -122
- package/dist/cjs/graphs/Chart/series/Rect.js.map +3 -3
- package/dist/cjs/graphs/Chart/series/StackedBar.js +14 -6
- package/dist/cjs/graphs/Chart/series/StackedBar.js.map +2 -2
- package/dist/cjs/graphs/Chart/styles.js +65 -34
- package/dist/cjs/graphs/Chart/styles.js.map +2 -2
- package/dist/cjs/graphs/constants.js +24 -9
- package/dist/cjs/graphs/constants.js.map +2 -2
- package/dist/cjs/index.js +17 -6
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/react-desc-prop-types.js +150 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/typescript-testing/slot-props.js +69 -0
- package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
- package/dist/cjs/typescript-testing/typescript-data-viz-valid.js +34 -2
- package/dist/cjs/typescript-testing/typescript-data-viz-valid.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-single-stacked-bar-valid.js +93 -0
- package/dist/cjs/typescript-testing/typescript-single-stacked-bar-valid.js.map +7 -0
- package/dist/esm/constants/index.js +43 -0
- package/dist/esm/constants/index.js.map +7 -0
- package/dist/esm/graphs/Chart/Chart.js +6 -1
- package/dist/esm/graphs/Chart/Chart.js.map +2 -2
- package/dist/esm/graphs/Chart/ChartContext.js.map +2 -2
- package/dist/esm/graphs/Chart/SingleStackedBar/SingleStackedBar.js +40 -23
- package/dist/esm/graphs/Chart/SingleStackedBar/SingleStackedBar.js.map +2 -2
- package/dist/esm/graphs/Chart/SingleStackedBar/styles.js +12 -5
- package/dist/esm/graphs/Chart/SingleStackedBar/styles.js.map +2 -2
- package/dist/esm/graphs/Chart/config/chartInteractionStore.js +68 -0
- package/dist/esm/graphs/Chart/config/chartInteractionStore.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useChart.js +58 -42
- package/dist/esm/graphs/Chart/config/useChart.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useChartDescription.js +32 -0
- package/dist/esm/graphs/Chart/config/useChartDescription.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useEntranceAnimation.js +111 -0
- package/dist/esm/graphs/Chart/config/useEntranceAnimation.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useGetters.js +10 -0
- package/dist/esm/graphs/Chart/config/useGetters.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useInternalMargins.js +26 -6
- package/dist/esm/graphs/Chart/config/useInternalMargins.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js +35 -51
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useScales.js +202 -69
- package/dist/esm/graphs/Chart/config/useScales.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useValidateProps.js +53 -4
- package/dist/esm/graphs/Chart/config/useValidateProps.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useValueAxisTransition.js +98 -0
- package/dist/esm/graphs/Chart/config/useValueAxisTransition.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useWheelScroll.js +81 -0
- package/dist/esm/graphs/Chart/config/useWheelScroll.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/alignedTicks.js +26 -0
- package/dist/esm/graphs/Chart/helpers/alignedTicks.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/barPath.js +23 -0
- package/dist/esm/graphs/Chart/helpers/barPath.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/dataInView.js +28 -0
- package/dist/esm/graphs/Chart/helpers/dataInView.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/index.js +34 -0
- package/dist/esm/graphs/Chart/helpers/index.js.map +2 -2
- package/dist/esm/graphs/Chart/helpers/logAxis.js +14 -0
- package/dist/esm/graphs/Chart/helpers/logAxis.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/tickRotation.js +24 -0
- package/dist/esm/graphs/Chart/helpers/tickRotation.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/timeTicks.js +26 -0
- package/dist/esm/graphs/Chart/helpers/timeTicks.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/trend.js +15 -0
- package/dist/esm/graphs/Chart/helpers/trend.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/useSerieDimming.js +15 -0
- package/dist/esm/graphs/Chart/helpers/useSerieDimming.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/useUniqueData.js +15 -18
- package/dist/esm/graphs/Chart/helpers/useUniqueData.js.map +2 -2
- package/dist/esm/graphs/Chart/helpers/useVirtualizedSeries.js +12 -5
- package/dist/esm/graphs/Chart/helpers/useVirtualizedSeries.js.map +2 -2
- package/dist/esm/graphs/Chart/helpers/zeroLine.js +13 -0
- package/dist/esm/graphs/Chart/helpers/zeroLine.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/A11yRegion.js +7 -1
- package/dist/esm/graphs/Chart/parts/A11yRegion.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/Axis.js +40 -4
- package/dist/esm/graphs/Chart/parts/Axis/Axis.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js +18 -4
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js +14 -6
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js +14 -4
- package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/GridLine.js +16 -2
- package/dist/esm/graphs/Chart/parts/Axis/GridLine.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/Tick.js +11 -5
- package/dist/esm/graphs/Chart/parts/Axis/Tick.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/useTickTransition.js +140 -0
- package/dist/esm/graphs/Chart/parts/Axis/useTickTransition.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/ChartContainer.js +41 -19
- package/dist/esm/graphs/Chart/parts/ChartContainer.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/FocusableRegion.js +7 -4
- package/dist/esm/graphs/Chart/parts/FocusableRegion.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/HoverBand.js +56 -0
- package/dist/esm/graphs/Chart/parts/HoverBand.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Labels/Label.js +12 -1
- package/dist/esm/graphs/Chart/parts/Labels/Label.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Labels/index.js +12 -4
- package/dist/esm/graphs/Chart/parts/Labels/index.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js +7 -4
- package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/LeftLegend.js +3 -7
- package/dist/esm/graphs/Chart/parts/Legend/LeftLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js +91 -9
- package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/RightLegend.js +4 -5
- package/dist/esm/graphs/Chart/parts/Legend/RightLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/TopLegend.js +9 -7
- package/dist/esm/graphs/Chart/parts/Legend/TopLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/Scrapper.js +29 -3
- package/dist/esm/graphs/Chart/parts/Scrapper/Scrapper.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js +83 -56
- package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +3 -3
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js +14 -6
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +68 -44
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/ScreenReaderText.js +18 -0
- package/dist/esm/graphs/Chart/parts/ScreenReaderText.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Scroller/BlurMask.js +14 -9
- package/dist/esm/graphs/Chart/parts/Scroller/BlurMask.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/Controllers.js +154 -51
- package/dist/esm/graphs/Chart/parts/Scroller/Controllers.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarX.js +22 -6
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarY.js +13 -6
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarY.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js +43 -36
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerY.js +10 -5
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerY.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js +40 -31
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/TrendHighlight.js +58 -20
- package/dist/esm/graphs/Chart/parts/TrendHighlight.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/ZeroLine.js +36 -0
- package/dist/esm/graphs/Chart/parts/ZeroLine.js.map +7 -0
- package/dist/esm/graphs/Chart/scales/index.js +51 -21
- package/dist/esm/graphs/Chart/scales/index.js.map +3 -3
- package/dist/esm/graphs/Chart/series/Area.js +77 -10
- package/dist/esm/graphs/Chart/series/Area.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Bars.js +3 -1
- package/dist/esm/graphs/Chart/series/Bars.js.map +2 -2
- package/dist/esm/graphs/Chart/series/HorizontalBars.js +4 -1
- package/dist/esm/graphs/Chart/series/HorizontalBars.js.map +2 -2
- package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js +15 -8
- package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Line.js +9 -7
- package/dist/esm/graphs/Chart/series/Line.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Point.js +120 -130
- package/dist/esm/graphs/Chart/series/Point.js.map +3 -3
- package/dist/esm/graphs/Chart/series/Points.js +8 -2
- package/dist/esm/graphs/Chart/series/Points.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Rect.js +134 -123
- package/dist/esm/graphs/Chart/series/Rect.js.map +3 -3
- package/dist/esm/graphs/Chart/series/StackedBar.js +15 -7
- package/dist/esm/graphs/Chart/series/StackedBar.js.map +2 -2
- package/dist/esm/graphs/Chart/styles.js +66 -35
- package/dist/esm/graphs/Chart/styles.js.map +2 -2
- package/dist/esm/graphs/constants.js +25 -10
- package/dist/esm/graphs/constants.js.map +2 -2
- package/dist/esm/index.js +19 -7
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +125 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/typescript-testing/slot-props.js +46 -0
- package/dist/esm/typescript-testing/slot-props.js.map +7 -0
- package/dist/esm/typescript-testing/typescript-data-viz-valid.js +35 -3
- package/dist/esm/typescript-testing/typescript-data-viz-valid.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-single-stacked-bar-valid.js +70 -0
- package/dist/esm/typescript-testing/typescript-single-stacked-bar-valid.js.map +7 -0
- package/dist/types/constants/index.d.ts +42 -0
- package/dist/types/graphs/Chart/Chart.d.ts +4 -2
- package/dist/types/graphs/Chart/ChartContext.d.ts +9 -11
- package/dist/types/graphs/Chart/SingleStackedBar/SingleStackedBar.d.ts +1 -1
- package/dist/types/graphs/Chart/config/chartInteractionStore.d.ts +32 -0
- package/dist/types/graphs/Chart/config/useChart.d.ts +9 -11
- package/dist/types/graphs/Chart/config/useChartDescription.d.ts +5 -0
- package/dist/types/graphs/Chart/config/useEntranceAnimation.d.ts +16 -0
- package/dist/types/graphs/Chart/config/useGetters.d.ts +1 -1
- package/dist/types/graphs/Chart/config/useInternalMargins.d.ts +4 -1
- package/dist/types/graphs/Chart/config/useKeyboardNavigation.d.ts +1 -1
- package/dist/types/graphs/Chart/config/useScales.d.ts +8 -2
- package/dist/types/graphs/Chart/config/useValidateProps.d.ts +7 -1
- package/dist/types/graphs/Chart/config/useValueAxisTransition.d.ts +6 -0
- package/dist/types/graphs/Chart/config/useWheelScroll.d.ts +2 -0
- package/dist/types/graphs/Chart/helpers/alignedTicks.d.ts +1 -0
- package/dist/types/graphs/Chart/helpers/barPath.d.ts +11 -0
- package/dist/types/graphs/Chart/helpers/dataInView.d.ts +6 -0
- package/dist/types/graphs/Chart/helpers/index.d.ts +10 -1
- package/dist/types/graphs/Chart/helpers/logAxis.d.ts +8 -0
- package/dist/types/graphs/Chart/helpers/tickRotation.d.ts +2 -0
- package/dist/types/graphs/Chart/helpers/timeTicks.d.ts +2 -0
- package/dist/types/graphs/Chart/helpers/trend.d.ts +3 -0
- package/dist/types/graphs/Chart/helpers/useSerieDimming.d.ts +3 -0
- package/dist/types/graphs/Chart/helpers/useUniqueData.d.ts +1 -1
- package/dist/types/graphs/Chart/helpers/useVirtualizedSeries.d.ts +1 -1
- package/dist/types/graphs/Chart/helpers/zeroLine.d.ts +2 -0
- package/dist/types/graphs/Chart/parts/Axis/Axis.d.ts +4 -1
- package/dist/types/graphs/Chart/parts/Axis/Tick.d.ts +1 -0
- package/dist/types/graphs/Chart/parts/Axis/useTickTransition.d.ts +24 -0
- package/dist/types/graphs/Chart/parts/HoverBand.d.ts +2 -0
- package/dist/types/graphs/Chart/parts/Labels/Label.d.ts +3 -0
- package/dist/types/graphs/Chart/parts/Scrapper/ScrapperLine.d.ts +11 -1
- package/dist/types/graphs/Chart/parts/Scrapper/VerticalScrapperLine.d.ts +6 -7
- package/dist/types/graphs/Chart/parts/ScreenReaderText.d.ts +5 -0
- package/dist/types/graphs/Chart/parts/TrendHighlight.d.ts +3 -2
- package/dist/types/graphs/Chart/parts/ZeroLine.d.ts +2 -0
- package/dist/types/graphs/Chart/scales/index.d.ts +10 -3
- package/dist/types/graphs/Chart/series/Area.d.ts +1 -1
- package/dist/types/graphs/Chart/series/Bars.d.ts +1 -1
- package/dist/types/graphs/Chart/series/HorizontalBars.d.ts +1 -1
- package/dist/types/graphs/Chart/series/HorizontalStackedBars.d.ts +1 -1
- package/dist/types/graphs/Chart/series/Line.d.ts +1 -1
- package/dist/types/graphs/Chart/series/Point.d.ts +3 -2
- package/dist/types/graphs/Chart/series/Points.d.ts +1 -1
- package/dist/types/graphs/Chart/series/Rect.d.ts +3 -2
- package/dist/types/graphs/Chart/series/StackedBar.d.ts +1 -1
- package/dist/types/graphs/Chart/styles.d.ts +18 -5
- package/dist/types/graphs/constants.d.ts +13 -1
- package/dist/types/index.d.ts +6 -1
- package/dist/types/react-desc-prop-types.d.ts +228 -0
- package/package.json +8 -7
- package/dist/cjs/graphs/Chart/DataTestIds.js.map +0 -7
- package/dist/cjs/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.js.map +0 -7
- package/dist/cjs/graphs/Chart/SingleStackedBar/exported-related/index.js.map +0 -7
- package/dist/cjs/graphs/Chart/SingleStackedBar/exported-related/theming.js.map +0 -7
- package/dist/cjs/graphs/Chart/SingleStackedBar/index.js +0 -31
- package/dist/cjs/graphs/Chart/SingleStackedBar/index.js.map +0 -7
- package/dist/cjs/graphs/Chart/SingleStackedBar/react-desc-prop-types.js +0 -51
- package/dist/cjs/graphs/Chart/SingleStackedBar/react-desc-prop-types.js.map +0 -7
- package/dist/cjs/graphs/Chart/index.js +0 -33
- package/dist/cjs/graphs/Chart/index.js.map +0 -7
- package/dist/cjs/graphs/Chart/react-desc-prop-types.js.map +0 -7
- package/dist/cjs/graphs/index.js +0 -31
- package/dist/cjs/graphs/index.js.map +0 -7
- package/dist/esm/graphs/Chart/DataTestIds.js +0 -10
- package/dist/esm/graphs/Chart/DataTestIds.js.map +0 -7
- package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.js +0 -8
- package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.js.map +0 -7
- package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/index.js +0 -4
- package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/index.js.map +0 -7
- package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/theming.js +0 -10
- package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/theming.js.map +0 -7
- package/dist/esm/graphs/Chart/SingleStackedBar/index.js +0 -4
- package/dist/esm/graphs/Chart/SingleStackedBar/index.js.map +0 -7
- package/dist/esm/graphs/Chart/SingleStackedBar/react-desc-prop-types.js +0 -21
- package/dist/esm/graphs/Chart/SingleStackedBar/react-desc-prop-types.js.map +0 -7
- package/dist/esm/graphs/Chart/index.js +0 -6
- package/dist/esm/graphs/Chart/index.js.map +0 -7
- package/dist/esm/graphs/Chart/react-desc-prop-types.js +0 -29
- package/dist/esm/graphs/Chart/react-desc-prop-types.js.map +0 -7
- package/dist/esm/graphs/index.js +0 -4
- package/dist/esm/graphs/index.js.map +0 -7
- package/dist/types/graphs/Chart/DataTestIds.d.ts +0 -5
- package/dist/types/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.d.ts +0 -3
- package/dist/types/graphs/Chart/SingleStackedBar/exported-related/index.d.ts +0 -2
- package/dist/types/graphs/Chart/SingleStackedBar/exported-related/theming.d.ts +0 -4
- package/dist/types/graphs/Chart/SingleStackedBar/index.d.ts +0 -3
- package/dist/types/graphs/Chart/SingleStackedBar/react-desc-prop-types.d.ts +0 -44
- package/dist/types/graphs/Chart/index.d.ts +0 -4
- package/dist/types/graphs/Chart/react-desc-prop-types.d.ts +0 -510
- package/dist/types/graphs/index.d.ts +0 -2
|
@@ -2,6 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useContext, useMemo } from "react";
|
|
4
4
|
import { ChartContext } from "../../ChartContext.js";
|
|
5
|
+
import { getPointerScrapperPosY, useChartInteraction } from "../../config/chartInteractionStore.js";
|
|
5
6
|
import { ScrapperLine } from "./ScrapperLine.js";
|
|
6
7
|
const Scrapper = () => {
|
|
7
8
|
const {
|
|
@@ -11,8 +12,17 @@ const Scrapper = () => {
|
|
|
11
12
|
getYScaleValue,
|
|
12
13
|
getXScaleValue,
|
|
13
14
|
getBandwidth,
|
|
14
|
-
currentData: data
|
|
15
|
+
currentData: data,
|
|
16
|
+
setScrapperPosY,
|
|
17
|
+
innerWidth,
|
|
18
|
+
setActivePoint,
|
|
19
|
+
isGrabbed,
|
|
20
|
+
getOwnerProps,
|
|
21
|
+
props: { TooltipRenderer, scrapper }
|
|
15
22
|
} = useContext(ChartContext);
|
|
23
|
+
const scrapperPosY = useChartInteraction(
|
|
24
|
+
(state) => state.activePoint ? (getYScaleValue(state.activePoint) ?? -1) + (yScale?.type === "BAND" ? getBandwidth() / 2 : 0) : getPointerScrapperPosY(state)
|
|
25
|
+
);
|
|
16
26
|
const isBandAxis = yScale?.type === "BAND";
|
|
17
27
|
const uniqueData = useMemo(() => {
|
|
18
28
|
let valueToPositionPerSeries;
|
|
@@ -47,7 +57,7 @@ const Scrapper = () => {
|
|
|
47
57
|
}
|
|
48
58
|
const positionUniqueData = {};
|
|
49
59
|
valueToPositionPerSeries.forEach((set) => {
|
|
50
|
-
if (
|
|
60
|
+
if (set.position === void 0 || Number.isNaN(set.position)) return;
|
|
51
61
|
if (positionUniqueData[set.position]) {
|
|
52
62
|
positionUniqueData[set.position] = [...positionUniqueData[set.position], { ...set }];
|
|
53
63
|
} else {
|
|
@@ -59,7 +69,23 @@ const Scrapper = () => {
|
|
|
59
69
|
return /* @__PURE__ */ jsx("g", { children: Object.keys(uniqueData).map((key) => {
|
|
60
70
|
const yPosition = parseFloat(key) + (isBandAxis ? getBandwidth() / 2 : 0);
|
|
61
71
|
const datum = uniqueData[key];
|
|
62
|
-
return /* @__PURE__ */ jsx(
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
73
|
+
ScrapperLine,
|
|
74
|
+
{
|
|
75
|
+
yPosition,
|
|
76
|
+
datum,
|
|
77
|
+
isActive: scrapperPosY === yPosition,
|
|
78
|
+
setScrapperPosY,
|
|
79
|
+
innerWidth,
|
|
80
|
+
yScale,
|
|
81
|
+
setActivePoint,
|
|
82
|
+
isGrabbed,
|
|
83
|
+
getOwnerProps,
|
|
84
|
+
TooltipRenderer,
|
|
85
|
+
scrapper
|
|
86
|
+
},
|
|
87
|
+
datum[0]?.datum.key ?? key
|
|
88
|
+
);
|
|
63
89
|
}) });
|
|
64
90
|
};
|
|
65
91
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scrapper/Scrapper.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext.js';\nimport { ScrapperLine } from './ScrapperLine.js';\nimport type { DSChartT } from '
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext.js';\nimport { getPointerScrapperPosY, useChartInteraction } from '../../config/chartInteractionStore.js';\nimport { ScrapperLine } from './ScrapperLine.js';\nimport type { DSChartT } from '../../../../react-desc-prop-types.js';\n\nexport const Scrapper = () => {\n const {\n yScale,\n getXValue,\n getYValue,\n getYScaleValue,\n getXScaleValue,\n getBandwidth,\n currentData: data,\n setScrapperPosY,\n innerWidth,\n setActivePoint,\n isGrabbed,\n getOwnerProps,\n props: { TooltipRenderer, scrapper },\n } = useContext(ChartContext);\n // the active position follows the active point of the keyboard, and the pointer otherwise (see VerticalScrapper)\n const scrapperPosY = useChartInteraction((state) =>\n state.activePoint\n ? (getYScaleValue(state.activePoint) ?? -1) + (yScale?.type === 'BAND' ? getBandwidth() / 2 : 0)\n : getPointerScrapperPosY(state),\n );\n\n const isBandAxis = yScale?.type === 'BAND';\n\n const uniqueData = useMemo(() => {\n let valueToPositionPerSeries;\n\n if (isBandAxis) {\n valueToPositionPerSeries = data\n .map((serie) =>\n serie.data.map((datum) => {\n const x = getXValue(datum);\n const y = getYValue(datum);\n return {\n position: getYScaleValue(datum),\n name: serie.name,\n xValue: x,\n yValue: y,\n key: datum.position,\n datum,\n color: serie.color,\n };\n }),\n )\n .flat(1);\n } else {\n valueToPositionPerSeries = data\n .map((serie) =>\n serie.data.map((datum) => ({\n position: getXScaleValue(datum),\n name: serie.name,\n xValue: getXValue(datum),\n yValue: getYValue(datum),\n key: datum.position,\n datum,\n color: serie.color,\n })),\n )\n .flat(1);\n }\n const positionUniqueData: Record<string, DSChartT.ScrapperDatum[]> = {};\n\n valueToPositionPerSeries.forEach((set) => {\n // 0 is the start of the axis (the lowest value of a linear axis), not a missing position\n if (set.position === undefined || Number.isNaN(set.position)) return;\n if (positionUniqueData[set.position]) {\n positionUniqueData[set.position] = [...positionUniqueData[set.position], { ...set }];\n } else {\n positionUniqueData[set.position] = [{ ...set }];\n }\n });\n\n return positionUniqueData;\n }, [data, getXScaleValue, getXValue, getYScaleValue, getYValue, isBandAxis]);\n\n return (\n <g>\n {Object.keys(uniqueData).map((key) => {\n const yPosition = parseFloat(key) + (isBandAxis ? getBandwidth() / 2 : 0);\n const datum = uniqueData[key];\n return (\n <ScrapperLine\n // keyed by its first data point, not by its position in pixels, so a resize updates the line instead of\n // remounting it\n key={datum[0]?.datum.key ?? key}\n yPosition={yPosition}\n datum={datum}\n isActive={scrapperPosY === yPosition}\n setScrapperPosY={setScrapperPosY}\n innerWidth={innerWidth}\n yScale={yScale}\n setActivePoint={setActivePoint}\n isGrabbed={isGrabbed}\n getOwnerProps={getOwnerProps}\n TooltipRenderer={TooltipRenderer}\n scrapper={scrapper}\n />\n );\n })}\n </g>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACwFb;AAxFV,SAAgB,YAAY,eAAe;AAC3C,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB,2BAA2B;AAC5D,SAAS,oBAAoB;AAGtB,MAAM,WAAW,MAAM;AAC5B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,iBAAiB,SAAS;AAAA,EACrC,IAAI,WAAW,YAAY;AAE3B,QAAM,eAAe;AAAA,IAAoB,CAAC,UACxC,MAAM,eACD,eAAe,MAAM,WAAW,KAAK,OAAO,QAAQ,SAAS,SAAS,aAAa,IAAI,IAAI,KAC5F,uBAAuB,KAAK;AAAA,EAClC;AAEA,QAAM,aAAa,QAAQ,SAAS;AAEpC,QAAM,aAAa,QAAQ,MAAM;AAC/B,QAAI;AAEJ,QAAI,YAAY;AACd,iCAA2B,KACxB;AAAA,QAAI,CAAC,UACJ,MAAM,KAAK,IAAI,CAAC,UAAU;AACxB,gBAAM,IAAI,UAAU,KAAK;AACzB,gBAAM,IAAI,UAAU,KAAK;AACzB,iBAAO;AAAA,YACL,UAAU,eAAe,KAAK;AAAA,YAC9B,MAAM,MAAM;AAAA,YACZ,QAAQ;AAAA,YACR,QAAQ;AAAA,YACR,KAAK,MAAM;AAAA,YACX;AAAA,YACA,OAAO,MAAM;AAAA,UACf;AAAA,QACF,CAAC;AAAA,MACH,EACC,KAAK,CAAC;AAAA,IACX,OAAO;AACL,iCAA2B,KACxB;AAAA,QAAI,CAAC,UACJ,MAAM,KAAK,IAAI,CAAC,WAAW;AAAA,UACzB,UAAU,eAAe,KAAK;AAAA,UAC9B,MAAM,MAAM;AAAA,UACZ,QAAQ,UAAU,KAAK;AAAA,UACvB,QAAQ,UAAU,KAAK;AAAA,UACvB,KAAK,MAAM;AAAA,UACX;AAAA,UACA,OAAO,MAAM;AAAA,QACf,EAAE;AAAA,MACJ,EACC,KAAK,CAAC;AAAA,IACX;AACA,UAAM,qBAA+D,CAAC;AAEtE,6BAAyB,QAAQ,CAAC,QAAQ;AAExC,UAAI,IAAI,aAAa,UAAa,OAAO,MAAM,IAAI,QAAQ,EAAG;AAC9D,UAAI,mBAAmB,IAAI,QAAQ,GAAG;AACpC,2BAAmB,IAAI,QAAQ,IAAI,CAAC,GAAG,mBAAmB,IAAI,QAAQ,GAAG,EAAE,GAAG,IAAI,CAAC;AAAA,MACrF,OAAO;AACL,2BAAmB,IAAI,QAAQ,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;AAAA,MAChD;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT,GAAG,CAAC,MAAM,gBAAgB,WAAW,gBAAgB,WAAW,UAAU,CAAC;AAE3E,SACE,oBAAC,OACE,iBAAO,KAAK,UAAU,EAAE,IAAI,CAAC,QAAQ;AACpC,UAAM,YAAY,WAAW,GAAG,KAAK,aAAa,aAAa,IAAI,IAAI;AACvE,UAAM,QAAQ,WAAW,GAAG;AAC5B,WACE;AAAA,MAAC;AAAA;AAAA,QAIC;AAAA,QACA;AAAA,QACA,UAAU,iBAAiB;AAAA,QAC3B;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,MAXK,MAAM,CAAC,GAAG,MAAM,OAAO;AAAA,IAY9B;AAAA,EAEJ,CAAC,GACH;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,74 +1,101 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useContext, useCallback } from "react";
|
|
3
|
+
import React2, { useContext, useCallback } from "react";
|
|
4
4
|
import { useFloatingContext, FloatingWrapper } from "@elliemae/ds-floating-context";
|
|
5
5
|
import { ThemeContext } from "@elliemae/ds-system";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
6
|
+
import { StyledMouseOverDetectionBox, StyledTooltipContainer, TOOLTIP_CONTENT_SLOT_PROPS } from "../../styles.js";
|
|
7
|
+
import { SCRAPPER_DEFAULT_TOOLTIP_PREFERENCE } from "../../../constants.js";
|
|
8
|
+
import { BandScale } from "../../scales/index.js";
|
|
9
|
+
const ScrapperGuide = ({
|
|
10
|
+
yPosition,
|
|
11
|
+
datum,
|
|
12
|
+
innerWidth,
|
|
13
|
+
getOwnerProps,
|
|
14
|
+
TooltipRenderer,
|
|
15
|
+
scrapper
|
|
16
|
+
}) => {
|
|
17
|
+
const theme = useContext(ThemeContext);
|
|
18
|
+
const guideColor = scrapper?.color ?? theme?.colors?.neutral?.["400"] ?? "#8C93A6";
|
|
19
|
+
const { refs, floatingStyles, context } = useFloatingContext({
|
|
20
|
+
externallyControlledIsOpen: !!TooltipRenderer,
|
|
21
|
+
withoutAnimation: true,
|
|
22
|
+
customOffset: [0, 5],
|
|
23
|
+
// without a placement the floating context fails on the first hover and the render throws
|
|
24
|
+
placement: scrapper?.tooltipPreference ?? SCRAPPER_DEFAULT_TOOLTIP_PREFERENCE
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
27
|
+
TooltipRenderer ? /* @__PURE__ */ jsx("foreignObject", { children: /* @__PURE__ */ jsxs(
|
|
28
|
+
FloatingWrapper,
|
|
29
|
+
{
|
|
30
|
+
innerRef: refs.setFloating,
|
|
31
|
+
isOpen: true,
|
|
32
|
+
floatingStyles: { ...floatingStyles, zIndex: theme.zIndex.tooltip },
|
|
33
|
+
context,
|
|
34
|
+
dsFloatingwrapperContent: TOOLTIP_CONTENT_SLOT_PROPS,
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsx(StyledMouseOverDetectionBox, { getOwnerProps }),
|
|
37
|
+
/* @__PURE__ */ jsx(StyledTooltipContainer, { getOwnerProps, children: /* @__PURE__ */ jsx(TooltipRenderer, { data: datum }) })
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
) }) : null,
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
"line",
|
|
43
|
+
{
|
|
44
|
+
ref: refs.setReference,
|
|
45
|
+
x1: innerWidth,
|
|
46
|
+
strokeWidth: "2px",
|
|
47
|
+
stroke: "transparent",
|
|
48
|
+
y1: yPosition,
|
|
49
|
+
x2: innerWidth,
|
|
50
|
+
y2: yPosition
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
"line",
|
|
55
|
+
{
|
|
56
|
+
x1: 0,
|
|
57
|
+
strokeWidth: "1px",
|
|
58
|
+
stroke: guideColor,
|
|
59
|
+
shapeRendering: "crispEdges",
|
|
60
|
+
y1: yPosition,
|
|
61
|
+
x2: innerWidth,
|
|
62
|
+
y2: yPosition
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
] });
|
|
66
|
+
};
|
|
67
|
+
const ScrapperLine = React2.memo((props) => {
|
|
9
68
|
const {
|
|
10
|
-
|
|
69
|
+
yPosition,
|
|
70
|
+
datum,
|
|
71
|
+
isActive,
|
|
11
72
|
setScrapperPosY,
|
|
12
73
|
innerWidth,
|
|
13
74
|
yScale,
|
|
14
75
|
setActivePoint,
|
|
15
76
|
isGrabbed,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
77
|
+
getOwnerProps,
|
|
78
|
+
TooltipRenderer,
|
|
79
|
+
scrapper
|
|
80
|
+
} = props;
|
|
19
81
|
const yPositionString = yPosition;
|
|
20
|
-
const isActive = scrapperPosY === yPositionString;
|
|
21
|
-
const { refs, floatingStyles, context } = useFloatingContext({
|
|
22
|
-
externallyControlledIsOpen: isActive && !!TooltipRenderer,
|
|
23
|
-
withoutAnimation: true,
|
|
24
|
-
customOffset: [0, 5],
|
|
25
|
-
placement: scrapper?.tooltipPreference
|
|
26
|
-
});
|
|
27
82
|
const handleOnMouseEnter = useCallback(() => {
|
|
28
83
|
if (!isGrabbed) setScrapperPosY(yPositionString);
|
|
29
84
|
setActivePoint(null);
|
|
30
85
|
}, [isGrabbed, setScrapperPosY, setActivePoint, yPositionString]);
|
|
31
|
-
const strokeDetectorWidth = yScale
|
|
86
|
+
const strokeDetectorWidth = yScale instanceof BandScale ? yScale.getStep() : "4px";
|
|
32
87
|
return /* @__PURE__ */ jsxs("g", { children: [
|
|
33
|
-
isActive ? /* @__PURE__ */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
) }) : null,
|
|
47
|
-
/* @__PURE__ */ jsx(
|
|
48
|
-
"line",
|
|
49
|
-
{
|
|
50
|
-
ref: refs.setReference,
|
|
51
|
-
x1: innerWidth,
|
|
52
|
-
strokeWidth: "2px",
|
|
53
|
-
stroke: "transparent",
|
|
54
|
-
y1: yPosition,
|
|
55
|
-
x2: innerWidth,
|
|
56
|
-
y2: yPosition
|
|
57
|
-
}
|
|
58
|
-
),
|
|
59
|
-
/* @__PURE__ */ jsx(
|
|
60
|
-
"line",
|
|
61
|
-
{
|
|
62
|
-
x1: 0,
|
|
63
|
-
strokeWidth: "2px",
|
|
64
|
-
stroke: "grey",
|
|
65
|
-
strokeDasharray: "4 4",
|
|
66
|
-
y1: yPosition,
|
|
67
|
-
x2: innerWidth,
|
|
68
|
-
y2: yPosition
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
] }) : null,
|
|
88
|
+
isActive ? /* @__PURE__ */ jsx(
|
|
89
|
+
ScrapperGuide,
|
|
90
|
+
{
|
|
91
|
+
yPosition,
|
|
92
|
+
datum,
|
|
93
|
+
innerWidth,
|
|
94
|
+
getOwnerProps,
|
|
95
|
+
TooltipRenderer,
|
|
96
|
+
scrapper
|
|
97
|
+
}
|
|
98
|
+
) : null,
|
|
72
99
|
/* @__PURE__ */ jsx(
|
|
73
100
|
"line",
|
|
74
101
|
{
|
|
@@ -82,7 +109,7 @@ const ScrapperLine = ({ yPosition, datum }) => {
|
|
|
82
109
|
}
|
|
83
110
|
)
|
|
84
111
|
] });
|
|
85
|
-
};
|
|
112
|
+
});
|
|
86
113
|
export {
|
|
87
114
|
ScrapperLine
|
|
88
115
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scrapper/ScrapperLine.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback } from 'react';\nimport { useFloatingContext, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback } from 'react';\nimport { useFloatingContext, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { StyledMouseOverDetectionBox, StyledTooltipContainer, TOOLTIP_CONTENT_SLOT_PROPS } from '../../styles.js';\nimport { SCRAPPER_DEFAULT_TOOLTIP_PREFERENCE } from '../../../constants.js';\nimport type { DSChartT } from '../../../../react-desc-prop-types.js';\nimport { BandScale, type ScaleT } from '../../scales/index.js';\ninterface ScrapperLineProps {\n yPosition: number;\n datum: DSChartT.ScrapperDatum[];\n isActive: boolean;\n setScrapperPosY: (y: number) => void;\n innerWidth: number;\n yScale: ScaleT | null;\n setActivePoint: React.Dispatch<React.SetStateAction<DSChartT.InternalDatum | null>>;\n isGrabbed: boolean;\n getOwnerProps: () => DSChartT.Props;\n TooltipRenderer: DSChartT.Props['TooltipRenderer'];\n scrapper: DSChartT.Props['scrapper'];\n}\n\ntype ScrapperGuideProps = Pick<\n ScrapperLineProps,\n 'yPosition' | 'datum' | 'innerWidth' | 'getOwnerProps' | 'TooltipRenderer' | 'scrapper'\n>;\n\n// The guide line of the active position and its tooltip, mounted only while the position is active. A chart has a hover\n// area per position, and a floating context per area made every mount and every resize pay for tooltips that never open.\nconst ScrapperGuide = ({\n yPosition,\n datum,\n innerWidth,\n getOwnerProps,\n TooltipRenderer,\n scrapper,\n}: ScrapperGuideProps) => {\n const theme = useContext(ThemeContext);\n const guideColor = scrapper?.color ?? theme?.colors?.neutral?.['400'] ?? '#8C93A6';\n\n const { refs, floatingStyles, context } = useFloatingContext({\n externallyControlledIsOpen: !!TooltipRenderer,\n withoutAnimation: true,\n customOffset: [0, 5],\n // without a placement the floating context fails on the first hover and the render throws\n placement: scrapper?.tooltipPreference ?? SCRAPPER_DEFAULT_TOOLTIP_PREFERENCE,\n });\n\n return (\n <g>\n {TooltipRenderer ? (\n <foreignObject>\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen\n floatingStyles={{ ...floatingStyles, zIndex: theme.zIndex.tooltip }}\n context={context}\n dsFloatingwrapperContent={TOOLTIP_CONTENT_SLOT_PROPS}\n >\n <StyledMouseOverDetectionBox getOwnerProps={getOwnerProps} />\n <StyledTooltipContainer getOwnerProps={getOwnerProps}>\n <TooltipRenderer data={datum} />\n </StyledTooltipContainer>\n </FloatingWrapper>\n </foreignObject>\n ) : null}\n <line\n ref={refs.setReference as React.Ref<SVGLineElement>}\n x1={innerWidth}\n strokeWidth=\"2px\"\n stroke=\"transparent\"\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n <line\n x1={0}\n // a solid hairline: a dashed line reads as a threshold or a projection\n strokeWidth=\"1px\"\n stroke={guideColor}\n shapeRendering=\"crispEdges\"\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n </g>\n );\n};\n\n// Receives everything as props, and whether it is the active line as a boolean: a hover re-renders the line that turns\n// off and the one that turns on, not every line of the chart (the chart context changes on every hover).\nexport const ScrapperLine: React.ComponentType<ScrapperLineProps> = React.memo((props) => {\n const {\n yPosition,\n datum,\n isActive,\n setScrapperPosY,\n innerWidth,\n yScale,\n setActivePoint,\n isGrabbed,\n getOwnerProps,\n TooltipRenderer,\n scrapper,\n } = props;\n const yPositionString = yPosition;\n\n const handleOnMouseEnter = useCallback(() => {\n if (!isGrabbed) setScrapperPosY(yPositionString);\n setActivePoint(null);\n }, [isGrabbed, setScrapperPosY, setActivePoint, yPositionString]);\n\n // on a band axis the hover area of a category is its whole step, the band and the padding around it (see\n // VerticalScrapperLine)\n const strokeDetectorWidth = yScale instanceof BandScale ? yScale.getStep() : '4px';\n\n return (\n <g>\n {isActive ? (\n <ScrapperGuide\n yPosition={yPosition}\n datum={datum}\n innerWidth={innerWidth}\n getOwnerProps={getOwnerProps}\n TooltipRenderer={TooltipRenderer}\n scrapper={scrapper}\n />\n ) : null}\n <line\n onMouseEnter={handleOnMouseEnter}\n x1={0}\n strokeWidth={strokeDetectorWidth}\n stroke=\"transparent\"\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n </g>\n );\n});\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACmDb,SAOE,KAPF;AAnDV,OAAOA,UAAS,YAAY,mBAAmB;AAC/C,SAAS,oBAAoB,uBAAuB;AACpD,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B,wBAAwB,kCAAkC;AAChG,SAAS,2CAA2C;AAEpD,SAAS,iBAA8B;AAsBvC,MAAM,gBAAgB,CAAC;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA0B;AACxB,QAAM,QAAQ,WAAW,YAAY;AACrC,QAAM,aAAa,UAAU,SAAS,OAAO,QAAQ,UAAU,KAAK,KAAK;AAEzE,QAAM,EAAE,MAAM,gBAAgB,QAAQ,IAAI,mBAAmB;AAAA,IAC3D,4BAA4B,CAAC,CAAC;AAAA,IAC9B,kBAAkB;AAAA,IAClB,cAAc,CAAC,GAAG,CAAC;AAAA;AAAA,IAEnB,WAAW,UAAU,qBAAqB;AAAA,EAC5C,CAAC;AAED,SACE,qBAAC,OACE;AAAA,sBACC,oBAAC,mBACC;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,KAAK;AAAA,QACf,QAAM;AAAA,QACN,gBAAgB,EAAE,GAAG,gBAAgB,QAAQ,MAAM,OAAO,QAAQ;AAAA,QAClE;AAAA,QACA,0BAA0B;AAAA,QAE1B;AAAA,8BAAC,+BAA4B,eAA8B;AAAA,UAC3D,oBAAC,0BAAuB,eACtB,8BAAC,mBAAgB,MAAM,OAAO,GAChC;AAAA;AAAA;AAAA,IACF,GACF,IACE;AAAA,IACJ;AAAA,MAAC;AAAA;AAAA,QACC,KAAK,KAAK;AAAA,QACV,IAAI;AAAA,QACJ,aAAY;AAAA,QACZ,QAAO;AAAA,QACP,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA;AAAA,IACN;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,IAAI;AAAA,QAEJ,aAAY;AAAA,QACZ,QAAQ;AAAA,QACR,gBAAe;AAAA,QACf,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA;AAAA,IACN;AAAA,KACF;AAEJ;AAIO,MAAM,eAAuDA,OAAM,KAAK,CAAC,UAAU;AACxF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,kBAAkB;AAExB,QAAM,qBAAqB,YAAY,MAAM;AAC3C,QAAI,CAAC,UAAW,iBAAgB,eAAe;AAC/C,mBAAe,IAAI;AAAA,EACrB,GAAG,CAAC,WAAW,iBAAiB,gBAAgB,eAAe,CAAC;AAIhE,QAAM,sBAAsB,kBAAkB,YAAY,OAAO,QAAQ,IAAI;AAE7E,SACE,qBAAC,OACE;AAAA,eACC;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF,IACE;AAAA,IACJ;AAAA,MAAC;AAAA;AAAA,QACC,cAAc;AAAA,QACd,IAAI;AAAA,QACJ,aAAa;AAAA,QACb,QAAO;AAAA,QACP,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA;AAAA,IACN;AAAA,KACF;AAEJ,CAAC;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -4,37 +4,45 @@ import { useMemo, useContext } from "react";
|
|
|
4
4
|
import { VerticalScrapperLine } from "./VerticalScrapperLine.js";
|
|
5
5
|
import { useUniqueData } from "../../helpers/useUniqueData.js";
|
|
6
6
|
import { ChartContext } from "../../ChartContext.js";
|
|
7
|
+
import { getPointerScrapperPosX, useChartInteraction } from "../../config/chartInteractionStore.js";
|
|
7
8
|
const VerticalScrapper = () => {
|
|
8
9
|
const uniqueData = useUniqueData();
|
|
9
10
|
const {
|
|
10
|
-
scrapperPosX,
|
|
11
11
|
setScrapperPosX,
|
|
12
12
|
isGrabbed,
|
|
13
13
|
xScale,
|
|
14
|
+
getXScaleValue,
|
|
14
15
|
setActivePoint,
|
|
15
16
|
innerHeight,
|
|
16
|
-
props: { TooltipRenderer, scrapper }
|
|
17
|
+
props: { TooltipRenderer, scrapper },
|
|
18
|
+
getOwnerProps
|
|
17
19
|
} = useContext(ChartContext);
|
|
20
|
+
const scrapperPosX = useChartInteraction(
|
|
21
|
+
(state) => state.activePoint ? getXScaleValue(state.activePoint) ?? -1 : getPointerScrapperPosX(state)
|
|
22
|
+
);
|
|
18
23
|
return useMemo(
|
|
19
24
|
() => /* @__PURE__ */ jsx("g", { className: "vertical-scrapper", children: scrapper && uniqueData.map((line) => /* @__PURE__ */ jsx(
|
|
20
25
|
VerticalScrapperLine,
|
|
21
26
|
{
|
|
22
|
-
|
|
27
|
+
rectDetectorLeft: line.rectDetector?.left,
|
|
28
|
+
rectDetectorRight: line.rectDetector?.right,
|
|
23
29
|
xPosition: line.xPosition,
|
|
24
30
|
data: line.dataPerPosition,
|
|
25
|
-
scrapperPosX,
|
|
31
|
+
isActive: scrapperPosX === line.xPosition,
|
|
26
32
|
setScrapperPosX,
|
|
27
33
|
isGrabbed,
|
|
28
34
|
xScale,
|
|
29
35
|
setActivePoint,
|
|
30
36
|
innerHeight,
|
|
31
37
|
TooltipRenderer,
|
|
32
|
-
scrapper
|
|
38
|
+
scrapper,
|
|
39
|
+
getOwnerProps
|
|
33
40
|
},
|
|
34
|
-
line.xPosition
|
|
41
|
+
line.dataPerPosition[0]?.datum.key ?? line.xPosition
|
|
35
42
|
)) }),
|
|
36
43
|
[
|
|
37
44
|
TooltipRenderer,
|
|
45
|
+
getOwnerProps,
|
|
38
46
|
innerHeight,
|
|
39
47
|
isGrabbed,
|
|
40
48
|
scrapper,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scrapper/VerticalScrapper.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo, useContext } from 'react';\nimport { VerticalScrapperLine } from './VerticalScrapperLine.js';\nimport { useUniqueData } from '../../helpers/useUniqueData.js';\nimport { ChartContext } from '../../ChartContext.js';\nexport const VerticalScrapper = () => {\n const uniqueData = useUniqueData();\n const {\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo, useContext } from 'react';\nimport { VerticalScrapperLine } from './VerticalScrapperLine.js';\nimport { useUniqueData } from '../../helpers/useUniqueData.js';\nimport { ChartContext } from '../../ChartContext.js';\nimport { getPointerScrapperPosX, useChartInteraction } from '../../config/chartInteractionStore.js';\nexport const VerticalScrapper = () => {\n const uniqueData = useUniqueData();\n const {\n setScrapperPosX,\n isGrabbed,\n xScale,\n getXScaleValue,\n setActivePoint,\n innerHeight,\n props: { TooltipRenderer, scrapper },\n getOwnerProps,\n } = useContext(ChartContext);\n // the active position follows the active point of the keyboard, and the pointer otherwise: navigating the data points\n // shows the guide line and the tooltip of every series at the position, as the pointer does\n const scrapperPosX = useChartInteraction((state) =>\n state.activePoint ? (getXScaleValue(state.activePoint) ?? -1) : getPointerScrapperPosX(state),\n );\n return useMemo(\n () => (\n <g className=\"vertical-scrapper\">\n {scrapper &&\n uniqueData.map((line) => (\n <VerticalScrapperLine\n // numbers, not the detector object: a scroll step builds the lines in view again, and an object would be new\n // every time\n rectDetectorLeft={line.rectDetector?.left}\n rectDetectorRight={line.rectDetector?.right}\n xPosition={line.xPosition}\n // keyed by its first data point, not by its position in pixels: a resize moves every position, and a key that\n // changes remounts every line instead of updating it\n key={line.dataPerPosition[0]?.datum.key ?? line.xPosition}\n data={line.dataPerPosition}\n // a boolean, not the position: every other line keeps its props and its memo, so a hover re-renders the\n // line that turns off and the one that turns on, not all of them\n isActive={scrapperPosX === line.xPosition}\n setScrapperPosX={setScrapperPosX}\n isGrabbed={isGrabbed}\n xScale={xScale}\n setActivePoint={setActivePoint}\n innerHeight={innerHeight}\n TooltipRenderer={TooltipRenderer}\n scrapper={scrapper}\n getOwnerProps={getOwnerProps}\n />\n ))}\n </g>\n ),\n [\n TooltipRenderer,\n getOwnerProps,\n innerHeight,\n isGrabbed,\n scrapper,\n scrapperPosX,\n setActivePoint,\n setScrapperPosX,\n uniqueData,\n xScale,\n ],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC2BX;AA3BZ,SAAgB,SAAS,kBAAkB;AAC3C,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB,2BAA2B;AACrD,MAAM,mBAAmB,MAAM;AACpC,QAAM,aAAa,cAAc;AACjC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,iBAAiB,SAAS;AAAA,IACnC;AAAA,EACF,IAAI,WAAW,YAAY;AAG3B,QAAM,eAAe;AAAA,IAAoB,CAAC,UACxC,MAAM,cAAe,eAAe,MAAM,WAAW,KAAK,KAAM,uBAAuB,KAAK;AAAA,EAC9F;AACA,SAAO;AAAA,IACL,MACE,oBAAC,OAAE,WAAU,qBACV,sBACC,WAAW,IAAI,CAAC,SACd;AAAA,MAAC;AAAA;AAAA,QAGC,kBAAkB,KAAK,cAAc;AAAA,QACrC,mBAAmB,KAAK,cAAc;AAAA,QACtC,WAAW,KAAK;AAAA,QAIhB,MAAM,KAAK;AAAA,QAGX,UAAU,iBAAiB,KAAK;AAAA,QAChC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,MAZK,KAAK,gBAAgB,CAAC,GAAG,MAAM,OAAO,KAAK;AAAA,IAalD,CACD,GACL;AAAA,IAEF;AAAA,MACE;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": []
|
|
7
7
|
}
|
|
@@ -3,71 +3,95 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import React2, { useContext, useCallback } from "react";
|
|
4
4
|
import { useFloatingContext, FloatingWrapper } from "@elliemae/ds-floating-context";
|
|
5
5
|
import { ThemeContext } from "@elliemae/ds-system";
|
|
6
|
-
import { StyledMouseOverDetectionBox, StyledTooltipContainer } from "../../styles.js";
|
|
6
|
+
import { StyledMouseOverDetectionBox, StyledTooltipContainer, TOOLTIP_CONTENT_SLOT_PROPS } from "../../styles.js";
|
|
7
|
+
import { SCRAPPER_DEFAULT_TOOLTIP_PREFERENCE } from "../../../constants.js";
|
|
8
|
+
import { BandScale } from "../../scales/index.js";
|
|
9
|
+
const VerticalScrapperGuide = ({
|
|
10
|
+
xPosition,
|
|
11
|
+
innerHeight,
|
|
12
|
+
data,
|
|
13
|
+
TooltipRenderer,
|
|
14
|
+
scrapper,
|
|
15
|
+
getOwnerProps
|
|
16
|
+
}) => {
|
|
17
|
+
const theme = useContext(ThemeContext);
|
|
18
|
+
const { refs, floatingStyles, context } = useFloatingContext({
|
|
19
|
+
externallyControlledIsOpen: !!TooltipRenderer,
|
|
20
|
+
withoutAnimation: true,
|
|
21
|
+
customOffset: [0, 5],
|
|
22
|
+
// without a placement the floating context fails on the first hover and the render throws
|
|
23
|
+
placement: scrapper.tooltipPreference ?? SCRAPPER_DEFAULT_TOOLTIP_PREFERENCE
|
|
24
|
+
});
|
|
25
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
26
|
+
TooltipRenderer ? /* @__PURE__ */ jsx("foreignObject", { children: /* @__PURE__ */ jsxs(
|
|
27
|
+
FloatingWrapper,
|
|
28
|
+
{
|
|
29
|
+
innerRef: refs.setFloating,
|
|
30
|
+
isOpen: true,
|
|
31
|
+
floatingStyles: { ...floatingStyles, zIndex: theme.zIndex.tooltip },
|
|
32
|
+
context,
|
|
33
|
+
dsFloatingwrapperContent: TOOLTIP_CONTENT_SLOT_PROPS,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsx(StyledMouseOverDetectionBox, { getOwnerProps }),
|
|
36
|
+
/* @__PURE__ */ jsx(StyledTooltipContainer, { getOwnerProps, children: /* @__PURE__ */ jsx(TooltipRenderer, { data }) })
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
) }) : null,
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
"line",
|
|
42
|
+
{
|
|
43
|
+
ref: refs.setReference,
|
|
44
|
+
x1: xPosition,
|
|
45
|
+
strokeWidth: "1px",
|
|
46
|
+
stroke: scrapper.color,
|
|
47
|
+
y1: 0,
|
|
48
|
+
x2: xPosition,
|
|
49
|
+
y2: innerHeight,
|
|
50
|
+
shapeRendering: "crispEdges"
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] });
|
|
54
|
+
};
|
|
7
55
|
const VerticalScrapperLine = React2.memo(
|
|
8
56
|
({
|
|
9
|
-
|
|
57
|
+
rectDetectorLeft,
|
|
58
|
+
rectDetectorRight,
|
|
10
59
|
xPosition,
|
|
11
60
|
data,
|
|
12
|
-
|
|
61
|
+
isActive,
|
|
13
62
|
setScrapperPosX,
|
|
14
63
|
isGrabbed,
|
|
15
64
|
xScale,
|
|
16
65
|
setActivePoint,
|
|
17
66
|
innerHeight,
|
|
18
67
|
TooltipRenderer,
|
|
19
|
-
scrapper
|
|
68
|
+
scrapper,
|
|
69
|
+
getOwnerProps
|
|
20
70
|
}) => {
|
|
21
|
-
const theme = useContext(ThemeContext);
|
|
22
|
-
const isActive = scrapperPosX === xPosition;
|
|
23
|
-
const { refs, floatingStyles, context } = useFloatingContext({
|
|
24
|
-
externallyControlledIsOpen: isActive && !isGrabbed && !!TooltipRenderer,
|
|
25
|
-
withoutAnimation: true,
|
|
26
|
-
customOffset: [0, 5],
|
|
27
|
-
placement: scrapper.tooltipPreference
|
|
28
|
-
});
|
|
29
71
|
const handleOnMouseEnter = useCallback(() => {
|
|
30
72
|
if (!isGrabbed) setScrapperPosX(xPosition);
|
|
31
73
|
setActivePoint(null);
|
|
32
74
|
}, [isGrabbed, setActivePoint, setScrapperPosX, xPosition]);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/* @__PURE__ */ jsx(StyledTooltipContainer, { children: /* @__PURE__ */ jsx(TooltipRenderer, { data }) })
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
) }) : null,
|
|
49
|
-
/* @__PURE__ */ jsx(
|
|
50
|
-
"line",
|
|
51
|
-
{
|
|
52
|
-
ref: refs.setReference,
|
|
53
|
-
x1: xPosition,
|
|
54
|
-
strokeWidth: "2px",
|
|
55
|
-
stroke: scrapper.color,
|
|
56
|
-
y1: 0,
|
|
57
|
-
x2: xPosition,
|
|
58
|
-
y2: innerHeight,
|
|
59
|
-
strokeDasharray: "4 4"
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
] }) : null,
|
|
75
|
+
return /* @__PURE__ */ jsxs("g", { transform: `translate(${xScale instanceof BandScale ? xScale.getBandwidth() / 2 : 0}, 0)`, children: [
|
|
76
|
+
isActive && !isGrabbed ? /* @__PURE__ */ jsx(
|
|
77
|
+
VerticalScrapperGuide,
|
|
78
|
+
{
|
|
79
|
+
xPosition,
|
|
80
|
+
innerHeight,
|
|
81
|
+
data,
|
|
82
|
+
TooltipRenderer,
|
|
83
|
+
scrapper,
|
|
84
|
+
getOwnerProps
|
|
85
|
+
}
|
|
86
|
+
) : null,
|
|
63
87
|
/* @__PURE__ */ jsx(
|
|
64
88
|
"rect",
|
|
65
89
|
{
|
|
66
90
|
onMouseOver: handleOnMouseEnter,
|
|
67
|
-
x:
|
|
91
|
+
x: xScale instanceof BandScale ? xPosition - xScale.getStep() / 2 : xPosition - (rectDetectorLeft ?? 0),
|
|
68
92
|
fill: "transparent",
|
|
69
93
|
y: 0,
|
|
70
|
-
width:
|
|
94
|
+
width: xScale instanceof BandScale ? xScale.getStep() : (rectDetectorRight ?? 0) + (rectDetectorLeft ?? 0),
|
|
71
95
|
height: innerHeight
|
|
72
96
|
}
|
|
73
97
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scrapper/VerticalScrapperLine.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, { useContext, useCallback } from 'react';\nimport { useFloatingContext, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { StyledMouseOverDetectionBox, StyledTooltipContainer } from '../../styles.js';\nimport type { DSChartT } from '
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, { useContext, useCallback } from 'react';\nimport { useFloatingContext, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { StyledMouseOverDetectionBox, StyledTooltipContainer, TOOLTIP_CONTENT_SLOT_PROPS } from '../../styles.js';\nimport { SCRAPPER_DEFAULT_TOOLTIP_PREFERENCE } from '../../../constants.js';\nimport type { DSChartT } from '../../../../react-desc-prop-types.js';\nimport { BandScale, type ScaleT } from '../../scales/index.js';\ninterface VerticalScrapperLineProps {\n // how far the hover area reaches to the left and the right of the position, on a linear axis\n rectDetectorLeft?: number;\n rectDetectorRight?: number;\n xPosition: number;\n data: DSChartT.ScrapperDatum[];\n isActive: boolean;\n setScrapperPosX: (x: number) => void;\n isGrabbed: boolean;\n xScale: ScaleT | null;\n setActivePoint: React.Dispatch<React.SetStateAction<DSChartT.InternalDatum | null>>;\n innerHeight: number;\n TooltipRenderer?:\n | React.ComponentType<{\n data: {\n name: string;\n xValue: string | number | Date | null;\n yValue: string | number | Date | null;\n datum: DSChartT.InternalDatum;\n }[];\n }>\n | undefined;\n scrapper: DSChartT.ScrapperT;\n getOwnerProps: () => DSChartT.Props;\n}\n\ntype VerticalScrapperGuideProps = Pick<\n VerticalScrapperLineProps,\n 'xPosition' | 'innerHeight' | 'data' | 'TooltipRenderer' | 'scrapper' | 'getOwnerProps'\n>;\n\n// The guide line of the active position and its tooltip, mounted only while the position is active. A chart has a hover\n// area per position, hundreds with many data points, and a floating context per area made every mount and every resize\n// pay for hundreds of tooltips that never open.\nconst VerticalScrapperGuide = ({\n xPosition,\n innerHeight,\n data,\n TooltipRenderer,\n scrapper,\n getOwnerProps,\n}: VerticalScrapperGuideProps) => {\n const theme = useContext(ThemeContext);\n\n const { refs, floatingStyles, context } = useFloatingContext({\n externallyControlledIsOpen: !!TooltipRenderer,\n withoutAnimation: true,\n customOffset: [0, 5],\n // without a placement the floating context fails on the first hover and the render throws\n placement: scrapper.tooltipPreference ?? SCRAPPER_DEFAULT_TOOLTIP_PREFERENCE,\n });\n\n return (\n <g>\n {TooltipRenderer ? (\n <foreignObject>\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen\n floatingStyles={{ ...floatingStyles, zIndex: theme.zIndex.tooltip }}\n context={context}\n dsFloatingwrapperContent={TOOLTIP_CONTENT_SLOT_PROPS}\n >\n <StyledMouseOverDetectionBox getOwnerProps={getOwnerProps} />\n <StyledTooltipContainer getOwnerProps={getOwnerProps}>\n <TooltipRenderer data={data} />\n </StyledTooltipContainer>\n </FloatingWrapper>\n </foreignObject>\n ) : null}\n <line\n ref={refs.setReference as React.Ref<SVGLineElement>}\n x1={xPosition}\n // a solid hairline: a dashed line reads as a threshold or a projection\n strokeWidth=\"1px\"\n stroke={scrapper.color}\n y1={0}\n x2={xPosition}\n y2={innerHeight}\n shapeRendering=\"crispEdges\"\n />\n </g>\n );\n};\n\nexport const VerticalScrapperLine: React.ComponentType<VerticalScrapperLineProps> = React.memo(\n ({\n rectDetectorLeft,\n rectDetectorRight,\n xPosition,\n data,\n isActive,\n setScrapperPosX,\n isGrabbed,\n xScale,\n setActivePoint,\n innerHeight,\n TooltipRenderer,\n scrapper,\n getOwnerProps,\n }) => {\n const handleOnMouseEnter = useCallback(() => {\n if (!isGrabbed) setScrapperPosX(xPosition);\n setActivePoint(null);\n }, [isGrabbed, setActivePoint, setScrapperPosX, xPosition]);\n return (\n <g transform={`translate(${xScale instanceof BandScale ? xScale.getBandwidth() / 2 : 0}, 0)`}>\n {isActive && !isGrabbed ? (\n <VerticalScrapperGuide\n xPosition={xPosition}\n innerHeight={innerHeight}\n data={data}\n TooltipRenderer={TooltipRenderer}\n scrapper={scrapper}\n getOwnerProps={getOwnerProps}\n />\n ) : null}\n {/* on a band axis the hover area of a category is its whole step, the band and the padding around it: with the\n band only, the pointer between two categories reached none of them and the tooltip closed */}\n <rect\n onMouseOver={handleOnMouseEnter}\n x={xScale instanceof BandScale ? xPosition - xScale.getStep() / 2 : xPosition - (rectDetectorLeft ?? 0)}\n fill=\"transparent\"\n y={0}\n width={xScale instanceof BandScale ? xScale.getStep() : (rectDetectorRight ?? 0) + (rectDetectorLeft ?? 0)}\n height={innerHeight}\n />\n </g>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACgEb,SAOE,KAPF;AA/DV,OAAOA,UAAS,YAAY,mBAAmB;AAC/C,SAAS,oBAAoB,uBAAuB;AACpD,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B,wBAAwB,kCAAkC;AAChG,SAAS,2CAA2C;AAEpD,SAAS,iBAA8B;AAmCvC,MAAM,wBAAwB,CAAC;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAkC;AAChC,QAAM,QAAQ,WAAW,YAAY;AAErC,QAAM,EAAE,MAAM,gBAAgB,QAAQ,IAAI,mBAAmB;AAAA,IAC3D,4BAA4B,CAAC,CAAC;AAAA,IAC9B,kBAAkB;AAAA,IAClB,cAAc,CAAC,GAAG,CAAC;AAAA;AAAA,IAEnB,WAAW,SAAS,qBAAqB;AAAA,EAC3C,CAAC;AAED,SACE,qBAAC,OACE;AAAA,sBACC,oBAAC,mBACC;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,KAAK;AAAA,QACf,QAAM;AAAA,QACN,gBAAgB,EAAE,GAAG,gBAAgB,QAAQ,MAAM,OAAO,QAAQ;AAAA,QAClE;AAAA,QACA,0BAA0B;AAAA,QAE1B;AAAA,8BAAC,+BAA4B,eAA8B;AAAA,UAC3D,oBAAC,0BAAuB,eACtB,8BAAC,mBAAgB,MAAY,GAC/B;AAAA;AAAA;AAAA,IACF,GACF,IACE;AAAA,IACJ;AAAA,MAAC;AAAA;AAAA,QACC,KAAK,KAAK;AAAA,QACV,IAAI;AAAA,QAEJ,aAAY;AAAA,QACZ,QAAQ,SAAS;AAAA,QACjB,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,gBAAe;AAAA;AAAA,IACjB;AAAA,KACF;AAEJ;AAEO,MAAM,uBAAuEA,OAAM;AAAA,EACxF,CAAC;AAAA,IACC;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,MAAM;AACJ,UAAM,qBAAqB,YAAY,MAAM;AAC3C,UAAI,CAAC,UAAW,iBAAgB,SAAS;AACzC,qBAAe,IAAI;AAAA,IACrB,GAAG,CAAC,WAAW,gBAAgB,iBAAiB,SAAS,CAAC;AAC1D,WACE,qBAAC,OAAE,WAAW,aAAa,kBAAkB,YAAY,OAAO,aAAa,IAAI,IAAI,CAAC,QACnF;AAAA,kBAAY,CAAC,YACZ;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF,IACE;AAAA,MAGJ;AAAA,QAAC;AAAA;AAAA,UACC,aAAa;AAAA,UACb,GAAG,kBAAkB,YAAY,YAAY,OAAO,QAAQ,IAAI,IAAI,aAAa,oBAAoB;AAAA,UACrG,MAAK;AAAA,UACL,GAAG;AAAA,UACH,OAAO,kBAAkB,YAAY,OAAO,QAAQ,KAAK,qBAAqB,MAAM,oBAAoB;AAAA,UACxG,QAAQ;AAAA;AAAA,MACV;AAAA,OACF;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
const srOnlyStyle = {
|
|
4
|
+
position: "absolute",
|
|
5
|
+
width: "1px",
|
|
6
|
+
height: "1px",
|
|
7
|
+
padding: 0,
|
|
8
|
+
margin: "-1px",
|
|
9
|
+
overflow: "hidden",
|
|
10
|
+
clip: "rect(0, 0, 0, 0)",
|
|
11
|
+
whiteSpace: "nowrap",
|
|
12
|
+
border: 0
|
|
13
|
+
};
|
|
14
|
+
const ScreenReaderText = ({ id, children }) => /* @__PURE__ */ jsx("span", { id, style: srOnlyStyle, children });
|
|
15
|
+
export {
|
|
16
|
+
ScreenReaderText
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=ScreenReaderText.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/parts/ScreenReaderText.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\n\n// text for screen readers only, kept in the layout but out of sight\nconst srOnlyStyle: React.CSSProperties = {\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: 0,\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n border: 0,\n};\n\nexport const ScreenReaderText = ({ id, children }: { id?: string; children: React.ReactNode }) => (\n <span id={id} style={srOnlyStyle}>\n {children}\n </span>\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACgBrB;AAbF,MAAM,cAAmC;AAAA,EACvC,UAAU;AAAA,EACV,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,QAAQ;AACV;AAEO,MAAM,mBAAmB,CAAC,EAAE,IAAI,SAAS,MAC9C,oBAAC,UAAK,IAAQ,OAAO,aAClB,UACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|