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    /// Active theme tokens.
90    #[get(type(copy))]
91    pub(crate) tokens: ThemeTokens,
92}
93
94/// Interactive preview card aligned with shadcn/ui `HoverCard`.
95#[derive(Clone, Data, Debug, New, Props)]
96pub struct EuvHoverCard {
97    /// Optional controlled reactive preview card visibility flag (creates internal state when omitted).
98    #[new(skip)]
99    #[get(skip)]
100    #[prop(custom)]
101    pub(crate) open: Option<Signal<bool>>,
102    /// Trigger link button label.
103    pub(crate) trigger_label: String,
104    /// Preview card heading.
105    pub(crate) title: String,
106    /// Optional preview card body text.
107    #[new(skip)]
108    #[prop(custom)]
109    pub(crate) description: String,
110    /// Active theme tokens.
111    #[get(type(copy))]
112    pub(crate) tokens: ThemeTokens,
113}
114
115/// Interactive 7-column monthly calendar picker aligned with shadcn/ui `Calendar`.
116#[derive(Clone, Data, Debug, New, Props)]
117pub struct EuvCalendar {
118    /// Month and year display heading (e.g. `"November 2026"`).
119    pub(crate) month_label: String,
120    /// Number of days in the displayed month (`28..=31`).
121    #[get(type(copy))]
122    pub(crate) days_in_month: u32,
123    /// Reactive selected day of month (`1..=days_in_month`).
124    #[get(type(copy))]
125    pub(crate) selected_day: Signal<u32>,
126    /// Active theme tokens.
127    #[get(type(copy))]
128    pub(crate) tokens: ThemeTokens,
129}
130
131/// Aspect-ratio constrained media container aligned with shadcn/ui `AspectRatio`.
132#[derive(Clone, Copy, Data, Debug, New, Props)]
133pub struct EuvAspectRatio {
134    /// Target width-to-height ratio (e.g. `16.0 / 9.0`).
135    #[get(type(copy))]
136    pub(crate) ratio: f32,
137    /// Mounted child node displayed inside the aspect-ratio box.
138    #[get(type(copy))]
139    pub(crate) child: NodeId,
140    /// Active theme tokens.
141    #[get(type(copy))]
142    pub(crate) tokens: ThemeTokens,
143}
144
145/// Responsive horizontal menubar aligned with shadcn/ui `Menubar`.
146#[derive(Clone, Data, Debug, New, Props)]
147pub struct EuvMenubar {
148    /// Top-level menu item labels.
149    pub(crate) menus: Vec<String>,
150    /// Reactive active menu index, or `None` when closed.
151    #[get(type(copy))]
152    pub(crate) active_menu: Signal<Option<usize>>,
153    /// Active theme tokens.
154    #[get(type(copy))]
155    pub(crate) tokens: ThemeTokens,
156}
157
158/// Responsive slide carousel aligned with shadcn/ui `Carousel`.
159#[derive(Clone, Data, Debug, New, Props)]
160pub struct EuvCarousel {
161    /// Slide content titles or summaries.
162    pub(crate) slides: Vec<String>,
163    /// Reactive active slide index.
164    #[get(type(copy))]
165    pub(crate) active_slide: Signal<usize>,
166    /// Active theme tokens.
167    #[get(type(copy))]
168    pub(crate) tokens: ThemeTokens,
169}