From 70bb11ab7030ff4e1119004b94ef1abd2bb899e9 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sun, 22 Nov 2026 08:25:18 +0700 Subject: [PATCH] ui-widgets: NumberField::STEP_UP and STEP_DOWN name the step arrows' parts publicly; the step-arrow trial and story use them --- crates/ui-widgets/src/text/number.rs | 13 +++++++------ crates/ui-widgets/src/text/number/stories.rs | 4 ++-- crates/ui-widgets/tests/it/text/step_arrows.rs | 7 ++----- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/crates/ui-widgets/src/text/number.rs b/crates/ui-widgets/src/text/number.rs index dc1e693ab..96368dd8b 100644 --- a/crates/ui-widgets/src/text/number.rs +++ b/crates/ui-widgets/src/text/number.rs @@ -92,10 +92,6 @@ fn content_sized(cx: &MeasureCx<'_, C>) -> bool { const PRESETS: PartKey = PartKey::new("presets"); /// The chevron that opens the popup slider. const SLIDER: PartKey = PartKey::new("slider"); -/// The up half of the step arrows. -const STEP_UP: PartKey = PartKey::new("step_up"); -/// The down half of the step arrows. -const STEP_DOWN: PartKey = PartKey::new("step_down"); /// The style of a number field: the field look, which the chevrons are laid out by, and the unit's text. #[derive(Clone, Debug, PartialEq, ComponentStyle)] @@ -200,6 +196,11 @@ pub struct NumberField<'a, V: NumberValue + 'static = Option> { } impl<'a> NumberField<'a, Option> { + /// The up half of the step arrows ([`step_arrows`](Self::step_arrows)): a press steps the value up once. + pub const STEP_UP: PartKey = PartKey::new("step_up"); + /// The down half of the step arrows: a press steps the value down once. + pub const STEP_DOWN: PartKey = PartKey::new("step_down"); + /// A number field named `label`; empty text is `None`. pub fn new(label: impl Into