-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: refactor hooks: useBodyScrollLock, usePortalContainer, useVirtua…
…lElementRef
- Loading branch information
Showing
16 changed files
with
85 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './Portal'; | ||
export * from '../../hooks/usePortalContainer/PortalProvider'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
export * from './useOutsideClick'; | ||
export * from './useBodyScrollLock'; | ||
export * from './useVirtualElementRef'; | ||
export * from './usePortalContainer'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!--GITHUB_BLOCK--> | ||
|
||
# useBodyScrollLock | ||
|
||
<!--/GITHUB_BLOCK--> | ||
|
||
```tsx | ||
import {useBodyScrollLock} from '@gravity-ui/uikit'; | ||
``` | ||
|
||
The `useBodyScrollLock` hook helps to blocks scrolling on the body element. | ||
|
||
## Properties | ||
|
||
| Name | Description | Type | Default | | ||
| :------ | :---------- | :-------: | :-----: | | ||
| enabled | Enable flag | `boolean` | | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export {useBodyScrollLock} from './useBodyScrollLock'; | ||
export type {UseBodyScrollLockProps} from './useBodyScrollLock'; |
4 changes: 2 additions & 2 deletions
4
src/components/utils/useBodyScrollLock.ts → ...ks/useBodyScrollLock/useBodyScrollLock.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!--GITHUB_BLOCK--> | ||
|
||
# usePortalContainer | ||
|
||
<!--/GITHUB_BLOCK--> | ||
|
||
```tsx | ||
import {usePortalContainer} from '@gravity-ui/uikit'; | ||
``` | ||
|
||
The `usePortalContainer` hook helps to create portal container | ||
|
||
## Return | ||
|
||
| Name | Description | Type | | ||
| :-------- | :--------------------------- | :------------------: | | ||
| container | Container element for portal | `HTMLElement - null` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export {usePortalContainer} from './usePortalContainer'; | ||
export {PortalProvider} from './PortalProvider'; | ||
export type {UsePortalContainerReturnType} from './usePortalContainer'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!--GITHUB_BLOCK--> | ||
|
||
# useVirtualElementRef | ||
|
||
<!--/GITHUB_BLOCK--> | ||
|
||
```tsx | ||
import {useVirtualElementRef} from '@gravity-ui/uikit'; | ||
``` | ||
|
||
The `useVirtualElementRef` hook helps to create virtual element for popup | ||
|
||
## Properties | ||
|
||
| Name | Description | Type | Default | | ||
| :------------- | :-------------------------------------------------- | :----------------------------------------: | :-----: | | ||
| rect | Position of virtual element in relation to viewport | `{top, bottom, left, right}: {[x]:number}` | | | ||
| contextElement | DOM-context of virtual element | `Element` | | | ||
|
||
## Return | ||
|
||
| Name | Description | Type | | ||
| :--- | :----------------------- | :----------------------: | | ||
| ref | Virtual element ref link | `React.MutableRefObject` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export {useVirtualElementRef} from './useVirtualElementRef'; | ||
export type { | ||
VirtualElementRect, | ||
UseVirtualElementRefProps, | ||
UseVirtualElementRefReturnType, | ||
} from './useVirtualElementRef'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters