UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

22 lines (21 loc) 1.05 kB
"use client"; //#region packages/@mantine/core/src/components/Slider/utils/get-step-mark-value/get-step-mark-value.ts function getNextMarkValue(currentValue, marks) { const nextMark = [...marks].sort((a, b) => a.value - b.value).find((mark) => mark.value > currentValue); return nextMark ? nextMark.value : currentValue; } function getPreviousMarkValue(currentValue, marks) { const previousMark = [...marks].sort((a, b) => b.value - a.value).find((mark) => mark.value < currentValue); return previousMark ? previousMark.value : currentValue; } function getFirstMarkValue(marks) { const sortedMarks = [...marks].sort((a, b) => a.value - b.value); return sortedMarks.length > 0 ? sortedMarks[0].value : 0; } function getLastMarkValue(marks) { const sortedMarks = [...marks].sort((a, b) => a.value - b.value); return sortedMarks.length > 0 ? sortedMarks[sortedMarks.length - 1].value : 100; } //#endregion export { getFirstMarkValue, getLastMarkValue, getNextMarkValue, getPreviousMarkValue }; //# sourceMappingURL=get-step-mark-value.mjs.map