Skip to main content

euv_ui/component/surface/
struct.rs

1use super::*;
2
3/// Centered responsive page container with constrained maximum width.
4#[derive(Clone, Data, New, Props)]
5pub struct EuvPageContainer {
6    /// Ordered child node handles.
7    #[new(skip)]
8    pub(crate) children: Vec<NodeId>,
9    /// Active theme tokens.
10    #[get(type(copy))]
11    pub(crate) tokens: ThemeTokens,
12    /// Optional style overrides controlling `max_width`, `padding`, `gap`, and container appearance (defaults to `max_width: Length::Px(1120.0)`).
13    #[new(skip)]
14    #[get(type(copy))]
15    pub(crate) style: Option<Style>,
16}
17
18/// Bordered surface panel for grouped tools or inspector content.
19#[derive(Clone, Data, New, Props)]
20pub struct EuvPanel {
21    /// Optional panel heading.
22    pub(crate) title: String,
23    /// Ordered child nodes inside the panel.
24    #[new(skip)]
25    pub(crate) children: Vec<NodeId>,
26    /// Active theme tokens.
27    #[get(type(copy))]
28    pub(crate) tokens: ThemeTokens,
29}
30
31/// Flex spacing helper arranging child nodes horizontally or vertically with uniform gap.
32#[derive(Clone, Data, New, Props)]
33pub struct EuvSpace {
34    /// When `true`, lays out children in a vertical column; otherwise horizontal row.
35    #[get(type(copy))]
36    pub(crate) vertical: bool,
37    /// Ordered child node handles.
38    #[new(skip)]
39    pub(crate) children: Vec<NodeId>,
40    /// Optional style overrides controlling `gap`, alignment, padding, and container appearance (defaults to `gap: SPACE_SM`).
41    #[new(skip)]
42    #[get(type(copy))]
43    pub(crate) style: Option<Style>,
44}
45
46/// Responsive fixed-column CSS-Grid-equivalent container.
47#[derive(Clone, Data, Default, New, Props)]
48pub struct EuvGrid {
49    /// Ordered child node handles.
50    #[new(skip)]
51    pub(crate) children: Vec<NodeId>,
52    /// Optional style overrides controlling `columns`, `gap`, and grid container appearance (defaults to `columns: 2`, `gap: SPACE_MD`).
53    #[new(skip)]
54    #[get(type(copy))]
55    pub(crate) style: Option<Style>,
56}
57
58/// Clipped scrollable viewport wrapper with configurable style height.
59#[derive(Clone, Data, New, Props)]
60pub struct EuvScrollArea {
61    /// Ordered child nodes inside the scroll area.
62    #[new(skip)]
63    pub(crate) children: Vec<NodeId>,
64    /// Active theme tokens.
65    #[get(type(copy))]
66    pub(crate) tokens: ThemeTokens,
67    /// Optional style overrides controlling viewport `height` and scroll container appearance (defaults to `height: Length::Px(240.0)`).
68    #[new(skip)]
69    #[get(type(copy))]
70    pub(crate) style: Option<Style>,
71}
72
73/// Two-pane split layout with proportional primary ratio.
74#[derive(Clone, Data, New, Props)]
75pub struct EuvSplitter {
76    /// Primary pane percentage in `[15.0, 85.0]`.
77    #[get(type(copy))]
78    pub(crate) ratio_percent: f32,
79    /// Primary pane node handle.
80    #[get(type(copy))]
81    pub(crate) primary: NodeId,
82    /// Secondary pane node handle.
83    #[get(type(copy))]
84    pub(crate) secondary: NodeId,
85    /// Active theme tokens.
86    #[get(type(copy))]
87    pub(crate) tokens: ThemeTokens,
88}
89
90/// Top navigation bar displaying brand title and trailing action nodes.
91#[derive(Clone, Data, New, Props)]
92pub struct EuvNavbar {
93    /// Brand title text.
94    pub(crate) brand: String,
95    /// Trailing action nodes.
96    #[new(skip)]
97    pub(crate) actions: Vec<NodeId>,
98    /// Active theme tokens.
99    #[get(type(copy))]
100    pub(crate) tokens: ThemeTokens,
101}
102
103/// Page footer strip with copyright or metadata text.
104#[derive(Clone, Data, New, Props)]
105pub struct EuvFooter {
106    /// Footer text content.
107    pub(crate) text: String,
108    /// Active theme tokens.
109    #[get(type(copy))]
110    pub(crate) tokens: ThemeTokens,
111}
112
113/// Contiguous horizontal group of button nodes.
114#[derive(Clone, Data, New, Props)]
115pub struct EuvButtonGroup {
116    /// Ordered button child handles.
117    pub(crate) children: Vec<NodeId>,
118    /// Active theme tokens.
119    #[get(type(copy))]
120    pub(crate) tokens: ThemeTokens,
121    /// Whether child buttons auto-grow across every wrapped row with zero trailing empty space.
122    #[new(skip)]
123    #[get(type(copy))]
124    #[prop(custom)]
125    pub(crate) wrap_fill: bool,
126}
127
128/// Pressable two-state toggle pill bound to a reactive `Signal<bool>`.
129#[derive(Clone, Data, New, Props)]
130pub struct EuvToggle {
131    /// Reactive pressed state signal.
132    #[get(type(copy))]
133    pub(crate) pressed: Signal<bool>,
134    /// Toggle label text.
135    pub(crate) label: String,
136    /// Active theme tokens.
137    #[get(type(copy))]
138    pub(crate) tokens: ThemeTokens,
139}