@dorsk/tsumikit 0.18.3 → 0.18.4
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.
|
@@ -43,9 +43,13 @@
|
|
|
43
43
|
function select(id: string, focus = false) {
|
|
44
44
|
if (tabs.find((t) => t.id === id)?.disabled) return;
|
|
45
45
|
value = id;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
queueMicrotask(() => {
|
|
47
|
+
const el = listEl?.querySelector<HTMLButtonElement>(`#${baseId}-tab-${id}`);
|
|
48
|
+
// The list scrolls when it is too narrow, so keyboard selection has to
|
|
49
|
+
// bring the tab back into view or it moves somewhere unseen.
|
|
50
|
+
el?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
51
|
+
if (focus) el?.focus();
|
|
52
|
+
});
|
|
49
53
|
}
|
|
50
54
|
// Step to the next non-disabled tab in a direction, wrapping around.
|
|
51
55
|
function step(from: number, dir: 1 | -1): number {
|
|
@@ -99,9 +103,13 @@
|
|
|
99
103
|
display: flex;
|
|
100
104
|
gap: var(--sp-1);
|
|
101
105
|
border-bottom: 1px solid var(--border);
|
|
106
|
+
overflow-x: auto;
|
|
107
|
+
scrollbar-width: thin;
|
|
102
108
|
}
|
|
103
109
|
.tab {
|
|
104
110
|
display: inline-flex;
|
|
111
|
+
flex: 0 0 auto;
|
|
112
|
+
white-space: nowrap;
|
|
105
113
|
align-items: center;
|
|
106
114
|
gap: var(--sp-2);
|
|
107
115
|
padding: var(--sp-2) var(--sp-3);
|
package/package.json
CHANGED