Skip to main content

euv_ui/component/sheet/view/
struct.rs

1use super::*;
2
3/// Shared ownership restores a document only after its final open sheet releases it.
4#[cfg(any(target_arch = "wasm32", test))]
5#[derive(Data)]
6pub(crate) struct SheetScrollLease {
7    /// Exact property restoration, consumed once by the final strong owner.
8    #[get(skip)]
9    #[get_mut(pub(crate))]
10    #[set(skip)]
11    pub(crate) cleanup: Option<Box<dyn FnOnce()>>,
12}
13
14/// Props of the [`euv_sheet`] component.
15///
16/// The sheet holds the open state, so the trigger and the panel always
17/// agree on whether the sheet is showing.
18#[derive(Clone, CustomDebug, Default)]
19pub struct EuvSheetProps {
20    /// Whether the sheet is open.
21    pub open: Signal<bool>,
22    /// The edge the sheet slides in from.
23    pub side: EuvSheetSide,
24    /// Immediate owning sheet state; closing it resets this sheet and its descendants.
25    /// Keep each nested sheet's `open` signal distinct from its parent's signal.
26    pub parent_open: Option<Signal<bool>>,
27}
28
29/// Props of the [`euv_sheet_trigger`] component.
30#[derive(Clone, CustomDebug, Default)]
31pub struct EuvSheetTriggerProps {
32    /// Whether the sheet is open.
33    pub open: Signal<bool>,
34    /// The label shown inside the trigger.
35    pub label: &'static str,
36}
37
38/// Props of the [`euv_sheet_overlay`] component.
39#[derive(Clone, CustomDebug, Default)]
40pub struct EuvSheetOverlayProps {
41    /// Whether the sheet is open.
42    pub open: Signal<bool>,
43}
44
45/// Props of the [`euv_sheet_content`] component.
46#[derive(Clone, CustomDebug, Default)]
47pub struct EuvSheetContentProps {
48    /// Whether the sheet is open.
49    pub open: Signal<bool>,
50    /// The edge the sheet slides in from.
51    pub side: EuvSheetSide,
52}
53
54/// Props of the [`euv_sheet_header`] component.
55#[derive(Clone, Copy, CustomDebug, Default)]
56pub struct EuvSheetHeaderProps {
57    /// The accessible name of the header.
58    pub label: &'static str,
59}
60
61/// Props of the [`euv_sheet_footer`] component.
62#[derive(Clone, Copy, CustomDebug, Default)]
63pub struct EuvSheetFooterProps {
64    /// The accessible name of the footer.
65    pub label: &'static str,
66}
67
68/// Props of the [`euv_sheet_title`] component.
69#[derive(Clone, Copy, CustomDebug, Default)]
70pub struct EuvSheetTitleProps {
71    /// The title text.
72    pub text: &'static str,
73}
74
75/// Props of the [`euv_sheet_description`] component.
76#[derive(Clone, Copy, CustomDebug, Default)]
77pub struct EuvSheetDescriptionProps {
78    /// The description text.
79    pub text: &'static str,
80}
81
82/// Props of the [`euv_sheet_close`] component.
83#[derive(Clone, CustomDebug, Default)]
84pub struct EuvSheetCloseProps {
85    /// The same caller-owned open state supplied to the root and content.
86    pub open: Signal<bool>,
87    /// The accessible name of the button.
88    pub label: &'static str,
89}