@proedis/react 1.2.3 → 1.3.0
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/cjs/hooks/useAutoControlledState.js +69 -69
- package/cjs/hooks/useClickOutside.js +54 -54
- package/cjs/hooks/useDataManager.js +29 -29
- package/cjs/hooks/useDataSelector.js +76 -76
- package/cjs/hooks/useDebouncedCallback.js +34 -34
- package/cjs/hooks/useElementType.js +35 -35
- package/cjs/hooks/useEnhancedEffect.js +8 -8
- package/cjs/hooks/useEvent.js +37 -37
- package/cjs/hooks/useForkRef.js +16 -16
- package/cjs/hooks/useInputValue.js +15 -15
- package/cjs/hooks/useObjectState.js +37 -37
- package/cjs/hooks/useSafeState.js +27 -27
- package/cjs/hooks/useSyncedRef.js +16 -16
- package/cjs/hooks/useUnmountEffect.js +14 -14
- package/cjs/hooks/useWindowSize.js +54 -54
- package/cjs/index.js +0 -4
- package/cjs/utils/compose.js +40 -40
- package/cjs/utils/contextBuilder.js +36 -36
- package/cjs/utils/shorthands.js +148 -148
- package/esm/hooks/useAutoControlledState.js +69 -69
- package/esm/hooks/useClickOutside.js +54 -54
- package/esm/hooks/useDataManager.js +29 -29
- package/esm/hooks/useDataSelector.js +76 -76
- package/esm/hooks/useDebouncedCallback.js +34 -34
- package/esm/hooks/useElementType.js +35 -35
- package/esm/hooks/useEnhancedEffect.js +8 -8
- package/esm/hooks/useEvent.js +37 -37
- package/esm/hooks/useForkRef.js +16 -16
- package/esm/hooks/useInputValue.js +15 -15
- package/esm/hooks/useObjectState.js +37 -37
- package/esm/hooks/useSafeState.js +27 -27
- package/esm/hooks/useSyncedRef.js +16 -16
- package/esm/hooks/useUnmountEffect.js +14 -14
- package/esm/hooks/useWindowSize.js +54 -54
- package/esm/index.js +0 -2
- package/esm/utils/compose.js +40 -40
- package/esm/utils/contextBuilder.js +36 -36
- package/esm/utils/shorthands.js +148 -148
- package/package.json +19 -21
- package/tsconfig.declaration.tsbuildinfo +1 -1
- package/types/hooks/index.d.ts +0 -2
- package/types/utils/shorthands.d.ts +1 -1
- package/cjs/hooks/useQueryString.js +0 -92
- package/cjs/hooks/useQueryStringValue.js +0 -50
- package/esm/hooks/useQueryString.js +0 -70
- package/esm/hooks/useQueryStringValue.js +0 -29
- package/types/hooks/useQueryString.d.ts +0 -22
- package/types/hooks/useQueryStringValue.d.ts +0 -8
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useQueryString } from './useQueryString.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Use this hook to manage a single field of the current query string.
|
|
6
|
-
* A utility function will be returned with the field value to help
|
|
7
|
-
* easily change the value.
|
|
8
|
-
*
|
|
9
|
-
* @param field
|
|
10
|
-
*/
|
|
11
|
-
function useQueryStringValue(field) {
|
|
12
|
-
// ----
|
|
13
|
-
// Internal Hooks
|
|
14
|
-
// ----
|
|
15
|
-
const [queryString, setQueryString] = useQueryString();
|
|
16
|
-
// ----
|
|
17
|
-
// Memoized Callbacks
|
|
18
|
-
// ----
|
|
19
|
-
const setNewQueryStringValue = React.useCallback((value) => setQueryString((curr) => {
|
|
20
|
-
curr[field] = value;
|
|
21
|
-
return curr;
|
|
22
|
-
}), [setQueryString, field]);
|
|
23
|
-
// ----
|
|
24
|
-
// Hook Returns
|
|
25
|
-
// ----
|
|
26
|
-
return [queryString[field], setNewQueryStringValue];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { useQueryStringValue };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { NavigateOptions } from 'react-router-dom';
|
|
3
|
-
import type { IParseOptions, IStringifyOptions, ParsedQs } from 'qs';
|
|
4
|
-
interface UseQueryStringOptions {
|
|
5
|
-
/** Options to use while parsing data */
|
|
6
|
-
parsing?: Partial<IParseOptions>;
|
|
7
|
-
/** Options to use while stringify data */
|
|
8
|
-
stringify?: Partial<IStringifyOptions>;
|
|
9
|
-
}
|
|
10
|
-
type SetQueryString<Data extends ParsedQs> = (value: React.SetStateAction<Data>, options?: NavigateOptions) => void;
|
|
11
|
-
type UseQueryStringResult<Data extends ParsedQs> = [Data, SetQueryString<Data>];
|
|
12
|
-
/**
|
|
13
|
-
* Use this hook to get or change the current query string.
|
|
14
|
-
* This hook strictly depends on the `react-router-dom` package and
|
|
15
|
-
* could not be used if package is not installed.
|
|
16
|
-
* Passed options will be referenced using useRef internal hook,
|
|
17
|
-
* changing them won't affect parsing/stringify url search data before next render
|
|
18
|
-
*
|
|
19
|
-
* @param options
|
|
20
|
-
*/
|
|
21
|
-
export declare function useQueryString<Data extends ParsedQs>(options?: UseQueryStringOptions): UseQueryStringResult<Data>;
|
|
22
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Use this hook to manage a single field of the current query string.
|
|
3
|
-
* A utility function will be returned with the field value to help
|
|
4
|
-
* easily change the value.
|
|
5
|
-
*
|
|
6
|
-
* @param field
|
|
7
|
-
*/
|
|
8
|
-
export declare function useQueryStringValue<T extends string | string[]>(field: string): [T, (value: T) => void];
|