@julo-ui/sliders
Version:
A React Slider component that implements input[type='range']
28 lines (26 loc) • 1.01 kB
TypeScript
/**
* Convert a value to percentage based on lower and upper bound values
*
* @param value the value in number
* @param min the minimum value
* @param max the maximum value
*/
declare function valueToPercent(value: number, min: number, max: number): number;
/**
* Calculate the value based on percentage, lower and upper bound values
*
* @param percent the percent value in decimals (e.g 0.6, 0.3)
* @param min the minimum value
* @param max the maximum value
*/
declare function percentToValue(percent: number, min: number, max: number): number;
declare function isMouseEvent(event: TouchEvent | MouseEvent | PointerEvent): event is MouseEvent;
/**
* Rounds a specific value to the next or previous step
*
* @param value the value to round
* @param from the number that stepping started from
* @param step the specified step
*/
declare function roundValueToStep(value: number, from: number, step: number): string;
export { isMouseEvent, percentToValue, roundValueToStep, valueToPercent };