@uxf/core-react 11.51.0 → 11.52.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BodyScrollOptions } from "@uxf/core/utils/
|
|
1
|
+
import { BodyScrollOptions } from "@uxf/core/utils/body-scroll-lock";
|
|
2
2
|
import { RefObject } from "react";
|
|
3
3
|
export interface UseBodyScrollLockOptions extends BodyScrollOptions {
|
|
4
4
|
clearAllOnClose?: boolean;
|
|
5
5
|
}
|
|
6
|
-
export declare function useBodyScrollLock<T extends HTMLElement
|
|
6
|
+
export declare function useBodyScrollLock<T extends HTMLElement>(containerRef: RefObject<T | null>, isOpen: boolean, { allowTouchMove, clearAllOnClose, reserveScrollBarGap }?: Partial<UseBodyScrollLockOptions>): void;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useBodyScrollLock = useBodyScrollLock;
|
|
4
|
-
const
|
|
4
|
+
const body_scroll_lock_1 = require("@uxf/core/utils/body-scroll-lock");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
function useBodyScrollLock(containerRef, isOpen, { allowTouchMove, clearAllOnClose, reserveScrollBarGap } = {}) {
|
|
7
7
|
(0, react_1.useEffect)(() => {
|
|
8
8
|
const node = containerRef.current;
|
|
9
9
|
if (isOpen && node) {
|
|
10
|
-
(0,
|
|
10
|
+
(0, body_scroll_lock_1.disableBodyScroll)(node, {
|
|
11
11
|
allowTouchMove: allowTouchMove ||
|
|
12
12
|
((element) => {
|
|
13
13
|
var _a;
|
|
@@ -24,10 +24,10 @@ function useBodyScrollLock(containerRef, isOpen, { allowTouchMove, clearAllOnClo
|
|
|
24
24
|
}
|
|
25
25
|
return () => {
|
|
26
26
|
if (node) {
|
|
27
|
-
(0,
|
|
27
|
+
(0, body_scroll_lock_1.enableBodyScroll)(node);
|
|
28
28
|
}
|
|
29
29
|
if (clearAllOnClose) {
|
|
30
|
-
(0,
|
|
30
|
+
(0, body_scroll_lock_1.clearAllBodyScrollLocks)();
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
}, [allowTouchMove, clearAllOnClose, containerRef, isOpen, reserveScrollBarGap]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FocusEventHandler, MouseEventHandler, RefObject } from "react";
|
|
2
|
-
export declare function useInputFocus<T extends HTMLInputElement | HTMLTextAreaElement | HTMLElement
|
|
2
|
+
export declare function useInputFocus<T extends HTMLInputElement | HTMLTextAreaElement | HTMLElement>(focusRef: RefObject<T | null>, onBlur?: FocusEventHandler<T>, onFocus?: FocusEventHandler<T>): {
|
|
3
3
|
focused: boolean;
|
|
4
4
|
focus: MouseEventHandler<HTMLElement>;
|
|
5
5
|
onBlur: FocusEventHandler<T>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useIsomorphicLayoutEffect = void 0;
|
|
4
|
-
const
|
|
4
|
+
const is_browser_1 = require("@uxf/core/utils/is-browser");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
exports.useIsomorphicLayoutEffect =
|
|
6
|
+
exports.useIsomorphicLayoutEffect = is_browser_1.isBrowser ? react_1.useLayoutEffect : react_1.useEffect;
|
package/hooks/use-key.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RefObject } from "react";
|
|
2
2
|
type KeyPredicate = (e: KeyboardEvent) => boolean;
|
|
3
3
|
export type KeyFilter = null | undefined | string | KeyPredicate;
|
|
4
|
-
export interface UseKeyOptions<T extends HTMLElement
|
|
4
|
+
export interface UseKeyOptions<T extends HTMLElement> {
|
|
5
5
|
disabled?: boolean;
|
|
6
|
-
targetRef?: RefObject<T>;
|
|
6
|
+
targetRef?: RefObject<T | null>;
|
|
7
7
|
type: "keydown" | "keyup" | "keypress";
|
|
8
8
|
}
|
|
9
9
|
export declare function useKey<T extends HTMLElement>(keyFilter: KeyFilter, callback: (e: KeyboardEvent) => void, { disabled, targetRef, type }?: Partial<UseKeyOptions<T>>): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CSSProperties, RefObject } from "react";
|
|
2
|
-
export declare function useMouseDragToScroll<T extends HTMLElement
|
|
2
|
+
export declare function useMouseDragToScroll<T extends HTMLElement>(containerRef: RefObject<T | null>): CSSProperties | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/core-react",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.52.0",
|
|
4
4
|
"description": "UXF Core",
|
|
5
5
|
"author": "UX Fans s.r.o",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"typecheck": "tsc --noEmit --skipLibCheck"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@uxf/core": "11.
|
|
15
|
+
"@uxf/core": "11.52.0"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"react": ">=18.2.0"
|