react-simplikit 0.0.16 → 0.0.18
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.
- package/README.md +1 -0
- package/dist/hooks/useBooleanState/index.cjs +3 -3
- package/dist/hooks/useBooleanState/index.d.cts +1 -1
- package/dist/index.cjs +3 -3
- package/esm/hooks/useBooleanState/index.d.ts +1 -1
- package/esm/hooks/useBooleanState/index.js +3 -3
- package/esm/index.js +3 -3
- package/package.json +10 -6
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ English | [Korean](./README-ko_kr.md)
|
|
|
16
16
|
import { useBooleanState } from 'react-simplikit';
|
|
17
17
|
|
|
18
18
|
function Component() {
|
|
19
|
+
// using the `useBooleanState` hook to manage state.
|
|
19
20
|
const [open, openBottomSheet, closeBottomSheet, toggleBottomSheet] = useBooleanState(false);
|
|
20
21
|
|
|
21
22
|
return (
|
|
@@ -26,7 +26,7 @@ module.exports = __toCommonJS(useBooleanState_exports);
|
|
|
26
26
|
|
|
27
27
|
// src/hooks/useBooleanState/useBooleanState.ts
|
|
28
28
|
var import_react = require("react");
|
|
29
|
-
|
|
29
|
+
function useBooleanState(defaultValue = false) {
|
|
30
30
|
const [bool, setBool] = (0, import_react.useState)(defaultValue);
|
|
31
31
|
const setTrue = (0, import_react.useCallback)(() => {
|
|
32
32
|
setBool(true);
|
|
@@ -35,10 +35,10 @@ var useBooleanState = (defaultValue = false) => {
|
|
|
35
35
|
setBool(false);
|
|
36
36
|
}, []);
|
|
37
37
|
const toggle = (0, import_react.useCallback)(() => {
|
|
38
|
-
setBool((
|
|
38
|
+
setBool((prevBool) => !prevBool);
|
|
39
39
|
}, []);
|
|
40
40
|
return [bool, setTrue, setFalse, toggle];
|
|
41
|
-
}
|
|
41
|
+
}
|
|
42
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43
43
|
0 && (module.exports = {
|
|
44
44
|
useBooleanState
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
* @example
|
|
15
15
|
* const [open, openBottomSheet, closeBottomSheet, toggleBottomSheet] = useBooleanState(false);
|
|
16
16
|
*/
|
|
17
|
-
declare
|
|
17
|
+
declare function useBooleanState(defaultValue?: boolean): readonly [boolean, () => void, () => void, () => void];
|
|
18
18
|
|
|
19
19
|
export { useBooleanState };
|
package/dist/index.cjs
CHANGED
|
@@ -344,7 +344,7 @@ function useAsyncEffect(effect, deps) {
|
|
|
344
344
|
|
|
345
345
|
// src/hooks/useBooleanState/useBooleanState.ts
|
|
346
346
|
var import_react9 = require("react");
|
|
347
|
-
|
|
347
|
+
function useBooleanState(defaultValue = false) {
|
|
348
348
|
const [bool, setBool] = (0, import_react9.useState)(defaultValue);
|
|
349
349
|
const setTrue = (0, import_react9.useCallback)(() => {
|
|
350
350
|
setBool(true);
|
|
@@ -353,10 +353,10 @@ var useBooleanState = (defaultValue = false) => {
|
|
|
353
353
|
setBool(false);
|
|
354
354
|
}, []);
|
|
355
355
|
const toggle2 = (0, import_react9.useCallback)(() => {
|
|
356
|
-
setBool((
|
|
356
|
+
setBool((prevBool) => !prevBool);
|
|
357
357
|
}, []);
|
|
358
358
|
return [bool, setTrue, setFalse, toggle2];
|
|
359
|
-
}
|
|
359
|
+
}
|
|
360
360
|
|
|
361
361
|
// src/hooks/useCallbackOncePerRender/useCallbackOncePerRender.ts
|
|
362
362
|
var import_react10 = require("react");
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
* @example
|
|
15
15
|
* const [open, openBottomSheet, closeBottomSheet, toggleBottomSheet] = useBooleanState(false);
|
|
16
16
|
*/
|
|
17
|
-
declare
|
|
17
|
+
declare function useBooleanState(defaultValue?: boolean): readonly [boolean, () => void, () => void, () => void];
|
|
18
18
|
|
|
19
19
|
export { useBooleanState };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/hooks/useBooleanState/useBooleanState.ts
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
|
-
|
|
3
|
+
function useBooleanState(defaultValue = false) {
|
|
4
4
|
const [bool, setBool] = useState(defaultValue);
|
|
5
5
|
const setTrue = useCallback(() => {
|
|
6
6
|
setBool(true);
|
|
@@ -9,10 +9,10 @@ var useBooleanState = (defaultValue = false) => {
|
|
|
9
9
|
setBool(false);
|
|
10
10
|
}, []);
|
|
11
11
|
const toggle = useCallback(() => {
|
|
12
|
-
setBool((
|
|
12
|
+
setBool((prevBool) => !prevBool);
|
|
13
13
|
}, []);
|
|
14
14
|
return [bool, setTrue, setFalse, toggle];
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
16
|
export {
|
|
17
17
|
useBooleanState
|
|
18
18
|
};
|
package/esm/index.js
CHANGED
|
@@ -295,7 +295,7 @@ function useAsyncEffect(effect, deps) {
|
|
|
295
295
|
|
|
296
296
|
// src/hooks/useBooleanState/useBooleanState.ts
|
|
297
297
|
import { useCallback as useCallback5, useState } from "react";
|
|
298
|
-
|
|
298
|
+
function useBooleanState(defaultValue = false) {
|
|
299
299
|
const [bool, setBool] = useState(defaultValue);
|
|
300
300
|
const setTrue = useCallback5(() => {
|
|
301
301
|
setBool(true);
|
|
@@ -304,10 +304,10 @@ var useBooleanState = (defaultValue = false) => {
|
|
|
304
304
|
setBool(false);
|
|
305
305
|
}, []);
|
|
306
306
|
const toggle2 = useCallback5(() => {
|
|
307
|
-
setBool((
|
|
307
|
+
setBool((prevBool) => !prevBool);
|
|
308
308
|
}, []);
|
|
309
309
|
return [bool, setTrue, setFalse, toggle2];
|
|
310
|
-
}
|
|
310
|
+
}
|
|
311
311
|
|
|
312
312
|
// src/hooks/useCallbackOncePerRender/useCallbackOncePerRender.ts
|
|
313
313
|
import { useEffect as useEffect5, useRef as useRef5 } from "react";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-simplikit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"main": "./dist/index.cjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -24,11 +24,15 @@
|
|
|
24
24
|
"docs:dev": "vitepress dev",
|
|
25
25
|
"docs:build": "vitepress build",
|
|
26
26
|
"docs:preview": "vitepress preview",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"test": "
|
|
31
|
-
"test:
|
|
27
|
+
"fix": "yarn run fix:lint && yarn run fix:format",
|
|
28
|
+
"fix:format": "prettier . --write",
|
|
29
|
+
"fix:lint": "eslint src --fix",
|
|
30
|
+
"test": "yarn run test:lint && yarn run test:format && yarn run test:type && yarn run test:spec && yarn run test:coverage",
|
|
31
|
+
"test:format": "prettier . --list-different",
|
|
32
|
+
"test:lint": "eslint src",
|
|
33
|
+
"test:type": "tsc --noEmit",
|
|
34
|
+
"test:spec": "vitest run",
|
|
35
|
+
"test:coverage": "vitest run --coverage",
|
|
32
36
|
"prepack": "tsup"
|
|
33
37
|
},
|
|
34
38
|
"publishConfig": {
|