euv_ui/component/message/view/struct.rs
1use super::*;
2
3/// One toast in the [`euv_message`] stack.
4///
5/// A message is a short line of text with an optional action and an
6/// optional close button. The component is purely presentational: it
7/// renders the item it is given and reports the clicks, so the caller
8/// keeps ownership of the queue and of any auto-dismiss timing.
9#[derive(Clone, CustomDebug, Default)]
10pub struct EuvMessageItem {
11 /// The message body, rendered in `c_euv_message_text`.
12 pub text: &'static str,
13 /// The label of the optional action button.
14 ///
15 /// An empty label renders no action button at all.
16 pub action_label: &'static str,
17 /// The callback fired when the action button is clicked.
18 #[debug(skip)]
19 pub on_action: Option<Rc<dyn Fn()>>,
20 /// The callback fired when the close button is clicked.
21 #[debug(skip)]
22 pub on_close: Option<Rc<dyn Fn()>>,
23 /// Whether the message renders a close button.
24 ///
25 /// Defaults to `false`, but supplying an `on_close` callback implies a
26 /// dismissible message, so the close button is rendered either way.
27 pub dismissible: bool,
28}
29
30/// Props for the [`euv_message`] component.
31///
32/// The stack is always mounted, so a caller can push messages into it
33/// without remounting the component.
34#[derive(Clone, CustomDebug, Default)]
35pub struct EuvMessageProps {
36 /// The messages rendered in the stack, top to bottom.
37 pub items: Vec<EuvMessageItem>,
38}
39
40/// Props for the [`euv_message_group`] component.
41///
42/// The group takes no settings of its own.
43#[derive(Clone, CustomDebug, Default)]
44pub struct EuvMessageGroupProps {}
45
46/// Props for the [`euv_message_header`] component.
47///
48/// The header takes no settings of its own.
49#[derive(Clone, CustomDebug, Default)]
50pub struct EuvMessageHeaderProps {}
51
52/// Props for the [`euv_message_avatar`] component.
53///
54/// The avatar takes no settings of its own.
55#[derive(Clone, CustomDebug, Default)]
56pub struct EuvMessageAvatarProps {}
57
58/// Props for the [`euv_message_content`] component.
59///
60/// The content takes no settings of its own.
61#[derive(Clone, CustomDebug, Default)]
62pub struct EuvMessageContentProps {}
63
64/// Props for the [`euv_message_bubble`] component.
65///
66/// The bubble takes no settings of its own.
67#[derive(Clone, CustomDebug, Default)]
68pub struct EuvMessageBubbleProps {}
69
70/// Props for the [`euv_message_footer`] component.
71///
72/// The footer takes no settings of its own.
73#[derive(Clone, CustomDebug, Default)]
74pub struct EuvMessageFooterProps {}