Skip to main content

tui_kit/wizard/
mod.rs

1//! Step-by-step wizard widget with tree-structured steps, optional steps,
2//! select (cycling) steps, and variable-length array steps.
3//!
4//! ## Visual layout (example)
5//!
6//! ```text
7//!   │
8//!   ●  name             my-blueprint
9//!   │
10//!   ●  description      (none)
11//!   │
12//!   ○  fields    [ + add ]  [0]        ← active array, collapsed
13//!   │
14//!   ◌  [ save ]                        ← pending Buttons step
15//!   │
16//! ```
17//!
18//! When the array is expanded:
19//!
20//! ```text
21//!   ◉  fields    [ + add ]  [2]        ← expanded, 2 items
22//!   │  │
23//!   │  ●  #1                           ← item (not selected)
24//!   │  │  │
25//!   │  │  ●  field name   title
26//!   │  │  │
27//!   │  │  ●  field type   String
28//!   │  │
29//!   │  ►  #2  [ remove ]               ← item selected; [ remove ] focusable via Right
30//!   │  │  │
31//!   │  │  ●  field name   count
32//!   │  │  │
33//!   │  │  ●  field type   Integer
34//!   │
35//! ```
36//!
37//! ## Navigation
38//!
39//! | Context | Key | Effect |
40//! |---------|-----|--------|
41//! | Any leaf | Tab / Enter | Confirm value, advance |
42//! | Any leaf | BackTab | Retreat (wraps) |
43//! | Any leaf | Esc | Cancel (dismiss wizard) |
44//! | Array collapsed | Left / Right | Switch between `[+ add]` and `[n]` |
45//! | Array collapsed | Enter on `[+ add]` | Expand + start new item |
46//! | Array collapsed | Enter on `[n]` | Expand only |
47//! | Array collapsed | Tab | Advance past array |
48//! | Array collapsed | Esc | Cancel (dismiss wizard) |
49//! | Array expanded | Tab | Cycle through items |
50//! | Array expanded | Enter | Edit focused item |
51//! | Array expanded | Right → `[remove]` → Enter | Delete focused item |
52//! | Array expanded | Esc / BackTab | Collapse |
53//! | Item editing leaf | Tab / Enter | Confirm sub-step / complete item |
54//! | Item editing leaf | Esc | Cancel edit (delete if new, restore if existing) |
55//! | Item editing select | Left / Right | Cycle option |
56//! | Item editing select | Tab / Enter | Confirm, advance sub-step |
57//! | Buttons | Left / Right / Tab | Cycle buttons (Tab wraps to first step) |
58//! | Buttons | BackTab | Retreat to previous step |
59//! | Buttons | Enter | Fire primary (Done) or secondary (Cancelled) |
60//! | Buttons | Esc | Cancel |
61
62mod types;
63mod helpers;
64mod input;
65mod render;
66
67// ── Public re-exports ─────────────────────────────────────────────────────────
68
69pub use types::{
70    ArrayEditSession, ArrayState, WizardEvent, WizardState, WizardStep, WizardStepKind,
71};
72pub use render::render_wizard;