@chayns-components/devalue-slider
Version:
A slider to devalue something.
51 lines (50 loc) • 1.84 kB
TypeScript
import React, { type CSSProperties } from 'react';
export type DevalueSliderOnDevalueHandlerResult = {
success: boolean;
};
export type DevalueSliderOnDevalueHandler = () => Promise<DevalueSliderOnDevalueHandlerResult>;
export type DevalueSliderOnChangeHandler = (relativeValue: number) => void;
export type DevalueSliderOnCompleteHandler = () => void;
export type DevalueSliderProps = {
/**
* The basic color of the slider.
* This color is the background of the track before the slider is devalued.
*/
backgroundColor?: CSSProperties['backgroundColor'];
/**
* The devalue color of the slider.
* This color fills the track from the left on user movement.
* This color is the background of the timer after the slider is devalued.
*/
devalueBackgroundColor?: CSSProperties['backgroundColor'];
/**
* If this slider was devalued, provide the time when it was devalued.
* This will show a timer.
*/
devalueTime?: Date;
/**
* Disables the slider and cancels any active drags.
*/
isDisabled?: boolean;
/**
* The label of the slider. The default value is "EINLÖSEN"
*/
label?: string;
/**
* This function is called when the slider is devalued.
*/
onDevalue?: DevalueSliderOnDevalueHandler;
/**
* This function is called when the slider value changes.
* With this function you can keep track of the movement of the slider.
*/
onChange?: DevalueSliderOnChangeHandler;
/**
* This function is called when the slider is completed.
* The slider is completed when the user devalues the slider
* and the animation is completed.
*/
onComplete?: DevalueSliderOnCompleteHandler;
};
declare const DevalueSlider: React.FC<DevalueSliderProps>;
export default DevalueSlider;