♻️ (bootsier): Reorganiza en capas token/class/bs
Sustituye `attrs/` y `classes/` por tres capas diferenciadas: - `token/`: primitivas CSS (BreakPoint, Color, ScaleSize, etc.). - `class/`: tipos compuestos (Border, Background, Margin, etc.). - `bs/*/props.rs`: props tipadas para cada componente de Bootstrap. El patrón de construcción es `suffix()` -> `push_to()` -> `to_class()`. `push_to()` es `pub` en `class/` y `bs/*/props.rs` para que los temas derivados puedan acceder a los mismos mecanismos de construcción.
This commit is contained in:
parent
64db114eb0
commit
f37db56ec5
47 changed files with 1307 additions and 1201 deletions
|
|
@ -1,44 +0,0 @@
|
|||
//! Definiciones para crear áreas de texto en formularios.
|
||||
|
||||
use pagetop::prelude::*;
|
||||
|
||||
pub use pagetop::base::component::form::Textarea;
|
||||
|
||||
/// Extensión de Bootsier para [`form::Textarea`].
|
||||
///
|
||||
/// Proporciona soporte para **etiquetas flotantes** (*floating label*). La etiqueta flotante se
|
||||
/// superpone al control mientras no hay ninguna opción seleccionada y permanece flotante cuando hay
|
||||
/// una selección activa.
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::locale::L10n;
|
||||
/// # use pagetop::core::component::Component;
|
||||
/// use pagetop_bootsier::theme::*;
|
||||
///
|
||||
/// let comentario = form::Textarea::new()
|
||||
/// .with_name("comment")
|
||||
/// .with_label(L10n::n("Comment"))
|
||||
/// .with_placeholder(L10n::n("Write here..."))
|
||||
/// .with_floating_label(true);
|
||||
/// ```
|
||||
pub trait TextareaBootsier {
|
||||
/// Establece si la etiqueta se muestra flotante sobre el campo.
|
||||
///
|
||||
/// Cuando está activo, la etiqueta se superpone al área de texto y asciende al enfocarlo o
|
||||
/// cuando tiene contenido. Requiere que el campo tenga un atributo `placeholder` definido;
|
||||
/// si no se especifica, se fuerza `placeholder=""` antes del renderizado.
|
||||
///
|
||||
/// Si se usa la etiqueta flotante, se anula el valor establecido con
|
||||
/// [`with_rows()`](form::Textarea::with_rows) antes del renderizado.
|
||||
fn with_floating_label(self, floating: bool) -> Self;
|
||||
}
|
||||
|
||||
impl TextareaBootsier for Textarea {
|
||||
fn with_floating_label(self, floating: bool) -> Self {
|
||||
if floating {
|
||||
self.with_prop(PropsOp::add_classes("form-floating"))
|
||||
} else {
|
||||
self.with_prop(PropsOp::remove_classes("form-floating"))
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue