@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.
@@ -36624,9 +36624,11 @@ function TableViewTabs({ tabs, activeId, onSelect, onAdd, onClose, onRename, rel
36624
36624
  if (id) onEditCancel?.(id);
36625
36625
  onEditDone?.();
36626
36626
  };
36627
+ const canClose = (id) => closable && tabs.length > 1 && id !== "default";
36628
+ const canRename = (id) => renameable && id !== "default";
36627
36629
  return /* @__PURE__ */ jsxs16("div", { className: "flex min-w-0 shrink-0 items-center border-b", "data-matrx-table-tabs": true, children: [
36628
- /* @__PURE__ */ jsxs16("div", { role: "tablist", "aria-label": "Table views", className: "flex min-w-0 flex-1 items-center overflow-x-auto", children: [
36629
- tabs.map((tab, index) => /* @__PURE__ */ jsxs16("div", { className: "group flex shrink-0 items-center border-r", children: [
36630
+ /* @__PURE__ */ jsxs16("div", { className: "flex min-w-0 flex-1 items-center overflow-x-auto", children: [
36631
+ /* @__PURE__ */ jsx24("div", { role: "tablist", "aria-label": "Table views", className: "flex shrink-0 items-center", children: tabs.map((tab, index) => /* @__PURE__ */ jsxs16("div", { role: "presentation", className: "group flex shrink-0 items-center border-r", children: [
36630
36632
  renaming === tab.id ? /* @__PURE__ */ jsx24(
36631
36633
  "input",
36632
36634
  {
@@ -36650,14 +36652,26 @@ function TableViewTabs({ tabs, activeId, onSelect, onAdd, onClose, onRename, rel
36650
36652
  role: "tab",
36651
36653
  "aria-selected": tab.id === activeId,
36652
36654
  tabIndex: tab.id === activeId ? 0 : -1,
36655
+ "aria-keyshortcuts": [canClose(tab.id) ? "Delete" : "", canRename(tab.id) ? "F2" : ""].filter(Boolean).join(" ") || void 0,
36653
36656
  onClick: () => onSelect(tab.id),
36654
36657
  onDoubleClick: () => {
36655
- if (renameable && tab.id !== "default") {
36658
+ if (canRename(tab.id)) {
36656
36659
  setDraft(tab.label);
36657
36660
  setRenaming(tab.id);
36658
36661
  }
36659
36662
  },
36660
36663
  onKeyDown: (e) => {
36664
+ if (e.key === "Delete" && canClose(tab.id)) {
36665
+ e.preventDefault();
36666
+ onClose(tab.id);
36667
+ return;
36668
+ }
36669
+ if (e.key === "F2" && canRename(tab.id)) {
36670
+ e.preventDefault();
36671
+ setDraft(tab.label);
36672
+ setRenaming(tab.id);
36673
+ return;
36674
+ }
36661
36675
  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;
36662
36676
  if (next >= 0) {
36663
36677
  e.preventDefault();
@@ -36673,14 +36687,15 @@ function TableViewTabs({ tabs, activeId, onSelect, onAdd, onClose, onRename, rel
36673
36687
  ]
36674
36688
  }
36675
36689
  ),
36676
- closable && tabs.length > 1 && tab.id !== "default" && /* @__PURE__ */ jsxs16(Tooltip, { children: [
36677
- /* @__PURE__ */ jsx24(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx24("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__ */ jsx24(X, { className: "size-4" }) }) }),
36690
+ canClose(tab.id) && /* @__PURE__ */ jsxs16(Tooltip, { children: [
36691
+ /* @__PURE__ */ jsx24(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx24("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__ */ jsx24(X, { className: "size-4" }) }) }),
36678
36692
  /* @__PURE__ */ jsxs16(TooltipContent, { children: [
36679
36693
  "Close ",
36680
- tab.label
36694
+ tab.label,
36695
+ " (Delete)"
36681
36696
  ] })
36682
36697
  ] })
36683
- ] }, tab.id)),
36698
+ ] }, tab.id)) }),
36684
36699
  /* @__PURE__ */ jsxs16(Tooltip, { children: [
36685
36700
  /* @__PURE__ */ jsx24(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx24("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__ */ jsx24(Plus, { className: "size-4" }) }) }),
36686
36701
  /* @__PURE__ */ jsx24(TooltipContent, { children: addHint })