@aiszlab/relax 1.2.28-beta.5 → 1.2.28-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ import { useDefault } from './use-default.mjs';
8
8
  * @description
9
9
  * a number counter with some useful apis
10
10
  */
11
- const useCounter = (initialState, { max = Infinity, min = 0 } = { max: Infinity, min: 0 }) => {
11
+ const useCounter = (initialState, { max = Infinity, min = -Infinity } = { max: Infinity, min: -Infinity }) => {
12
12
  const defaultState = useDefault(initialState !== null && initialState !== void 0 ? initialState : 0);
13
13
  const [_count, _setCount] = useState(defaultState);
14
14
  const add = useCallback((step = 1) => {
@@ -26,7 +26,7 @@ const useCounter = (initialState, { max = Infinity, min = 0 } = { max: Infinity,
26
26
  const reset = useCallback(() => {
27
27
  _setCount(defaultState);
28
28
  }, []);
29
- const count = useMemo(() => clamp(_count, min, max), [min, max]);
29
+ const count = useMemo(() => clamp(_count, min, max), [_count, min, max]);
30
30
  return [count, { add, subtract, first, last, reset, setCount: _setCount }];
31
31
  };
32
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiszlab/relax",
3
- "version": "1.2.28-beta.5",
3
+ "version": "1.2.28-beta.6",
4
4
  "description": "react utils collection",
5
5
  "type": "module",
6
6
  "exports": {