1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
//! An interactive button that displays an icon.
//!
//! ## Usage
//!
//! Use for compact actions where an icon is sufficient to convey the meaning.
use Builder;
use tessera;
use crate::;
/// Arguments for [`icon_button`].
/// Lifted [`glass_button`] counterpart for icon buttons.
/// # icon_button
///
/// Renders a standard button with an icon as its content.
///
/// ## Usage
///
/// Use for common actions like "edit", "delete", or "settings" in a toolbar or list item.
///
/// ## Parameters
///
/// - `args` — configures the underlying button and the icon; see [`IconButtonArgs`].
/// - `ripple_state` — a clonable [`RippleState`] to manage the ripple animation.
///
/// ## Examples
///
/// ```no_run
/// use std::sync::Arc;
/// use tessera_ui_basic_components::{
/// icon_button::{icon_button, IconButtonArgsBuilder},
/// button::ButtonArgsBuilder,
/// icon::IconArgsBuilder,
/// image_vector::{ImageVectorSource, load_image_vector_from_source},
/// ripple_state::RippleState,
/// };
///
/// let ripple_state = RippleState::new();
/// let svg_path = "../assets/emoji_u1f416.svg";
/// let vector_data = load_image_vector_from_source(
/// &ImageVectorSource::Path(svg_path.to_string())
/// ).unwrap();
///
/// icon_button(
/// IconButtonArgsBuilder::default()
/// .button(
/// ButtonArgsBuilder::default()
/// .on_click(Arc::new(|| {}))
/// .build()
/// .unwrap()
/// )
/// .icon(IconArgsBuilder::default().content(vector_data.clone()).build().unwrap())
/// .build()
/// .unwrap(),
/// ripple_state,
/// );
/// ```
/// # glass_icon_button
///
/// Renders a button with a glass effect and an icon as its content.
///
/// ## Usage
///
/// Use for prominent icon-based actions in a modern, layered UI.
///
/// ## Parameters
///
/// - `args` — configures the underlying glass button and the icon; see [`GlassIconButtonArgs`].
/// - `ripple_state` — a clonable [`RippleState`] to manage the ripple animation.
///
/// ## Examples
///
/// ```no_run
/// use std::sync::Arc;
/// use tessera_ui_basic_components::{
/// icon_button::{glass_icon_button, GlassIconButtonArgsBuilder},
/// glass_button::GlassButtonArgsBuilder,
/// icon::IconArgsBuilder,
/// image_vector::{ImageVectorSource, load_image_vector_from_source},
/// ripple_state::RippleState,
/// };
///
/// let ripple_state = RippleState::new();
/// let svg_path = "../assets/emoji_u1f416.svg";
/// let vector_data = load_image_vector_from_source(
/// &ImageVectorSource::Path(svg_path.to_string())
/// ).unwrap();
///
/// glass_icon_button(
/// GlassIconButtonArgsBuilder::default()
/// .button(
/// GlassButtonArgsBuilder::default()
/// .on_click(Arc::new(|| {}))
/// .build()
/// .unwrap()
/// )
/// .icon(IconArgsBuilder::default().content(vector_data).build().unwrap())
/// .build()
/// .unwrap(),
/// ripple_state,
/// );
/// ```