@nulogy/components 13.1.3 → 13.1.5
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/dist/main.js +185 -257
- package/dist/main.module.js +185 -257
- package/dist/src/Layout/Sidebar.d.ts +1 -1
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/testing/useUrlProps.d.ts +6 -0
- package/dist/src/utils/useScrollLock.d.ts +55 -0
- package/package.json +1 -1
- package/dist/src/utils/PreventBodyElementScrolling.d.ts +0 -8
- /package/dist/src/utils/{testHelpers → testing}/createMatchMedia.d.ts +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useLayoutEffect } from "react";
|
|
2
|
+
export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
|
|
3
|
+
/** Hook options. */
|
|
4
|
+
type UseScrollLockOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* Whether to lock the scroll initially.
|
|
7
|
+
* @default true
|
|
8
|
+
*/
|
|
9
|
+
autoLock?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The target element to lock the scroll (default is the body element).
|
|
12
|
+
* @default document.body
|
|
13
|
+
*/
|
|
14
|
+
lockTarget?: HTMLElement | string;
|
|
15
|
+
/**
|
|
16
|
+
* Whether to prevent width reflow when locking the scroll.
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
widthReflow?: boolean;
|
|
20
|
+
};
|
|
21
|
+
/** Hook return type. */
|
|
22
|
+
type UseScrollLockReturn = {
|
|
23
|
+
/** Whether the scroll is locked. */
|
|
24
|
+
isLocked: boolean;
|
|
25
|
+
/** Lock the scroll. */
|
|
26
|
+
lock: () => void;
|
|
27
|
+
/** Unlock the scroll. */
|
|
28
|
+
unlock: () => void;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* A custom hook that locks and unlocks scroll.
|
|
32
|
+
* @param {UseScrollLockOptions} [options] - Options to configure the hook, by default it will lock the scroll automatically.
|
|
33
|
+
* @returns {UseScrollLockReturn} - An object containing the lock and unlock functions.
|
|
34
|
+
* @public
|
|
35
|
+
* @see [Documentation](https://usehooks-ts.com/react-hook/use-scroll-lock)
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* // Lock the scroll when the modal is mounted, and unlock it when it's unmounted
|
|
39
|
+
* useScrollLock()
|
|
40
|
+
* ```
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* // Manually lock and unlock the scroll
|
|
44
|
+
* const { lock, unlock } = useScrollLock({ autoLock: false })
|
|
45
|
+
*
|
|
46
|
+
* return (
|
|
47
|
+
* <div>
|
|
48
|
+
* <button onClick={lock}>Lock</button>
|
|
49
|
+
* <button onClick={unlock}>Unlock</button>
|
|
50
|
+
* </div>
|
|
51
|
+
* )
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function useScrollLock(options?: UseScrollLockOptions): UseScrollLockReturn;
|
|
55
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export default class PreventBodyElementScrolling extends React.Component<any, any, any> {
|
|
2
|
-
constructor(props: any);
|
|
3
|
-
constructor(props: any, context: any);
|
|
4
|
-
componentDidMount(): void;
|
|
5
|
-
componentWillUnmount(): void;
|
|
6
|
-
render(): React.JSX.Element;
|
|
7
|
-
}
|
|
8
|
-
import React from "react";
|
|
File without changes
|