euv_ui/component/display/struct.rs
1use super::*;
2
3/// Compact status pill badge component.
4#[derive(Clone, Data, Debug, New, Props)]
5pub struct EuvBadge {
6 /// Badge text label.
7 pub(crate) label: String,
8 /// Semantic tone.
9 #[get(type(copy))]
10 #[prop(custom)]
11 pub(crate) tone: EuvTone,
12 /// Active theme tokens.
13 #[get(type(copy))]
14 pub(crate) tokens: ThemeTokens,
15}
16
17/// Semantic alert banner displaying title and message.
18#[derive(Clone, Data, Debug, New, Props)]
19pub struct EuvAlert {
20 /// Alert heading.
21 pub(crate) title: String,
22 /// Supporting description.
23 pub(crate) description: String,
24 /// Semantic tone.
25 #[get(type(copy))]
26 pub(crate) tone: EuvTone,
27 /// Active theme tokens.
28 #[get(type(copy))]
29 pub(crate) tokens: ThemeTokens,
30 /// Optional style overrides merged onto the alert container (`style: { text_select: ..., margin: ... }`).
31 #[new(skip)]
32 #[get(type(copy))]
33 pub(crate) style: Option<Style>,
34}
35
36/// Linear progress bar displaying normalized completion in `[0.0, 1.0]`.
37#[derive(Clone, Copy, Data, Debug, New, Props)]
38pub struct EuvProgress {
39 /// Progress fraction clamped to `[0.0, 1.0]`.
40 #[get(type(copy))]
41 pub(crate) value: f32,
42 /// Optional style overrides merged onto the progress track (`style: { height: Length::Px(12.0) }`).
43 #[new(skip)]
44 #[get(type(copy))]
45 pub(crate) style: Option<Style>,
46 /// Active theme tokens.
47 #[get(type(copy))]
48 pub(crate) tokens: ThemeTokens,
49}
50
51/// High-performance reactive virtualized scrollable list rendering only the visible window of `total_items`.
52#[derive(Clone, CustomDebug, Data, New)]
53pub struct EuvVirtualList {
54 /// Total number of logical rows.
55 #[get(type(copy))]
56 pub(crate) total_items: usize,
57 /// Fixed height of each row in logical pixels.
58 #[get(type(copy))]
59 pub(crate) item_height: f32,
60 /// Viewport height in logical pixels (`0.0` defaults to `320.0`).
61 #[new(skip)]
62 #[get(type(copy))]
63 pub(crate) viewport_height: f32,
64 /// Reactive scroll Y offset signal in logical pixels.
65 #[get(type(copy))]
66 pub(crate) scroll_y: Signal<f32>,
67 /// Extra overscan rows mounted above and below the viewport (`0` defaults to `3`).
68 #[new(skip)]
69 #[get(type(copy))]
70 pub(crate) overscan: usize,
71 /// Active theme tokens.
72 #[get(type(copy))]
73 pub(crate) tokens: ThemeTokens,
74}
75
76/// Mounted `EuvVirtualList` controller enabling O(1) stable-ID single-row patches and refreshes without rebuilding sibling rows.
77#[derive(Clone, CustomDebug)]
78pub struct EuvVirtualListHandle {
79 /// Mounted scrollable container root node handle.
80 pub(crate) container: NodeId,
81 /// Persistent inner column hosting the materialized sliding-window rows.
82 pub(crate) rows_host: NodeId,
83 /// Shared scene handle for single-lock targeted row updates.
84 #[debug(skip)]
85 pub(crate) scene: SceneHandle,
86 /// Ambient build context preserved for isolated single-row refreshes.
87 #[debug(skip)]
88 pub(crate) ctx: Context,
89 /// Active sliding window mapping logical indices to `(scope, node)`.
90 #[debug(skip)]
91 pub(crate) window: Rc<RefCell<VecDeque<(usize, Scope, NodeId)>>>,
92 /// Shared row factory invoked only when a specific visible row is refreshed.
93 #[debug(skip)]
94 pub(crate) builder: Rc<RefCell<dyn FnMut(usize) -> NodeId + 'static>>,
95}
96
97/// Simple structured cross-platform data table.
98#[derive(Clone, Data, Debug, New, Props)]
99pub struct EuvTable {
100 /// Ordered column header labels.
101 pub(crate) headers: Vec<String>,
102 /// Matrix of row cell strings.
103 pub(crate) rows: Vec<Vec<String>>,
104 /// Active theme tokens.
105 #[get(type(copy))]
106 pub(crate) tokens: ThemeTokens,
107 /// Optional style overrides merged onto the table container (`style: { text_select: ..., max_height: ... }`).
108 #[new(skip)]
109 #[get(type(copy))]
110 pub(crate) style: Option<Style>,
111}