T13b Trees: Tree, TreeNode, TreeSelect, Outline, Disclosure (review pending: codex 401)

This commit is contained in:
ZacharyZhang-NY committed 2026-09-25 19:59:11 -04:00
1 parent 2d6404f688
commit db3b993cac
22 files changed
+1969 -94

No files matched your search

+15
View File
@@ -20,6 +20,7 @@ pub struct Choice {
pub icon: Option<IconName>,
pub note: Option<SharedString>,
pub disabled: bool,
pub depth: usize,
}
impl Choice {
@@ -30,9 +31,16 @@ impl Choice {
icon: None,
note: None,
disabled: false,
depth: 0,
}
}
/// How far it sits under a parent, for choices that come from a tree.
pub fn depth(mut self, depth: usize) -> Self {
self.depth = depth;
self
}
pub fn icon(mut self, icon: IconName) -> Self {
self.icon = Some(icon);
self
@@ -108,6 +116,13 @@ pub(crate) fn option_row(
}),
)
})
.when(choice.depth > 0, |row| {
row.child(
div()
.flex_none()
.w(theme.tree_indent() * choice.depth as f32),
)
})
.when_some(choice.icon, |row, icon| {
row.child(Icon::new(icon).size(IconSize::Sm).color(colors.fg_muted))
})