Skip to main content

euv_ui/component/calendar/view/
struct.rs

1use super::*;
2
3/// One cell of the [`euv_calendar`] day grid.
4///
5/// The calendar is pure presentation: the caller computes the month, the
6/// leading/trailing spill-over cells and the today flag, then hands the
7/// finished grid in. This keeps the component free of date arithmetic.
8#[derive(Clone, Copy, CustomDebug, Data, Default, New)]
9pub struct EuvCalendarDay {
10    /// The day-of-month number rendered inside the cell.
11    #[get(type(copy))]
12    pub day: u32,
13    /// Whether the cell belongs to the previous or next month.
14    ///
15    /// Drives the `_muted` modifier so spill-over cells read as secondary
16    /// without changing the grid's shape.
17    #[get(type(copy))]
18    pub muted: bool,
19    /// Whether the cell is today's date.
20    #[get(type(copy))]
21    pub today: bool,
22}
23
24/// Props for the [`euv_calendar`] component.
25///
26/// The component renders only what it is given: `weekdays` drives the header
27/// row and `days` the grid. No date is computed here.
28#[derive(Clone, CustomDebug, Default)]
29pub struct EuvCalendarProps {
30    /// The month caption rendered in the header row.
31    pub title: &'static str,
32    /// The column headings, in display order.
33    pub weekdays: Vec<EuvCalendarWeekday>,
34    /// The day cells, in display order.
35    pub days: Vec<EuvCalendarDay>,
36    /// The currently selected day number.
37    pub selected: Signal<u32>,
38}