Formular
@@ -282,6 +319,44 @@
setAccent(acc);
seg("accent-seg", acc, setAccent);
+ var tabs = Array.prototype.slice.call(document.querySelectorAll("#tabs [role=tab]"));
+ function selectTab(i, focus) {
+ tabs.forEach(function (b, j) {
+ var on = j === i; b.setAttribute("aria-selected", String(on)); b.tabIndex = on ? 0 : -1;
+ document.getElementById(b.getAttribute("aria-controls")).hidden = !on;
+ });
+ if (focus) tabs[i].focus();
+ }
+ tabs.forEach(function (b, i) { b.addEventListener("click", function () { selectTab(i, false); }); });
+ document.getElementById("tabs").addEventListener("keydown", function (e) {
+ var i = tabs.indexOf(document.activeElement); if (i < 0) return;
+ var n = null;
+ if (e.key === "ArrowRight") n = (i + 1) % tabs.length;
+ else if (e.key === "ArrowLeft") n = (i + tabs.length - 1) % tabs.length;
+ else if (e.key === "Home") n = 0; else if (e.key === "End") n = tabs.length - 1;
+ if (n !== null) { e.preventDefault(); selectTab(n, true); }
+ });
+
+ var menu = document.getElementById("menu"), trig = menu.querySelector("button"), list = document.getElementById("menu-list");
+ function items() { return Array.prototype.slice.call(list.querySelectorAll("[role=menuitem]:not(:disabled)")); }
+ function setOpen(o, back) {
+ list.hidden = !o; trig.setAttribute("aria-expanded", String(o));
+ if (!o && back) trig.focus();
+ }
+ trig.addEventListener("click", function () { setOpen(list.hidden, false); });
+ menu.addEventListener("keydown", function (e) {
+ if (list.hidden) { if (e.target === trig && (e.key === "ArrowDown" || e.key === "ArrowUp")) { e.preventDefault(); setOpen(true); items()[0].focus(); } return; }
+ if (e.key === "Escape") { e.preventDefault(); setOpen(false, true); return; }
+ if (e.key === "Tab") { setOpen(false, false); return; }
+ var k = e.key; if (["ArrowDown","ArrowUp","Home","End"].indexOf(k) < 0) return;
+ e.preventDefault();
+ var l = items(), i = l.indexOf(document.activeElement);
+ var n = k === "Home" ? 0 : k === "End" ? l.length - 1 : (i + (k === "ArrowDown" ? 1 : l.length - 1)) % l.length;
+ l[n].focus();
+ });
+ list.addEventListener("click", function (e) { if (e.target.closest("[role=menuitem]")) setOpen(false, false); });
+ document.addEventListener("mousedown", function (e) { if (!list.hidden && !menu.contains(e.target)) setOpen(false, false); });
+
var tokens = ["bg","surface","surface-2","text","muted","border","border-field","accent","accent-strong","accent-soft","accent-text","ok","warn","danger","info","on-ok","on-warn","on-danger","cat-1","cat-2","cat-3"];
var box = document.getElementById("swatches");
tokens.forEach(function (t) {
diff --git a/tokens.css b/tokens.css
index 9ee8fad..5a26c4f 100644
--- a/tokens.css
+++ b/tokens.css
@@ -129,6 +129,7 @@
/* Ebenen (aus Studio übernommen) */
--z-drag: 200;
+ --z-dropdown: 40;
--z-modal: 100;
--z-modal-2: 110;
--z-system: 300;
@@ -142,6 +143,7 @@
--dialog-pad: 18px 22px;
--dialog-gap: 8px;
--shadow-dialog: 0 20px 60px rgba(0, 0, 0, .35);
+ --shadow-menu: 0 10px 30px rgba(0, 0, 0, .25);
--shadow-toast: 0 10px 30px rgba(0, 0, 0, .3);
--focus-ring: 2px solid var(--accent-strong);