@scalio-cloud/ui 0.48.0 → 0.49.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
@@ -327,6 +327,7 @@ import { AuthLayout, AuthHeader, MicrosoftButton, AuthDivider, AuthMessage, Prof
327
327
  <AuthDivider lang={lang} />
328
328
  <form>...</form>
329
329
  <AuthMessage kind="error">{error}</AuthMessage>
330
+ <DemoAccounts accounts={config.accounts} lang={lang} onPick={(a) => { setEmail(a.email); setPassword(a.password); }} />
330
331
  </AuthLayout>
331
332
 
332
333
  // Profile page: the same sections in every app, leave out what an app does not need.
@@ -337,6 +338,9 @@ import { AuthLayout, AuthHeader, MicrosoftButton, AuthDivider, AuthMessage, Prof
337
338
  <ProfileSection id="connections" lang={lang}>...</ProfileSection> // Verknüpfungen
338
339
  ```
339
340
 
341
+ `DemoAccounts` (since 0.49.0, scalio-docs ADR 0097): the demo accounts of a demo instance under the form, from
342
+ `login_info` of scalio-platform `demo` (`{demo, accounts}`); shows nothing when the list is empty.
343
+
340
344
  Content of the sections (same in every app, reference Nexus): `ProfileIdentity` in Konto, `ThemeChoice` in
341
345
  Darstellung, `LanguageChoice` + `TimezoneChoice` in Sprache und Region, `PasswordChange` + `SecurityFactors` in
342
346
  Sicherheit. The app stores the time zone (`POST /auth/preferences {timezone}`), calls `setUserTimezone()` with
package/auth.css CHANGED
@@ -193,3 +193,28 @@
193
193
  .scalio-profile-field .scalio-field-label { margin-top: 0; }
194
194
  .scalio-profile-pw .scalio-profile-help { margin-top: -0.5rem; }
195
195
  .scalio-profile-submit { align-self: flex-start; margin-top: 0; padding: 0 1rem; }
196
+
197
+ /* Demo accounts on the sign-in page of a demo instance (DemoAccounts, scalio-docs ADR 0097) */
198
+ .scalio-auth-demo {
199
+ border: 1px solid hsl(var(--border)); border-left: 3px solid hsl(var(--primary));
200
+ border-radius: 0.125rem; padding: 0.875rem 1rem; background: hsl(var(--muted) / 0.4);
201
+ }
202
+ .scalio-auth-demo-title {
203
+ font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
204
+ color: hsl(var(--primary)); margin-bottom: 0.25rem;
205
+ }
206
+ .scalio-auth-demo-hint { font-size: 0.75rem; color: hsl(var(--muted-foreground)); margin: 0 0 0.75rem; }
207
+ .scalio-auth-demo-list { display: flex; flex-direction: column; gap: 0.375rem; }
208
+ .scalio-auth-demo-account {
209
+ display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; width: 100%;
210
+ text-align: left; padding: 0.5rem 0.75rem; border: 1px solid hsl(var(--border)); border-radius: 0.125rem;
211
+ background: hsl(var(--background)); color: hsl(var(--foreground)); cursor: pointer;
212
+ }
213
+ .scalio-auth-demo-account:hover, .scalio-auth-demo-account:focus-visible { border-color: hsl(var(--primary)); outline: none; }
214
+ .scalio-auth-demo-who { display: flex; flex-direction: column; min-width: 0; }
215
+ .scalio-auth-demo-label { font-size: 0.75rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
216
+ .scalio-auth-demo-email, .scalio-auth-demo-password {
217
+ font-family: 'JetBrains Mono', monospace; font-size: 0.6875rem; color: hsl(var(--muted-foreground));
218
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
219
+ }
220
+ .scalio-auth-demo-password { flex-shrink: 0; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalio-cloud/ui",
3
- "version": "0.48.0",
3
+ "version": "0.49.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
@@ -55,6 +55,42 @@ function AppVersion({ version, url, lang, labels, className, testId }) {
55
55
  );
56
56
  }
57
57
 
58
+ // Demo accounts on the sign-in page of a demo instance (scalio-docs ADR 0097 stage/7, scalio-platform demo.login_info).
59
+ // accounts: [{ email, password, role, label_de, label_en }]; onPick(account) fills the form (or signs in).
60
+ // Nothing is shown when the list is empty, so the app can always render it.
61
+ function DemoAccounts({ accounts, onPick, lang, labels, className, testId }) {
62
+ const L = labelsFor(lang, labels);
63
+ const list = Array.isArray(accounts) ? accounts : [];
64
+ if (!list.length) return null;
65
+ const label = (a) => (lang === "en" ? a.label_en : a.label_de) || a.label || a.role;
66
+ return h(
67
+ "div",
68
+ { className: cx("scalio-auth-demo", className), "data-testid": testId || "demo-credentials" },
69
+ h("div", { className: "scalio-auth-demo-title" }, L.demoTitle),
70
+ h("p", { className: "scalio-auth-demo-hint" }, L.demoHint),
71
+ h(
72
+ "div",
73
+ { className: "scalio-auth-demo-list" },
74
+ list.map((a) =>
75
+ h(
76
+ "button",
77
+ {
78
+ key: a.email, type: "button", className: "scalio-auth-demo-account",
79
+ onClick: () => onPick && onPick(a), "data-testid": `demo-account-${a.role}`,
80
+ },
81
+ h(
82
+ "span",
83
+ { className: "scalio-auth-demo-who" },
84
+ h("span", { className: "scalio-auth-demo-label" }, label(a)),
85
+ h("span", { className: "scalio-auth-demo-email" }, a.email)
86
+ ),
87
+ h("span", { className: "scalio-auth-demo-password", title: L.demoPassword }, a.password)
88
+ )
89
+ )
90
+ )
91
+ );
92
+ }
93
+
58
94
  // brand: { mark: "N", name: "Scalio Nexus", claim, eyebrow, features: [..], color }
59
95
  // version: shown small bottom left; left out = read from /version.json, false = hidden.
60
96
  function AuthLayout(props) {
@@ -193,4 +229,4 @@ function ProfileSection({ id, title, description, lang, labels, children, testId
193
229
  );
194
230
  }
195
231
 
196
- module.exports = { AuthLayout, AppVersion, formatVersion, AuthHeader, AuthDivider, AuthMessage, MicrosoftButton, MicrosoftLogo, ProfileSection, PROFILE_SECTIONS };
232
+ module.exports = { AuthLayout, AppVersion, DemoAccounts, formatVersion, AuthHeader, AuthDivider, AuthMessage, MicrosoftButton, MicrosoftLogo, ProfileSection, PROFILE_SECTIONS };
package/react/labels.js CHANGED
@@ -13,6 +13,9 @@ const LABELS = {
13
13
  userMenu: "Benutzermenü",
14
14
  menu: "Menü",
15
15
  version: "Version",
16
+ demoTitle: "Demo",
17
+ demoHint: "Wählen Sie ein Demo-Konto. Die Demo setzt sich jede Nacht zurück.",
18
+ demoPassword: "Passwort",
16
19
  dialog: { ok: "OK", cancel: "Abbrechen", confirm: "Bestätigen", input: "Eingabe" },
17
20
  wizard: {
18
21
  step: "Schritt {n} von {total}",
@@ -577,6 +580,9 @@ const LABELS = {
577
580
  userMenu: "User menu",
578
581
  menu: "Menu",
579
582
  version: "Version",
583
+ demoTitle: "Demo",
584
+ demoHint: "Pick a demo account. The demo resets itself every night.",
585
+ demoPassword: "Password",
580
586
  dialog: { ok: "OK", cancel: "Cancel", confirm: "Confirm", input: "Input" },
581
587
  wizard: {
582
588
  step: "Step {n} of {total}",