Skip to main content

euv_ui/component/alert_dialog/view/
struct.rs

1use super::*;
2
3/// Props of the [`euv_alert_dialog`] component.
4#[derive(Clone, CustomDebug, Default)]
5pub struct EuvAlertDialogProps {
6    /// Whether the dialog is open.
7    pub open: Signal<bool>,
8}
9
10/// Props of the [`euv_alert_dialog_trigger`] component.
11#[derive(Clone, CustomDebug, Default)]
12pub struct EuvAlertDialogTriggerProps {
13    /// Whether the dialog is open.
14    pub open: Signal<bool>,
15    /// The id of the content controlled by this trigger.
16    pub content_id: &'static str,
17    /// The label shown inside the trigger.
18    pub label: &'static str,
19}
20
21/// Props of the [`euv_alert_dialog_overlay`] component.
22#[derive(Clone, CustomDebug, Default)]
23pub struct EuvAlertDialogOverlayProps {
24    /// Whether the dialog is open.
25    pub open: Signal<bool>,
26}
27
28/// Props of the [`euv_alert_dialog_content`] component.
29#[derive(Clone, CustomDebug, Default)]
30pub struct EuvAlertDialogContentProps {
31    /// Whether the dialog is open.
32    pub open: Signal<bool>,
33    /// The id referenced by the trigger's `aria-controls`.
34    pub id: &'static str,
35    /// The id of the title that labels the dialog.
36    pub title_id: &'static str,
37    /// The id of the description that explains the dialog.
38    pub description_id: &'static str,
39}
40
41/// Props of the [`euv_alert_dialog_media`] component.
42///
43/// The media is the glyph the dialog leads with.
44#[derive(Clone, Copy, CustomDebug, Default)]
45pub struct EuvAlertDialogMediaProps {
46    /// The glyph shown inside the media.
47    pub glyph: &'static str,
48}
49
50/// Props of the [`euv_alert_dialog_header`] component.
51#[derive(Clone, Copy, CustomDebug, Default)]
52pub struct EuvAlertDialogHeaderProps {
53    /// The accessible name of the header.
54    pub label: &'static str,
55}
56
57/// Props of the [`euv_alert_dialog_footer`] component.
58#[derive(Clone, Copy, CustomDebug, Default)]
59pub struct EuvAlertDialogFooterProps {
60    /// The accessible name of the footer.
61    pub label: &'static str,
62}
63
64/// Props of the [`euv_alert_dialog_title`] component.
65#[derive(Clone, Copy, CustomDebug, Default)]
66pub struct EuvAlertDialogTitleProps {
67    /// The id referenced by the dialog content's accessible name.
68    pub id: &'static str,
69    /// The title text.
70    pub text: &'static str,
71}
72
73/// Props of the [`euv_alert_dialog_description`] component.
74#[derive(Clone, Copy, CustomDebug, Default)]
75pub struct EuvAlertDialogDescriptionProps {
76    /// The id referenced by the dialog content's accessible description.
77    pub id: &'static str,
78    /// The description text.
79    pub text: &'static str,
80}
81
82/// Props of the [`euv_alert_dialog_action`] component.
83#[derive(Clone, CustomDebug, Default)]
84pub struct EuvAlertDialogActionProps {
85    /// The label of the button.
86    pub label: &'static str,
87    /// The visual button variant, defaulting to the primary treatment.
88    pub variant: Option<EuvButtonVariant>,
89    /// The shared open state that the action closes.
90    pub open: Signal<bool>,
91    /// Optional action callback invoked before the dialog closes.
92    #[debug(skip)]
93    pub onclick: Option<Rc<dyn Fn(Event)>>,
94}
95
96/// Props of the [`euv_alert_dialog_cancel`] component.
97#[derive(Clone, CustomDebug, Default)]
98pub struct EuvAlertDialogCancelProps {
99    /// The label of the button.
100    pub label: &'static str,
101    /// The shared open state that the cancel button closes.
102    pub open: Signal<bool>,
103    /// Optional cancel callback invoked before the dialog closes.
104    #[debug(skip)]
105    pub onclick: Option<Rc<dyn Fn(Event)>>,
106}