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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
//! # Shadow Design
//!
//! A modular, high-performance UI component library for **Dioxus 0.7** applications (Web, Desktop, and Mobile).
//! Built with Mantine-inspired themes, tactile craft surfaces, dark aesthetics, and zero external runtime dependencies.
//!
//! ## 🎨 Zero-Tooling Style Integration (`STYLES`)
//!
//! Shadow Design uses a **100% Pure SCSS** architecture bundled directly inside the crate.
//! You do **not** need Node.js, npm, Tailwind CLI, or external bundlers/watchers in your application.
//!
//! The compiled stylesheet is exposed as a Dioxus [`Asset`] via [`STYLES`]. Dioxus's native asset pipeline
//! automatically processes and bundles the SCSS stylesheet at compile time.
//!
//! ### Quick Setup
//!
//! In your root application component, link [`STYLES`] directly using `document::Link`:
//!
//! ```rust,no_run
//! # #[cfg(all(feature = "button", feature = "card", feature = "notification"))]
//! # fn doc_example() {
//! use dioxus::prelude::*;
//! use shadow_design::prelude::*;
//!
//! fn main() {
//! dioxus::launch(App);
//! }
//!
//! #[component]
//! fn App() -> Element {
//! rsx! {
//! // 1. Link the master stylesheet directly from the crate
//! document::Link { rel: "stylesheet", href: STYLES }
//!
//! // 2. Wrap with NotificationProvider if using toast notifications
//! NotificationProvider {
//! MainView {}
//! }
//! }
//! }
//!
//! #[component]
//! fn MainView() -> Element {
//! rsx! {
//! Card {
//! title: "Welcome to Shadow Design".to_string(),
//! shadow: CardShadow::Md,
//! p { "High-performance Dioxus UI components with pure SCSS styling." }
//! Button {
//! variant: ButtonVariant::Primary,
//! onclick: move |_| println!("Clicked!"),
//! "Get Started"
//! }
//! }
//! }
//! }
//! # }
//! ```
//!
//! Alternatively, you can alias or re-export the stylesheet constant:
//!
//! ```rust,no_run
//! use dioxus::prelude::*;
//!
//! pub const STYLES: Asset = shadow_design::STYLES;
//! ```
//!
//! ### What [`STYLES`] Includes
//!
//! - **CSS Preflight Reset**: Normalizes browser default styles (`button`, `input`, `select`, etc.) to eliminate native browser artifacts.
//! - **Elevation Layers & Z-Index Stack**: Mathematically sound z-index scale (`_zindex.scss`) preventing dropdown, modal, drawer, or tooltip clipping.
//! - **Built-in Theme Presets**: Design tokens for 5 core presets:
//! - `Ultraviolet Shadow` (Default): Deep black (`#000000`) with purple accents and specular highlights.
//! - `Obsidian Titanium`: Strict monochrome silver and titanium finish.
//! - `Crimson Phoenix`: Deep black with vibrant phoenix crimson glow.
//! - `Cyber Cyan`: High-contrast electric cyan aesthetic.
//! - `Emerald Matrix`: Crisp emerald green telemetry style.
//! - **Micro-Interactions**: Tactile button press feedback, smooth hover states, and ambient glow matrix.
//! - **Keyframe Animations**: Smooth slide-in toast notifications, dialog zoom scaling, accordion unrolls, and indeterminate loaders.
//!
//! ## 🧩 Feature Flags
//!
//! Shadow Design is built with a zero-bloat architecture. Each component is isolated behind its own Cargo feature:
//!
//! | Feature Flag | Module | Description |
//! | :--- | :--- | :--- |
//! | `all` | *All modules* | Enables the complete suite of components and theming |
//! | `button` | `button` | Buttons with BEM variants, sizes, loading spinners, and tactile active states |
//! | `card` | `card` | Container cards with elevated, interactive, and metric variants |
//! | `input` | `input` | Reactive text inputs with clickable icons, clear buttons, and signal binding |
//! | `select` | `select` | Advanced dropdown Select, MultiSelect with tags, and Combobox autocomplete |
//! | `textarea` | `textarea` | Multiline text areas with dynamic auto-resize, character count, and clear button |
//! | `checkbox` | `checkbox` | Tactile checkboxes with indeterminate and error states |
//! | `badge` | `badge` | Status labels, pill badges, and pulsating live dots |
//! | `navbar` | `navbar` | Responsive navigation bars with brand and action slots |
//! | `modal` | `modal` | Overlay dialog modals with animated backdrop and signal control |
//! | `alert` | `alert` | Callout banners with semantic variants and dismiss handlers |
//! | `theme` | `theme` | Mantine-style reactive theme engine (`ThemeProvider`, `use_theme`) |
//! | `icon` | `icon` | Zero-dependency native SVG icons (1.5px stroke) |
//! | `typography` | `typography` | Typography primitives (`Heading`, `Text`, `Kbd`, `Code`) |
//! | `notification` | `notification` | Global toast notification system (`NotificationProvider`, `use_notification`) |
//! | `tabs` | `tabs` | Horizontal tab navigation (`TabList`, `Tab`, `TabPanel`) |
//! | `switch` | `switch` | Precision tactile toggle switches |
//! | `tooltip` | `tooltip` | Floating hover tooltips with 4-directional placement |
//! | `drawer` | `drawer` | Slide-over side panels from left or right with backdrop |
//! | `dropdown` | `dropdown` | Trigger-anchored context menus with auto-dismiss |
//! | `animation` | `animation` | Optical transitions and micro-animation wrappers |
//! | `avatar` | `avatar` | User avatars, presence status dot, initials fallback, and avatar groups |
//! | `chat` | `chat` | P2P & messaging chat bubbles with delivery status, security badges, and rich media |
//! | `progress` | `progress` | Progress bars with semantic variants and shimmer indeterminate animations |
//! | `attachment_card` | `attachment_card` | Media attachments and file transfer cards with action slots |
//! | `contact_card` | `contact_card` | Contact profile cards with presence indicators and quick action buttons |
//! | `segmented_control` | `segmented_control` | Tactile sliding segmented selectors with theme glow |
//! | `divider` | `divider` | Horizontal and vertical translucent separators with label support |
//! | `tree` | `tree` | Hierarchical tree views with collapsible nodes and connection lines |
//! | `skeleton` | `skeleton` | Geometric loading placeholder shimmers (circle, rect, text) |
//!
//! ## 🎨 Reactive Theming vs. Zero-Cost Static Fallback
//!
//! Shadow Design components support dual execution paths:
//!
//! 1. **With `theme` feature enabled**: Components reactively read the current theme from Dioxus Context via `theme::use_theme()`. When you switch palettes, radius scale, or glow mode at runtime, every mounted component updates immediately.
//! 2. **Without `theme` feature enabled**: Components fall back transparently to optimized, hardcoded static classes, incurring zero context lookup or runtime overhead.
//!
//! Or enable the `all` feature to include the entire suite.
use *;
/// Master SCSS stylesheet asset provided by the Shadow Design library.
///
/// This asset points to `/scss/main.scss` packaged inside the crate and is processed
/// natively by Dioxus 0.7's [`asset!`] macro. It contains the complete styling engine:
/// preflight reset, typography, theme color variables, surface elevation layers,
/// component classes (`.sd-btn`, `.sd-card`, `.sd-input`, etc.), and keyframe animations.
///
/// ### Usage in Dioxus
///
/// Include it directly in your application's root component head:
///
/// ```rust,no_run
/// # #[cfg(feature = "button")]
/// # fn doc_example() {
/// use dioxus::prelude::*;
/// use shadow_design::prelude::*;
///
/// #[component]
/// fn App() -> Element {
/// rsx! {
/// // Embed the compiled stylesheet
/// document::Link { rel: "stylesheet", href: STYLES }
///
/// // Your UI components
/// Button { "Click me" }
/// }
/// }
/// # }
/// ```
///
/// Downstream projects do not need Node.js, npm, or Tailwind CLI; Dioxus bundles
/// the SCSS stylesheet automatically.
pub const STYLES: Asset = asset!;
pub
pub