@scalio-cloud/ui 0.90.0 → 0.91.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/package.json +1 -1
- package/react/license.js +6 -6
- package/react/mail.js +5 -4
- package/react/nav.js +13 -1
- package/react/saas_updates.js +6 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalio-cloud/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.91.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/license.js
CHANGED
|
@@ -271,12 +271,12 @@ function LicensePanel(props) {
|
|
|
271
271
|
: m.managed
|
|
272
272
|
? null
|
|
273
273
|
: h(
|
|
274
|
-
"
|
|
275
|
-
{ key: "form", className: "scalio-license-form" },
|
|
274
|
+
"form",
|
|
275
|
+
{ key: "form", className: "scalio-license-form", onSubmit: (e) => { e.preventDefault(); if (!busy && addon.trim()) addAddon(); } },
|
|
276
276
|
h("textarea", { className: "scalio-input scalio-textarea", rows: 2, value: addon, placeholder: L.addonPlaceholder, disabled: busy,
|
|
277
277
|
"aria-label": L.addonPlaceholder, "data-testid": "license-addon-input", onChange: (e) => setAddon(e.target.value) }),
|
|
278
278
|
h("div", { className: "scalio-license-actions" },
|
|
279
|
-
h("button", { type: "
|
|
279
|
+
h("button", { type: "submit", className: "scalio-btn is-primary", disabled: busy || !addon.trim(), "data-testid": "license-addon-add" },
|
|
280
280
|
h(Icons.Plus, { className: "scalio-icon" }), L.add))
|
|
281
281
|
),
|
|
282
282
|
];
|
|
@@ -284,14 +284,14 @@ function LicensePanel(props) {
|
|
|
284
284
|
const keyCard = m.keyReadOnly
|
|
285
285
|
? h("div", { className: "scalio-notice is-info", "data-testid": "license-key-readonly" }, m.keyReadOnly)
|
|
286
286
|
: h(
|
|
287
|
-
"
|
|
288
|
-
{ className: "scalio-license-form" },
|
|
287
|
+
"form",
|
|
288
|
+
{ className: "scalio-license-form", onSubmit: (e) => { e.preventDefault(); if (!busy && key.trim()) activate(); } },
|
|
289
289
|
h("textarea", { className: "scalio-input scalio-textarea", rows: 3, value: key, placeholder: L.keyPlaceholder, disabled: busy,
|
|
290
290
|
"aria-label": L.keyPlaceholder, "data-testid": "license-key-input", onChange: (e) => setKey(e.target.value) }),
|
|
291
291
|
h(
|
|
292
292
|
"div",
|
|
293
293
|
{ className: "scalio-license-actions" },
|
|
294
|
-
h("button", { type: "
|
|
294
|
+
h("button", { type: "submit", className: "scalio-btn is-primary", disabled: busy || !key.trim(), "data-testid": "license-activate" },
|
|
295
295
|
h(Icons.ShieldCheck, { className: "scalio-icon" }), L.activate),
|
|
296
296
|
m.keyPresent
|
|
297
297
|
? h("button", { type: "button", className: "scalio-btn is-danger", disabled: busy, onClick: remove, "data-testid": "license-remove" },
|
package/react/mail.js
CHANGED
|
@@ -752,7 +752,7 @@ function MailTemplates(props) {
|
|
|
752
752
|
}
|
|
753
753
|
setBusy(false);
|
|
754
754
|
};
|
|
755
|
-
const
|
|
755
|
+
const saveTemplate = () => run(async () => apply(await client.saveTemplate(kind, tlang, { subject, body }), kind, tlang), L.templateSaved);
|
|
756
756
|
const reset = () => run(async () => apply(await client.resetTemplate(kind, tlang), kind, tlang), L.templateReset);
|
|
757
757
|
const testMe = () => run(() => client.testTemplate({ kind, lang: tlang, subject, body }), (r) => L.testSent.replace("{to}", (r && r.to) || ""));
|
|
758
758
|
const toggle = (on) => run(async () => {
|
|
@@ -767,9 +767,10 @@ function MailTemplates(props) {
|
|
|
767
767
|
: h("textarea", { id: "mail-template-body", className: "scalio-input scalio-textarea scalio-mail-body", rows: 14, value: body, maxLength: 50000,
|
|
768
768
|
"data-testid": "mail-template-body", onChange: (e) => setBody(e.target.value) });
|
|
769
769
|
|
|
770
|
+
const onSubmit = (e) => { e.preventDefault(); if (!busy && subject.trim() && body.trim()) saveTemplate(); };
|
|
770
771
|
return section(h(
|
|
771
|
-
"
|
|
772
|
-
{ className: "scalio-settings-form" },
|
|
772
|
+
"form",
|
|
773
|
+
{ className: "scalio-settings-form", onSubmit },
|
|
773
774
|
provider === "off" ? h("div", { className: "scalio-notice is-info", "data-testid": "mail-templates-off" }, L.off) : null,
|
|
774
775
|
h("div", { className: "scalio-mail-grid" },
|
|
775
776
|
h(Field, { id: "mail-template-kind", label: L.kind, hint: meta.description[lang === "en" ? "en" : "de"] },
|
|
@@ -810,7 +811,7 @@ function MailTemplates(props) {
|
|
|
810
811
|
: null,
|
|
811
812
|
h("button", { type: "button", className: "scalio-btn", onClick: testMe, disabled: busy || provider === "off", "data-testid": "mail-template-test" },
|
|
812
813
|
h(Icons.CornerDownLeft, { className: "scalio-icon" }), L.testToMe),
|
|
813
|
-
h("button", { type: "
|
|
814
|
+
h("button", { type: "submit", className: "scalio-btn is-primary", disabled: busy || !subject.trim() || !body.trim(), "data-testid": "mail-template-save" },
|
|
814
815
|
h(Icons.Check, { className: "scalio-icon" }), L.saveTemplate))
|
|
815
816
|
));
|
|
816
817
|
}
|
package/react/nav.js
CHANGED
|
@@ -512,14 +512,26 @@ function SupportDrawer({ open, onClose, onSubmit, client, page, context, lang, l
|
|
|
512
512
|
const [description, setDescription] = React.useState("");
|
|
513
513
|
const [busy, setBusy] = React.useState(false);
|
|
514
514
|
const [error, setError] = React.useState("");
|
|
515
|
+
const panel = React.useRef(null);
|
|
516
|
+
// ADR 0095 K2: Escape closes, Tab stays inside the drawer.
|
|
515
517
|
React.useEffect(() => {
|
|
516
518
|
if (!open) return undefined;
|
|
517
519
|
function onKey(e) {
|
|
518
520
|
if (e.key === "Escape" && onClose) onClose();
|
|
521
|
+
else if (e.key === "Tab") require("./wizard").trapTab(e, panel.current);
|
|
519
522
|
}
|
|
520
523
|
document.addEventListener("keydown", onKey);
|
|
521
524
|
return () => document.removeEventListener("keydown", onKey);
|
|
522
525
|
}, [open, onClose]);
|
|
526
|
+
// The focus moves into the drawer on open and returns to the trigger on close.
|
|
527
|
+
React.useEffect(() => {
|
|
528
|
+
if (!open) return undefined;
|
|
529
|
+
const before = document.activeElement;
|
|
530
|
+
const node = panel.current;
|
|
531
|
+
const first = node && (node.querySelector("input,textarea") || node.querySelector("button"));
|
|
532
|
+
if (first) first.focus();
|
|
533
|
+
return () => { if (before && typeof before.focus === "function" && document.contains(before)) before.focus(); };
|
|
534
|
+
}, [open]);
|
|
523
535
|
if (!open) return null;
|
|
524
536
|
const submit = async (e) => {
|
|
525
537
|
e.preventDefault();
|
|
@@ -542,7 +554,7 @@ function SupportDrawer({ open, onClose, onSubmit, client, page, context, lang, l
|
|
|
542
554
|
h("div", { className: "scalio-drawer-backdrop", onClick: onClose }),
|
|
543
555
|
h(
|
|
544
556
|
"div",
|
|
545
|
-
{ className: "scalio-support", role: "dialog", "aria-modal": "true", "aria-label": L.supportTitle, "data-testid": "scalio-support-drawer" },
|
|
557
|
+
{ ref: panel, className: "scalio-support", role: "dialog", "aria-modal": "true", "aria-label": L.supportTitle, "data-testid": "scalio-support-drawer" },
|
|
546
558
|
h(
|
|
547
559
|
"div",
|
|
548
560
|
{ className: "scalio-support-head" },
|
package/react/saas_updates.js
CHANGED
|
@@ -424,11 +424,11 @@ function SaasUpdatesPanel(props) {
|
|
|
424
424
|
h(Icons.Download, { className: "scalio-icon" }), L.now)));
|
|
425
425
|
// Postponing only makes sense against a deadline; a pre-release has none.
|
|
426
426
|
if (offer.due_at || !pre) rows.push(h(Field, { key: "post", id: "saas-updates-until", label: L.postpone },
|
|
427
|
-
h("
|
|
427
|
+
h("form", { style: { display: "flex", gap: "0.5rem" },
|
|
428
|
+
onSubmit: (e) => { e.preventDefault(); if (!busy && until) act("postpone", { until: new Date(`${until}T00:00:00`).toISOString() }); } },
|
|
428
429
|
h("input", { id: "saas-updates-until", type: "date", className: "scalio-input", value: until, max: due, disabled: busy,
|
|
429
430
|
"data-testid": "saas-updates-until", onChange: (e) => setUntil(e.target.value) }),
|
|
430
|
-
h("button", { type: "
|
|
431
|
-
onClick: () => act("postpone", { until: new Date(`${until}T00:00:00`).toISOString() }) }, L.postponeGo))));
|
|
431
|
+
h("button", { type: "submit", className: "scalio-btn", disabled: busy || !until, "data-testid": "saas-updates-postpone" }, L.postponeGo))));
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
if (preSwitch) rows.push(preSwitch);
|
|
@@ -439,6 +439,7 @@ function SaasUpdatesPanel(props) {
|
|
|
439
439
|
h("span", null, m === "auto" ? L.modeAuto : L.modeManual)))));
|
|
440
440
|
const toggleDay = (d) => setWin(Object.assign({}, win, { days: win.days.includes(d) ? win.days.filter((x) => x !== d) : win.days.concat([d]).sort() }));
|
|
441
441
|
rows.push(h(Field, { key: "win", label: `${L.window} (${st.own_window ? L.ownWindow : L.defaultWindow})`, hint: L.windowHint },
|
|
442
|
+
h("form", { onSubmit: (e) => { e.preventDefault(); if (!busy) act("window", { window: win }); } },
|
|
442
443
|
h("div", { className: "scalio-settings-text" }, L.days),
|
|
443
444
|
h("div", { style: { display: "flex", flexWrap: "wrap", gap: "0.75rem" } },
|
|
444
445
|
L.weekdays.map((name, d) => h("label", { key: d, className: "scalio-settings-check" },
|
|
@@ -452,8 +453,8 @@ function SaasUpdatesPanel(props) {
|
|
|
452
453
|
h("label", null, L.tz, " ", h("input", { className: "scalio-input", value: win.tz, disabled: busy, "data-testid": "saas-updates-tz",
|
|
453
454
|
onChange: (e) => setWin(Object.assign({}, win, { tz: e.target.value })) }))),
|
|
454
455
|
h("div", { className: "scalio-settings-section-footer" },
|
|
455
|
-
h("button", { type: "
|
|
456
|
-
st.own_window ? h("button", { type: "button", className: "scalio-btn", disabled: busy, "data-testid": "saas-updates-default-window", onClick: () => act("window", {}) }, L.useDefault) : null)));
|
|
456
|
+
h("button", { type: "submit", className: "scalio-btn", disabled: busy, "data-testid": "saas-updates-save-window" }, L.save),
|
|
457
|
+
st.own_window ? h("button", { type: "button", className: "scalio-btn", disabled: busy, "data-testid": "saas-updates-default-window", onClick: () => act("window", {}) }, L.useDefault) : null))));
|
|
457
458
|
if (st.last) rows.push(h(Field, { key: "last", label: L.last },
|
|
458
459
|
h("div", { className: "scalio-settings-text", "data-testid": "saas-updates-last" },
|
|
459
460
|
fill(st.last.state === "done" ? L.lastDone : L.lastError, { version: st.last.version, at: when(st.last.at, props.lang) }))));
|