Skip to main content

euv_ui/component/command/view/
struct.rs

1use super::*;
2
3/// Props of the [`euv_command`] component.
4///
5/// The command holds the query the reader typed, so a caller can filter
6/// the rows it puts inside the command.
7#[derive(Clone, CustomDebug, Default)]
8pub struct EuvCommandProps {
9    /// The query the reader typed.
10    pub value: Signal<String>,
11    /// The accessible name of the command.
12    pub label: &'static str,
13}
14
15/// Props of the [`euv_command_input`] component.
16#[derive(Clone, CustomDebug, Default)]
17pub struct EuvCommandInputProps {
18    /// The query the reader typed.
19    pub value: Signal<String>,
20    /// The text shown while the field is empty.
21    pub placeholder: &'static str,
22    /// Whether the field is disabled.
23    pub disabled: bool,
24}
25
26/// Props of the [`euv_command_list`] component.
27#[derive(Clone, Copy, CustomDebug, Default)]
28pub struct EuvCommandListProps {
29    /// The accessible name of the list.
30    pub label: &'static str,
31}
32
33/// Props of the [`euv_command_empty`] component.
34#[derive(Clone, Copy, CustomDebug, Default)]
35pub struct EuvCommandEmptyProps {
36    /// The text shown when nothing matched the query.
37    pub text: &'static str,
38}
39
40/// Props of the [`euv_command_group`] component.
41#[derive(Clone, Copy, CustomDebug, Default)]
42pub struct EuvCommandGroupProps {
43    /// The heading that names the group.
44    pub heading: &'static str,
45}
46
47/// Props of the [`euv_command_item`] component.
48#[derive(Clone, CustomDebug, Default)]
49pub struct EuvCommandItemProps {
50    /// The value the row stands for.
51    pub value: &'static str,
52    /// The label shown inside the row.
53    pub label: &'static str,
54    /// Whether the row is the selected one.
55    pub selected: bool,
56    /// Whether the row is disabled.
57    pub disabled: bool,
58    /// Optional callback receiving the chosen value.
59    #[debug(skip)]
60    pub on_select: Option<Rc<dyn Fn(&'static str)>>,
61}
62
63/// Props of the [`euv_command_separator`] component.
64#[derive(Clone, Copy, CustomDebug, Default)]
65pub struct EuvCommandSeparatorProps {
66    /// The label reported to assistive technology, if any.
67    pub label: &'static str,
68}
69
70/// Props of the [`euv_command_shortcut`] component.
71#[derive(Clone, Copy, CustomDebug, Default)]
72pub struct EuvCommandShortcutProps {
73    /// The key hint text.
74    pub text: &'static str,
75}