From bd9dc30f38744b71d31b4c5ebdbebcb17b08fe6b Mon Sep 17 00:00:00 2001 From: Ezequiel Surijon Date: Fri, 6 Mar 2020 19:15:00 -0300 Subject: [PATCH] React countup upgrade definitions up to version 4.3.3 (#42748) * update react-countup to version 4.3.3 * lint fixes * update version Co-authored-by: Ezequiel Surijon --- types/react-countup/index.d.ts | 118 ++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 2 deletions(-) diff --git a/types/react-countup/index.d.ts b/types/react-countup/index.d.ts index cfbb37650c..bcd7bb3cf7 100644 --- a/types/react-countup/index.d.ts +++ b/types/react-countup/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for react-countup 4.0 +// Type definitions for react-countup 4.3 // Project: https://react-countup.now.sh // Definitions by: Daniel Brodin +// Ezequiel Surijon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -12,52 +13,165 @@ export = ReactCountUp; declare namespace ReactCountUp { interface RenderProps { + /** + * Ref to hook the countUp instance to + */ countUpRef: React.RefObject; + /** + * Pauses or resumes the transition + */ pauseResume(): void; + /** + * Resets to initial value + */ reset(): void; + /** + * Starts or restarts the transition + */ start(): void; + /** + * Updates transition to the new end value (if given) + */ update(newEnd?: number): void; } interface Props { + /** + * CSS class name of the span element. + * Note: This won't be applied when using CountUp with render props. + */ className?: string; + + /** + * Specifies decimal character. + * Default: . + */ decimal?: string; + + /** + * Amount of decimals to display. + * Default: 0 + */ decimals?: number; + + /** + * Delay in seconds before starting the transition. + * Default: null + * Note: delay={0} will automatically start the count up. + */ delay?: number; + + /** + * Duration in seconds. + * Default: 2 + */ duration?: number; + + /** + * Target value. + */ end?: number; + + /** + * Static text before the transitioning value. + */ prefix?: string; + + /** + * Forces count up transition on every component update. + * Default: false + */ redraw?: boolean; + + /** + * Save previously ended number to start every new animation from it. + * Default: false + */ + preserveValue?: boolean; + + /** + * Specifies character of thousands separator. + */ separator?: string; + + /** + * Initial value. + * Default: 0 + */ start?: number; + + /** + * Use for start counter on mount for hook usage. + * Default: true + */ + startOnMount?: boolean; + + /** + * Static text after the transitioning value. + */ suffix?: string; + + /** + * Enables easing. Set to false for a linear transition. + * Default: true + */ useEasing?: boolean; + + /** + * Easing function. http://robertpenner.com/easing for more details. + * Default: easeInExpo + */ easingFn?(t: number, b: number, c: number, d: number): void; + + /** + * Function to customize the formatting of the number + */ formattingFn?(value: number): string; - onComplete?(): void; + + /** + * Callback function on transition end. + */ onEnd?(providedFn: { pauseResume(): void; reset(): void; start(): void; update(): void; }): void; + + /** + * Callback function on transition start. + */ onStart?(providedFn: { pauseResume(): void; reset(): void; update(): void; }): void; + + /** + * Callback function on pause or resume. + */ onPauseResume?(): ( providedFn: { reset(): void; start(): void; update(): void } ) => void; + + /** + * Callback function on reset. + */ onReset?(): ( providedFn: { pauseResume(): void; start(): void; update(): void } ) => void; + + /** + * Callback function on update. + */ onUpdate?(providedFn: { pauseResume(): void; reset(): void; start(): void; }): void; + style?: React.CSSProperties; + children?(data: RenderProps): React.ReactElement; } }