Skip to main content

euv_ui/component/shadcn_extra/
struct.rs

1use super::*;
2
3/// Modal confirmation dialog aligned with shadcn/ui `AlertDialog`.
4#[derive(Clone, Data, Debug, New, Props)]
5pub struct EuvAlertDialog {
6    /// Reactive dialog open state.
7    #[get(type(copy))]
8    pub(crate) open: Signal<bool>,
9    /// Dialog heading text.
10    pub(crate) title: String,
11    /// Explanatory description text.
12    #[new(skip)]
13    #[prop(custom)]
14    pub(crate) description: String,
15    /// Cancel button label (`"Cancel"` when omitted).
16    #[new(skip)]
17    pub(crate) cancel_label: String,
18    /// Primary destructive/confirm button label (`"Continue"` when omitted).
19    #[new(skip)]
20    pub(crate) confirm_label: String,
21    /// Reactive flag set to `true` when the user confirms.
22    #[get(type(copy))]
23    pub(crate) confirmed: Signal<bool>,
24    /// Active theme tokens.
25    #[get(type(copy))]
26    pub(crate) tokens: ThemeTokens,
27}
28
29/// Interactive collapsible disclosure panel aligned with shadcn/ui `Collapsible`.
30#[derive(Clone, Data, Debug, New, Props)]
31pub struct EuvCollapsible {
32    /// Reactive expanded state.
33    #[get(type(copy))]
34    pub(crate) open: Signal<bool>,
35    /// Header title text.
36    pub(crate) title: String,
37    /// Mounted body node toggled by `open`.
38    #[get(type(copy))]
39    pub(crate) content: NodeId,
40    /// Active theme tokens.
41    #[get(type(copy))]
42    pub(crate) tokens: ThemeTokens,
43}
44
45/// Wrapping multi-option toggle button group aligned with shadcn/ui `ToggleGroup`.
46#[derive(Clone, Data, Debug, New, Props)]
47pub struct EuvToggleGroup {
48    /// Ordered toggle item labels.
49    pub(crate) options: Vec<String>,
50    /// Reactive selected item index.
51    #[get(type(copy))]
52    pub(crate) selected: Signal<usize>,
53    /// Active theme tokens.
54    #[get(type(copy))]
55    pub(crate) tokens: ThemeTokens,
56}
57
58/// Segmented one-time passcode input aligned with shadcn/ui `InputOTP`.
59#[derive(Clone, Data, Debug, New, Props)]
60pub struct EuvInputOtp {
61    /// Reactive passcode string value.
62    #[get(type(copy))]
63    pub(crate) value: Signal<String>,
64    /// Total number of passcode digit slots (`4..=8`).
65    #[get(type(copy))]
66    pub(crate) length: usize,
67    /// Active theme tokens.
68    #[get(type(copy))]
69    pub(crate) tokens: ThemeTokens,
70}
71
72/// Searchable command palette aligned with shadcn/ui `Command`.
73#[derive(Clone, Data, Debug, New, Props)]
74pub struct EuvCommand {
75    /// Optional controlled reactive search query string (creates internal state when omitted).
76    #[new(skip)]
77    #[get(skip)]
78    #[prop(custom)]
79    pub(crate) query: Option<Signal<String>>,
80    /// Input placeholder prompt (`"Type a command or search..."` when empty).
81    #[new(skip)]
82    #[prop(custom)]
83    pub(crate) placeholder: String,
84    /// Available command item labels.
85    pub(crate) items: Vec<String>,
86    /// Reactive index of the last activated command item.
87    #[get(type(copy))]
88    pub(crate) selected: Signal<Option<usize>>,
89    /// Renders without an outer bordered/shadowed card container when embedded inside another surface such as `EuvModal`.
90    #[new(skip)]
91    #[get(type(copy))]
92    #[prop(custom)]
93    pub(crate) frameless: bool,
94    /// Active theme tokens.
95    #[get(type(copy))]
96    pub(crate) tokens: ThemeTokens,
97}
98
99/// Interactive preview card aligned with shadcn/ui `HoverCard`.
100#[derive(Clone, Data, Debug, New, Props)]
101pub struct EuvHoverCard {
102    /// Optional controlled reactive preview card visibility flag (creates internal state when omitted).
103    #[new(skip)]
104    #[get(skip)]
105    #[prop(custom)]
106    pub(crate) open: Option<Signal<bool>>,
107    /// Trigger link button label.
108    pub(crate) trigger_label: String,
109    /// Preview card heading.
110    pub(crate) title: String,
111    /// Optional preview card body text.
112    #[new(skip)]
113    #[prop(custom)]
114    pub(crate) description: String,
115    /// Active theme tokens.
116    #[get(type(copy))]
117    pub(crate) tokens: ThemeTokens,
118}
119
120/// Interactive 7-column monthly calendar picker aligned with shadcn/ui `Calendar`.
121#[derive(Clone, Data, Debug, New, Props)]
122pub struct EuvCalendar {
123    /// Month and year display heading (e.g. `"November 2026"`).
124    pub(crate) month_label: String,
125    /// Number of days in the displayed month (`28..=31`).
126    #[get(type(copy))]
127    pub(crate) days_in_month: u32,
128    /// Reactive selected day of month (`1..=days_in_month`).
129    #[get(type(copy))]
130    pub(crate) selected_day: Signal<u32>,
131    /// Active theme tokens.
132    #[get(type(copy))]
133    pub(crate) tokens: ThemeTokens,
134}
135
136/// Aspect-ratio constrained media container aligned with shadcn/ui `AspectRatio`.
137#[derive(Clone, Copy, Data, Debug, New, Props)]
138pub struct EuvAspectRatio {
139    /// Target width-to-height ratio (e.g. `16.0 / 9.0`).
140    #[get(type(copy))]
141    pub(crate) ratio: f32,
142    /// Mounted child node displayed inside the aspect-ratio box.
143    #[get(type(copy))]
144    pub(crate) child: NodeId,
145    /// Active theme tokens.
146    #[get(type(copy))]
147    pub(crate) tokens: ThemeTokens,
148}
149
150/// Responsive horizontal menubar aligned with shadcn/ui `Menubar`.
151#[derive(Clone, Data, Debug, New, Props)]
152pub struct EuvMenubar {
153    /// Top-level menu item labels.
154    pub(crate) menus: Vec<String>,
155    /// Reactive active menu index, or `None` when closed.
156    #[get(type(copy))]
157    pub(crate) active_menu: Signal<Option<usize>>,
158    /// Active theme tokens.
159    #[get(type(copy))]
160    pub(crate) tokens: ThemeTokens,
161}
162
163/// Responsive slide carousel aligned with shadcn/ui `Carousel`.
164#[derive(Clone, Data, Debug, New, Props)]
165pub struct EuvCarousel {
166    /// Slide content titles or summaries.
167    pub(crate) slides: Vec<String>,
168    /// Reactive active slide index.
169    #[get(type(copy))]
170    pub(crate) active_slide: Signal<usize>,
171    /// Active theme tokens.
172    #[get(type(copy))]
173    pub(crate) tokens: ThemeTokens,
174}