T06b forms selection: checkbox, radio, cards, switch, select, combobox, multi select, cascader, transfer list, list box, chips, rating, sliders, knob, stepper

This commit is contained in:
ZacharyZhang-NY committed 2026-09-25 06:41:35 -04:00
1 parent ec5713c10b
commit e39d623b58
36 files changed
+5170 -198

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
use gpui::{App, ElementId, Window};
struct Changes<T> {
last: T,
count: usize,
}
/// How often `value` changed since `id` first rendered. Key an animation on it to replay per change.
pub(crate) fn changes<T: Clone + PartialEq + 'static>(
id: impl Into<ElementId>,
value: T,
window: &mut Window,
cx: &mut App,
) -> usize {
let state = window.use_keyed_state(id, cx, |_, _| Changes {
last: value.clone(),
count: 0,
});
if state.read(cx).last != value {
state.update(cx, |state, _| {
state.last = value;
state.count += 1;
});
}
state.read(cx).count
}
+2
View File
@@ -1,3 +1,5 @@
mod changes;
mod curve;
pub(crate) use changes::changes;
pub use curve::*;