ui-contract: a link side label keeps its caption's type role and takes only the link's ink, so it takes the room its control measured for it

This commit is contained in:
bflatastic
2026-11-22 19:45:13 +07:00
parent 91012d7127
commit ff6ba8b216
@@ -169,13 +169,16 @@ impl Component for LabelLeaf {
Stateful::new(muted).off(States::new(muted, muted, muted, off))
},
// A caption reads as secondary; a check box's or a radio's text after it is the control's own.
name: if key.link {
cx.link_look(true)
} else {
name: {
let text = &cx.tokens.color.text;
let (role, ink) = if key.after { (TypeRole::Body, text.normal) } else { (TypeRole::Label, text.muted) };
let (ink, off) = (cx.color(ink), cx.color(text.disabled));
TextLook::new(role, Stateful::new(ink).off(States::new(ink, ink, ink, off)))
if key.link {
// A link label keeps its role, so it takes the room of the caption it is, in the link's ink.
TextLook { role, ..cx.link_look(true) }
} else {
let (ink, off) = (cx.color(ink), cx.color(text.disabled));
TextLook::new(role, Stateful::new(ink).off(States::new(ink, ink, ink, off)))
}
},
glyph: {
let off = Some(cx.color(cx.tokens.color.text.disabled));