@scalio-cloud/ui 0.46.0 → 0.47.0
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.
- package/README.md +11 -1
- package/nav.css +6 -3
- package/package.json +1 -1
- package/react/tenant.js +22 -1
- package/react/wizard.js +69 -6
package/README.md
CHANGED
|
@@ -209,6 +209,10 @@ the setup script as the way out, and the code that comes back as `#scalio_connec
|
|
|
209
209
|
app passes its own routes as `client`: `status()` (`{connected, organization, azure_tenant_id, missing, last_error}`),
|
|
210
210
|
`link()` (`{url}`), `script()` (`{script}`), `redeem(code)` and optionally `check()`. An app with a tenant list
|
|
211
211
|
creates its default tenant itself in these calls. `onChange(status)` runs after every action.
|
|
212
|
+
Several views can show the tenant at once (back from «Scalio Setup» the wizard opens over the settings page, and
|
|
213
|
+
only one of them takes the code). After a connect, check or removal a view calls `announceTenantChange()`, and
|
|
214
|
+
every view that uses `useTenantChange(reload)` reads its state again; `TenantConnectStep` does both by itself. An
|
|
215
|
+
app with its own connection block does the same, else the wizard keeps showing «Nicht verbunden».
|
|
212
216
|
|
|
213
217
|
`<FirstAdminSetup microsoft={...} codeFrom="portal" onSubmit={...} onMicrosoft={...} lang={lang} />` is the first-run
|
|
214
218
|
form «Ersten Administrator anlegen» inside `AuthLayout`, with the same texts in every app (Citadel, Beacon and Pulse
|
|
@@ -407,7 +411,13 @@ function AppWizard() {
|
|
|
407
411
|
```
|
|
408
412
|
|
|
409
413
|
Test IDs: `setup-wizard`, `wizard-stepper(-item)`, `wizard-step-{id}`, `wizard-next`, `wizard-back`, `wizard-skip`,
|
|
410
|
-
`wizard-close`, `wizard-error`, `wizard-success`, `wizard-done`, `settings-open-wizard`.
|
|
414
|
+
`wizard-body`, `wizard-actions`, `wizard-close`, `wizard-error`, `wizard-success`, `wizard-done`, `settings-open-wizard`.
|
|
415
|
+
|
|
416
|
+
Keyboard and layout (from 0.47.0): the wizard has the same height on every step; only the step scrolls, so
|
|
417
|
+
Zurück (left) and Weiter (right) never move. Enter means Weiter (not in a button, link, textarea, select or a field
|
|
418
|
+
inside its own `<form>`, not with a modifier, not while Weiter is blocked). Each step puts the focus on its first
|
|
419
|
+
field, else on Weiter; Tab stays inside the wizard; Escape closes it (when it may be closed). An app with its own
|
|
420
|
+
step dialog uses `enterMeansNext(event.target)` for the same Enter rule.
|
|
411
421
|
|
|
412
422
|
## Two-factor card and license panel (React)
|
|
413
423
|
|
package/nav.css
CHANGED
|
@@ -525,8 +525,9 @@
|
|
|
525
525
|
|
|
526
526
|
/* Setup wizard (SetupWizard, ADR 0060): design of the Nexus wizard, first built in Kontor */
|
|
527
527
|
.scalio-wizard-root { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgb(0 0 0 / 0.5); }
|
|
528
|
+
/* Same height on every step (Markus 2026-11-07): only the step scrolls, Zurück and Weiter stay where they are. */
|
|
528
529
|
.scalio-wizard {
|
|
529
|
-
display: flex; flex-direction: column; gap: 1rem; width: calc(100vw - 2rem); max-width: 42rem;
|
|
530
|
+
display: flex; flex-direction: column; gap: 1rem; width: calc(100vw - 2rem); max-width: 42rem; height: min(46rem, 90vh); overflow: hidden;
|
|
530
531
|
padding: 1.5rem; border: 1px solid hsl(var(--border)); border-radius: 2px; background: hsl(var(--background)); color: hsl(var(--foreground));
|
|
531
532
|
box-shadow: 0 16px 40px rgb(0 0 0 / 0.25); font-size: 0.875rem;
|
|
532
533
|
}
|
|
@@ -550,9 +551,11 @@
|
|
|
550
551
|
.scalio-wizard-step { display: flex; flex-direction: column; gap: 0.75rem; }
|
|
551
552
|
.scalio-wizard-step-title { margin: 0; font-size: 0.875rem; font-weight: 700; }
|
|
552
553
|
.scalio-wizard-text { margin: 0; color: hsl(var(--muted-foreground)); }
|
|
553
|
-
.scalio-wizard
|
|
554
|
+
.scalio-wizard:focus { outline: none; }
|
|
555
|
+
.scalio-wizard-body { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 1rem; overflow-y: auto; }
|
|
556
|
+
.scalio-wizard-actions { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 0.5rem; padding-top: 1rem; border-top: 1px solid hsl(var(--border)); }
|
|
554
557
|
.scalio-wizard-actions-right { display: flex; align-items: center; gap: 0.5rem; }
|
|
555
|
-
.scalio-wizard-success { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; padding: 1.5rem 0; text-align: center; }
|
|
558
|
+
.scalio-wizard-success { display: flex; flex: 1 1 auto; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem; padding: 1.5rem 0; text-align: center; }
|
|
556
559
|
.scalio-wizard-success .scalio-wizard-step-title { font-size: 1.125rem; }
|
|
557
560
|
.scalio-wizard-success .scalio-wizard-text { max-width: 28rem; }
|
|
558
561
|
.scalio-wizard-success .scalio-btn { margin-top: 0.5rem; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalio-cloud/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"description": "Scalio Control Room design tokens, Tailwind preset, self-hosted fonts, the shared app header, sign-in layout, sidebar and page blocks",
|
|
5
5
|
"license": "SEE LICENSE IN README.md",
|
|
6
6
|
"private": false,
|
package/react/tenant.js
CHANGED
|
@@ -28,6 +28,24 @@ function takeConnectCode() {
|
|
|
28
28
|
return decodeURIComponent(m[1]);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
// Several views can show the same tenant at once: back from «Scalio Setup» the wizard opens over the settings page.
|
|
32
|
+
// Only one of them takes the code, so whoever changes the connection announces it and every view reloads its state.
|
|
33
|
+
const TENANT_EVENT = "scalio:tenant-changed";
|
|
34
|
+
function announceTenantChange(detail) {
|
|
35
|
+
if (typeof window === "undefined" || typeof window.dispatchEvent !== "function") return;
|
|
36
|
+
window.dispatchEvent(new window.CustomEvent(TENANT_EVENT, { detail: detail || {} }));
|
|
37
|
+
}
|
|
38
|
+
function useTenantChange(onChange) {
|
|
39
|
+
const ref = React.useRef(onChange);
|
|
40
|
+
ref.current = onChange;
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
if (typeof window === "undefined" || typeof window.addEventListener !== "function") return undefined;
|
|
43
|
+
const fn = (e) => ref.current && ref.current(e.detail || {});
|
|
44
|
+
window.addEventListener(TENANT_EVENT, fn);
|
|
45
|
+
return () => window.removeEventListener(TENANT_EVENT, fn);
|
|
46
|
+
}, []);
|
|
47
|
+
}
|
|
48
|
+
|
|
31
49
|
function TenantConnectStep({ client, app = "Scalio", lang, labels, onChange, showLater = true }) {
|
|
32
50
|
const L = labelsFor(lang, labels);
|
|
33
51
|
const [st, setSt] = React.useState(null);
|
|
@@ -40,6 +58,8 @@ function TenantConnectStep({ client, app = "Scalio", lang, labels, onChange, sho
|
|
|
40
58
|
() => client.status().then((d) => (setSt(d || {}), d)).catch((err) => (setError(errorText(err)), setSt({}))),
|
|
41
59
|
[client]
|
|
42
60
|
);
|
|
61
|
+
const self = React.useRef({});
|
|
62
|
+
useTenantChange((d) => { if (d.from !== self.current) load(); });
|
|
43
63
|
const run = async (kind, fn, ok) => {
|
|
44
64
|
setBusy(kind);
|
|
45
65
|
setError("");
|
|
@@ -53,6 +73,7 @@ function TenantConnectStep({ client, app = "Scalio", lang, labels, onChange, sho
|
|
|
53
73
|
setBusy("");
|
|
54
74
|
}
|
|
55
75
|
const d = await load();
|
|
76
|
+
if (kind !== "link" && kind !== "script") announceTenantChange({ from: self.current });
|
|
56
77
|
if (onChange) onChange(d);
|
|
57
78
|
};
|
|
58
79
|
const redeem = (value) => run("code", async () => {
|
|
@@ -131,4 +152,4 @@ function TenantConnectStep({ client, app = "Scalio", lang, labels, onChange, sho
|
|
|
131
152
|
);
|
|
132
153
|
}
|
|
133
154
|
|
|
134
|
-
module.exports = { TenantConnectStep, takeConnectCode };
|
|
155
|
+
module.exports = { TenantConnectStep, takeConnectCode, announceTenantChange, useTenantChange, TENANT_EVENT };
|
package/react/wizard.js
CHANGED
|
@@ -100,6 +100,35 @@ function useSetupWizard(opts) {
|
|
|
100
100
|
return { state, open, setOpen, step, setStep, reload, props };
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
const FIELDS = 'input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled])';
|
|
104
|
+
const FOCUSABLE = 'a[href], button:not([disabled]), input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
105
|
+
|
|
106
|
+
// Enter means Weiter unless the element has its own Enter: a button or link, a multi-line field, a select, an
|
|
107
|
+
// editable area, or a field inside its own form (e.g. «Verbindungscode einfügen» submits that form).
|
|
108
|
+
function enterMeansNext(el) {
|
|
109
|
+
if (!el || !el.tagName) return true;
|
|
110
|
+
const tag = el.tagName.toLowerCase();
|
|
111
|
+
if (tag === "button" || tag === "a" || tag === "textarea" || tag === "select" || tag === "summary") return false;
|
|
112
|
+
if (el.isContentEditable) return false;
|
|
113
|
+
if (tag === "input" && /^(button|submit|reset|checkbox|radio|file|color|range)$/i.test(el.type || "")) return false;
|
|
114
|
+
if (el.closest && el.closest("form")) return false;
|
|
115
|
+
const role = el.getAttribute && el.getAttribute("role");
|
|
116
|
+
if (role && /^(button|link|combobox|listbox|option|menuitem|tab|switch|checkbox|radio)$/.test(role)) return false;
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Tab from the last element goes to the first and Shift+Tab back, so the focus never leaves the open wizard.
|
|
121
|
+
function trapTab(e, root) {
|
|
122
|
+
if (!root) return;
|
|
123
|
+
const items = [...root.querySelectorAll(FOCUSABLE)].filter((n) => !n.closest("[hidden]"));
|
|
124
|
+
if (items.length === 0) return;
|
|
125
|
+
const first = items[0];
|
|
126
|
+
const last = items[items.length - 1];
|
|
127
|
+
const at = document.activeElement;
|
|
128
|
+
if (e.shiftKey && (at === first || at === root)) { e.preventDefault(); last.focus(); }
|
|
129
|
+
else if (!e.shiftKey && at === last) { e.preventDefault(); first.focus(); }
|
|
130
|
+
}
|
|
131
|
+
|
|
103
132
|
function StepDot({ index, current }) {
|
|
104
133
|
const cls = index < current ? "is-done" : index === current ? "is-current" : "";
|
|
105
134
|
return h("span", { className: `scalio-wizard-dot ${cls}`.trim() }, index < current ? h(Icons.Check, { width: 14, height: 14 }) : index + 1);
|
|
@@ -130,6 +159,22 @@ function SetupWizard(props) {
|
|
|
130
159
|
return () => window.removeEventListener("keydown", onKey);
|
|
131
160
|
}, [open, onClose, busy]);
|
|
132
161
|
|
|
162
|
+
// Keyboard (Markus 2026-11-07): focus moves into each new step (first field, else Weiter), Tab stays inside.
|
|
163
|
+
const panel = React.useRef(null);
|
|
164
|
+
React.useEffect(() => {
|
|
165
|
+
if (!open || !panel.current) return undefined;
|
|
166
|
+
const before = document.activeElement;
|
|
167
|
+
return () => { if (before && typeof before.focus === "function" && document.contains(before)) before.focus(); };
|
|
168
|
+
}, [open]);
|
|
169
|
+
React.useEffect(() => {
|
|
170
|
+
const root = panel.current;
|
|
171
|
+
if (!open || !root) return;
|
|
172
|
+
if (finished) return; // the success view focuses «Fertig» itself
|
|
173
|
+
const field = root.querySelector(`[data-wizard-step] ${FIELDS}`);
|
|
174
|
+
const target = field || root.querySelector('[data-testid="wizard-next"]:not([disabled])') || root;
|
|
175
|
+
if (target && typeof target.focus === "function") target.focus();
|
|
176
|
+
}, [open, index, finished]);
|
|
177
|
+
|
|
133
178
|
if (!open || !current) return null;
|
|
134
179
|
|
|
135
180
|
async function next(save) {
|
|
@@ -178,6 +223,9 @@ function SetupWizard(props) {
|
|
|
178
223
|
: h(
|
|
179
224
|
React.Fragment,
|
|
180
225
|
null,
|
|
226
|
+
h(
|
|
227
|
+
"div",
|
|
228
|
+
{ className: "scalio-wizard-body", "data-testid": "wizard-body" },
|
|
181
229
|
h(
|
|
182
230
|
"ol",
|
|
183
231
|
{ className: "scalio-wizard-stepper", "data-testid": "wizard-stepper" },
|
|
@@ -194,16 +242,17 @@ function SetupWizard(props) {
|
|
|
194
242
|
h("p", { className: "scalio-wizard-count" }, L.step.replace("{n}", String(index + 1)).replace("{total}", String(list.length))),
|
|
195
243
|
h(
|
|
196
244
|
"section",
|
|
197
|
-
{ className: "scalio-wizard-step", "data-testid": `wizard-step-${current.id}
|
|
245
|
+
{ className: "scalio-wizard-step", "data-testid": `wizard-step-${current.id}`, "data-wizard-step": "" },
|
|
198
246
|
h("div", null,
|
|
199
247
|
h("h3", { className: "scalio-wizard-step-title" }, current.title),
|
|
200
248
|
current.description ? h("p", { className: "scalio-wizard-text" }, current.description) : null),
|
|
201
249
|
current.content
|
|
202
250
|
),
|
|
203
|
-
error ? h(Notice, { kind: "error", icon: false, testId: "wizard-error", lang: props.lang }, error) : null
|
|
251
|
+
error ? h(Notice, { kind: "error", icon: false, testId: "wizard-error", lang: props.lang }, error) : null
|
|
252
|
+
),
|
|
204
253
|
h(
|
|
205
254
|
"div",
|
|
206
|
-
{ className: "scalio-wizard-actions" },
|
|
255
|
+
{ className: "scalio-wizard-actions", "data-testid": "wizard-actions" },
|
|
207
256
|
left
|
|
208
257
|
? h("button", { type: "button", className: "scalio-btn", onClick: left.onClick, disabled: busy, "data-testid": "wizard-back" }, left.label)
|
|
209
258
|
: h("span", null),
|
|
@@ -215,7 +264,7 @@ function SetupWizard(props) {
|
|
|
215
264
|
: null,
|
|
216
265
|
h(
|
|
217
266
|
"button",
|
|
218
|
-
{ type: "button", className: "scalio-btn is-primary", onClick: () => next(true), disabled: busy || current.canNext === false, "data-testid": "wizard-next" },
|
|
267
|
+
{ type: "button", className: "scalio-btn is-primary", onClick: () => next(true), disabled: busy || current.canNext === false, "data-testid": "wizard-next", "aria-keyshortcuts": "Enter" },
|
|
219
268
|
busy ? h("span", { className: "scalio-spinner", "aria-hidden": "true" }) : null,
|
|
220
269
|
last ? L.finish : L.next
|
|
221
270
|
)
|
|
@@ -223,10 +272,24 @@ function SetupWizard(props) {
|
|
|
223
272
|
)
|
|
224
273
|
);
|
|
225
274
|
|
|
275
|
+
function onKeyDown(e) {
|
|
276
|
+
if (e.key === "Tab") return trapTab(e, panel.current);
|
|
277
|
+
if (e.key !== "Enter" || finished || busy || e.defaultPrevented || e.isComposing) return;
|
|
278
|
+
if (e.shiftKey || e.ctrlKey || e.altKey || e.metaKey) return;
|
|
279
|
+
if (!enterMeansNext(e.target)) return;
|
|
280
|
+
if (current.canNext === false) return;
|
|
281
|
+
e.preventDefault();
|
|
282
|
+
next(true);
|
|
283
|
+
}
|
|
284
|
+
|
|
226
285
|
return h(
|
|
227
286
|
"div",
|
|
228
287
|
{ className: "scalio-wizard-root", onMouseDown: (e) => { if (e.target === e.currentTarget && !busy && onClose) onClose(); } },
|
|
229
|
-
h("div", {
|
|
288
|
+
h("div", {
|
|
289
|
+
ref: panel, tabIndex: -1, onKeyDown,
|
|
290
|
+
role: "dialog", "aria-modal": "true", "aria-label": title,
|
|
291
|
+
className: wide ? "scalio-wizard is-wide" : "scalio-wizard", "data-testid": testId || "setup-wizard",
|
|
292
|
+
}, head, body)
|
|
230
293
|
);
|
|
231
294
|
}
|
|
232
295
|
|
|
@@ -236,4 +299,4 @@ function SetupWizardButton({ lang, labels, testId, className }) {
|
|
|
236
299
|
return h("button", { type: "button", className: className || "scalio-btn", onClick: () => openSetupWizard(0), "data-testid": testId || "settings-open-wizard", title: L.openHint }, L.open);
|
|
237
300
|
}
|
|
238
301
|
|
|
239
|
-
module.exports = { SetupWizard, SetupWizardButton, useSetupWizard, setupWizardApi, normalizeWizardState, openSetupWizard, OPEN_SETUP_WIZARD };
|
|
302
|
+
module.exports = { SetupWizard, SetupWizardButton, useSetupWizard, setupWizardApi, normalizeWizardState, openSetupWizard, OPEN_SETUP_WIZARD, enterMeansNext };
|