@aiszlab/relax 1.2.49-beta.0 → 1.2.50

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.
@@ -1,6 +1,10 @@
1
1
  import { type Dispatch, type SetStateAction } from 'react';
2
2
  import type { State } from '../types';
3
3
  interface Props<T> {
4
+ /**
5
+ * @description
6
+ * default value
7
+ */
4
8
  defaultState?: State<T>;
5
9
  }
6
10
  /**
@@ -1,11 +1,6 @@
1
1
  import { type Dispatch, type SetStateAction } from 'react';
2
2
  import type { State } from '../types';
3
3
  type Props = {
4
- /**
5
- * @description
6
- * initial value
7
- */
8
- initialState?: State<number>;
9
4
  /**
10
5
  * @description
11
6
  * max: count will not be greater than max
@@ -9,16 +9,15 @@ import { useDefault } from './use-default.js';
9
9
  * @description
10
10
  * a number counter with some useful apis
11
11
  */
12
- var useCounter = function useCounter(initialState) {
13
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
14
- max: Infinity,
15
- min: -Infinity
16
- },
12
+ var useCounter = function useCounter() {
13
+ var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
14
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
17
15
  _ref$max = _ref.max,
18
16
  max = _ref$max === void 0 ? Infinity : _ref$max,
19
17
  _ref$min = _ref.min,
20
18
  min = _ref$min === void 0 ? -Infinity : _ref$min;
21
- var defaultState = useDefault(initialState !== null && initialState !== void 0 ? initialState : 0);
19
+ // memorized first time prop value
20
+ var defaultState = useDefault(initialState);
22
21
  var _useState = useState(defaultState),
23
22
  _useState2 = _slicedToArray(_useState, 2),
24
23
  _count = _useState2[0],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiszlab/relax",
3
- "version": "1.2.49-beta.0",
3
+ "version": "1.2.50",
4
4
  "description": "react utils collection",
5
5
  "type": "module",
6
6
  "exports": {