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
//! Form widgets - Form and input validation components
//!
//! This module provides widgets and utilities for building forms with validation.
//!
//! # Widgets
//!
//! ## Form Widget
//!
//! A container for organizing input fields with a label and displaying validation errors.
//!
//! ```rust,ignore
//! use revue::prelude::*;
//!
//! let form = form()
//! .label("User Information")
//! .child(input().placeholder("Name"))
//! .child(input().placeholder("Email"))
//! .child(button("Submit"));
//! ```
//!
//! ## Form Fields
//!
//! Individual input components with validation support:
//!
//! - [`form_field()`] - Labeled form field with error display
//! - [`password_input()`] - Password field with masking
//! - [`pin_input()`] - PIN/OTP code input
//! - [`masked_input()`] - Custom masked input (e.g., phone, SSN)
//! - [`credit_card_input()`] - Credit card number input with formatting
//!
//! ## Rich Text Editor
//!
//! Multi-line text editor with formatting support:
//!
//! ```rust,ignore
//! use revue::prelude::*;
//!
//! let editor = rich_text_editor()
//! .placeholder("Enter content...")
//! .toolbar(true)
//! .min_height(10);
//! ```
//!
//! # Validation
//!
//! Form fields support built-in and custom validators:
//!
//! ## Built-in Validators
//!
//! ```rust,ignore
//! use revue::widget::form_field;
//!
//! // Email validation
//! form_field("Email")
//! .validator(Validators::email())
//!
//! // Required field
//! form_field("Name")
//! .validator(Validators::required())
//!
//! // Length validation
//! form_field("Password")
//! .validator(Validators::min_length(8))
//!
//! // Pattern matching
//! form_field("Phone")
//! .validator(Validators::regex(r"^\d{3}-\d{3}-\d{4}$"))
//!
//! // Custom validator
//! form_field("Age")
//! .validator(|value| {
//! if value.parse::<u32>().ok().filter(|&a| a >= 18).is_some() {
//! Ok(())
//! } else {
//! Err("Must be 18 or older".to_string())
//! }
//! })
//! ```
//!
//! ## Error Display
//!
//! Form fields can display errors in different styles:
//!
//! ```rust,ignore
//! use revue::widget::form_field;
//! use revue::widget::form::ErrorDisplayStyle;
//!
//! // Show errors inline below the field
//! form_field("Email")
//! .validator(Validators::email())
//! .error_style(ErrorDisplayStyle::Inline)
//!
//! // Show errors as tooltips
//! form_field("Password")
//! .error_style(ErrorDisplayStyle::Tooltip)
//! ```
//!
//! # Masked Input
//!
//! Create inputs with automatic character masking for sensitive data:
//!
//! ```rust,ignore
//! use revue::prelude::*;
//!
//! // Password field (default masking)
//! password_input()
//! .label("Password")
//! .mask('*')
//!
//! // PIN input
//! pin_input()
//! .length(6)
//! .mask('●')
//!
//! // Custom masked input (e.g., phone number)
//! masked_input("(___) ___-____")
//! .mask_char('_')
//! .label("Phone Number")
//!
//! // Credit card with automatic formatting
//! credit_card_input()
//! .label("Card Number")
//! ```
//!
//! # Input Types
//!
//! Form fields support various input types:
//!
//! ```rust,ignore
//! use revue::widget::form_field;
//! use revue::widget::form::InputType;
//!
//! form_field("Email")
//! .input_type(InputType::Email)
//!
//! form_field("Password")
//! .input_type(InputType::Password)
//!
//! form_field("Number")
//! .input_type(InputType::Number)
//!
//! form_field("Phone")
//! .input_type(InputType::Tel)
//! ```
//!
//! # Form State Management
//!
//! Combine form fields with the [`FormState`](crate::patterns::FormState) pattern
//! for complete form management:
//!
//! ```rust,ignore
//! use revue::patterns::{FormState, Validators};
//!
//! let mut form = FormState::new();
//!
//! form.add_field("name")
//! .validator(Validators::required())
//! .validator(Validators::min_length(2));
//!
//! form.add_field("email")
//! .validator(Validators::email());
//!
//! // Validate all fields
//! if form.validate() {
//! let data = form.get_values();
//! // Submit form...
//! }
//! ```
// Re-exports for convenience
pub use ;
pub use ;
pub use ;