dsh-better-ask-user 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,119 +1,122 @@
1
- /* Ask-user settings: one 920px column, section rows, flat 1px surfaces. */
1
+ /* Roles follow the host; controls keep the same shape in both themes. */
2
2
  .cfg {
3
- --ui-accent: #3388bb;
4
- --ui-accent-solid: #20709e;
5
- --ui-accent-text: #14587f;
6
- --ui-accent-fg: #fff;
7
- --ui-accent-soft: color-mix(in srgb, var(--ui-accent) 10%, transparent);
8
- --ui-ink-1: var(--dsw-alias-label-primary, #0f1115);
9
- --ui-ink-2: var(--dsw-alias-label-secondary, #61666b);
10
- --ui-ink-3: color-mix(in srgb, var(--dsw-alias-label-tertiary, #81858c) 80%, var(--dsw-alias-label-primary, #0f1115));
11
- --ui-line-1: var(--dsw-alias-border-l1, #0000000a);
12
- --ui-line-2: var(--dsw-alias-border-l2, #0000001a);
13
- --ui-line-3: var(--dsw-alias-border-l3, #0000001f);
14
- --ui-canvas: var(--dsw-alias-bg-layer-1, #fff);
15
- --ui-raised: var(--dsw-alias-bg-layer-2, #fff);
16
- --ui-sunken: color-mix(in srgb, var(--ui-ink-1) 4%, var(--ui-canvas));
17
- --ui-hover: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, var(--ui-ink-1) 5%, transparent));
18
- --ui-danger: var(--dsw-alias-state-error-primary, #c8322b);
19
- --ui-radius-sm: 6px;
20
- --ui-radius-md: 8px;
3
+ --cfg-accent: var(--dsw-alias-state-business-primary, #3388bb);
4
+ --cfg-accent-text: color-mix(in srgb, var(--cfg-accent) 70%, var(--cfg-ink));
5
+ --cfg-solid: var(--dsw-alias-button-primary-fill, #20709e);
6
+ --cfg-solid-hover: color-mix(in srgb, var(--cfg-solid) 88%, var(--cfg-on-solid));
7
+ --cfg-on-solid: var(--dsw-alias-label-primary-foreground, #fff);
8
+ --cfg-ink: var(--dsw-alias-label-primary);
9
+ --cfg-muted: var(--dsw-alias-label-secondary);
10
+ --cfg-line: var(--dsw-alias-border-l2);
11
+ --cfg-surface: var(--dsw-alias-bg-layer-1);
12
+ --cfg-hover: var(--dsw-alias-interactive-bg-hover);
13
+ --cfg-danger: var(--dsw-alias-state-error-primary);
21
14
  display: flex;
22
15
  flex-direction: column;
23
16
  gap: 20px;
24
17
  width: 100%;
25
- max-width: 920px;
18
+ max-width: 960px;
26
19
  margin: 0 auto;
27
20
  min-width: 0;
28
- color: var(--ui-ink-1);
21
+ color: var(--cfg-ink);
29
22
  font: inherit;
23
+ font-size: 13px;
30
24
  line-height: 20px;
31
- font-variant-numeric: tabular-nums;
32
25
  }
33
- .cfg *,
34
- .cfg { box-sizing: border-box; }
35
- .pageHead { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
36
- .title { margin: 0; font-size: 20px; line-height: 28px; font-weight: 500; letter-spacing: -.01em; }
37
- .badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border: 1px solid var(--ui-line-2); border-radius: 999px; background: var(--ui-raised); color: var(--ui-ink-3); font-size: 11px; line-height: 18px; white-space: nowrap; }
38
- .group { display: flex; flex-direction: column; min-width: 0; border-top: 1px solid var(--ui-line-2); }
39
- .row { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 44px; min-width: 0; padding: 10px 0; border-bottom: 1px solid var(--ui-line-1); }
40
- .rowText { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
41
- .rowTitle { color: var(--ui-ink-1); font-size: 13px; line-height: 20px; font-weight: 500; }
42
- .rowDesc { color: var(--ui-ink-3); font-size: 12px; line-height: 18px; }
43
- .control { display: flex; align-items: center; gap: 8px; flex: none; min-width: 0; }
44
- .choices { display: inline-flex; flex: none; gap: 2px; height: 32px; padding: 1px; border: 1px solid var(--ui-line-2); border-radius: var(--ui-radius-md); background: var(--ui-sunken); }
26
+ .cfg *, .cfg { box-sizing: border-box; }
27
+ .pageHead { display: flex; flex-direction: column; align-items: flex-start; flex-wrap: wrap; gap: 4px; min-width: 0; }
28
+ .title { flex: none; margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -.01em; }
29
+ .purpose { flex: 0 0 auto; min-width: 0; margin: 0; color: var(--cfg-muted); font-size: 13px; line-height: 20px; }
30
+ .badge { flex: none; display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 1px solid var(--cfg-line); border-radius: 8px; color: var(--cfg-muted); font-size: 12px; }
31
+ .note, .status { margin: 0; color: var(--cfg-muted); font-size: 12px; overflow-wrap: anywhere; }
32
+ .group { display: flex; flex-direction: column; min-width: 0; }
33
+ .section { display: flex; flex-direction: column; gap: 12px; padding: 12px 0; min-width: 0; }
34
+ .section:first-child { padding-top: 0; }
35
+ .section:last-child { padding-bottom: 0; }
36
+ .waitHead { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
37
+ .sectionLabel { margin: 0; color: color-mix(in srgb, var(--dsw-alias-label-tertiary) 80%, var(--cfg-ink)); font-size: 12px; line-height: 20px; font-weight: 500; }
38
+ .sectionNote { margin: 0; color: var(--cfg-muted); font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
39
+ .choices { display: inline-flex; flex: none; gap: 2px; padding: 2px; border: 1px solid var(--cfg-line); border-radius: 8px; background: color-mix(in srgb, var(--cfg-ink) 4%, var(--cfg-surface)); }
45
40
  .choice { position: relative; display: inline-flex; min-width: 0; }
46
41
  .choice input { appearance: none; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
47
- .choice span { display: flex; align-items: center; justify-content: center; min-height: 28px; padding: 0 12px; border-radius: var(--ui-radius-sm); color: var(--ui-ink-3); font-size: 13px; line-height: 20px; white-space: nowrap; transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease; }
48
- .choice:has(input:checked) span { background: var(--ui-raised); box-shadow: inset 0 0 0 1px var(--ui-line-2); color: var(--ui-accent-text); font-weight: 500; }
49
- .choice:has(input:hover:not(:disabled):not(:checked)) span { background: var(--ui-hover); color: var(--ui-ink-1); }
50
- .choice:has(input:focus-visible) span { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
42
+ .choice span { display: flex; align-items: center; justify-content: center; height: 26px; padding: 0 10px; border: 1px solid transparent; border-radius: 6px; color: var(--cfg-muted); font-size: 12px; white-space: nowrap; }
43
+ .choice:has(input:checked) span { border-color: var(--cfg-line); background: var(--cfg-surface); color: var(--cfg-accent-text); font-weight: 500; }
44
+ .choice:has(input:hover:not(:disabled):not(:checked)) span { background: var(--cfg-hover); }
45
+ .choice:has(input:focus-visible) { outline: 2px solid var(--cfg-accent); outline-offset: 2px; border-radius: 6px; }
51
46
  .choice:has(input:disabled) { opacity: .4; }
52
47
  .choice input:disabled { cursor: not-allowed; }
53
- .input { appearance: none; width: 76px; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--ui-line-2); border-radius: var(--ui-radius-md); background: var(--ui-raised); color: var(--ui-ink-1); font: inherit; font-size: 13px; line-height: 20px; font-variant-numeric: tabular-nums; transition: border-color 140ms ease, box-shadow 140ms ease; }
54
- .input:hover:not(:disabled) { border-color: var(--ui-line-3); }
55
- .input:focus-visible { outline: none; border-color: var(--ui-accent); box-shadow: 0 0 0 2px var(--ui-accent-soft); }
56
- .input[aria-invalid=true] { border-color: var(--ui-danger); }
48
+ .waitControl { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; min-width: 0; }
49
+ .duration { display: inline-flex; align-items: center; gap: 8px; flex: none; }
50
+ .input { appearance: none; width: 132px; height: 32px; padding: 0 10px; border: 1px solid var(--cfg-line); border-radius: 8px; background: var(--cfg-surface); color: inherit; font: inherit; font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; }
51
+ .input:hover:not(:disabled) { border-color: color-mix(in srgb, var(--cfg-line) 55%, var(--cfg-ink)); }
52
+ .input[aria-invalid='true'] { border-color: var(--cfg-danger); }
53
+ .input:focus-visible, .chip:focus-visible { outline: 2px solid var(--cfg-accent); outline-offset: 1px; }
57
54
  .input:disabled { opacity: .4; cursor: not-allowed; }
58
- .duration { display: inline-flex; align-items: center; gap: 6px; flex: none; }
59
- .unit { color: var(--ui-ink-3); font-size: 12px; line-height: 18px; }
60
- .srOnly { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
61
- .fieldError { margin: 6px 0 0; color: var(--ui-danger); font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
62
- .sectionLabel { margin: 20px 0 0; padding-bottom: 6px; border-bottom: 1px solid var(--ui-line-2); color: var(--ui-ink-3); font-size: 12px; line-height: 18px; font-weight: 500; letter-spacing: .02em; }
63
- .advanced { margin-top: 12px; border-top: 1px solid var(--ui-line-1); }
64
- .advanced summary { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 0; color: var(--ui-ink-2); font-size: 13px; line-height: 20px; font-weight: 500; list-style: none; cursor: pointer; }
65
- .advanced summary::-webkit-details-marker { display: none; }
66
- .advanced summary:hover { color: var(--ui-ink-1); }
67
- .advanced summary:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; border-radius: 4px; }
68
- .advancedValue { margin-left: auto; color: var(--ui-ink-3); font-size: 11px; line-height: 18px; font-weight: 400; white-space: nowrap; }
69
- .chevron { width: 6px; height: 6px; margin: 0 4px 3px auto; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); transition: transform 140ms ease; }
70
- .advancedValue + .chevron { margin-left: 0; }
71
- .advanced[open] .chevron { transform: rotate(225deg); margin-bottom: -3px; }
72
- .status { margin: 0; color: var(--ui-ink-3); font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
73
- .footer { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--ui-line-2); background: var(--ui-canvas); margin-top: auto; }
55
+ .unit { color: var(--cfg-muted); font-size: 12px; }
56
+ .presets { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
57
+ .chip { appearance: none; height: 32px; padding: 0 10px; border: 1px solid var(--cfg-line); border-radius: 8px; background: transparent; color: var(--cfg-muted); font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; cursor: pointer; }
58
+ .chip:hover:not(:disabled) { background: var(--cfg-hover); color: var(--cfg-ink); }
59
+ .chip[aria-pressed='true'] { border-color: var(--cfg-accent); background: color-mix(in srgb, var(--cfg-accent) 8%, transparent); color: var(--cfg-accent-text); font-weight: 500; }
60
+ .chip:disabled { opacity: .4; cursor: not-allowed; }
61
+ .timeline { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--cfg-muted); font-size: 12px; line-height: 18px; }
62
+ .timelineNode { flex: none; white-space: nowrap; }
63
+ .timelineRail { position: relative; display: flex; align-items: center; justify-content: center; flex: 1; min-width: 64px; height: 1px; background: var(--cfg-line); }
64
+ .timelineRail::after { content: ''; position: absolute; right: 0; top: -3px; width: 6px; height: 6px; border-top: 1px solid var(--cfg-line); border-right: 1px solid var(--cfg-line); transform: rotate(45deg); }
65
+ .timeline[data-unlimited='true'] .timelineRail::after { display: none; }
66
+ .timelineChip { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; min-height: 24px; padding: 0 8px; border: 1px solid var(--cfg-line); border-radius: 8px; background: var(--cfg-surface); color: var(--cfg-ink); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
67
+ .timeline[data-unlimited='true'] .timelineChip { color: var(--cfg-muted); }
68
+ .fieldError { margin: 0; color: var(--cfg-danger); font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
69
+ .cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-width: 0; }
70
+ .card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'head head' 'desc diagram'; gap: 6px 12px; padding: 12px; border: 1px solid var(--cfg-line); border-radius: 8px; background: var(--cfg-surface); cursor: pointer; }
71
+ .card:hover { background: var(--cfg-hover); }
72
+ .card:has(input:checked), .card:has(input:checked):hover { border-color: var(--cfg-accent); background: color-mix(in srgb, var(--cfg-accent) 6%, var(--cfg-surface)); }
73
+ .card:has(input:focus-visible) { outline: 2px solid var(--cfg-accent); outline-offset: 2px; }
74
+ .card:has(input:disabled) { opacity: .5; cursor: not-allowed; }
75
+ .cardInput { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
76
+ .cardHead { grid-area: head; display: flex; align-items: center; gap: 8px; min-width: 0; }
77
+ .cardName { min-width: 0; overflow-wrap: anywhere; font-size: 13px; line-height: 20px; font-weight: 500; }
78
+ .cardMark { flex: none; width: 16px; height: 16px; margin-left: auto; border: 1px solid var(--dsw-alias-border-l4, var(--cfg-line)); border-radius: 50%; }
79
+ .cardMark::after { content: ''; display: block; width: 8px; height: 8px; margin: 3px; border-radius: 50%; background: var(--cfg-accent); opacity: 0; }
80
+ .card:has(input:checked) .cardMark { border-color: var(--cfg-accent); }
81
+ .card:has(input:checked) .cardMark::after { opacity: 1; }
82
+ .cardDesc { grid-area: desc; min-width: 0; color: var(--cfg-muted); font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
83
+ .cardDiagram { grid-area: diagram; align-self: center; display: block; width: 104px; max-width: 100%; color: var(--cfg-muted); }
84
+ .cardDiagram svg { display: block; width: 100%; height: auto; }
85
+ .card:has(input:checked) .cardDiagram { color: var(--cfg-accent); }
86
+ .footer { position: sticky; bottom: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 12px 0; border-top: 1px solid var(--cfg-line); background: var(--dsw-alias-bg-layer-1); }
74
87
  .footer .status { flex: 1; min-width: 0; }
75
- .button,
76
- .primary { appearance: none; display: inline-flex; align-items: center; justify-content: center; flex: none; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--ui-line-2); border-radius: var(--ui-radius-md); background: var(--ui-raised); color: var(--ui-ink-1); font: inherit; font-size: 13px; line-height: 20px; font-weight: 500; cursor: pointer; transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease; }
77
- .button:hover:not(:disabled) { background: var(--ui-hover); }
78
- .button:active:not(:disabled) { background: var(--ui-sunken); }
79
- .primary { min-width: 96px; border-color: transparent; background: var(--ui-accent-solid); color: var(--ui-accent-fg); }
80
- .primary:hover:not(:disabled) { background: color-mix(in srgb, var(--ui-accent-solid) 88%, black); }
81
- .primary:active:not(:disabled) { background: color-mix(in srgb, var(--ui-accent-solid) 80%, black); }
82
- .button:focus-visible,
83
- .primary:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
84
- .button:disabled,
85
- .primary:disabled { opacity: .4; cursor: not-allowed; }
88
+ .button, .primary { appearance: none; display: inline-flex; align-items: center; justify-content: center; flex: none; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--cfg-line); border-radius: 8px; background: transparent; color: inherit; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
89
+ .button:hover:not(:disabled) { background: var(--cfg-hover); }
90
+ .primary { min-width: 96px; border-color: transparent; background: var(--cfg-solid); color: var(--cfg-on-solid); }
91
+ .primary:hover:not(:disabled) { background: var(--cfg-solid-hover); }
92
+ .button:focus-visible, .primary:focus-visible { outline: 2px solid var(--cfg-accent); outline-offset: 2px; }
93
+ .button:disabled, .primary:disabled { opacity: .4; cursor: not-allowed; }
94
+ .button:active:not(:disabled), .primary:active:not(:disabled) { transform: translateY(1px); }
86
95
  .spinner { width: 12px; height: 12px; border: 1px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 800ms linear infinite; }
87
96
  @keyframes spin { to { transform: rotate(360deg); } }
88
97
  @media (max-width: 640px) {
89
- .title { font-size: 18px; line-height: 26px; }
90
- .row { align-items: stretch; flex-direction: column; gap: 8px; }
91
- .control { width: 100%; flex-wrap: wrap; }
98
+ .waitHead { align-items: stretch; flex-direction: column; gap: 8px; }
99
+ .choices { width: 100%; }
92
100
  .choice { flex: 1; }
93
101
  .choice span { width: 100%; }
102
+ .waitControl { align-items: stretch; flex-direction: column; gap: 8px; }
103
+ .duration, .presets { width: 100%; }
104
+ .input { flex: 1; width: auto; font-size: 16px; }
105
+ .cards { grid-template-columns: minmax(0, 1fr); }
106
+ .chip, .input, .button, .primary, .choice span { min-height: 44px; }
107
+ .section { padding: 12px 0; }
94
108
  .footer { flex-wrap: wrap; }
95
109
  .footer .status { flex-basis: 100%; }
96
- .advancedValue { max-width: 65%; text-align: right; white-space: normal; }
97
110
  }
98
111
  @media (pointer: coarse) {
99
- .choices { height: auto; }
100
- .choice span,
101
- .input,
102
- .button,
103
- .primary { min-height: 44px; }
104
- }
105
- @media (prefers-reduced-motion: reduce) {
106
- .spinner { animation: none; }
107
- .input,
108
- .choice span,
109
- .button,
110
- .primary,
111
- .chevron { transition: none; }
112
+ .chip, .input, .button, .primary, .choice span { min-height: 44px; }
112
113
  }
114
+ @media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .button:active:not(:disabled), .primary:active:not(:disabled) { transform: none; } }
115
+
113
116
  [data-ds-dark-theme] .cfg {
114
- --ui-accent: #4eb0e8;
115
- --ui-accent-solid: #4eb0e8;
116
- --ui-accent-text: #6fc0ee;
117
- --ui-accent-fg: #0e1014;
118
- --ui-accent-soft: color-mix(in srgb, var(--ui-accent) 14%, transparent);
117
+ --cfg-accent: var(--dsw-alias-state-business-primary, #4eb0e8);
118
+ --cfg-accent-text: color-mix(in srgb, var(--cfg-accent) 70%, var(--cfg-ink));
119
+ --cfg-solid: var(--dsw-alias-button-primary-fill, #4eb0e8);
120
+ --cfg-solid-hover: color-mix(in srgb, var(--cfg-solid) 88%, var(--cfg-on-solid));
121
+ --cfg-on-solid: var(--dsw-alias-label-primary-foreground, #0e1014);
119
122
  }
@@ -64,20 +64,7 @@ function parseDraft(draft: Draft): ConfigValue | undefined {
64
64
  return { questionTimeoutSeconds: seconds, timeoutBehavior: draft.timeoutBehavior, goalTimeoutBehavior: draft.goalTimeoutBehavior }
65
65
  }
66
66
 
67
- /** Compact settings row with an optional dependency description. */
68
- function Row({ id, label, hint, children }: { id: string; label: string; hint?: string; children: ReactNode }) {
69
- return (
70
- <div className={css.row}>
71
- <div className={css.rowText}>
72
- <span className={css.rowTitle} id={`${id}-label`}>{label}</span>
73
- {hint ? <span className={css.rowDesc} id={`${id}-hint`}>{hint}</span> : null}
74
- </div>
75
- <div className={css.control}>{children}</div>
76
- </div>
77
- )
78
- }
79
-
80
- /** Native radio semantics with one compact, fully styled choice surface. */
67
+ /** Native radio semantics with one compact segmented surface. */
81
68
  function Choices({ id, value, options, disabled, describedBy, onChange }: {
82
69
  id: string
83
70
  value: string
@@ -105,6 +92,70 @@ function Choices({ id, value, options, disabled, describedBy, onChange }: {
105
92
  )
106
93
  }
107
94
 
95
+ /** Radio-backed choice cards with a small diagram per consequence. */
96
+ function ChoiceCards({ id, value, options, disabled, describedBy, onChange }: {
97
+ id: string
98
+ value: string
99
+ options: Array<{ value: string; label: string; description: string; diagram: ReactNode }>
100
+ disabled: boolean
101
+ describedBy?: string
102
+ onChange: (value: string) => void
103
+ }) {
104
+ const name = useId()
105
+ return (
106
+ <div className={css.cards} id={id} role="radiogroup" aria-labelledby={`${id}-label`} aria-describedby={describedBy} aria-disabled={disabled}>
107
+ {options.map((option) => (
108
+ <label className={css.card} key={option.value} data-choice={option.value}>
109
+ <input
110
+ id={`${id}-${option.value}`}
111
+ className={css.cardInput}
112
+ type="radio" name={name} value={option.value}
113
+ checked={value === option.value} disabled={disabled}
114
+ aria-describedby={`${id}-${option.value}-desc`}
115
+ onChange={() => { onChange(option.value) }}
116
+ />
117
+ <span className={css.cardHead}>
118
+ <span className={css.cardName}>{option.label}</span>
119
+ <span className={css.cardMark} aria-hidden="true" />
120
+ </span>
121
+ <span className={css.cardDesc} id={`${id}-${option.value}-desc`}>{option.description}</span>
122
+ <span className={css.cardDiagram} aria-hidden="true">{option.diagram}</span>
123
+ </label>
124
+ ))}
125
+ </div>
126
+ )
127
+ }
128
+
129
+ /** Question goes out, wait, then the timeout keeps it open and answerable. */
130
+ function OpenFlow() {
131
+ return (
132
+ <svg viewBox="0 0 104 24" fill="none" stroke="currentColor" strokeWidth="1.5" aria-hidden="true">
133
+ <rect x="1" y="5" width="24" height="14" rx="3" />
134
+ <path d="M7 10h12M7 14h7" strokeWidth="1" />
135
+ <path d="M27 12h14" />
136
+ <circle cx="47" cy="12" r="4" />
137
+ <path d="M51 12h14" />
138
+ <path d="m61 8 4 4-4 4" />
139
+ <path d="M71 7v10M78 7v10M85 7v10" strokeWidth="1" />
140
+ </svg>
141
+ )
142
+ }
143
+
144
+ /** Question goes out, wait, then the default answer is selected automatically. */
145
+ function DefaultFlow() {
146
+ return (
147
+ <svg viewBox="0 0 104 24" fill="none" stroke="currentColor" strokeWidth="1.5" aria-hidden="true">
148
+ <rect x="1" y="5" width="24" height="14" rx="3" />
149
+ <path d="M7 10h12M7 14h7" strokeWidth="1" />
150
+ <path d="M27 12h16" />
151
+ <circle cx="49" cy="12" r="4" />
152
+ <path d="M53 12h16" />
153
+ <circle cx="78" cy="12" r="7" />
154
+ <path d="m75 12 2 2 4-4" />
155
+ </svg>
156
+ )
157
+ }
158
+
108
159
  /** Page body, rendered inside the settings host's row config page. */
109
160
  export function SettingsPage({ form, t = fallbackT }: { form?: any; t?: (key: SettingsKey) => string }) {
110
161
  const state = form?.state
@@ -170,66 +221,92 @@ export function SettingsPage({ form, t = fallbackT }: { form?: any; t?: (key: Se
170
221
  const invalid = parsed === undefined
171
222
  const unlimited = live.questionTimeoutSeconds === '-1'
172
223
  const controlsDisabled = !writable || busy
173
- const behaviors = [{ value: 'native', label: t('native') }, { value: 'default', label: t('default') }]
224
+ const seconds = parsed?.questionTimeoutSeconds
225
+ const waitAmount = unlimited ? '∞' : seconds === undefined ? '—' : `${t('timelineWait')} ${seconds} ${t('seconds')}`
226
+ const presets = [
227
+ { seconds: 30, label: `30${t('secondShort')}` },
228
+ { seconds: 120, label: `2${t('minuteShort')}` },
229
+ { seconds: 300, label: `5${t('minuteShort')}` },
230
+ { seconds: 600, label: `10${t('minuteShort')}` },
231
+ ]
232
+ const behaviorCards = [
233
+ { value: 'native', label: t('native'), description: t('nativeHint'), diagram: <OpenFlow /> },
234
+ { value: 'default', label: t('default'), description: t('defaultHint'), diagram: <DefaultFlow /> },
235
+ ]
174
236
 
175
237
  return (
176
238
  <div className={css.cfg} aria-busy={busy} data-settings-dirty={dirty} data-settings-busy={busy}>
177
- <div className={css.pageHead}>
239
+ <header className={css.pageHead}>
178
240
  <h2 className={css.title} id="better-ask-user-title">{t('title')}</h2>
241
+ <p className={css.purpose}>{t('purpose')}</p>
179
242
  {writable ? null : <span className={css.badge} role="status">{t('readonly')}</span>}
180
- </div>
243
+ </header>
181
244
  <section className={css.group} aria-label={t('title')}>
182
- <Row id="better-ask-user-wait-mode" label={t('waitLabel')}>
183
- <Choices
184
- id="better-ask-user-wait-mode" value={unlimited ? 'unlimited' : 'timed'}
185
- options={[{ value: 'timed', label: t('timed') }, { value: 'unlimited', label: t('unlimited') }]}
186
- disabled={controlsDisabled} describedBy="better-ask-user-wait-hint"
187
- onChange={(value) => {
188
- const nextUnlimited = value === 'unlimited'
189
- if (nextUnlimited && !invalid) setTimedSeconds(live.questionTimeoutSeconds)
190
- edit(current => ({ ...current, questionTimeoutSeconds: nextUnlimited ? '-1' : timedSeconds }))
191
- }}
192
- />
193
- {unlimited ? null : <span className={css.duration}>
194
- <input
195
- id="better-ask-user-wait" className={css.input}
196
- aria-label={t('durationLabel')}
197
- aria-describedby={invalid ? 'better-ask-user-error' : 'better-ask-user-wait-hint'}
198
- type="text" inputMode="numeric" aria-invalid={invalid || undefined}
199
- value={live.questionTimeoutSeconds} disabled={controlsDisabled}
200
- onChange={(event) => { edit(current => ({ ...current, questionTimeoutSeconds: event.target.value })) }}
201
- />
202
- <span className={css.unit}>{t('seconds')}</span>
203
- </span>}
204
- </Row>
205
- <p className={css.srOnly} id="better-ask-user-wait-hint">{t(unlimited ? 'unlimitedHint' : 'waitHint')}</p>
206
- {invalid && <p className={css.fieldError} id="better-ask-user-error" role="alert">{t('invalidWait')}</p>}
207
- {!unlimited && <>
208
- <h3 className={css.sectionLabel}>{t('timeoutTitle')}</h3>
209
- <Row id="better-ask-user-behavior" label={t('behaviorLabel')}>
245
+ <div className={css.section} data-ask-section="wait">
246
+ <div className={css.waitHead}>
247
+ <h3 className={css.sectionLabel} id="better-ask-user-wait-mode-label">{t('waitLabel')}</h3>
210
248
  <Choices
211
- id="better-ask-user-behavior" value={live.timeoutBehavior} options={behaviors}
212
- disabled={controlsDisabled} describedBy="better-ask-user-timeout-hint"
213
- onChange={(value) => { edit(current => ({ ...current, timeoutBehavior: value as Behavior })) }}
249
+ id="better-ask-user-wait-mode" value={unlimited ? 'unlimited' : 'timed'}
250
+ options={[{ value: 'timed', label: t('timed') }, { value: 'unlimited', label: t('unlimited') }]}
251
+ disabled={controlsDisabled} describedBy="better-ask-user-wait-hint"
252
+ onChange={(value) => {
253
+ const nextUnlimited = value === 'unlimited'
254
+ if (nextUnlimited && !invalid) setTimedSeconds(live.questionTimeoutSeconds)
255
+ edit(current => ({ ...current, questionTimeoutSeconds: nextUnlimited ? '-1' : timedSeconds }))
256
+ }}
214
257
  />
215
- </Row>
216
- <p className={css.srOnly} id="better-ask-user-timeout-hint">{t(live.timeoutBehavior === 'default' ? 'defaultHint' : 'nativeHint')}</p>
217
- <details className={css.advanced}>
218
- <summary>
219
- <span>{t('advanced')}</span>
220
- {live.goalTimeoutBehavior !== DEFAULTS.goalTimeoutBehavior && <span className={css.advancedValue}>{t('goalBehaviorLabel')} · {t(live.goalTimeoutBehavior)}</span>}
221
- <span className={css.chevron} aria-hidden="true" />
222
- </summary>
223
- <Row id="better-ask-user-goal-behavior" label={t('goalBehaviorLabel')}>
224
- <Choices
225
- id="better-ask-user-goal-behavior" value={live.goalTimeoutBehavior} options={behaviors}
226
- disabled={controlsDisabled} describedBy="better-ask-user-goal-hint"
227
- onChange={(value) => { edit(current => ({ ...current, goalTimeoutBehavior: value as Behavior })) }}
258
+ </div>
259
+ {unlimited ? null : <div className={css.waitControl}>
260
+ <span className={css.duration}>
261
+ <input
262
+ id="better-ask-user-wait" className={css.input}
263
+ aria-label={t('durationLabel')}
264
+ aria-describedby={invalid ? 'better-ask-user-error' : 'better-ask-user-wait-hint'}
265
+ type="text" inputMode="numeric" aria-invalid={invalid || undefined}
266
+ value={live.questionTimeoutSeconds} disabled={controlsDisabled}
267
+ onChange={(event) => { edit(current => ({ ...current, questionTimeoutSeconds: event.target.value })) }}
228
268
  />
229
- </Row>
230
- <p className={css.srOnly} id="better-ask-user-goal-hint">{t(live.goalTimeoutBehavior === 'default' ? 'defaultHint' : 'nativeHint')}</p>
231
- </details>
232
- </>}
269
+ <span className={css.unit}>{t('seconds')}</span>
270
+ </span>
271
+ <div className={css.presets} role="group" aria-label={t('presetLabel')}>
272
+ {presets.map((preset) => (
273
+ <button
274
+ key={preset.seconds} type="button" className={css.chip}
275
+ data-preset={preset.seconds}
276
+ aria-pressed={seconds === preset.seconds}
277
+ disabled={controlsDisabled}
278
+ onClick={() => { edit(current => ({ ...current, questionTimeoutSeconds: String(preset.seconds) })) }}
279
+ >{preset.label}</button>
280
+ ))}
281
+ </div>
282
+ </div>}
283
+ <div className={css.timeline} data-unlimited={unlimited} aria-hidden="true">
284
+ <span className={css.timelineNode}>{t('timelineAsk')}</span>
285
+ <span className={css.timelineRail}>
286
+ <span className={css.timelineChip}>{waitAmount}</span>
287
+ </span>
288
+ <span className={css.timelineNode}>{unlimited ? t('unlimited') : t('timelineEnd')}</span>
289
+ </div>
290
+ <p className={css.sectionNote} id="better-ask-user-wait-hint">{t(unlimited ? 'unlimitedHint' : 'waitHint')}</p>
291
+ {invalid && <p className={css.fieldError} id="better-ask-user-error" role="alert">{t('invalidWait')}</p>}
292
+ </div>
293
+ {unlimited ? null : <div className={css.section} data-ask-section="timeout">
294
+ <h3 className={css.sectionLabel} id="better-ask-user-behavior-label">{t('timeoutTitle')}</h3>
295
+ <ChoiceCards
296
+ id="better-ask-user-behavior" value={live.timeoutBehavior} options={behaviorCards}
297
+ disabled={controlsDisabled}
298
+ onChange={(value) => { edit(current => ({ ...current, timeoutBehavior: value as Behavior })) }}
299
+ />
300
+ </div>}
301
+ <div className={css.section} data-ask-section="goal">
302
+ <h3 className={css.sectionLabel} id="better-ask-user-goal-behavior-label">{t('goalBehaviorLabel')}</h3>
303
+ <p className={css.sectionNote} id="better-ask-user-goal-hint">{t('goalExplain')}</p>
304
+ <ChoiceCards
305
+ id="better-ask-user-goal-behavior" value={live.goalTimeoutBehavior} options={behaviorCards}
306
+ disabled={controlsDisabled} describedBy="better-ask-user-goal-hint"
307
+ onChange={(value) => { edit(current => ({ ...current, goalTimeoutBehavior: value as Behavior })) }}
308
+ />
309
+ </div>
233
310
  </section>
234
311
  {notice !== null && <p className={notice.tone === 'ok' ? css.status : css.fieldError} role={notice.tone === 'error' ? 'alert' : 'status'}>{notice.text}</p>}
235
312
  {dirty && <div className={css.footer} id="better-ask-user-settings-footer">