From 86c8e4e5e749933b201e0a701873534cad2961ba Mon Sep 17 00:00:00 2001 From: dleadbetter Date: Mon, 12 Aug 2024 10:56:46 -0400 Subject: [PATCH] RC #291 - Adding "onChange" prop to FacetTimeline component --- packages/core-data/src/components/FacetTimeline.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/core-data/src/components/FacetTimeline.js b/packages/core-data/src/components/FacetTimeline.js index b2ce14ef..19a37dbc 100644 --- a/packages/core-data/src/components/FacetTimeline.js +++ b/packages/core-data/src/components/FacetTimeline.js @@ -49,6 +49,11 @@ type Props = { */ description?: boolean, + /** + * Callback fired when the range or min/max properties are changed. + */ + onChange?: (range: [number, number], minMax: [number, number]) => void, + /** * Callback fired when the event popover is clicked. */ @@ -136,6 +141,10 @@ const FacetTimeline = (props: Props) => { .fetchAll({ min_year: range[0], max_year: range[1] }) .then(onLoad) )); + + if (props.onChange) { + props.onChange(range, [min, max]); + } }, [max, min, range]); /**