react-countup
Advanced tools
Comparing version 6.4.1 to 6.4.2
@@ -8,2 +8,29 @@ 'use strict'; | ||
function _iterableToArrayLimit(arr, i) { | ||
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (null != _i) { | ||
var _s, | ||
_e, | ||
_x, | ||
_r, | ||
_arr = [], | ||
_n = !0, | ||
_d = !1; | ||
try { | ||
if (_x = (_i = _i.call(arr)).next, 0 === i) { | ||
if (Object(_i) !== _i) return; | ||
_n = !1; | ||
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); | ||
} catch (err) { | ||
_d = !0, _e = err; | ||
} finally { | ||
try { | ||
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
} | ||
function ownKeys(object, enumerableOnly) { | ||
@@ -85,2 +112,24 @@ var keys = Object.keys(object); | ||
} | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _toPrimitive(input, hint) { | ||
@@ -145,2 +194,4 @@ if (typeof input !== "object" || input === null) return input; | ||
useEasing = props.useEasing, | ||
useGrouping = props.useGrouping, | ||
useIndianSeparators = props.useIndianSeparators, | ||
enableScrollSpy = props.enableScrollSpy, | ||
@@ -161,3 +212,4 @@ scrollSpyDelay = props.scrollSpyDelay, | ||
useEasing: useEasing, | ||
useGrouping: !!separator, | ||
useIndianSeparators: useIndianSeparators, | ||
useGrouping: useGrouping, | ||
enableScrollSpy: enableScrollSpy, | ||
@@ -172,2 +224,3 @@ scrollSpyDelay: scrollSpyDelay, | ||
decimal: '.', | ||
separator: ',', | ||
delay: null, | ||
@@ -178,8 +231,17 @@ prefix: '', | ||
start: 0, | ||
decimals: 0, | ||
startOnMount: true, | ||
enableReinitialize: true | ||
enableReinitialize: true, | ||
useEasing: true, | ||
useGrouping: true, | ||
useIndianSeparators: false | ||
}; | ||
var useCountUp = function useCountUp(props) { | ||
var filteredProps = Object.fromEntries(Object.entries(props).filter(function (_ref) { | ||
var _ref2 = _slicedToArray(_ref, 2), | ||
value = _ref2[1]; | ||
return value !== undefined; | ||
})); | ||
var _useMemo = React.useMemo(function () { | ||
return _objectSpread2(_objectSpread2({}, DEFAULTS), props); | ||
return _objectSpread2(_objectSpread2({}, DEFAULTS), filteredProps); | ||
}, [props]), | ||
@@ -186,0 +248,0 @@ ref = _useMemo.ref, |
@@ -48,2 +48,3 @@ import * as React from 'react'; | ||
start?: number; | ||
useEasing?: boolean; | ||
} | ||
@@ -50,0 +51,0 @@ export interface CommonProps extends CountUpInstanceProps { |
@@ -1,4 +0,4 @@ | ||
import { CallbackProps, CommonProps, CountUpApi } from './types'; | ||
import { CallbackProps, CommonProps, CountUpApi } from "./types"; | ||
import React from 'react'; | ||
export interface useCountUpProps extends CommonProps, CallbackProps { | ||
export interface UseCountUpProps extends CommonProps, CallbackProps { | ||
startOnMount?: boolean; | ||
@@ -8,3 +8,3 @@ ref: string | React.RefObject<HTMLElement>; | ||
} | ||
declare const useCountUp: (props: useCountUpProps) => CountUpApi; | ||
declare const useCountUp: (props: UseCountUpProps) => CountUpApi; | ||
export default useCountUp; |
{ | ||
"name": "react-countup", | ||
"version": "6.4.1", | ||
"version": "6.4.2", | ||
"description": "A React component wrapper around CountUp.js", | ||
@@ -37,7 +37,7 @@ "author": "Glenn Reyes <glenn@glennreyes.com> (https://twitter.com/glnnrys)", | ||
"dependencies": { | ||
"@rollup/plugin-babel": "^6.0.2", | ||
"countup.js": "^2.4.1" | ||
"@rollup/plugin-babel": "^6.0.3", | ||
"countup.js": "^2.5.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.20.12", | ||
"@babel/core": "7.21.0", | ||
"@babel/preset-env": "7.20.2", | ||
@@ -50,3 +50,3 @@ "@babel/preset-react": "7.18.6", | ||
"@typescript-eslint/parser": "^5.44.0", | ||
"babel-jest": "29.4.0", | ||
"babel-jest": "29.5.0", | ||
"eslint": "^8.28.0", | ||
@@ -57,5 +57,5 @@ "eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-react-hooks": "^4.2.0", | ||
"jest": "28.1.2", | ||
"jest-environment-jsdom": "^28.1.1", | ||
"prettier": "2.8.3", | ||
"jest": "29.5.0", | ||
"jest-environment-jsdom": "^29.5.0", | ||
"prettier": "2.8.4", | ||
"pretty-quick": "3.1.3", | ||
@@ -65,5 +65,5 @@ "react": "18.2.0", | ||
"react-test-renderer": "18.2.0", | ||
"rollup": "3.11.0", | ||
"rollup": "3.19.1", | ||
"typescript": "^4.9.3" | ||
} | ||
} |
32935
531
Updated@rollup/plugin-babel@^6.0.3
Updatedcountup.js@^2.5.0