use-count-up
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "use-count-up", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Lightweight React hook to animate counting up or down to a number, infinity, or even beyond", | ||
@@ -33,3 +33,3 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"use-elapsed-time": "^1.1.2" | ||
"use-elapsed-time": "^1.1.3" | ||
}, | ||
@@ -36,0 +36,0 @@ "peerDependencies": { |
@@ -54,7 +54,7 @@ # useCountUp React hook | ||
duration?: number, | ||
onComplete?: () => void, | ||
onComplete?: () => undefined | [shouldRepeat: boolean, delay: number], | ||
easing?: (t: number, b: number, c: number, d: number) => number, | ||
formatter?: (value: number) => number|string|node, | ||
formatter?: (value: number) => number | string | node, | ||
} | ||
) => number|string|node; | ||
) => number | string | node; | ||
``` | ||
@@ -86,3 +86,3 @@ ### 1st agrument `isCounting: boolean` | ||
#### `onComplete: () => void | [shouldRepeat: boolean, delay: number]` | ||
#### `onComplete: () => undefined | [shouldRepeat: boolean, delay: number]` | ||
> Default: `onComplete = undefined` | ||
@@ -101,5 +101,5 @@ | ||
#### `formatter: (value: number) => number|string|node` | ||
#### `formatter: (value: number) => number | string | node` | ||
> Default: `formatter = value => Math.round(value)` | ||
A function that formats the output value. It can be used to add prefix or suffix to the value. A good formatting option is to use [`toLocaleString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString), which will give the correct decimal and thousand separators. |
import * as React from 'react'; | ||
import * as useElapsedTime from 'use-elapsed-time'; | ||
type ReturnValue = number | string | React.ReactNode; | ||
/** Optional configuration object */ | ||
@@ -11,14 +14,13 @@ export interface Config { | ||
duration?: number, | ||
/** On animation complete event handler. It can be used to restart the animation by returning an array where the first element "shouldRepeat" indicates if the loop should start over and second element "delay" specifies the delay before looping again in milliseconds. */ | ||
onComplete?: () => void | [boolean, number], // [shouldRepeat: boolean, delay: number] | ||
/** | ||
* Easing function to control how the animation is progressing | ||
* t - current time | ||
* b - start value | ||
* c - change in value | ||
* d - duration | ||
*/ | ||
easing?: (t: number, b: number, c: number, d: number) => number, | ||
/** On animation complete event handler. */ | ||
onComplete?: useElapsedTime.Config.onComplete, | ||
/** Easing function to control how the animation is progressing */ | ||
easing?: ( | ||
currentTime: number, | ||
startValue: number, | ||
changeInValue: number, | ||
duration: number | ||
) => number, | ||
/** A function that formats the output value */ | ||
formatter?: (value: number) => React.ReactNode | ||
formatter?: (value: number) => ReturnValue | ||
} | ||
@@ -29,2 +31,2 @@ | ||
config?: Config | ||
): React.ReactNode; | ||
): ReturnValue; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26
10413
Updateduse-elapsed-time@^1.1.3