UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

13 lines (12 loc) 635 B
"use client"; //#region packages/@mantine/core/src/components/Slider/utils/get-change-value/get-change-value.ts function getChangeValue({ value, containerWidth, min, max, step, precision }) { const dx = (!containerWidth ? value : Math.min(Math.max(value, 0), containerWidth) / containerWidth) * (max - min); const nextValue = (dx !== 0 ? Math.round(dx / step) * step : 0) + min; const nextValueWithinStep = Math.max(nextValue, min); if (precision !== void 0) return Number(nextValueWithinStep.toFixed(precision)); return nextValueWithinStep; } //#endregion export { getChangeValue }; //# sourceMappingURL=get-change-value.mjs.map