We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5e69c04 commit 08e316cCopy full SHA for 08e316c
primitives/src/calendar.rs
@@ -485,6 +485,12 @@ impl RangeCalendarContext {
485
self.highlighted_range.set(Some(range));
486
}
487
488
+
489
+ /// Set previous selected range
490
+ pub fn reset_selection(&mut self, range: Option<DateRange>) {
491
+ self.anchor_date.set(None);
492
+ self.highlighted_range.set(range);
493
+ }
494
495
496
/// The props for the [`RangeCalendar`] component.
@@ -692,6 +698,7 @@ pub fn RangeCalendar(props: RangeCalendarProps) -> Element {
692
698
set_focused_date(Some(focused_date.saturating_add(7.days())));
693
699
694
700
701
+ Key::Escape => ctx.reset_selection((props.selected_range)()),
695
702
_ => {}
696
703
697
704
},
0 commit comments