chore: audit components

This commit is contained in:
2026-11-10 15:06:16 +07:00
parent af2177c6c8
commit 03369f501e
92 changed files with 2744 additions and 1947 deletions
+7 -7
View File
@@ -4,11 +4,10 @@ use gpui::prelude::FluentBuilder as _;
use gpui::{
AnimationExt as _, App, Bounds, ElementId, Entity, InteractiveElement as _, IntoElement,
KeyDownEvent, ParentElement as _, Point, RenderOnce, Role, SharedString, SpringAnimation,
SpringConfig, StatefulInteractiveElement as _, StyleRefinement, Styled as _, Toggled, Window,
canvas, div,
StatefulInteractiveElement as _, StyleRefinement, Styled as _, Toggled, Window, canvas, div,
};
use gpui_native_icons::Icon;
use gpui_native_theme::{ActiveTheme as _, Size};
use gpui_native_theme::{ActiveTheme as _, CONTROL_SPRING, Size};
use gpui_native_utils::{focus_handle, focus_ring};
use crate::common::{Sizable, StyledExt, h_flex};
@@ -18,6 +17,7 @@ type ChangeHandler<T> = Rc<dyn Fn(T, &mut Window, &mut App)>;
/// Segment option for a segmented control.
#[derive(Clone)]
#[must_use]
pub struct SegmentedOption<T> {
value: T,
label: SharedString,
@@ -62,6 +62,7 @@ where
/// A pill strip of mutually exclusive choices.
#[derive(IntoElement)]
#[must_use]
pub struct Segmented<T>
where
T: Clone + PartialEq + 'static,
@@ -187,7 +188,6 @@ where
window.use_keyed_state("segmented-track-origin", cx, |_, _| None);
let focus = focus_handle(&self.id, window, cx);
let anim_config = SpringConfig::new(500., 35., 1.);
let track_point = *track_origin.read(cx);
let plate_target = geometry
@@ -214,7 +214,7 @@ where
};
h_flex()
.id(("segment", index))
.id((ElementId::from("segment"), segment.label.clone()))
.gap_1p5()
.justify_center()
.cursor_pointer()
@@ -309,12 +309,12 @@ where
.shadow(plate_shadow.clone())
.with_spring(
"segmented-plate-x",
SpringAnimation::new(anim_config).to(x),
SpringAnimation::new(CONTROL_SPRING).to(x),
|plate, x| plate.left(x),
)
.with_spring(
"segmented-plate-w",
SpringAnimation::new(anim_config).to(width),
SpringAnimation::new(CONTROL_SPRING).to(width),
|spring_plate, width| {
spring_plate.map_element(move |plate| plate.w(width))
},