UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

57 lines (54 loc) 1.14 kB
'use client'; 'use strict'; function getPreviousIndex({ currentIndex, isOptionDisabled, totalOptionsCount, loop }) { for (let i = currentIndex - 1; i >= 0; i -= 1) { if (!isOptionDisabled(i)) { return i; } } if (loop) { for (let i = totalOptionsCount - 1; i > -1; i -= 1) { if (!isOptionDisabled(i)) { return i; } } } return currentIndex; } function getNextIndex({ currentIndex, isOptionDisabled, totalOptionsCount, loop }) { for (let i = currentIndex + 1; i < totalOptionsCount; i += 1) { if (!isOptionDisabled(i)) { return i; } } if (loop) { for (let i = 0; i < totalOptionsCount; i += 1) { if (!isOptionDisabled(i)) { return i; } } } return currentIndex; } function getFirstIndex({ totalOptionsCount, isOptionDisabled }) { for (let i = 0; i < totalOptionsCount; i += 1) { if (!isOptionDisabled(i)) { return i; } } return -1; } exports.getFirstIndex = getFirstIndex; exports.getNextIndex = getNextIndex; exports.getPreviousIndex = getPreviousIndex; //# sourceMappingURL=get-virtualized-index.cjs.map