Skip to main content

euv_ui/component/nav_extra/
struct.rs

1use super::*;
2
3/// Horizontal breadcrumb trail separated by `/` with optional reactive active segment selection.
4#[derive(Clone, Data, New, Props)]
5pub struct EuvBreadcrumb {
6    /// Ordered trail labels.
7    pub(crate) segments: Vec<String>,
8    /// Optional reactive active segment index updated when clicking breadcrumb items.
9    #[new(skip)]
10    #[get(skip)]
11    #[prop(custom)]
12    pub(crate) active: Option<Signal<usize>>,
13    /// Active theme tokens.
14    #[get(type(copy))]
15    pub(crate) tokens: ThemeTokens,
16}
17
18/// Interactive page navigation bar bound to `Signal<usize>`.
19#[derive(Clone, Data, New, Props)]
20pub struct EuvPagination {
21    /// Current 1-based page number signal.
22    #[get(type(copy))]
23    pub(crate) current: Signal<usize>,
24    /// Total number of pages.
25    #[get(type(copy))]
26    pub(crate) total_pages: usize,
27    /// Active theme tokens.
28    #[get(type(copy))]
29    pub(crate) tokens: ThemeTokens,
30}
31
32/// Multi-step progress indicator bound to `Signal<usize>`.
33#[derive(Clone, Data, New, Props)]
34pub struct EuvSteps {
35    /// Step titles.
36    pub(crate) labels: Vec<String>,
37    /// Current 0-based step index signal.
38    #[get(type(copy))]
39    pub(crate) active: Signal<usize>,
40    /// Active theme tokens.
41    #[get(type(copy))]
42    pub(crate) tokens: ThemeTokens,
43}
44
45/// Single collapsible item inside `EuvAccordion`.
46#[derive(Clone, Debug, Eq, Getter, New, PartialEq)]
47pub struct EuvAccordionItem {
48    /// Collapsible section title.
49    pub(crate) title: String,
50    /// Collapsible body text.
51    pub(crate) content: String,
52}
53
54/// Reactive accordion expanding one active section at a time.
55#[derive(Clone, Data, New, Props)]
56pub struct EuvAccordion {
57    /// Accordion entries.
58    pub(crate) items: Vec<EuvAccordionItem>,
59    /// Currently expanded index (`None` when all collapsed).
60    #[get(type(copy))]
61    pub(crate) open_index: Signal<Option<usize>>,
62    /// Active theme tokens.
63    #[get(type(copy))]
64    pub(crate) tokens: ThemeTokens,
65}
66
67/// Table-of-contents outline panel with active anchor selection.
68#[derive(Clone, Data, New, Props)]
69pub struct EuvToc {
70    /// Ordered section heading labels.
71    pub(crate) headings: Vec<String>,
72    /// Active heading index signal.
73    #[get(type(copy))]
74    pub(crate) active: Signal<usize>,
75    /// Active theme tokens.
76    #[get(type(copy))]
77    pub(crate) tokens: ThemeTokens,
78}