react-simplikit 0.0.17 → 0.0.19
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/dist/hooks/useBooleanState/index.cjs +2 -2
- package/dist/hooks/useBooleanState/index.d.cts +2 -2
- package/dist/hooks/useStorageState/index.d.cts +1 -1
- package/dist/index.cjs +2 -2
- package/esm/hooks/useBooleanState/index.d.ts +2 -2
- package/esm/hooks/useBooleanState/index.js +2 -2
- package/esm/hooks/useStorageState/index.d.ts +1 -1
- package/esm/index.js +2 -2
- package/package.json +1 -1
|
@@ -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);
|
|
@@ -38,7 +38,7 @@ var useBooleanState = (defaultValue = false) => {
|
|
|
38
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
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @param {boolean} [defaultValue=false] - The initial value of the state. Defaults to `false`.
|
|
7
7
|
*
|
|
8
|
-
* @returns {[state: boolean, setTrue: () => void, setFalse: () => void, toggle: () => void]} A tuple containing:
|
|
8
|
+
* @returns {readonly [state: boolean, setTrue: () => void, setFalse: () => void, toggle: () => void]} A tuple containing:
|
|
9
9
|
* - state `boolean` - The current state value;
|
|
10
10
|
* - setTrue `() => void` - A function to set the state to `true`;
|
|
11
11
|
* - setFalse `() => void` - A function to set the state to `false`;
|
|
@@ -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 };
|
|
@@ -27,7 +27,7 @@ type StorageStateOptionsWithDefaultValue<T> = StorageStateOptions<T> & {
|
|
|
27
27
|
* @param {Storage} [options.storage=localStorage] - The storage type (`localStorage` or `sessionStorage`). Defaults to `localStorage`.
|
|
28
28
|
* @param {T} [options.defaultValue] - The initial value if no existing value is found.
|
|
29
29
|
*
|
|
30
|
-
* @returns {[state: Serializable<T> | undefined, setState: (value: SetStateAction<Serializable<T> | undefined>) => void]} A tuple:
|
|
30
|
+
* @returns {readonly [state: Serializable<T> | undefined, setState: (value: SetStateAction<Serializable<T> | undefined>) => void]} A tuple:
|
|
31
31
|
* - state `Serializable<T> | undefined` - The current state value retrieved from storage;
|
|
32
32
|
* - setState `(value: SetStateAction<Serializable<T> | undefined>) => void` - A function to update and persist the state;
|
|
33
33
|
*
|
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);
|
|
@@ -356,7 +356,7 @@ var useBooleanState = (defaultValue = false) => {
|
|
|
356
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");
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @param {boolean} [defaultValue=false] - The initial value of the state. Defaults to `false`.
|
|
7
7
|
*
|
|
8
|
-
* @returns {[state: boolean, setTrue: () => void, setFalse: () => void, toggle: () => void]} A tuple containing:
|
|
8
|
+
* @returns {readonly [state: boolean, setTrue: () => void, setFalse: () => void, toggle: () => void]} A tuple containing:
|
|
9
9
|
* - state `boolean` - The current state value;
|
|
10
10
|
* - setTrue `() => void` - A function to set the state to `true`;
|
|
11
11
|
* - setFalse `() => void` - A function to set the state to `false`;
|
|
@@ -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);
|
|
@@ -12,7 +12,7 @@ var useBooleanState = (defaultValue = false) => {
|
|
|
12
12
|
setBool((prevBool) => !prevBool);
|
|
13
13
|
}, []);
|
|
14
14
|
return [bool, setTrue, setFalse, toggle];
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
16
|
export {
|
|
17
17
|
useBooleanState
|
|
18
18
|
};
|
|
@@ -27,7 +27,7 @@ type StorageStateOptionsWithDefaultValue<T> = StorageStateOptions<T> & {
|
|
|
27
27
|
* @param {Storage} [options.storage=localStorage] - The storage type (`localStorage` or `sessionStorage`). Defaults to `localStorage`.
|
|
28
28
|
* @param {T} [options.defaultValue] - The initial value if no existing value is found.
|
|
29
29
|
*
|
|
30
|
-
* @returns {[state: Serializable<T> | undefined, setState: (value: SetStateAction<Serializable<T> | undefined>) => void]} A tuple:
|
|
30
|
+
* @returns {readonly [state: Serializable<T> | undefined, setState: (value: SetStateAction<Serializable<T> | undefined>) => void]} A tuple:
|
|
31
31
|
* - state `Serializable<T> | undefined` - The current state value retrieved from storage;
|
|
32
32
|
* - setState `(value: SetStateAction<Serializable<T> | undefined>) => void` - A function to update and persist the state;
|
|
33
33
|
*
|
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);
|
|
@@ -307,7 +307,7 @@ var useBooleanState = (defaultValue = false) => {
|
|
|
307
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";
|