@ai-matrx/design-system 0.49.18 → 0.49.19

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.49.19
4
+ ### Unreleased
5
+
6
+ - **A table's view tabs are a valid tablist, and every tab action works from the keyboard** (a11y pass, /education/library 2026-09-28: axe `aria-required-children`, critical). `TableViewTabs` put the "+" button and every close "×" inside `role="tablist"`, so assistive tech was told a list of tabs held buttons. The tablist now holds only tabs; "+" sits right after it; each "×" stays beside its tab for the pointer but is `aria-hidden` and out of the tab order, and the tab itself owns the keyboard actions as the WAI-ARIA tabs pattern does: **Delete** closes a closable tab and **F2** renames a renameable one (announced through `aria-keyshortcuts`). Proof: `TableViewTabs.test.tsx`, 3 of 5 red on the previous source. Consumer action: a test that found a close button by role/name (`"Close <label>"`) queries `[data-close-tab]` or presses Delete on the tab instead.
7
+
3
8
  ## 0.49.18
4
9
  ### Unreleased
5
10
 
@@ -36758,9 +36758,11 @@ function TableViewTabs({ tabs, activeId, onSelect, onAdd, onClose, onRename, rel
36758
36758
  if (id) onEditCancel?.(id);
36759
36759
  onEditDone?.();
36760
36760
  };
36761
+ const canClose = (id) => closable && tabs.length > 1 && id !== "default";
36762
+ const canRename = (id) => renameable && id !== "default";
36761
36763
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex min-w-0 shrink-0 items-center border-b", "data-matrx-table-tabs": true, children: [
36762
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { role: "tablist", "aria-label": "Table views", className: "flex min-w-0 flex-1 items-center overflow-x-auto", children: [
36763
- tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "group flex shrink-0 items-center border-r", children: [
36764
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex min-w-0 flex-1 items-center overflow-x-auto", children: [
36765
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { role: "tablist", "aria-label": "Table views", className: "flex shrink-0 items-center", children: tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { role: "presentation", className: "group flex shrink-0 items-center border-r", children: [
36764
36766
  renaming === tab.id ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
36765
36767
  "input",
36766
36768
  {
@@ -36784,14 +36786,26 @@ function TableViewTabs({ tabs, activeId, onSelect, onAdd, onClose, onRename, rel
36784
36786
  role: "tab",
36785
36787
  "aria-selected": tab.id === activeId,
36786
36788
  tabIndex: tab.id === activeId ? 0 : -1,
36789
+ "aria-keyshortcuts": [canClose(tab.id) ? "Delete" : "", canRename(tab.id) ? "F2" : ""].filter(Boolean).join(" ") || void 0,
36787
36790
  onClick: () => onSelect(tab.id),
36788
36791
  onDoubleClick: () => {
36789
- if (renameable && tab.id !== "default") {
36792
+ if (canRename(tab.id)) {
36790
36793
  setDraft(tab.label);
36791
36794
  setRenaming(tab.id);
36792
36795
  }
36793
36796
  },
36794
36797
  onKeyDown: (e) => {
36798
+ if (e.key === "Delete" && canClose(tab.id)) {
36799
+ e.preventDefault();
36800
+ onClose(tab.id);
36801
+ return;
36802
+ }
36803
+ if (e.key === "F2" && canRename(tab.id)) {
36804
+ e.preventDefault();
36805
+ setDraft(tab.label);
36806
+ setRenaming(tab.id);
36807
+ return;
36808
+ }
36795
36809
  const next = e.key === "ArrowRight" ? (index + 1) % tabs.length : e.key === "ArrowLeft" ? (index + tabs.length - 1) % tabs.length : e.key === "Home" ? 0 : e.key === "End" ? tabs.length - 1 : -1;
36796
36810
  if (next >= 0) {
36797
36811
  e.preventDefault();
@@ -36807,14 +36821,15 @@ function TableViewTabs({ tabs, activeId, onSelect, onAdd, onClose, onRename, rel
36807
36821
  ]
36808
36822
  }
36809
36823
  ),
36810
- closable && tabs.length > 1 && tab.id !== "default" && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Tooltip, { children: [
36811
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", "aria-label": `Close ${tab.label}`, onClick: () => onClose(tab.id), className: "flex size-7 items-center justify-center rounded hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(X, { className: "size-4" }) }) }),
36824
+ canClose(tab.id) && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Tooltip, { children: [
36825
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", "aria-hidden": "true", tabIndex: -1, "data-close-tab": tab.id, onClick: () => onClose(tab.id), className: "flex size-7 items-center justify-center rounded hover:bg-muted", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(X, { className: "size-4" }) }) }),
36812
36826
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(TooltipContent, { children: [
36813
36827
  "Close ",
36814
- tab.label
36828
+ tab.label,
36829
+ " (Delete)"
36815
36830
  ] })
36816
36831
  ] })
36817
- ] }, tab.id)),
36832
+ ] }, tab.id)) }),
36818
36833
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Tooltip, { children: [
36819
36834
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", "aria-label": "New table tab", onClick: onAdd, className: "flex size-8 shrink-0 items-center justify-center rounded hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Plus, { className: "size-4" }) }) }),
36820
36835
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipContent, { children: addHint })