@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.
Files changed (48) hide show
  1. package/cjs/hooks/useAutoControlledState.js +69 -69
  2. package/cjs/hooks/useClickOutside.js +54 -54
  3. package/cjs/hooks/useDataManager.js +29 -29
  4. package/cjs/hooks/useDataSelector.js +76 -76
  5. package/cjs/hooks/useDebouncedCallback.js +34 -34
  6. package/cjs/hooks/useElementType.js +35 -35
  7. package/cjs/hooks/useEnhancedEffect.js +8 -8
  8. package/cjs/hooks/useEvent.js +37 -37
  9. package/cjs/hooks/useForkRef.js +16 -16
  10. package/cjs/hooks/useInputValue.js +15 -15
  11. package/cjs/hooks/useObjectState.js +37 -37
  12. package/cjs/hooks/useSafeState.js +27 -27
  13. package/cjs/hooks/useSyncedRef.js +16 -16
  14. package/cjs/hooks/useUnmountEffect.js +14 -14
  15. package/cjs/hooks/useWindowSize.js +54 -54
  16. package/cjs/index.js +0 -4
  17. package/cjs/utils/compose.js +40 -40
  18. package/cjs/utils/contextBuilder.js +36 -36
  19. package/cjs/utils/shorthands.js +148 -148
  20. package/esm/hooks/useAutoControlledState.js +69 -69
  21. package/esm/hooks/useClickOutside.js +54 -54
  22. package/esm/hooks/useDataManager.js +29 -29
  23. package/esm/hooks/useDataSelector.js +76 -76
  24. package/esm/hooks/useDebouncedCallback.js +34 -34
  25. package/esm/hooks/useElementType.js +35 -35
  26. package/esm/hooks/useEnhancedEffect.js +8 -8
  27. package/esm/hooks/useEvent.js +37 -37
  28. package/esm/hooks/useForkRef.js +16 -16
  29. package/esm/hooks/useInputValue.js +15 -15
  30. package/esm/hooks/useObjectState.js +37 -37
  31. package/esm/hooks/useSafeState.js +27 -27
  32. package/esm/hooks/useSyncedRef.js +16 -16
  33. package/esm/hooks/useUnmountEffect.js +14 -14
  34. package/esm/hooks/useWindowSize.js +54 -54
  35. package/esm/index.js +0 -2
  36. package/esm/utils/compose.js +40 -40
  37. package/esm/utils/contextBuilder.js +36 -36
  38. package/esm/utils/shorthands.js +148 -148
  39. package/package.json +19 -21
  40. package/tsconfig.declaration.tsbuildinfo +1 -1
  41. package/types/hooks/index.d.ts +0 -2
  42. package/types/utils/shorthands.d.ts +1 -1
  43. package/cjs/hooks/useQueryString.js +0 -92
  44. package/cjs/hooks/useQueryStringValue.js +0 -50
  45. package/esm/hooks/useQueryString.js +0 -70
  46. package/esm/hooks/useQueryStringValue.js +0 -29
  47. package/types/hooks/useQueryString.d.ts +0 -22
  48. 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];