const require_rolldown_runtime = require('../rolldown-runtime.cjs'); const vue = require_rolldown_runtime.__toESM(require("vue")); //#region src/shared/date/useSegmentNavigation.ts function useSegmentNavigation({ segmentElements, currentFocusedElement, dir, segmentAttributes }) { const currentSegmentIndex = (0, vue.computed)(() => Array.from(segmentElements.value).findIndex((el) => segmentAttributes.every((attribute) => el.getAttribute(attribute) === currentFocusedElement.value?.getAttribute(attribute)))); const nextFocusableSegment = (0, vue.computed)(() => { const sign = dir.value === "rtl" ? -1 : 1; const nextCondition = sign < 0 ? currentSegmentIndex.value < 0 : currentSegmentIndex.value > segmentElements.value.size - 1; if (nextCondition) return null; const segmentToFocus = Array.from(segmentElements.value)[currentSegmentIndex.value + sign]; return segmentToFocus; }); const prevFocusableSegment = (0, vue.computed)(() => { const sign = dir.value === "rtl" ? -1 : 1; const prevCondition = sign > 0 ? currentSegmentIndex.value < 0 : currentSegmentIndex.value > segmentElements.value.size - 1; if (prevCondition) return null; const segmentToFocus = Array.from(segmentElements.value)[currentSegmentIndex.value - sign]; return segmentToFocus; }); function focusNext() { Array.from(segmentElements.value)[currentSegmentIndex.value + 1]?.focus(); } return { currentSegmentIndex, nextFocusableSegment, prevFocusableSegment, focusNext }; } //#endregion Object.defineProperty(exports, 'useSegmentNavigation', { enumerable: true, get: function () { return useSegmentNavigation; } }); //# sourceMappingURL=useSegmentNavigation.cjs.map