export function focusableIds(items) { return items.filter((item) => !item.disabled).map((item) => item.id); } export function nextFocusIndex(items, current, delta) { const enabled = items .map((item, index) => ({ item, index })) .filter((entry) => !entry.item.disabled) .map((entry) => entry.index); if (enabled.length === 0) return -1; const position = enabled.indexOf(current); const base = position === -1 ? (delta === 1 ? -1 : 0) : position; const next = (base + delta + enabled.length) % enabled.length; return enabled[next] ?? enabled[0] ?? -1; } export function trapTabIndex(items, current, shift) { return nextFocusIndex(items, current, shift ? -1 : 1); } //# sourceMappingURL=focus.js.map