UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

24 lines (23 loc) 1.05 kB
"use client"; //#region packages/@mantine/core/src/components/Combobox/use-combobox/get-index/get-index.ts function getPreviousIndex(currentIndex, elements, loop) { for (let i = currentIndex - 1; i >= 0; i -= 1) if (!elements[i].hasAttribute("data-combobox-disabled")) return i; if (loop) { for (let i = elements.length - 1; i > -1; i -= 1) if (!elements[i].hasAttribute("data-combobox-disabled")) return i; } return currentIndex; } function getNextIndex(currentIndex, elements, loop) { for (let i = currentIndex + 1; i < elements.length; i += 1) if (!elements[i].hasAttribute("data-combobox-disabled")) return i; if (loop) { for (let i = 0; i < elements.length; i += 1) if (!elements[i].hasAttribute("data-combobox-disabled")) return i; } return currentIndex; } function getFirstIndex(elements) { for (let i = 0; i < elements.length; i += 1) if (!elements[i].hasAttribute("data-combobox-disabled")) return i; return -1; } //#endregion export { getFirstIndex, getNextIndex, getPreviousIndex }; //# sourceMappingURL=get-index.mjs.map