@ai-matrx/canvas 0.8.1 → 0.8.3
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 +14 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +38 -13
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +38 -13
- package/dist/react.js.map +1 -1
- package/dist/{toggleKind-CAI7pndj.d.cts → toggleKind-BoFnqhzq.d.cts} +1 -1
- package/dist/{toggleKind-CAI7pndj.d.ts → toggleKind-BoFnqhzq.d.ts} +1 -1
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -3324,24 +3324,49 @@ function TabStrip({
|
|
|
3324
3324
|
"data-overflow": overflow ? "" : void 0,
|
|
3325
3325
|
style: { ["--mxc-tab-min"]: `${CANVAS_TAB_MIN_WIDTH}px` },
|
|
3326
3326
|
children: [
|
|
3327
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3327
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3328
|
+
"div",
|
|
3329
|
+
{
|
|
3330
|
+
ref: list,
|
|
3331
|
+
className: "mxc-tabs",
|
|
3332
|
+
role: "tablist",
|
|
3333
|
+
"aria-label": "Canvas tabs",
|
|
3334
|
+
"aria-multiselectable": joined ? true : void 0,
|
|
3335
|
+
onKeyDown: moveTabFocus,
|
|
3336
|
+
children: entries.map(
|
|
3337
|
+
(entry) => entry.type === "tab" ? tabView(entry.tab) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3338
|
+
"div",
|
|
3339
|
+
{
|
|
3340
|
+
className: "mxc-tab-group",
|
|
3341
|
+
"data-split": "",
|
|
3342
|
+
role: "presentation",
|
|
3343
|
+
style: { ["--mxc-group-n"]: entry.tabs.length },
|
|
3344
|
+
children: entry.tabs.map(tabView)
|
|
3345
|
+
},
|
|
3346
|
+
`split:${entry.tabs.map((tab) => tab.itemId).join("|")}`
|
|
3347
|
+
)
|
|
3348
|
+
)
|
|
3349
|
+
}
|
|
3350
|
+
),
|
|
3340
3351
|
overflow ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TabListMenu, { tabs, activeItemId }) : null
|
|
3341
3352
|
]
|
|
3342
3353
|
}
|
|
3343
3354
|
);
|
|
3344
3355
|
}
|
|
3356
|
+
function moveTabFocus(event) {
|
|
3357
|
+
const keys = ["ArrowLeft", "ArrowRight", "Home", "End"];
|
|
3358
|
+
if (!keys.includes(event.key) || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
3359
|
+
const tabs = [...event.currentTarget.querySelectorAll('[role="tab"]')];
|
|
3360
|
+
const at = tabs.findIndex((tab) => tab === event.target || tab.contains(event.target));
|
|
3361
|
+
if (at < 0 || tabs.length < 2) return;
|
|
3362
|
+
event.preventDefault();
|
|
3363
|
+
const rtl = getComputedStyle(event.currentTarget).direction === "rtl";
|
|
3364
|
+
const step = event.key === "ArrowRight" !== rtl ? 1 : -1;
|
|
3365
|
+
const next = event.key === "Home" ? 0 : event.key === "End" ? tabs.length - 1 : (at + step + tabs.length) % tabs.length;
|
|
3366
|
+
const target = tabs[next];
|
|
3367
|
+
target?.focus();
|
|
3368
|
+
target?.click();
|
|
3369
|
+
}
|
|
3345
3370
|
function TabListMenu({ tabs, activeItemId }) {
|
|
3346
3371
|
const canvas = useCanvas();
|
|
3347
3372
|
const { ports, layer } = useCanvasInternals();
|