♻️ (locale): Sustituye Attr<Lc> por Lc::none()

This commit is contained in:
Manuel Cillero 2026-08-17 03:16:49 +02:00
parent c3ff8a6ff8
commit 213aa18b12
17 changed files with 275 additions and 146 deletions

View file

@ -74,9 +74,9 @@ pub struct Button {
/// Devuelve el valor del botón.
value: AttrValue,
/// Devuelve la etiqueta del botón.
label: Attr<Lc>,
label: Lc,
/// Devuelve el texto emergente del botón (atributo `title`).
title: Attr<Lc>,
title: Lc,
/// Devuelve si el botón recibe el foco automáticamente al cargar la página.
autofocus: bool,
/// Devuelve si el botón está deshabilitado.
@ -124,7 +124,7 @@ impl Button {
pub fn submit(label: Lc) -> Self {
Self {
kind: ButtonAction::Submit,
label: Attr::some(label),
label,
..Default::default()
}
}
@ -135,7 +135,7 @@ impl Button {
pub fn reset(label: Lc) -> Self {
Self {
kind: ButtonAction::Reset,
label: Attr::some(label),
label,
..Default::default()
}
}
@ -147,7 +147,7 @@ impl Button {
pub fn plain(label: Lc) -> Self {
Self {
kind: ButtonAction::Plain,
label: Attr::some(label),
label,
..Default::default()
}
}
@ -188,17 +188,17 @@ impl Button {
self
}
/// Establece o elimina la etiqueta visible del botón (basta pasar `None` para quitarla).
/// Establece la etiqueta visible del botón (usa [`Lc::none()`] para quitarla).
#[builder_fn]
pub fn with_label(mut self, label: impl Into<Option<Lc>>) -> Self {
self.label.alter_opt(label.into());
pub fn with_label(mut self, label: Lc) -> Self {
self.label = label;
self
}
/// Establece o elimina el texto emergente del botón (basta pasar `None` para quitarlo).
/// Establece el texto emergente del botón (usa [`Lc::none()`] para quitarlo).
#[builder_fn]
pub fn with_title(mut self, title: impl Into<Option<Lc>>) -> Self {
self.title.alter_opt(title.into());
pub fn with_title(mut self, title: Lc) -> Self {
self.title = title;
self
}

View file

@ -103,9 +103,9 @@ pub struct Field {
/// Devuelve el nombre compartido por todas las casillas del grupo.
name: AttrName,
/// Devuelve la etiqueta del grupo.
label: Attr<Lc>,
label: Lc,
/// Devuelve el texto de ayuda del grupo.
help_text: Attr<Lc>,
help_text: Lc,
/// Devuelve las casillas del grupo.
items: Vec<Item>,
/// Devuelve si todo el grupo está deshabilitado.
@ -207,17 +207,17 @@ impl Field {
self
}
/// Establece o elimina la etiqueta visible del grupo (basta pasar `None` para quitarla).
/// Establece la etiqueta visible del grupo (usa [`Lc::none()`] para quitarla).
#[builder_fn]
pub fn with_label(mut self, label: impl Into<Option<Lc>>) -> Self {
self.label.alter_opt(label.into());
pub fn with_label(mut self, label: Lc) -> Self {
self.label = label;
self
}
/// Establece o elimina el texto de ayuda del grupo (basta pasar `None` para quitarlo).
/// Establece el texto de ayuda del grupo (usa [`Lc::none()`] para quitarlo).
#[builder_fn]
pub fn with_help_text(mut self, help_text: impl Into<Option<Lc>>) -> Self {
self.help_text.alter_opt(help_text.into());
pub fn with_help_text(mut self, help_text: Lc) -> Self {
self.help_text = help_text;
self
}

View file

@ -46,7 +46,7 @@ pub struct Checkbox {
/// Devuelve el nombre del campo.
name: AttrName,
/// Devuelve la etiqueta del control.
label: Attr<Lc>,
label: Lc,
/// Devuelve si el control debe estar marcado/activo por defecto.
checked: bool,
/// Devuelve si el control recibe el foco automáticamente al cargar la página.
@ -182,10 +182,10 @@ impl Checkbox {
self
}
/// Establece o elimina la etiqueta visible del control (basta pasar `None` para quitarla).
/// Establece la etiqueta visible del control (usa [`Lc::none()`] para quitarla).
#[builder_fn]
pub fn with_label(mut self, label: impl Into<Option<Lc>>) -> Self {
self.label.alter_opt(label.into());
pub fn with_label(mut self, label: Lc) -> Self {
self.label = label;
self
}

View file

@ -27,9 +27,9 @@ pub struct Fieldset {
/// Devuelve identificador, clases CSS, atributos HTML y valores extra del componente.
props: Props,
/// Devuelve la leyenda del `fieldset`.
legend: Attr<Lc>,
legend: Lc,
/// Devuelve la descripción del `fieldset`.
description: Attr<Lc>,
description: Lc,
/// Devuelve si el `fieldset` está deshabilitado.
disabled: bool,
/// Devuelve la lista de componentes del `fieldset`.
@ -84,17 +84,17 @@ impl Fieldset {
self
}
/// Establece o elimina la leyenda del `fieldset` (basta pasar `None` para quitarla).
/// Establece la leyenda del `fieldset` (usa [`Lc::none()`] para quitarla).
#[builder_fn]
pub fn with_legend(mut self, legend: impl Into<Option<Lc>>) -> Self {
self.legend.alter_opt(legend.into());
pub fn with_legend(mut self, legend: Lc) -> Self {
self.legend = legend;
self
}
/// Establece o elimina la descripción del `fieldset` (basta pasar `None` para quitarla).
/// Establece la descripción del `fieldset` (usa [`Lc::none()`] para quitarla).
#[builder_fn]
pub fn with_description(mut self, description: impl Into<Option<Lc>>) -> Self {
self.description.alter_opt(description.into());
pub fn with_description(mut self, description: Lc) -> Self {
self.description = description;
self
}

View file

@ -161,15 +161,15 @@ pub struct Field {
/// Devuelve el valor inicial del campo.
value: AttrValue,
/// Devuelve la etiqueta del campo.
label: Attr<Lc>,
label: Lc,
/// Devuelve el texto de ayuda del campo.
help_text: Attr<Lc>,
help_text: Lc,
/// Devuelve la longitud mínima permitida en caracteres.
minlength: Attr<u16>,
/// Devuelve la longitud máxima permitida en caracteres.
maxlength: Attr<u16>,
/// Devuelve el texto indicativo del campo.
placeholder: Attr<Lc>,
placeholder: Lc,
/// Devuelve la configuración de autocompletado del campo.
autocomplete: Attr<form::Autocomplete>,
/// Devuelve si el campo recibe el foco automáticamente al cargar la página.
@ -418,17 +418,17 @@ impl Field {
self
}
/// Establece o elimina la etiqueta visible del campo (basta pasar `None` para quitarla).
/// Establece la etiqueta visible del campo (usa [`Lc::none()`] para quitarla).
#[builder_fn]
pub fn with_label(mut self, label: impl Into<Option<Lc>>) -> Self {
self.label.alter_opt(label.into());
pub fn with_label(mut self, label: Lc) -> Self {
self.label = label;
self
}
/// Establece o elimina el texto de ayuda del campo (basta pasar `None` para quitarlo).
/// Establece el texto de ayuda del campo (usa [`Lc::none()`] para quitarlo).
#[builder_fn]
pub fn with_help_text(mut self, help_text: impl Into<Option<Lc>>) -> Self {
self.help_text.alter_opt(help_text.into());
pub fn with_help_text(mut self, help_text: Lc) -> Self {
self.help_text = help_text;
self
}
@ -446,13 +446,13 @@ impl Field {
self
}
/// Establece o elimina el texto indicativo del campo (`None` para quitarlo).
/// Establece el texto indicativo del campo (usa [`Lc::none()`] para quitarlo).
///
/// Este texto aparece en el mismo campo y desaparece en cuanto el usuario empieza a escribir.
/// Al ser texto visible para el usuario se acepta [`Lc`] para poder localizarlo.
#[builder_fn]
pub fn with_placeholder(mut self, placeholder: impl Into<Option<Lc>>) -> Self {
self.placeholder.alter_opt(placeholder.into());
pub fn with_placeholder(mut self, placeholder: Lc) -> Self {
self.placeholder = placeholder;
self
}

View file

@ -37,9 +37,9 @@ pub struct Number {
/// Devuelve el valor inicial del campo.
value: Attr<u64>,
/// Devuelve la etiqueta del campo.
label: Attr<Lc>,
label: Lc,
/// Devuelve el texto de ayuda del campo.
help_text: Attr<Lc>,
help_text: Lc,
/// Devuelve el valor mínimo permitido.
min: Attr<u64>,
/// Devuelve el valor máximo permitido.
@ -151,17 +151,17 @@ impl Number {
self
}
/// Establece o elimina la etiqueta visible del campo (basta pasar `None` para quitarla).
/// Establece la etiqueta visible del campo (usa [`Lc::none()`] para quitarla).
#[builder_fn]
pub fn with_label(mut self, label: impl Into<Option<Lc>>) -> Self {
self.label.alter_opt(label.into());
pub fn with_label(mut self, label: Lc) -> Self {
self.label = label;
self
}
/// Establece o elimina el texto de ayuda del campo (basta pasar `None` para quitarlo).
/// Establece el texto de ayuda del campo (usa [`Lc::none()`] para quitarlo).
#[builder_fn]
pub fn with_help_text(mut self, help_text: impl Into<Option<Lc>>) -> Self {
self.help_text.alter_opt(help_text.into());
pub fn with_help_text(mut self, help_text: Lc) -> Self {
self.help_text = help_text;
self
}

View file

@ -101,9 +101,9 @@ pub struct Field {
/// Devuelve el nombre compartido por todos los botones de opción del grupo.
name: AttrName,
/// Devuelve la etiqueta del grupo.
label: Attr<Lc>,
label: Lc,
/// Devuelve el texto de ayuda del grupo.
help_text: Attr<Lc>,
help_text: Lc,
/// Devuelve las opciones del grupo.
items: Vec<Item>,
/// Devuelve si la selección de alguna opción del grupo es obligatoria.
@ -227,17 +227,17 @@ impl Field {
self
}
/// Establece o elimina la etiqueta visible del grupo (basta pasar `None` para quitarla).
/// Establece la etiqueta visible del grupo (usa [`Lc::none()`] para quitarla).
#[builder_fn]
pub fn with_label(mut self, label: impl Into<Option<Lc>>) -> Self {
self.label.alter_opt(label.into());
pub fn with_label(mut self, label: Lc) -> Self {
self.label = label;
self
}
/// Establece o elimina el texto de ayuda del grupo (basta pasar `None` para quitarlo).
/// Establece el texto de ayuda del grupo (usa [`Lc::none()`] para quitarlo).
#[builder_fn]
pub fn with_help_text(mut self, help_text: impl Into<Option<Lc>>) -> Self {
self.help_text.alter_opt(help_text.into());
pub fn with_help_text(mut self, help_text: Lc) -> Self {
self.help_text = help_text;
self
}

View file

@ -38,9 +38,9 @@ pub struct Range {
/// Devuelve el valor inicial del campo.
value: Attr<f64>,
/// Devuelve la etiqueta del campo.
label: Attr<Lc>,
label: Lc,
/// Devuelve el texto de ayuda del campo.
help_text: Attr<Lc>,
help_text: Lc,
/// Devuelve el valor mínimo permitido.
min: Attr<f64>,
/// Devuelve el valor máximo permitido.
@ -139,17 +139,17 @@ impl Range {
self
}
/// Establece o elimina la etiqueta visible del campo (basta pasar `None` para quitarla).
/// Establece la etiqueta visible del campo (usa [`Lc::none()`] para quitarla).
#[builder_fn]
pub fn with_label(mut self, label: impl Into<Option<Lc>>) -> Self {
self.label.alter_opt(label.into());
pub fn with_label(mut self, label: Lc) -> Self {
self.label = label;
self
}
/// Establece o elimina el texto de ayuda del campo (basta pasar `None` para quitarlo).
/// Establece el texto de ayuda del campo (usa [`Lc::none()`] para quitarlo).
#[builder_fn]
pub fn with_help_text(mut self, help_text: impl Into<Option<Lc>>) -> Self {
self.help_text.alter_opt(help_text.into());
pub fn with_help_text(mut self, help_text: Lc) -> Self {
self.help_text = help_text;
self
}

View file

@ -197,9 +197,9 @@ pub struct Field {
/// Devuelve el nombre del campo.
name: AttrName,
/// Devuelve la etiqueta del campo.
label: Attr<Lc>,
label: Lc,
/// Devuelve el texto de ayuda del campo.
help_text: Attr<Lc>,
help_text: Lc,
/// Devuelve las entradas de la lista (elementos individuales y grupos de elementos).
entries: Vec<Entry>,
/// Devuelve si la lista permite selección múltiple.
@ -333,17 +333,17 @@ impl Field {
self
}
/// Establece o elimina la etiqueta visible del campo (basta pasar `None` para quitarla).
/// Establece la etiqueta visible del campo (usa [`Lc::none()`] para quitarla).
#[builder_fn]
pub fn with_label(mut self, label: impl Into<Option<Lc>>) -> Self {
self.label.alter_opt(label.into());
pub fn with_label(mut self, label: Lc) -> Self {
self.label = label;
self
}
/// Establece o elimina el texto de ayuda del campo (basta pasar `None` para quitarlo).
/// Establece el texto de ayuda del campo (usa [`Lc::none()`] para quitarlo).
#[builder_fn]
pub fn with_help_text(mut self, help_text: impl Into<Option<Lc>>) -> Self {
self.help_text.alter_opt(help_text.into());
pub fn with_help_text(mut self, help_text: Lc) -> Self {
self.help_text = help_text;
self
}

View file

@ -40,9 +40,9 @@ pub struct Textarea {
/// Devuelve el valor inicial del área de texto.
value: AttrValue,
/// Devuelve la etiqueta del campo.
label: Attr<Lc>,
label: Lc,
/// Devuelve el texto de ayuda del campo.
help_text: Attr<Lc>,
help_text: Lc,
/// Devuelve el número de filas visibles del área de texto.
rows: Attr<u16>,
/// Devuelve la longitud mínima permitida en caracteres.
@ -50,7 +50,7 @@ pub struct Textarea {
/// Devuelve la longitud máxima permitida en caracteres.
maxlength: Attr<u16>,
/// Devuelve el texto indicativo del área de texto.
placeholder: Attr<Lc>,
placeholder: Lc,
/// Devuelve la configuración de autocompletado del campo.
autocomplete: Attr<form::Autocomplete>,
/// Devuelve si el campo recibe el foco automáticamente al cargar la página.
@ -166,17 +166,17 @@ impl Textarea {
self
}
/// Establece o elimina la etiqueta visible del campo (basta pasar `None` para quitarla).
/// Establece la etiqueta visible del campo (usa [`Lc::none()`] para quitarla).
#[builder_fn]
pub fn with_label(mut self, label: impl Into<Option<Lc>>) -> Self {
self.label.alter_opt(label.into());
pub fn with_label(mut self, label: Lc) -> Self {
self.label = label;
self
}
/// Establece o elimina el texto de ayuda del campo (basta pasar `None` para quitarlo).
/// Establece el texto de ayuda del campo (usa [`Lc::none()`] para quitarlo).
#[builder_fn]
pub fn with_help_text(mut self, help_text: impl Into<Option<Lc>>) -> Self {
self.help_text.alter_opt(help_text.into());
pub fn with_help_text(mut self, help_text: Lc) -> Self {
self.help_text = help_text;
self
}
@ -204,13 +204,13 @@ impl Textarea {
self
}
/// Establece o elimina el texto indicativo del área de texto (`None` para quitarlo).
/// Establece el texto indicativo del área de texto (usa [`Lc::none()`] para quitarlo).
///
/// Este texto aparece en el área de texto y desaparece en cuanto el usuario empieza a escribir.
/// Al ser texto visible para el usuario se acepta [`Lc`] para poder localizarlo.
#[builder_fn]
pub fn with_placeholder(mut self, placeholder: impl Into<Option<Lc>>) -> Self {
self.placeholder.alter_opt(placeholder.into());
pub fn with_placeholder(mut self, placeholder: Lc) -> Self {
self.placeholder = placeholder;
self
}

View file

@ -29,7 +29,7 @@ pub struct Image {
/// Devuelve el origen de la imagen.
source: image::Source,
/// Devuelve el texto alternativo localizado.
alternative: Attr<Lc>,
alternative: Lc,
}
#[async_trait]
@ -140,7 +140,7 @@ impl Image {
/// decorativa.
#[builder_fn]
pub fn with_alternative(mut self, alt: Lc) -> Self {
self.alternative.alter_value(alt);
self.alternative = alt;
self
}
}