♻️ (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,46 +0,0 @@
|
|||
//! Definiciones para crear listas de selección.
|
||||
|
||||
use pagetop::prelude::*;
|
||||
|
||||
pub use pagetop::base::component::form::select::{Entry, Field, Group, Item};
|
||||
|
||||
/// Extensión de Bootsier para [`form::select::Field`].
|
||||
///
|
||||
/// 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 language = form::select::Field::new()
|
||||
/// .with_name("language")
|
||||
/// .with_label(L10n::n("Language"))
|
||||
/// .with_floating_label(true)
|
||||
/// .with_item(form::select::Item::new("", L10n::n("— Choose —")).with_selected(true))
|
||||
/// .with_item(form::select::Item::new("es", L10n::n("Spanish")))
|
||||
/// .with_item(form::select::Item::new("en", L10n::n("English")));
|
||||
/// ```
|
||||
pub trait SelectBootsier {
|
||||
/// Establece si la etiqueta se muestra flotante sobre el campo.
|
||||
///
|
||||
/// Cuando está activo, la etiqueta se superpone al control y permanece flotante siempre que
|
||||
/// haya una opción visible.
|
||||
///
|
||||
/// Si se usa la etiqueta flotante, se anulan los valores establecidos con
|
||||
/// [`with_multiple()`](form::select::Field::with_multiple) y
|
||||
/// [`with_rows()`](form::select::Field::with_rows) antes del renderizado.
|
||||
fn with_floating_label(self, floating: bool) -> Self;
|
||||
}
|
||||
|
||||
impl SelectBootsier for Field {
|
||||
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