From e4ad9acabeb2ffc19dd7c2a8336fabf444c5a6fd Mon Sep 17 00:00:00 2001 From: aiongg Date: Thu, 12 Nov 2026 02:03:42 +0000 Subject: [PATCH] BlockingOverlay: built-in spinner and message; Cancel shows the card and lets Escape close it --- crates/ui-panels/src/dialog/blocking.rs | 44 ++++++++++++++++++++++--- crates/ui-panels/src/dialog/stories.rs | 12 ++----- crates/ui-panels/src/dialog/trials.rs | 21 ++++++++++++ 3 files changed, 63 insertions(+), 14 deletions(-) diff --git a/crates/ui-panels/src/dialog/blocking.rs b/crates/ui-panels/src/dialog/blocking.rs index bbef31772..186b8ce5b 100644 --- a/crates/ui-panels/src/dialog/blocking.rs +++ b/crates/ui-panels/src/dialog/blocking.rs @@ -2,8 +2,11 @@ use super::frame::{self, DialogOutput, FOOTER}; use crate::contract::{ - Bind, BindMut, BodyCx, Common, Component, Container, ContainerProps, Cx, Mount, Overlay, Pad, Pointer as _, Props as _, Role, SaveKey, + Bind, BindMut, BodyCx, Common, Component, Container, ContainerProps, Cx, HeaderRegion, Mount, Overlay, Pad, Pointer as _, Props as _, Role, + SaveKey, Show as _, ShowContainer as _, }; +use crate::display::{Spinner, Text}; +use crate::layout_components::Row; use crate::runtime::env::Label; use crate::runtime::focus::{FocusPolicy, Initial}; use crate::runtime::overlay::{Backdrop, CloseReason, Rank}; @@ -23,11 +26,12 @@ pub struct BlockingOverlayStyle { /// A modal layer that takes the window's input while it is shown, with the wait cursor. Its label is the accessible /// name. Without a card the layer has no look at all; with one, the body sits on the dialog surface, centred. /// +/// - Progress: [`message`](BlockingOverlay::message) shows a spinner and the message over the body, on the card. /// - Open state: bound with [`opened`](BlockingOverlay::opened), else a session slot that starts open. Show it /// every pass the work lasts, or bind the state to the work. /// - Cancel: Escape closes it when [`cancellable`](BlockingOverlay::cancellable) says so, and a footer button /// named by [`cancel`](BlockingOverlay::cancel) closes it as `CloseReason::Requested`; the open state then reads -/// `false`. +/// `false`. A Cancel button also shows the card and lets Escape close it. #[derive(crate::contract::Component, crate::contract::Props)] #[component(container)] pub struct BlockingOverlay<'a> { @@ -42,6 +46,7 @@ pub struct BlockingOverlay<'a> { #[prop] cursor: CursorIcon, cancel: Option