From 932e8df74b299fdacc63b86332489cda29e7fa5d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 22 Nov 2026 15:58:09 -0500 Subject: [PATCH] Preferences: one scrolling page of cards, segmented short choices, a search with its match count (L-311) --- .../src/patterns/preferences/body.rs | 193 ++++++++---------- .../src/patterns/preferences/model.rs | 12 +- .../src/patterns/preferences/rows.rs | 67 ++++-- .../src/patterns/preferences/window.rs | 19 +- .../src/patterns/preferences/words.rs | 4 +- .../ui-patterns/tests/it/preferences/mod.rs | 1 + .../ui-patterns/tests/it/preferences/page.rs | 74 +++++++ 7 files changed, 236 insertions(+), 134 deletions(-) create mode 100644 crates/ui-patterns/tests/it/preferences/page.rs diff --git a/crates/ui-patterns/src/patterns/preferences/body.rs b/crates/ui-patterns/src/patterns/preferences/body.rs index 7bca75294..17224f3e3 100644 --- a/crates/ui-patterns/src/patterns/preferences/body.rs +++ b/crates/ui-patterns/src/patterns/preferences/body.rs @@ -1,34 +1,23 @@ -//! The contents of the preferences window: a search field over a page list and the shown page. +//! The contents of the preferences window: a search field with its match count over one scrolling page of cards. use super::model::{PageSpec, PrefValue, PreferencesModel}; use super::rows::{RowsOut, ShownRow, reset_button, show_row}; use super::search::{self, Listed}; use super::window::PreferencesState; use super::words::PreferencesWords; -use crate::contract::{ - ActivateOn, Bind, CollectionEvent, Props as _, Scroll, SelectMode, Show as _, ShowCollection as _, ShowContainer as _, Sizing, -}; -use crate::display::{Divider, Shade, Text}; +use crate::contract::{Bind, Pad, Props as _, Scroll, Show as _, ShowContainer as _}; +use crate::display::{Shade, Text}; use crate::form::FieldGroup; use crate::layout_components::{Row, Stack}; -use crate::list::{List, ListRow, RowInk}; use crate::notices::{Notice, NoticeLayout}; -use crate::runtime::env::{Label, Units}; +use crate::runtime::env::{Env, Label, Units}; use crate::sections::Section; -use crate::style::TypeRole; +use crate::style::{SurfaceKind, TypeRole}; use crate::text::TextField; -use craft_behavior::{DisplayOrder, ItemSource, Selection, SelectionChange}; use craft_i18n::matcher::Matcher; use craft_theme::variant::Tone; use egui::Ui; -/// One entry of the page list. -pub(super) struct PageEntry { - pub id: String, - pub title: Label, - pub dimmed: bool, -} - /// A group of the shown page: its title and the rows the search keeps. struct ShownGroup { title: Option