Files
oak-gpui/crates/ui/src/components.rs
T
e5f05a21ce settings ui: Improve numeric stepper component interface (#36513)
This is the first step to allowing users to type into a numeric stepper
to set its value. This PR makes the numeric stepper take in a generic
type `T` where T: `NumericStepperType`

```rust
pub trait NumericStepperType:
    Display
    + Add<Output = Self>
    + Sub<Output = Self>
    + Copy
    + Clone
    + Sized
    + PartialOrd
    + FromStr
    + 'static
{
    fn default_format(value: &Self) -> String {
        format!("{}", value)
    }
    fn default_step() -> Self;
    fn large_step() -> Self;
    fn small_step() -> Self;
    fn min_value() -> Self;
    fn max_value() -> Self;
}
```

This allows setting of step sizes and min/max values as well as making
the component easier to use.

cc @danilo-leal 

Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
Co-authored-by: Gaauwe Rombouts <mail@grombouts.nl>
2025-10-03 17:35:30 +00:00

88 lines
1.5 KiB
Rust

mod avatar;
mod badge;
mod banner;
mod button;
mod callout;
mod chip;
mod content_group;
mod context_menu;
mod data_table;
mod disclosure;
mod divider;
mod dropdown_menu;
mod facepile;
mod group;
mod icon;
mod image;
mod indent_guides;
mod indicator;
mod keybinding;
mod keybinding_hint;
mod label;
mod list;
mod modal;
mod navigable;
mod notification;
mod popover;
mod popover_menu;
mod progress;
mod radio;
mod right_click_menu;
mod scrollbar;
mod settings_container;
mod settings_group;
mod stack;
mod sticky_items;
mod tab;
mod tab_bar;
mod toggle;
mod tooltip;
mod tree_view_item;
#[cfg(feature = "stories")]
mod stories;
pub use avatar::*;
pub use badge::*;
pub use banner::*;
pub use button::*;
pub use callout::*;
pub use chip::*;
pub use content_group::*;
pub use context_menu::*;
pub use data_table::*;
pub use disclosure::*;
pub use divider::*;
pub use dropdown_menu::*;
pub use facepile::*;
pub use group::*;
pub use icon::*;
pub use image::*;
pub use indent_guides::*;
pub use indicator::*;
pub use keybinding::*;
pub use keybinding_hint::*;
pub use label::*;
pub use list::*;
pub use modal::*;
pub use navigable::*;
pub use notification::*;
pub use popover::*;
pub use popover_menu::*;
pub use progress::*;
pub use radio::*;
pub use right_click_menu::*;
pub use scrollbar::*;
pub use settings_container::*;
pub use settings_group::*;
pub use stack::*;
pub use sticky_items::*;
pub use tab::*;
pub use tab_bar::*;
pub use toggle::*;
pub use tooltip::*;
pub use tree_view_item::*;
#[cfg(feature = "stories")]
pub use stories::*;