@scalio-cloud/ui 0.49.1 → 0.50.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 +13 -0
- package/base.css +9 -0
- package/package.json +1 -1
- package/react/index.js +1 -1
- package/react/keyboard.js +36 -0
package/README.md
CHANGED
|
@@ -439,6 +439,19 @@ Test IDs: `confirm-dialog`, `confirm-dialog-ok`, `confirm-dialog-cancel`, `confi
|
|
|
439
439
|
with `askConfirm` and then shows `UpdateProgress` (`saas-update-progress`): it polls `/version.json` (props
|
|
440
440
|
`versionUrl`, `checkVersion`, `pollMs` 5 s, `timeoutMs` 20 min) and reloads the page once the new version runs.
|
|
441
441
|
|
|
442
|
+
## Keyboard: rows and focus ring (from 0.50.0)
|
|
443
|
+
|
|
444
|
+
ADR 0095 `kbd/K4`: a row that opens with a click is reachable with Tab and opens with Enter or Space. Spread
|
|
445
|
+
`rowOpenProps` on the row; a click or Enter on a button, link or field inside the row stays with that control:
|
|
446
|
+
|
|
447
|
+
```js
|
|
448
|
+
import { rowOpenProps } from "@scalio-cloud/ui/react";
|
|
449
|
+
<tr key={t.id} {...rowOpenProps(() => navigate(`/tickets/${t.key}`), { label: `${t.key} öffnen` })}>…</tr>
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
`kbd/K5`: `base.css` draws a focus ring (`--ring`, 2px) on every link, button, field, `summary` and element with
|
|
453
|
+
`tabindex` that has no focus style of its own. The rule uses `:where()` (no specificity), so any own style wins.
|
|
454
|
+
|
|
442
455
|
## Two-factor card and license panel (React)
|
|
443
456
|
|
|
444
457
|
The same backend routes in every app, so the apps pass only their axios instance and a few helpers.
|
package/base.css
CHANGED
|
@@ -10,3 +10,12 @@ h1, h2, h3, h4, .font-display {
|
|
|
10
10
|
code, pre, kbd, .font-mono {
|
|
11
11
|
font-family: 'JetBrains Mono', ui-monospace, monospace;
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
/* Keyboard (ADR 0095 kbd/K5): every control shows where the focus is. :where() has no specificity, so a component's
|
|
15
|
+
own focus style wins; this is the fallback for controls without one. Never remove it without a replacement. */
|
|
16
|
+
:where(a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
|
|
17
|
+
outline: 2px solid hsl(var(--ring));
|
|
18
|
+
outline-offset: 2px;
|
|
19
|
+
}
|
|
20
|
+
.scalio-row-open { cursor: pointer; }
|
|
21
|
+
.scalio-row-open:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: -2px; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalio-cloud/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.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/index.js
CHANGED
|
@@ -378,6 +378,6 @@ module.exports = {
|
|
|
378
378
|
TEST_IDS,
|
|
379
379
|
initials,
|
|
380
380
|
};
|
|
381
|
-
Object.assign(module.exports, Nav, Blocks, require("./settings"), require("./support"), require("./beacon"), require("./security"), require("./license"), require("./palette"), require("./unify"), require("./profile"), require("./actions"), require("./selftest"), require("./users"), require("./customers"), require("./roles"), require("./wizard"), require("./maintenance"), require("./backup"), require("./audit"), require("./mail"), require("./saas_updates"), require("./pages"), require("./tenant"), require("./fields"), require("./dialog"));
|
|
381
|
+
Object.assign(module.exports, Nav, Blocks, require("./settings"), require("./support"), require("./beacon"), require("./security"), require("./license"), require("./palette"), require("./unify"), require("./profile"), require("./actions"), require("./selftest"), require("./users"), require("./customers"), require("./roles"), require("./wizard"), require("./maintenance"), require("./backup"), require("./audit"), require("./mail"), require("./saas_updates"), require("./pages"), require("./tenant"), require("./fields"), require("./dialog"), require("./keyboard"));
|
|
382
382
|
// After the exports above: auth.js uses LanguageToggle and ThemeToggle from this module.
|
|
383
383
|
Object.assign(module.exports, require("./auth"), require("./session"), require("./setup"), require("./clientErrors"));
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Keyboard standard of ADR 0095. kbd/K4: a row (table row, list entry, card) that opens with a click is reachable
|
|
3
|
+
// with Tab and opens with Enter or Space. Use it as <tr {...rowOpenProps(() => open(t), { label })}>.
|
|
4
|
+
|
|
5
|
+
const INTERACTIVE = "a,button,input,select,textarea,summary,label,[role=button],[role=link],[contenteditable]";
|
|
6
|
+
|
|
7
|
+
// Whether the event comes from a control inside the row (that control handles it itself).
|
|
8
|
+
function fromInner(e) {
|
|
9
|
+
const t = e.target;
|
|
10
|
+
if (!t || t === e.currentTarget || typeof t.closest !== "function") return false;
|
|
11
|
+
const hit = t.closest(INTERACTIVE);
|
|
12
|
+
return !!hit && hit !== e.currentTarget && e.currentTarget.contains(hit);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function rowOpenProps(onOpen, opts) {
|
|
16
|
+
if (typeof onOpen !== "function") return {};
|
|
17
|
+
const o = opts || {};
|
|
18
|
+
const props = {
|
|
19
|
+
tabIndex: 0,
|
|
20
|
+
onClick(e) {
|
|
21
|
+
if (fromInner(e)) return;
|
|
22
|
+
onOpen(e);
|
|
23
|
+
},
|
|
24
|
+
onKeyDown(e) {
|
|
25
|
+
if (e.key !== "Enter" && e.key !== " ") return;
|
|
26
|
+
if (e.target !== e.currentTarget || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey) return;
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
onOpen(e);
|
|
29
|
+
},
|
|
30
|
+
className: o.className ? `scalio-row-open ${o.className}` : "scalio-row-open",
|
|
31
|
+
};
|
|
32
|
+
if (o.label) props["aria-label"] = o.label;
|
|
33
|
+
return props;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = { rowOpenProps };
|