Skip to main content

euv_ui/component/date_picker/view/
struct.rs

1use super::*;
2
3/// Props for the [`euv_date_picker`] component.
4///
5/// The selected date lives in a caller-owned [`Signal`] formatted as
6/// `YYYY-MM-DD`; the month the panel shows and the open state of the panel
7/// are owned by the component itself.
8#[derive(Clone, CustomDebug, Default)]
9pub struct EuvDatePickerProps {
10    /// The selected date, formatted as `YYYY-MM-DD`.
11    ///
12    /// An empty string means that nothing is selected yet.
13    pub value: Signal<String>,
14    /// The placeholder shown on the trigger while nothing is selected.
15    pub placeholder: &'static str,
16    /// The label rendered above the trigger.
17    ///
18    /// An empty string renders the picker without a label.
19    pub label: &'static str,
20    /// The earliest selectable date, formatted as `YYYY-MM-DD`.
21    ///
22    /// An empty string means that there is no lower bound.
23    pub min: &'static str,
24    /// The latest selectable date, formatted as `YYYY-MM-DD`.
25    ///
26    /// An empty string means that there is no upper bound.
27    pub max: &'static str,
28    /// The callback invoked with the new date after every change.
29    #[debug(skip)]
30    pub on_change: Option<Rc<dyn Fn(&'static str)>>,
31}
32
33/// The cache of one month's caption.
34#[derive(Clone, Data, Debug, Default)]
35pub(crate) struct MonthCaption {
36    /// The cached `(year, month, caption)` triple.
37    #[get(pub(crate))]
38    #[get_mut(pub(crate))]
39    #[set(pub(crate))]
40    cached: CachedCaption,
41}