Skip to main content

euv_ui/component/data_display/
struct.rs

1use super::*;
2
3/// Compact dismissible or labeled metadata tag.
4#[derive(Clone, Data, New, Props)]
5pub struct EuvTag {
6    /// Tag text label.
7    pub(crate) label: String,
8    /// Semantic tone.
9    #[get(type(copy))]
10    pub(crate) tone: EuvTone,
11    /// Active theme tokens.
12    #[get(type(copy))]
13    pub(crate) tokens: ThemeTokens,
14}
15
16/// Circular initials avatar surface.
17#[derive(Clone, Data, New, Props)]
18pub struct EuvAvatar {
19    /// Display initials (1-2 chars).
20    pub(crate) initials: String,
21    /// Diameter in logical pixels.
22    #[get(type(copy))]
23    pub(crate) size: f32,
24    /// Active theme tokens.
25    #[get(type(copy))]
26    pub(crate) tokens: ThemeTokens,
27}
28
29/// Crisp vector-rendered symbolic icon badge.
30#[derive(Clone, Data, New, Props)]
31pub struct EuvIcon {
32    /// Symbolic glyph string (used when `icon` is `None`).
33    pub(crate) symbol: String,
34    /// Icon box size in logical pixels.
35    #[get(type(copy))]
36    pub(crate) size: f32,
37    /// Optional style overrides controlling icon foreground color and layout (`style: { color: ... }`).
38    #[new(skip)]
39    #[get(type(copy))]
40    pub(crate) style: Option<Style>,
41    /// Optional built-in native vector glyph drawn directly via `DisplayList` primitives.
42    #[new(skip)]
43    #[get(type(copy))]
44    #[prop(default = None)]
45    pub(crate) icon: Option<EuvIconName>,
46}
47
48/// Keyboard shortcut keycap indicator (`Cmd`, `Ctrl`, `K`).
49#[derive(Clone, Data, New, Props)]
50pub struct EuvKbd {
51    /// Keycap text.
52    pub(crate) key: String,
53    /// Active theme tokens.
54    #[get(type(copy))]
55    pub(crate) tokens: ThemeTokens,
56}
57
58/// Semantic typography text node across heading, body, and caption scales.
59#[derive(Clone, Data, New, Props)]
60pub struct EuvTypography {
61    /// Text string.
62    pub(crate) text: String,
63    /// Scale variant.
64    #[get(type(copy))]
65    pub(crate) variant: EuvTypographyVariant,
66    /// Active theme tokens.
67    #[get(type(copy))]
68    pub(crate) tokens: ThemeTokens,
69}
70
71/// Empty-state placeholder card with title and explanation.
72#[derive(Clone, Data, New, Props)]
73pub struct EuvEmpty {
74    /// Empty-state heading.
75    pub(crate) title: String,
76    /// Supporting guidance text.
77    pub(crate) description: String,
78    /// Active theme tokens.
79    #[get(type(copy))]
80    pub(crate) tokens: ThemeTokens,
81}
82
83/// Shimmer-style skeleton loading placeholder rectangle.
84#[derive(Clone, Data, New, Props)]
85pub struct EuvSkeleton {
86    /// Active theme tokens.
87    #[get(type(copy))]
88    pub(crate) tokens: ThemeTokens,
89    /// Optional style overrides controlling dimensions and shape (`style: { width: Length::Px(180.0) height: Length::Px(16.0) }`).
90    #[new(skip)]
91    #[get(type(copy))]
92    pub(crate) style: Option<Style>,
93}
94
95/// Vector circular activity spinner rendered via `Canvas`.
96#[derive(Clone, Data, New, Props)]
97pub struct EuvSpinner {
98    /// Diameter in logical pixels.
99    #[get(type(copy))]
100    pub(crate) size: f32,
101    /// Active theme tokens.
102    #[get(type(copy))]
103    pub(crate) tokens: ThemeTokens,
104}
105
106/// Single chronological milestone entry inside `EuvTimeline`.
107#[derive(Clone, Debug, Eq, Getter, New, PartialEq)]
108pub struct EuvTimelineItem {
109    /// Milestone title.
110    pub(crate) title: String,
111    /// Timestamp or version label.
112    pub(crate) timestamp: String,
113    /// Event description.
114    pub(crate) detail: String,
115}
116
117/// Vertical chronological timeline component.
118#[derive(Clone, Data, New, Props)]
119pub struct EuvTimeline {
120    /// Ordered milestone entries.
121    pub(crate) items: Vec<EuvTimelineItem>,
122    /// Active theme tokens.
123    #[get(type(copy))]
124    pub(crate) tokens: ThemeTokens,
125}
126
127/// Structured vertical list component with dividers.
128#[derive(Clone, Data, New, Props)]
129pub struct EuvList {
130    /// Ordered row text labels.
131    pub(crate) items: Vec<String>,
132    /// Active theme tokens.
133    #[get(type(copy))]
134    pub(crate) tokens: ThemeTokens,
135}
136
137/// Hierarchical node entry inside `EuvTree`.
138#[derive(Clone, Debug, Eq, Getter, New, PartialEq)]
139pub struct EuvTreeNode {
140    /// Visible node label.
141    pub(crate) label: String,
142    /// Nested child tree nodes.
143    pub(crate) children: Vec<Self>,
144}
145
146/// Indented hierarchical tree viewer component with interactive branch folding and optional node selection.
147#[derive(Clone, Data, New, Props)]
148pub struct EuvTree {
149    /// Root tree nodes.
150    pub(crate) roots: Vec<EuvTreeNode>,
151    /// Optional controlled selected node label signal.
152    #[new(skip)]
153    #[get(skip)]
154    #[prop(custom)]
155    pub(crate) selected: Option<Signal<Option<String>>>,
156    /// Active theme tokens.
157    #[get(type(copy))]
158    pub(crate) tokens: ThemeTokens,
159}