@proedis/react 1.0.1
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/LICENSE +9 -0
- package/cjs/hooks/useAutoControlledState.js +97 -0
- package/cjs/hooks/useClickOutside.js +62 -0
- package/cjs/hooks/useDebouncedCallback.js +62 -0
- package/cjs/hooks/useElementType.js +40 -0
- package/cjs/hooks/useEnhancedEffect.js +35 -0
- package/cjs/hooks/useEvent.js +45 -0
- package/cjs/hooks/useForkRef.js +42 -0
- package/cjs/hooks/useSafeState.js +54 -0
- package/cjs/hooks/useSyncedRef.js +42 -0
- package/cjs/hooks/useUnmountEffect.js +22 -0
- package/cjs/hooks/useWindowSize.js +81 -0
- package/cjs/index.js +29 -0
- package/cjs/utils/contextBuilder.js +56 -0
- package/esm/hooks/useAutoControlledState.js +76 -0
- package/esm/hooks/useClickOutside.js +60 -0
- package/esm/hooks/useDebouncedCallback.js +41 -0
- package/esm/hooks/useElementType.js +38 -0
- package/esm/hooks/useEnhancedEffect.js +14 -0
- package/esm/hooks/useEvent.js +43 -0
- package/esm/hooks/useForkRef.js +21 -0
- package/esm/hooks/useSafeState.js +33 -0
- package/esm/hooks/useSyncedRef.js +21 -0
- package/esm/hooks/useUnmountEffect.js +20 -0
- package/esm/hooks/useWindowSize.js +60 -0
- package/esm/index.js +12 -0
- package/esm/utils/contextBuilder.js +35 -0
- package/package.json +39 -0
- package/tsconfig.declaration.tsbuildinfo +1 -0
- package/types/hooks/index.d.ts +11 -0
- package/types/hooks/useAutoControlledState.d.ts +30 -0
- package/types/hooks/useClickOutside.d.ts +9 -0
- package/types/hooks/useDebouncedCallback.d.ts +16 -0
- package/types/hooks/useElementType.d.ts +25 -0
- package/types/hooks/useEnhancedEffect.d.ts +8 -0
- package/types/hooks/useEvent.d.ts +16 -0
- package/types/hooks/useForkRef.d.ts +8 -0
- package/types/hooks/useSafeState.d.ts +9 -0
- package/types/hooks/useSyncedRef.d.ts +11 -0
- package/types/hooks/useUnmountEffect.d.ts +8 -0
- package/types/hooks/useWindowSize.d.ts +30 -0
- package/types/index.d.ts +2 -0
- package/types/utils/contextBuilder.d.ts +18 -0
- package/types/utils/index.d.ts +1 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useEnhancedEffect } from './useEnhancedEffect.js';
|
|
3
|
+
import { useSafeState } from './useSafeState.js';
|
|
4
|
+
|
|
5
|
+
/* --------
|
|
6
|
+
* Hook Function
|
|
7
|
+
* -------- */
|
|
8
|
+
/**
|
|
9
|
+
* Augmented useState with AutoControlled option.
|
|
10
|
+
* Use this hook if the controlling of this state
|
|
11
|
+
* will be optionally demanded externally and
|
|
12
|
+
* potentially controlled by a prop or an arbitrary value
|
|
13
|
+
*
|
|
14
|
+
* @param initialState The initial state of the AutoControlled State
|
|
15
|
+
* @param options Options to pass controlled value and default value
|
|
16
|
+
*/
|
|
17
|
+
function useAutoControlledState(initialState, options) {
|
|
18
|
+
/**
|
|
19
|
+
* Get the user defined options to check if
|
|
20
|
+
* the state will be auto-controlled or
|
|
21
|
+
* controlled externally by user
|
|
22
|
+
*/
|
|
23
|
+
const { value, defaultValue } = options || {};
|
|
24
|
+
/**
|
|
25
|
+
* To avoid the useCallback change every time
|
|
26
|
+
* the value change, and let invalidate the
|
|
27
|
+
* other hooks, depending on it, save the
|
|
28
|
+
* AutoControlled state into an internal ref
|
|
29
|
+
*/
|
|
30
|
+
const isAutoControlled = React.useRef(value === undefined);
|
|
31
|
+
/**
|
|
32
|
+
* Update the isAutoControlled value any time the
|
|
33
|
+
* value will change
|
|
34
|
+
*/
|
|
35
|
+
useEnhancedEffect(() => {
|
|
36
|
+
isAutoControlled.current = value === undefined;
|
|
37
|
+
}, [value]);
|
|
38
|
+
/**
|
|
39
|
+
* As this hook will be principally used on a component
|
|
40
|
+
* with value (like input, checkbox) or in component
|
|
41
|
+
* with an external controllable state (like modal),
|
|
42
|
+
* use the SafeState hook to avoid state change when the
|
|
43
|
+
* component is unmounted
|
|
44
|
+
*/
|
|
45
|
+
const [state, setState] = useSafeState(() => {
|
|
46
|
+
/** Get initial value from user props */
|
|
47
|
+
const initialProp = value === undefined ? defaultValue : undefined;
|
|
48
|
+
/** If initialProps is undefined, could return it */
|
|
49
|
+
if (initialProp !== undefined) {
|
|
50
|
+
return initialProp;
|
|
51
|
+
}
|
|
52
|
+
/** Else, return the initialState provided within the function */
|
|
53
|
+
return typeof initialState === 'function'
|
|
54
|
+
? initialState()
|
|
55
|
+
: initialState;
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Create a new function that could be used to attempt to modify
|
|
59
|
+
* the state object, only if the state is not being controlled
|
|
60
|
+
* by the external property
|
|
61
|
+
*/
|
|
62
|
+
const trySetState = React.useCallback((newState) => {
|
|
63
|
+
/** Update the state only if current prop is not */
|
|
64
|
+
if (isAutoControlled.current) {
|
|
65
|
+
setState(newState);
|
|
66
|
+
}
|
|
67
|
+
}, [setState]);
|
|
68
|
+
/** Return the Hook Result with state and utilities */
|
|
69
|
+
return [
|
|
70
|
+
value === undefined ? state : value,
|
|
71
|
+
trySetState,
|
|
72
|
+
setState
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { useAutoControlledState };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useEnhancedEffect } from './useEnhancedEffect.js';
|
|
2
|
+
import { useSyncedRef } from './useSyncedRef.js';
|
|
3
|
+
|
|
4
|
+
/** The default events name to listen to */
|
|
5
|
+
const DEFAULT_EVENTS = [
|
|
6
|
+
'mousedown',
|
|
7
|
+
'touchstart'
|
|
8
|
+
];
|
|
9
|
+
/**
|
|
10
|
+
* Use this hook to fire an event every time a click occurs outside
|
|
11
|
+
* the provided target element
|
|
12
|
+
* @param target
|
|
13
|
+
* @param callback
|
|
14
|
+
* @param events
|
|
15
|
+
*/
|
|
16
|
+
function useClickOutside(target, callback, events = DEFAULT_EVENTS) {
|
|
17
|
+
/** Wrap dependent data into synced ref to maintain immutable */
|
|
18
|
+
const targetElement = useSyncedRef(target);
|
|
19
|
+
const callbackFunction = useSyncedRef(callback);
|
|
20
|
+
/** Use the Enhanced Effect to attach event listeners */
|
|
21
|
+
useEnhancedEffect(() => {
|
|
22
|
+
/**
|
|
23
|
+
* Internal function used to check if the event
|
|
24
|
+
* target received from the listener it is contained within the
|
|
25
|
+
* requested target element provided within the hook
|
|
26
|
+
*
|
|
27
|
+
* @param event HTML Event received
|
|
28
|
+
*/
|
|
29
|
+
function handler(event) {
|
|
30
|
+
/** Assert the target element exists */
|
|
31
|
+
if (!targetElement.current.current) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
/** Extract the event target */
|
|
35
|
+
const { target: eventTarget } = event;
|
|
36
|
+
const cb = callbackFunction.current;
|
|
37
|
+
if (!eventTarget
|
|
38
|
+
|| (!!eventTarget && !targetElement.current.current.contains(eventTarget))) {
|
|
39
|
+
/** Call the callback */
|
|
40
|
+
cb.call(this, event);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Attach the events on all requested keys */
|
|
44
|
+
events.forEach((eventName) => {
|
|
45
|
+
/** List for event directly on document element */
|
|
46
|
+
document.addEventListener(eventName, handler, { passive: true });
|
|
47
|
+
});
|
|
48
|
+
/** On effect clear, remove all events */
|
|
49
|
+
return () => {
|
|
50
|
+
events.forEach((eventName) => {
|
|
51
|
+
/** List for event directly on document element */
|
|
52
|
+
document.removeEventListener(eventName, handler);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
57
|
+
[callbackFunction, targetElement, ...events]);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { useClickOutside };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useSyncedRef } from './useSyncedRef.js';
|
|
3
|
+
import { useUnmountEffect } from './useUnmountEffect.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Return a wrapped Debounced variant function of the
|
|
7
|
+
* provided function.
|
|
8
|
+
* Interval param will delay the returned function call
|
|
9
|
+
* if a next invoking will be requested
|
|
10
|
+
*
|
|
11
|
+
* @param callback The function to call
|
|
12
|
+
* @param deps Array dependencies list
|
|
13
|
+
* @param interval The interval time
|
|
14
|
+
*/
|
|
15
|
+
function useDebouncedCallback(callback, deps, interval) {
|
|
16
|
+
/** Prepare the timeout ref */
|
|
17
|
+
const timeout = React.useRef();
|
|
18
|
+
const debounceCallback = useSyncedRef(callback);
|
|
19
|
+
/** Set up a function that could be used to clear timeout */
|
|
20
|
+
const clearTimeoutRef = React.useCallback(() => {
|
|
21
|
+
if (timeout.current) {
|
|
22
|
+
clearTimeout(timeout.current);
|
|
23
|
+
timeout.current = undefined;
|
|
24
|
+
}
|
|
25
|
+
}, []);
|
|
26
|
+
/** Cleanup the timeout on unmount */
|
|
27
|
+
useUnmountEffect(() => {
|
|
28
|
+
clearTimeoutRef();
|
|
29
|
+
});
|
|
30
|
+
/** Return a new wrapped function that will set up the timeout on call */
|
|
31
|
+
return React.useCallback((...args) => {
|
|
32
|
+
/** If the timeout already exists, clear it */
|
|
33
|
+
clearTimeoutRef();
|
|
34
|
+
/** Set a new timeout to wait for function call */
|
|
35
|
+
timeout.current = setTimeout(() => {
|
|
36
|
+
debounceCallback.current(...args);
|
|
37
|
+
}, interval);
|
|
38
|
+
}, [clearTimeoutRef, interval, debounceCallback]);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { useDebouncedCallback };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* --------
|
|
2
|
+
* Hook Definition
|
|
3
|
+
* -------- */
|
|
4
|
+
/**
|
|
5
|
+
* Get the ElementType that must be used to render a Component
|
|
6
|
+
*
|
|
7
|
+
* @param Component The Component to render
|
|
8
|
+
* @param props Props received by Component
|
|
9
|
+
* @param defaultElementType A default element type to use
|
|
10
|
+
* @param getDefault A defined function used to compute the ElementType by props
|
|
11
|
+
*/
|
|
12
|
+
function useElementType(Component, props, defaultElementType, getDefault) {
|
|
13
|
+
/** Get default props directly from Component */
|
|
14
|
+
const { defaultProps: componentDefaultProps } = Component;
|
|
15
|
+
/** If received props contain the element type, use it to render the component */
|
|
16
|
+
if (props.as && props.as !== (componentDefaultProps === null || componentDefaultProps === void 0 ? void 0 : componentDefaultProps.as)) {
|
|
17
|
+
return props.as;
|
|
18
|
+
}
|
|
19
|
+
/** If a function has been provided to compute the element type, call it and return the element if exists */
|
|
20
|
+
if (typeof getDefault === 'function') {
|
|
21
|
+
const computedElementType = getDefault(props);
|
|
22
|
+
if (computedElementType) {
|
|
23
|
+
return computedElementType;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** If getDefault is an object than is a ElementType mapper using props, compute it and return */
|
|
27
|
+
if (typeof getDefault === 'object') {
|
|
28
|
+
return getDefault.using[props[getDefault.map]] || getDefault.default;
|
|
29
|
+
}
|
|
30
|
+
/** If props include a href key, return anchor element as the element type */
|
|
31
|
+
if (props.href) {
|
|
32
|
+
return 'a';
|
|
33
|
+
}
|
|
34
|
+
/** Return element type, falling back to a 'div' element */
|
|
35
|
+
return (componentDefaultProps === null || componentDefaultProps === void 0 ? void 0 : componentDefaultProps.as) || defaultElementType || 'div';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { useElementType };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { isBrowser } from '@proedis/utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Return the best way to use the native
|
|
6
|
+
* useEffect React hook, getting the
|
|
7
|
+
* useLayoutEffect if current code is executing
|
|
8
|
+
* on a real browser client
|
|
9
|
+
*/
|
|
10
|
+
const useEnhancedEffect = isBrowser
|
|
11
|
+
? React.useLayoutEffect
|
|
12
|
+
: React.useEffect;
|
|
13
|
+
|
|
14
|
+
export { useEnhancedEffect };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useEnhancedEffect } from './useEnhancedEffect.js';
|
|
2
|
+
import { useSyncedRef } from './useSyncedRef.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Attach a HTMLElement lister to a target DOM Element.
|
|
6
|
+
*
|
|
7
|
+
* @param name The event to listen to
|
|
8
|
+
* @param callback The callback function to call
|
|
9
|
+
* @param options Some options to customize the hook
|
|
10
|
+
*/
|
|
11
|
+
function useEvent(name, callback, options) {
|
|
12
|
+
/** Get options and set defaults */
|
|
13
|
+
const { disabled = false, target = document.documentElement } = options || {};
|
|
14
|
+
/**
|
|
15
|
+
* Every time the hook will be called update the handler
|
|
16
|
+
* function in the ref object.
|
|
17
|
+
* This logic will help the event listener to get the last
|
|
18
|
+
* version update of the handler, without having the need to save it
|
|
19
|
+
* into react use effect dependencies
|
|
20
|
+
*/
|
|
21
|
+
const handler = useSyncedRef(callback);
|
|
22
|
+
useEnhancedEffect(() => {
|
|
23
|
+
/** If hook has been disabled, avoid the event listen */
|
|
24
|
+
if (disabled) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Wrap the handler function into a local scoped function to be removed
|
|
29
|
+
* once the effect will be cleared.
|
|
30
|
+
* HEADS UP, using the useRef method to save the handler; the function
|
|
31
|
+
* could not be the same reference as the component mount
|
|
32
|
+
*/
|
|
33
|
+
const eventCallback = (event) => (handler.current.apply(target, [event]));
|
|
34
|
+
/** Attach the event listener to the DOM target */
|
|
35
|
+
target.addEventListener(name, eventCallback);
|
|
36
|
+
/** On effect clear, remove the event attached to the target */
|
|
37
|
+
return () => {
|
|
38
|
+
target.removeEventListener(name, eventCallback);
|
|
39
|
+
};
|
|
40
|
+
}, [disabled, name, target, handler]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { useEvent };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Group multiple ref object into a single ref that will
|
|
5
|
+
* assign the referenced element to each single ref.
|
|
6
|
+
*
|
|
7
|
+
* @param refs
|
|
8
|
+
*/
|
|
9
|
+
function useForkRef(...refs) {
|
|
10
|
+
return React.useCallback((refValue) => {
|
|
11
|
+
refs.forEach((ref) => ref.current = refValue !== null && refValue !== void 0 ? refValue : undefined);
|
|
12
|
+
},
|
|
13
|
+
// react-hooks/exhaustive-deps will warn the next line because
|
|
14
|
+
// the array will always change at each call of the hook.
|
|
15
|
+
// In this case, could disable the warning because the ref hook used
|
|
16
|
+
// as arguments won't change, because ref objects are immutable
|
|
17
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
|
+
[...refs]);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { useForkRef };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useEnhancedEffect } from './useEnhancedEffect.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Hook that could be used to wrap the original
|
|
6
|
+
* setState hook function to be called and to change
|
|
7
|
+
* state only if the using component is mounted
|
|
8
|
+
*
|
|
9
|
+
* @param initialState Initial state to use
|
|
10
|
+
*/
|
|
11
|
+
function useSafeState(initialState) {
|
|
12
|
+
/** Init internal state using default React hook */
|
|
13
|
+
const [state, setState] = React.useState(initialState);
|
|
14
|
+
/** Use a ref hook to check component mount */
|
|
15
|
+
const isMounted = React.useRef(false);
|
|
16
|
+
/** Update the ref on component mount/unmount */
|
|
17
|
+
useEnhancedEffect(() => {
|
|
18
|
+
isMounted.current = true;
|
|
19
|
+
return () => {
|
|
20
|
+
isMounted.current = false;
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
/** Wrap original setState action to consider mounted state */
|
|
24
|
+
const wrappedSeState = React.useCallback((newState) => {
|
|
25
|
+
if (isMounted.current) {
|
|
26
|
+
setState(newState);
|
|
27
|
+
}
|
|
28
|
+
}, []);
|
|
29
|
+
/** Return state and wrapped set state */
|
|
30
|
+
return [state, wrappedSeState];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { useSafeState };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An augmented version of the useRef function.
|
|
5
|
+
* It will return a 'ref' style object with the
|
|
6
|
+
* current key memoized, returning each time
|
|
7
|
+
* the most updated version of the value
|
|
8
|
+
*
|
|
9
|
+
* @param value The value to store into ref object
|
|
10
|
+
*/
|
|
11
|
+
function useSyncedRef(value) {
|
|
12
|
+
const ref = React.useRef(value);
|
|
13
|
+
ref.current = value;
|
|
14
|
+
return React.useMemo(() => Object.freeze({
|
|
15
|
+
get current() {
|
|
16
|
+
return ref.current;
|
|
17
|
+
}
|
|
18
|
+
}), []);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { useSyncedRef };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEnhancedEffect } from './useEnhancedEffect.js';
|
|
2
|
+
import { useSyncedRef } from './useSyncedRef.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Use this hook to call the provided
|
|
6
|
+
* callable function to be called once the
|
|
7
|
+
* component will unmount
|
|
8
|
+
*
|
|
9
|
+
* @param callback Function to be called
|
|
10
|
+
*/
|
|
11
|
+
function useUnmountEffect(callback) {
|
|
12
|
+
/** Save the callback function into an immutable object */
|
|
13
|
+
const unmountCallback = useSyncedRef(callback);
|
|
14
|
+
/** Attach an event to call function on unmount */
|
|
15
|
+
useEnhancedEffect(() => () => {
|
|
16
|
+
unmountCallback.current();
|
|
17
|
+
}, [unmountCallback]);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { useUnmountEffect };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useEnhancedEffect } from './useEnhancedEffect.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Monitor the change of the Window Size.
|
|
6
|
+
* Take careful that the object returned by the hook will never change:
|
|
7
|
+
* to use value within hook dependencies must deconstruct internal properties
|
|
8
|
+
*
|
|
9
|
+
* @param options Set hook options
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Do this
|
|
13
|
+
* const { height, width } = useWindowSize();
|
|
14
|
+
*
|
|
15
|
+
* React.useEffect(
|
|
16
|
+
* () => {
|
|
17
|
+
* // Wonderful code...
|
|
18
|
+
* },
|
|
19
|
+
* [ height, width ]
|
|
20
|
+
* );
|
|
21
|
+
*/
|
|
22
|
+
function useWindowSize(options) {
|
|
23
|
+
const { disabled } = options || {};
|
|
24
|
+
// ----
|
|
25
|
+
// Internal State
|
|
26
|
+
// ----
|
|
27
|
+
const [currentSize, setCurrentSize] = React.useState(() => ({
|
|
28
|
+
height: typeof window !== 'undefined' ? window.innerHeight : 0,
|
|
29
|
+
width: typeof window !== 'undefined' ? window.innerWidth : 0
|
|
30
|
+
}));
|
|
31
|
+
// ----
|
|
32
|
+
// Handler
|
|
33
|
+
// ----
|
|
34
|
+
const handleWindowSizeChange = React.useCallback(() => setCurrentSize((curr) => {
|
|
35
|
+
curr.height = window.innerHeight;
|
|
36
|
+
curr.width = window.innerWidth;
|
|
37
|
+
return curr;
|
|
38
|
+
}), []);
|
|
39
|
+
// ----
|
|
40
|
+
// Internal Hooks
|
|
41
|
+
// ----
|
|
42
|
+
useEnhancedEffect(() => {
|
|
43
|
+
/** If hook has been disabled, avoid the event listen */
|
|
44
|
+
if (disabled) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
/** Attach event to the window element to listen for resize change */
|
|
48
|
+
window.addEventListener('resize', handleWindowSizeChange);
|
|
49
|
+
/** On effect clear, remove the event attached to the window */
|
|
50
|
+
return () => {
|
|
51
|
+
window.removeEventListener('resize', handleWindowSizeChange);
|
|
52
|
+
};
|
|
53
|
+
}, [disabled, handleWindowSizeChange]);
|
|
54
|
+
// ----
|
|
55
|
+
// Hook returns
|
|
56
|
+
// ----
|
|
57
|
+
return currentSize;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { useWindowSize };
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { useAutoControlledState } from './hooks/useAutoControlledState.js';
|
|
2
|
+
export { useClickOutside } from './hooks/useClickOutside.js';
|
|
3
|
+
export { useDebouncedCallback } from './hooks/useDebouncedCallback.js';
|
|
4
|
+
export { useElementType } from './hooks/useElementType.js';
|
|
5
|
+
export { useEnhancedEffect } from './hooks/useEnhancedEffect.js';
|
|
6
|
+
export { useEvent } from './hooks/useEvent.js';
|
|
7
|
+
export { useForkRef } from './hooks/useForkRef.js';
|
|
8
|
+
export { useSafeState } from './hooks/useSafeState.js';
|
|
9
|
+
export { useSyncedRef } from './hooks/useSyncedRef.js';
|
|
10
|
+
export { useUnmountEffect } from './hooks/useUnmountEffect.js';
|
|
11
|
+
export { useWindowSize } from './hooks/useWindowSize.js';
|
|
12
|
+
export { contextBuilder } from './utils/contextBuilder.js';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Easy creation of a React Context providing the name to use
|
|
5
|
+
* and optionally an initial context.
|
|
6
|
+
* Object returned will reformat string and return well-named function and components
|
|
7
|
+
* @param name
|
|
8
|
+
* @param initialContext
|
|
9
|
+
*/
|
|
10
|
+
function contextBuilder(name, initialContext) {
|
|
11
|
+
/** Create the base context using provided data */
|
|
12
|
+
const BaseContext = React.createContext(initialContext);
|
|
13
|
+
/** Create the capitalized name */
|
|
14
|
+
const capitalizedName = `${name.charAt(0).toUpperCase()}${name.slice(1)}`;
|
|
15
|
+
/** Create the hook function to return */
|
|
16
|
+
const useContextHook = () => {
|
|
17
|
+
/** Get the context value using built in hook */
|
|
18
|
+
const contextValue = React.useContext(BaseContext);
|
|
19
|
+
/** Assert the context value exists */
|
|
20
|
+
if (!contextValue) {
|
|
21
|
+
throw new Error(`use${capitalizedName}() hook must be invoked inside its right Context`);
|
|
22
|
+
}
|
|
23
|
+
/** Return extracted value */
|
|
24
|
+
return contextValue;
|
|
25
|
+
};
|
|
26
|
+
/** Assign name to Context objects */
|
|
27
|
+
BaseContext.displayName = capitalizedName;
|
|
28
|
+
/** Return context tools */
|
|
29
|
+
const contextHook = { [`use${capitalizedName}`]: useContextHook };
|
|
30
|
+
const contextProvider = { [`${capitalizedName}Provider`]: BaseContext.Provider };
|
|
31
|
+
const contextConsumer = { [`${capitalizedName}Consumer`]: BaseContext.Consumer };
|
|
32
|
+
return Object.assign(Object.assign(Object.assign({}, contextHook), contextProvider), contextConsumer);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { contextBuilder };
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@proedis/react",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "A set of React Hooks, that add UI or Core functionality to your Apps",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"proedis",
|
|
7
|
+
"react",
|
|
8
|
+
"hooks"
|
|
9
|
+
],
|
|
10
|
+
"main": "./cjs/index.js",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": {
|
|
13
|
+
"name": "Marco Cavanna",
|
|
14
|
+
"email": "m.cavanna@proedis.net"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/proedis/Npm.Suite",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/proedis/Npm.Suite.git",
|
|
20
|
+
"directory": "packages/react-hooks"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/proedis/Npm.Suite/issues",
|
|
24
|
+
"email": "info@proedis.net"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@proedis/utils": "^1.0.1"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": "^18.2.0"
|
|
34
|
+
},
|
|
35
|
+
"gitHead": "8cba9bf577350eaf9ee04be523bd47053c9e7495",
|
|
36
|
+
"private": false,
|
|
37
|
+
"module": "./esm/index.js",
|
|
38
|
+
"types": "./types/index.d.ts"
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/typescript/lib/lib.scripthost.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.full.d.ts","../../../node_modules/tslib/tslib.d.ts","../../../node_modules/@types/react/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/@types/react/index.d.ts","../../utils/build/types/constants/isbrowser.d.ts","../../utils/build/types/constants/index.d.ts","../../utils/build/types/index.d.ts","../src/hooks/useenhancedeffect.ts","../src/hooks/usesafestate.ts","../src/hooks/useautocontrolledstate.ts","../src/hooks/usesyncedref.ts","../src/hooks/useclickoutside.ts","../src/hooks/useunmounteffect.ts","../src/hooks/usedebouncedcallback.ts","../../types/objects.d.ts","../../types/index.d.ts","../src/hooks/useelementtype.ts","../src/hooks/useevent.ts","../src/hooks/useforkref.ts","../src/hooks/usewindowsize.ts","../src/hooks/index.ts","../src/utils/contextbuilder.ts","../src/utils/index.ts","../src/index.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/dom-events.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/readline/promises.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/globals.global.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/@types/glob/node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/glob/index.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/minimist/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/react-dom/index.d.ts","../../../node_modules/@types/scheduler/index.d.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts"],"fileInfos":[{"version":"8730f4bf322026ff5229336391a18bcaa1f94d4f82416c8b2f3954e2ccaae2ba","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","4b421cbfb3a38a27c279dec1e9112c3d1da296f77a1a85ddadf7e7a425d45d18","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"3aafcb693fe5b5c3bd277bd4c3a617b53db474fe498fc5df067c5603b1eebde7","affectsGlobalScope":true},{"version":"f3d4da15233e593eacb3965cde7960f3fddf5878528d882bcedd5cbaba0193c7","affectsGlobalScope":true},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"5f406584aef28a331c36523df688ca3650288d14f39c5d2e555c95f0d2ff8f6f","affectsGlobalScope":true},{"version":"22f230e544b35349cfb3bd9110b6ef37b41c6d6c43c3314a31bd0d9652fcec72","affectsGlobalScope":true},{"version":"7ea0b55f6b315cf9ac2ad622b0a7813315bb6e97bf4bb3fbf8f8affbca7dc695","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"eb26de841c52236d8222f87e9e6a235332e0788af8c87a71e9e210314300410a","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"5e5e095c4470c8bab227dbbc61374878ecead104c74ab9960d3adcccfee23205","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"2768ef564cfc0689a1b76106c421a2909bdff0acbe87da010785adab80efdd5c","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"d2f31f19e1ba6ed59be9259d660a239d9a3fcbbc8e038c6b2009bde34b175fed","f1c9fe42b65437a61104e601eb298c5c859fb522b483f1bdb700eed67a16f980",{"version":"bbdf156fea2fabed31a569445835aeedcc33643d404fcbaa54541f06c109df3f","affectsGlobalScope":true},"1c29793071152b207c01ea1954e343be9a44d85234447b2b236acae9e709a383","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"d11a5d3967290ea6be7e6d7667c4673a7626cfaa32cfc68101000d2b218606ab","affectsGlobalScope":true},"161d1be268e5fe36b7ad8ceff30ef3c128117787955d40e06bba1c35f7ee5480","411eae398cc5920950fc90ceadc4966466305197bb16df0ccac32eac6674c2c0","cb9305834f7e616194db3f6d71b5fba45a999e8906ce3226041aa39cade44eed",{"version":"10b1afa35d2a545be06be709ae760b013c734652a6e271b4dcce8fb756a0ae0c","signature":"bafd4242f3b30fa6c9718f85bcf37fa9c814ad668fd28c608eb504a7a5a8da15"},{"version":"20285281e958aeafb0bec76cd90d10d2c12a8133ac175cb92ac5db23c7d64b37","signature":"d555ca29d81070a251f2e4a933b2713477467d3c861707da335ee378dba69f3c"},{"version":"861522243ea126c6b30136c8bc9641cea044da377940dfbf843349e101eb2342","signature":"fb959232148e12d7e21ae3756d7cf1b1d6afc5df98905b9f252a36e5e1dcc1cc"},{"version":"33f9f1810d024959d0939fb64604666533089abcaa4dae1ad7f3bba0370face6","signature":"d6f3ff5f92e64526758510cf8da5408b41c8d0aa0f7a591ab1f465d40d77c3b6"},{"version":"85963844abd8766da1ef7d457c65e4927b1d4424aa519d481f05bbb0210639c3","signature":"fe3072e77b4bd60f072125c9dafc794ad0a07669884eda16317d6a232e270188"},{"version":"9d2f76f3a85781b1874acac60e814111d96e9a2fcfb288706c491cd1897d43b9","signature":"5c3eb5ba86f702d4f8817c2fe7bbf23ae3e3a9261c20717d53f3e6f45705a6b4"},{"version":"7e6f56987af0d496ce99af66b60db9d3105f43cb81721b8a6d036b8f772d6d11","signature":"512e1aa59a3a933774903cb35dcf72368db2866ce7d068a7d6de93ac37f87193"},"9240793939a4381eb8ffe0efbf5385a4defe55a6bc9b647fa133ec1360c2b161","f0e2cb3527ad83fcfa3db88f2381f3e9334f67cb5abd72da87608f0664762e5b",{"version":"200dafcb5228706a3006b24b58c9f2136b5bf14a6055f6b284aa024285dc70a2","signature":"3f1cd5bdf45d343116b0b58b90bdf63ef34afed13ea8f3a6f1f12afb5fe5cb5b"},{"version":"8516d2f179a6cc93d6126e9a3c0918695a5ca9fd0d953090fa4f1884750379b0","signature":"a9ed9b84e4c4bff2a115de92656986609942a613875f7b0bd6d37f01dc0f8519"},{"version":"eb1dc175c829ad616349100d807b83a120d26065b67b889beb830047abd05dda","signature":"efb64b15c80c6cda5a0dd7b04b9f803c5736fdc79e13d8afbf9915a5212a7f6c"},{"version":"4a47e4469033c865816ec539762cc3191b2cdfa972238226033056be1562b363","signature":"7aea9123586fa99f5434326d302752b3bb8944d7aae18eca73ca58b44c6ccd35"},{"version":"c7f01eca8e6e9c7d79ea4e9ca8bc8776133e510e4fcb9b5d067f86e604d23386","signature":"e6d98ea75bafb3210755006d4be17668ab544314c4f95ec4ac3ad05fc9faf056"},{"version":"88229810f3fa2ce729b7e0b82574eb3ecb974f346c3a03ab7c070c89d4acd3a7","signature":"11c9a1e4c54d95bad7f3a3050a066ded7149627b0deeb64b34e9c83b0efe6e00"},"30a101b6a4e04b0a15b12c7da94a8ab60736d4eeb76d2d5c0d382fee91a9694f",{"version":"40288ed0ed72d5ef842a04447c98fb34680563f0ae54aa11d166db24a2952b03","signature":"fb437a439261ed4b0934e543010631c7a918c3e19f7967ee79f410a3d9b1269f"},"946bd1737d9412395a8f24414c70f18660b84a75a12b0b448e6eb1a2161d06dd","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"ca72190df0eb9b09d4b600821c8c7b6c9747b75a1c700c4d57dc0bb72abc074c","affectsGlobalScope":true},"11e2d554398d2bd460e7d06b2fa5827a297c8acfbe00b4f894a224ac0862857f",{"version":"bb65c6267c5d6676be61acbf6604cf0a4555ac4b505df58ac15c831fcbff4e3e","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","dab86d9604fe40854ef3c0a6f9e8948873dc3509213418e5e457f410fd11200f","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"2c45b35f4850881ab132f80d3cb51e8a359a4d8fafdc5ff2401d260dc27862f4","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","fd93cee2621ff42dabe57b7be402783fd1aa69ece755bcba1e0290547ae60513","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","a15eb098ed86a4135cba05d77e792d6189fa8607a00c9b1b381c0e9550c04ba5",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","c4577fb855ca259bdbf3ea663ca73988ce5f84251a92b4aef80a1f4122b6f98e","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"ff07a9a03c65732ccc59b3c65bc584173da093bd563a6565411c01f5703bd3cb","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"cc4fa603eb4f28847cfa5bfb698dd186a0864853383d49f2478b3482d5caca9e","963d59066dd6742da1918a6213a209bcc205b8ee53b1876ee2b4e6d80f97c85e","fd326577c62145816fe1acc306c734c2396487f76719d3785d4e825b34540b33","f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649","209e814e8e71aec74f69686a9506dd7610b97ab59dcee9446266446f72a76d05","6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","e4dd91dd4789a109aab51d8a0569a282369fcda9ba6f2b2297bc61bacfb1a042","74b0245c42990ed8a849df955db3f4362c81b13f799ebc981b7bec2d5b414a57","2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","77c1d91a129ba60b8c405f9f539e42df834afb174fe0785f89d92a2c7c16b77a","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","6aee496bf0ecfbf6731aa8cca32f4b6e92cdc0a444911a7d88410408a45ecc5d"],"options":{"composite":true,"declaration":true,"downlevelIteration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"experimentalDecorators":true,"importHelpers":true,"inlineSources":false,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitAny":true,"noImplicitReturns":true,"noUnusedLocals":false,"noUnusedParameters":false,"outDir":"./types","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":4},"fileIdsList":[[120],[90,91,120,127,128],[74,120],[77,120],[78,83,111,120],[79,90,91,98,108,119,120],[79,80,90,98,120],[81,120],[82,83,91,99,120],[83,108,116,120],[84,86,90,98,120],[85,120],[86,87,120],[90,120],[88,90,120],[90,91,92,108,119,120],[90,91,92,105,108,111,120],[120,124],[86,93,98,108,119,120],[90,91,93,94,98,108,116,119,120],[93,95,108,116,119,120],[74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126],[90,96,120],[97,119,120],[86,90,98,108,120],[99,120],[100,120],[77,101,120],[102,118,120,124],[103,120],[104,120],[90,105,106,120],[105,107,120,122],[78,90,108,109,110,111,120],[78,108,110,120],[108,109,120],[111,120],[112,120],[90,114,115,120],[114,115,120],[83,98,108,116,120],[117,120],[98,118,120],[78,93,104,119,120],[83,120],[108,120,121],[120,122],[120,123],[78,83,90,92,101,108,119,120,122,124],[108,120,125],[52,120],[48,49,50,51,120],[120,138,177],[120,138,162,177],[120,177],[120,138],[120,138,163,177],[120,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176],[120,163,177],[47,56,57,58,59,60,61,62,65,66,67,68,120],[47,52,56,57,120],[47,52,56,59,120],[47,52,59,61,120],[47,52,64,120],[47,52,55,120],[47,56,59,120],[47,52,120],[47,52,56,120],[47,69,71,120],[47,70,120],[63,120],[53,120],[54,120],[56,57,58,59,60,61,62,65,66,67,68],[52],[52,64],[69,71]],"referencedMap":[[73,1],[129,2],[128,1],[130,1],[131,1],[132,1],[133,1],[74,3],[75,3],[77,4],[78,5],[79,6],[80,7],[81,8],[82,9],[83,10],[84,11],[85,12],[86,13],[87,13],[89,14],[88,15],[90,14],[91,16],[92,17],[76,18],[126,1],[93,19],[94,20],[95,21],[127,22],[96,23],[97,24],[98,25],[99,26],[100,27],[101,28],[102,29],[103,30],[104,31],[105,32],[106,32],[107,33],[108,34],[110,35],[109,36],[111,37],[112,38],[113,1],[114,39],[115,40],[116,41],[117,42],[118,43],[119,44],[120,45],[121,46],[122,47],[123,48],[124,49],[125,50],[134,1],[135,1],[50,1],[136,51],[48,1],[52,52],[137,1],[51,1],[162,53],[163,54],[138,55],[141,55],[160,53],[161,53],[151,53],[150,56],[148,53],[143,53],[156,53],[154,53],[158,53],[142,53],[155,53],[159,53],[144,53],[145,53],[157,53],[139,53],[146,53],[147,53],[149,53],[153,53],[164,57],[152,53],[140,53],[177,58],[176,1],[171,57],[173,59],[172,57],[165,57],[166,57],[168,57],[170,57],[174,59],[175,59],[167,59],[169,59],[49,1],[47,1],[8,1],[9,1],[13,1],[12,1],[2,1],[14,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[21,1],[3,1],[4,1],[46,1],[25,1],[22,1],[23,1],[24,1],[26,1],[27,1],[28,1],[5,1],[29,1],[30,1],[31,1],[32,1],[6,1],[36,1],[33,1],[34,1],[35,1],[37,1],[7,1],[38,1],[43,1],[44,1],[39,1],[40,1],[41,1],[42,1],[1,1],[45,1],[11,1],[10,1],[69,60],[58,61],[60,62],[62,63],[65,64],[56,65],[66,66],[67,67],[57,68],[59,67],[61,66],[68,68],[72,69],[70,64],[71,70],[64,71],[63,1],[54,72],[53,1],[55,73]],"exportedModulesMap":[[73,1],[129,2],[128,1],[130,1],[131,1],[132,1],[133,1],[74,3],[75,3],[77,4],[78,5],[79,6],[80,7],[81,8],[82,9],[83,10],[84,11],[85,12],[86,13],[87,13],[89,14],[88,15],[90,14],[91,16],[92,17],[76,18],[126,1],[93,19],[94,20],[95,21],[127,22],[96,23],[97,24],[98,25],[99,26],[100,27],[101,28],[102,29],[103,30],[104,31],[105,32],[106,32],[107,33],[108,34],[110,35],[109,36],[111,37],[112,38],[113,1],[114,39],[115,40],[116,41],[117,42],[118,43],[119,44],[120,45],[121,46],[122,47],[123,48],[124,49],[125,50],[134,1],[135,1],[50,1],[136,51],[48,1],[52,52],[137,1],[51,1],[162,53],[163,54],[138,55],[141,55],[160,53],[161,53],[151,53],[150,56],[148,53],[143,53],[156,53],[154,53],[158,53],[142,53],[155,53],[159,53],[144,53],[145,53],[157,53],[139,53],[146,53],[147,53],[149,53],[153,53],[164,57],[152,53],[140,53],[177,58],[176,1],[171,57],[173,59],[172,57],[165,57],[166,57],[168,57],[170,57],[174,59],[175,59],[167,59],[169,59],[49,1],[47,1],[8,1],[9,1],[13,1],[12,1],[2,1],[14,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[21,1],[3,1],[4,1],[46,1],[25,1],[22,1],[23,1],[24,1],[26,1],[27,1],[28,1],[5,1],[29,1],[30,1],[31,1],[32,1],[6,1],[36,1],[33,1],[34,1],[35,1],[37,1],[7,1],[38,1],[43,1],[44,1],[39,1],[40,1],[41,1],[42,1],[1,1],[45,1],[11,1],[10,1],[69,74],[58,75],[60,75],[62,75],[65,76],[56,75],[67,75],[57,75],[72,77],[70,76],[71,70],[64,71],[63,1],[54,72],[53,1],[55,73]],"semanticDiagnosticsPerFile":[73,129,128,130,131,132,133,74,75,77,78,79,80,81,82,83,84,85,86,87,89,88,90,91,92,76,126,93,94,95,127,96,97,98,99,100,101,102,103,104,105,106,107,108,110,109,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,134,135,50,136,48,52,137,51,162,163,138,141,160,161,151,150,148,143,156,154,158,142,155,159,144,145,157,139,146,147,149,153,164,152,140,177,176,171,173,172,165,166,168,170,174,175,167,169,49,47,8,9,13,12,2,14,15,16,17,18,19,20,21,3,4,46,25,22,23,24,26,27,28,5,29,30,31,32,6,36,33,34,35,37,7,38,43,44,39,40,41,42,1,45,11,10,69,58,60,62,65,56,66,67,57,59,61,68,72,70,71,64,63,54,53,55],"latestChangedDtsFile":"./types/index.d.ts"},"version":"4.9.5"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './useAutoControlledState';
|
|
2
|
+
export * from './useClickOutside';
|
|
3
|
+
export * from './useDebouncedCallback';
|
|
4
|
+
export * from './useElementType';
|
|
5
|
+
export * from './useEnhancedEffect';
|
|
6
|
+
export * from './useEvent';
|
|
7
|
+
export * from './useForkRef';
|
|
8
|
+
export * from './useSafeState';
|
|
9
|
+
export * from './useSyncedRef';
|
|
10
|
+
export * from './useUnmountEffect';
|
|
11
|
+
export * from './useWindowSize';
|