@dfds-ui/hooks 2.2.0-alpha.9edc847c → 2.2.0-alpha.a1ae8508

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.
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- declare function useForwardedRef<T>(forwardedRef: ((instance: T | null) => void) | React.MutableRefObject<T | null> | null): React.RefObject<T>;
2
+ declare function useForwardedRef<T>(forwardedRef: ((instance: T | null) => void) | React.MutableRefObject<T | null> | null): React.RefObject<T | null>;
3
3
  export default useForwardedRef;
package/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export { default as useScript } from './useScript';
2
+ export { default as useResizeObserver } from './useResizeObserver';
3
+ export { default as useForwardedRef } from './useForwardedRef';
4
+ export { default as useOffline } from './useOffline';
5
+ export { default as useDimensions } from './useDimensions';
6
+ export * from './useGoogleReCaptchaV3';
package/package.json CHANGED
@@ -3,20 +3,20 @@
3
3
  "description": "React hooks",
4
4
  "license": "MIT",
5
5
  "private": false,
6
- "version": "2.2.0-alpha.9edc847c",
6
+ "version": "2.2.0-alpha.a1ae8508",
7
7
  "sideEffects": false,
8
8
  "main": "./cjs/index.js",
9
9
  "module": "./index.js",
10
10
  "esnext": "./index.js",
11
11
  "typings": "./index.d.ts",
12
12
  "peerDependencies": {
13
- "react": ">= 18.3.1",
14
- "react-dom": ">= 18.3.1"
13
+ "react": ">= 19.0.0",
14
+ "react-dom": ">= 19.0.0"
15
15
  },
16
16
  "dependencies": {
17
17
  "use-resize-observer": "^9.1.0"
18
18
  },
19
- "gitHead": "9edc847c21d2f86054d768d1f84d34027ca9d675",
19
+ "gitHead": "a1ae8508444d4439c2f289df498fc1e335416f65",
20
20
  "publishConfig": {
21
21
  "access": "public"
22
22
  }
@@ -0,0 +1,16 @@
1
+ export interface DimensionObject {
2
+ width: number;
3
+ height: number;
4
+ top: number;
5
+ left: number;
6
+ x: number;
7
+ y: number;
8
+ right: number;
9
+ bottom: number;
10
+ }
11
+ export type UseDimensionsHook = [(node: HTMLElement | null) => void, DimensionObject, HTMLElement | null];
12
+ export interface UseDimensionsArgs {
13
+ liveMeasure?: boolean;
14
+ }
15
+ declare function useDimensions({ liveMeasure }?: UseDimensionsArgs): UseDimensionsHook;
16
+ export default useDimensions;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare function useForwardedRef<T>(forwardedRef: ((instance: T | null) => void) | React.MutableRefObject<T | null> | null): React.RefObject<T | null>;
3
+ export default useForwardedRef;
@@ -0,0 +1,18 @@
1
+ declare global {
2
+ interface Window {
3
+ grecaptcha: any;
4
+ }
5
+ }
6
+ export type GoogleReCaptchaV3Options = {
7
+ /**
8
+ * The `sitekey` to use with reCAPTCHA v3.
9
+ * https://developers.google.com/recaptcha/docs/v3
10
+ */
11
+ siteKey: string;
12
+ /**
13
+ * Disable ReCaptcha preventing the script from loading and return undefined from the execute function.
14
+ * This is useful when consumer needs to conditionally enable or disable ReCaptcha
15
+ */
16
+ disabled?: boolean;
17
+ };
18
+ export declare function useGoogleReCaptchaV3({ siteKey, disabled }: GoogleReCaptchaV3Options): (action?: string) => Promise<string | undefined>;
@@ -0,0 +1,5 @@
1
+ declare const useOffline: () => {
2
+ isOnline: boolean;
3
+ isOffline: boolean;
4
+ };
5
+ export default useOffline;
@@ -0,0 +1,2 @@
1
+ import useResizeObserver from 'use-resize-observer/polyfilled';
2
+ export default useResizeObserver;
package/useScript.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Hook for loading external script
3
+ * @param {string} src - The URL of the script
4
+ * @param {boolean} [doNotLoad=false] - If set to true the script will not be loaded
5
+ * This can be handy because hooks can not be called conditionally by the consumer
6
+ */
7
+ declare function useScript(src: string, doNotLoad?: boolean): boolean[];
8
+ export default useScript;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes