@scalio-cloud/ui 0.45.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 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
@@ -315,6 +319,8 @@ import { AuthLayout, AuthHeader, MicrosoftButton, AuthDivider, AuthMessage, Prof
315
319
  lang={lang} onLangChange={setLang} // top right
316
320
  theme={theme} onThemeChange={setTheme} // optional
317
321
  footer={<VersionTag version={v} />} // optional
322
+ // version: shown small bottom left in every app. Left out = read from /version.json (written by the
323
+ // frontend image), a string = that version, false = hidden.
318
324
  >
319
325
  <AuthHeader eyebrow="Zugang" title="Anmelden" subtitle="..." />
320
326
  <MicrosoftButton href="/api/auth/sso/login" lang={lang} disabled={!ssoReady} hint="..." />
@@ -405,7 +411,13 @@ function AppWizard() {
405
411
  ```
406
412
 
407
413
  Test IDs: `setup-wizard`, `wizard-stepper(-item)`, `wizard-step-{id}`, `wizard-next`, `wizard-back`, `wizard-skip`,
408
- `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.
409
421
 
410
422
  ## Two-factor card and license panel (React)
411
423
 
package/auth.css CHANGED
@@ -53,6 +53,14 @@
53
53
  font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
54
54
  }
55
55
 
56
+ /* App version bottom left: on the dark brand panel from 1024px, on the page below. */
57
+ .scalio-auth { position: relative; }
58
+ .scalio-auth-version {
59
+ position: absolute; left: 1rem; bottom: 0.75rem; z-index: 1; pointer-events: none;
60
+ color: #71717a; font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.08em;
61
+ }
62
+ @media (min-width: 1024px) { .scalio-auth-version { left: 3rem; bottom: 1rem; } }
63
+
56
64
  .scalio-auth-main { position: relative; display: flex; flex-direction: column; min-width: 0; }
57
65
  .scalio-auth-top { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 1rem; min-height: 4.25rem; }
58
66
  .scalio-auth-body { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 0 1.5rem 2rem; }
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; max-height: 90vh; overflow-y: auto;
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-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.5rem; }
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.45.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/auth.js CHANGED
@@ -19,7 +19,44 @@ function BrandMark({ brand, className }) {
19
19
  );
20
20
  }
21
21
 
22
+ // "1.4.0" -> "v1.4.0"; dev builds ("dev-1a2b3c4") and other names stay as they are.
23
+ function formatVersion(v) {
24
+ const s = String(v || "").trim();
25
+ return /^\d/.test(s) ? `v${s}` : s;
26
+ }
27
+
28
+ // Reads the build of this frontend from /version.json ({version, commit, build_date}, written by every
29
+ // app's frontend image). Gives "" while loading or when the file is missing (local vite run).
30
+ function useAppVersion(given, url) {
31
+ const [v, setV] = React.useState(typeof given === "string" ? given : "");
32
+ React.useEffect(() => {
33
+ if (typeof given === "string") { setV(given); return undefined; }
34
+ if (given === false || typeof fetch !== "function") return undefined;
35
+ let alive = true;
36
+ fetch(url || "/version.json", { cache: "no-store" })
37
+ .then((r) => (r.ok ? r.json() : null))
38
+ .then((d) => { if (alive && d && d.version) setV(String(d.version)); })
39
+ .catch(() => {});
40
+ return () => { alive = false; };
41
+ }, [given, url]);
42
+ return v;
43
+ }
44
+
45
+ // Small version bottom left of the sign-in page. version: a string, false (hidden), or left out
46
+ // (read from /version.json).
47
+ function AppVersion({ version, url, lang, labels, className, testId }) {
48
+ const L = labelsFor(lang, labels);
49
+ const v = useAppVersion(version, url);
50
+ if (!v) return null;
51
+ return h(
52
+ "div",
53
+ { className: cx("scalio-auth-version", className), title: `${L.version} ${v}`, "data-testid": testId || "auth-version" },
54
+ formatVersion(v)
55
+ );
56
+ }
57
+
22
58
  // brand: { mark: "N", name: "Scalio Nexus", claim, eyebrow, features: [..], color }
59
+ // version: shown small bottom left; left out = read from /version.json, false = hidden.
23
60
  function AuthLayout(props) {
24
61
  const brand = props.brand || {};
25
62
  const L = labelsFor(props.lang, props.labels);
@@ -73,7 +110,8 @@ function AuthLayout(props) {
73
110
  )
74
111
  ),
75
112
  props.footer ? h("div", { className: "scalio-auth-footer", "aria-label": L.version }, props.footer) : null
76
- )
113
+ ),
114
+ h(AppVersion, { version: props.version, url: props.versionUrl, lang: props.lang, labels: props.labels })
77
115
  );
78
116
  }
79
117
 
@@ -155,4 +193,4 @@ function ProfileSection({ id, title, description, lang, labels, children, testId
155
193
  );
156
194
  }
157
195
 
158
- module.exports = { AuthLayout, AuthHeader, AuthDivider, AuthMessage, MicrosoftButton, MicrosoftLogo, ProfileSection, PROFILE_SECTIONS };
196
+ module.exports = { AuthLayout, AppVersion, formatVersion, AuthHeader, AuthDivider, AuthMessage, MicrosoftButton, MicrosoftLogo, ProfileSection, PROFILE_SECTIONS };
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", { role: "dialog", "aria-modal": "true", "aria-label": title, className: wide ? "scalio-wizard is-wide" : "scalio-wizard", "data-testid": testId || "setup-wizard" }, head, body)
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 };