euv_ui/component/modal/view/struct.rs
1use super::*;
2
3/// Props for the `euv_modal` component.
4///
5/// Defines the strongly-typed interface for the modal dialog.
6#[derive(Clone, CustomDebug, Data, Default, New)]
7pub struct EuvModalProps {
8 /// The modal title text.
9 #[get(type(copy))]
10 pub title: &'static str,
11 /// Optional close handler triggered by overlay or close button click.
12 #[debug(skip)]
13 pub onclick: Option<Rc<dyn Fn(Event)>>,
14}
15
16/// Props of the [`euv_dialog`] component.
17///
18/// The dialog holds the open state, so the trigger and the panel always
19/// agree on whether the dialog is showing.
20#[derive(Clone, CustomDebug, Default)]
21pub struct EuvDialogProps {
22 /// Whether the dialog is open.
23 pub open: Signal<bool>,
24 /// The title of the dialog.
25 pub title: &'static str,
26 /// The description of the dialog.
27 pub description: &'static str,
28}
29
30/// Props of the [`euv_dialog_header`] component.
31#[derive(Clone, Copy, CustomDebug, Default)]
32pub struct EuvDialogHeaderProps {
33 /// The accessible name of the header.
34 pub label: &'static str,
35}
36
37/// Props of the [`euv_dialog_title`] component.
38#[derive(Clone, Copy, CustomDebug, Default)]
39pub struct EuvDialogTitleProps {
40 /// The title text.
41 pub text: &'static str,
42}
43
44/// Props of the [`euv_dialog_description`] component.
45#[derive(Clone, Copy, CustomDebug, Default)]
46pub struct EuvDialogDescriptionProps {
47 /// The description text.
48 pub text: &'static str,
49}
50
51/// Props of the [`euv_dialog_footer`] component.
52#[derive(Clone, Copy, CustomDebug, Default)]
53pub struct EuvDialogFooterProps {
54 /// The accessible name of the footer.
55 pub label: &'static str,
56}
57
58/// Props of the [`euv_dialog_trigger`] component.
59///
60/// The trigger opens the dialog, so it carries the open state the panel
61/// reads.
62#[derive(Clone, CustomDebug, Default)]
63pub struct EuvDialogTriggerProps {
64 /// Whether the dialog is open.
65 pub open: Signal<bool>,
66}
67
68/// Props of the [`euv_dialog_close`] component.
69#[derive(Clone, CustomDebug, Default)]
70pub struct EuvDialogCloseProps {
71 /// The accessible name of the button.
72 pub label: &'static str,
73 /// The optional handler that closes the dialog.
74 #[debug(skip)]
75 pub onclick: Option<Rc<dyn Fn(Event)>>,
76}
77
78/// Props for the [`euv_dialog_overlay`] component.
79///
80/// The overlay dims the page behind a dialog. It carries the open state, so
81/// it can fade away together with the panel.
82#[derive(Clone, CustomDebug, Default)]
83pub struct EuvDialogOverlayProps {
84 /// Whether the dialog is open.
85 pub open: Signal<bool>,
86}
87
88/// Props for the [`euv_dialog_content`] component.
89///
90/// The content is the panel of a dialog. It carries the open state, so the
91/// panel can slide away together with the overlay.
92#[derive(Clone, CustomDebug, Default)]
93pub struct EuvDialogContentProps {
94 /// Whether the dialog is open.
95 pub open: Signal<bool>,
96}