@jobber/hooks 2.19.2 → 2.19.3
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,4 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
1
2
|
/**
|
|
2
3
|
* Traps the focus within the children of the ref element.
|
|
3
4
|
*
|
|
@@ -6,4 +7,4 @@
|
|
|
6
7
|
*
|
|
7
8
|
* @returns ref
|
|
8
9
|
*/
|
|
9
|
-
export declare function useFocusTrap<T extends HTMLElement>(active: boolean):
|
|
10
|
+
export declare function useFocusTrap<T extends HTMLElement>(active: boolean): RefObject<T>;
|
package/dist/useFocusTrap-cjs.js
CHANGED
|
@@ -14,6 +14,7 @@ function useFocusTrap(active) {
|
|
|
14
14
|
// There's an ongoing issue with useRef return type clashing with an element's
|
|
15
15
|
// ref prop type. TLDR: Use null because useRef doesn't expect undefined.
|
|
16
16
|
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/35572
|
|
17
|
+
// Requires the cast because we need to be compatible with React 18's RefObject type.
|
|
17
18
|
const ref = require$$1.useRef(null);
|
|
18
19
|
function handleKeyDown(event) {
|
|
19
20
|
if (!(active && ref.current) || event.key !== "Tab") {
|
package/dist/useFocusTrap-es.js
CHANGED
|
@@ -12,6 +12,7 @@ function useFocusTrap(active) {
|
|
|
12
12
|
// There's an ongoing issue with useRef return type clashing with an element's
|
|
13
13
|
// ref prop type. TLDR: Use null because useRef doesn't expect undefined.
|
|
14
14
|
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/35572
|
|
15
|
+
// Requires the cast because we need to be compatible with React 18's RefObject type.
|
|
15
16
|
const ref = useRef(null);
|
|
16
17
|
function handleKeyDown(event) {
|
|
17
18
|
if (!(active && ref.current) || event.key !== "Tab") {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { RefObject } from "react";
|
|
2
|
-
export declare function useInView<T extends Element>(): [RefObject<T
|
|
2
|
+
export declare function useInView<T extends Element>(): [RefObject<T>, boolean];
|
package/dist/useInView-cjs.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var require$$1 = require('react');
|
|
4
4
|
|
|
5
5
|
function useInView() {
|
|
6
|
+
// Requires the cast because we need to be compatible with React 18's RefObject type.
|
|
6
7
|
const ref = require$$1.useRef(null);
|
|
7
8
|
const [isInView, setIsInView] = require$$1.useState(false);
|
|
8
9
|
const handleIntersection = require$$1.useCallback(entries => setIsInView(entries[0].isIntersecting), [setIsInView]);
|
package/dist/useInView-es.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useRef, useState, useCallback, useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
function useInView() {
|
|
4
|
+
// Requires the cast because we need to be compatible with React 18's RefObject type.
|
|
4
5
|
const ref = useRef(null);
|
|
5
6
|
const [isInView, setIsInView] = useState(false);
|
|
6
7
|
const handleIntersection = useCallback(entries => setIsInView(entries[0].isIntersecting), [setIsInView]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/hooks",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -140,5 +140,5 @@
|
|
|
140
140
|
"@apollo/client": "^3.0.0",
|
|
141
141
|
"react": "^18 || ^19.1.0"
|
|
142
142
|
},
|
|
143
|
-
"gitHead": "
|
|
143
|
+
"gitHead": "80f1a53013920ffd3ace6c8bce1a2fb4fe5be121"
|
|
144
144
|
}
|