diff --git a/src/hooks/index.ts b/src/hooks/index.ts index c2f62a9d45..8ce4679d64 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -1,4 +1,4 @@ -export * from './useOutsideClick'; export * from './useBodyScrollLock'; -export * from './useVirtualElementRef'; +export * from './useOutsideClick'; export * from './usePortalContainer'; +export * from './useVirtualElementRef'; diff --git a/src/hooks/useBodyScrollLock/index.ts b/src/hooks/useBodyScrollLock/index.ts index de319276c0..66226dde7f 100644 --- a/src/hooks/useBodyScrollLock/index.ts +++ b/src/hooks/useBodyScrollLock/index.ts @@ -1,2 +1,2 @@ export {useBodyScrollLock} from './useBodyScrollLock'; -export type {UseBodyScrollLockProps} from './useBodyScrollLock'; +export type {BodyScrollLockProps} from './useBodyScrollLock'; diff --git a/src/hooks/useBodyScrollLock/useBodyScrollLock.ts b/src/hooks/useBodyScrollLock/useBodyScrollLock.ts index c50f5229b6..3d47b0fc53 100644 --- a/src/hooks/useBodyScrollLock/useBodyScrollLock.ts +++ b/src/hooks/useBodyScrollLock/useBodyScrollLock.ts @@ -1,13 +1,13 @@ import React from 'react'; -export interface UseBodyScrollLockProps { +export interface BodyScrollLockProps { enabled: boolean; } let locks = 0; let storedBodyStyle: string | undefined; -export function useBodyScrollLock({enabled}: UseBodyScrollLockProps) { +export function useBodyScrollLock({enabled}: BodyScrollLockProps) { React.useLayoutEffect(() => { if (enabled) { locks++; diff --git a/src/hooks/usePortalContainer/README.md b/src/hooks/usePortalContainer/README.md index 45207cb319..71f1f45d2a 100644 --- a/src/hooks/usePortalContainer/README.md +++ b/src/hooks/usePortalContainer/README.md @@ -8,9 +8,9 @@ import {usePortalContainer} from '@gravity-ui/uikit'; ``` -The `usePortalContainer` hook helps to create portal container +The `usePortalContainer` hook returns portal container element in the current scope -## Return +## Result | Name | Description | Type | | :-------- | :--------------------------- | :------------------: | diff --git a/src/hooks/usePortalContainer/index.ts b/src/hooks/usePortalContainer/index.ts index a152b18a94..e768dc2839 100644 --- a/src/hooks/usePortalContainer/index.ts +++ b/src/hooks/usePortalContainer/index.ts @@ -1,3 +1,3 @@ export {usePortalContainer} from './usePortalContainer'; export {PortalProvider} from './PortalProvider'; -export type {UsePortalContainerReturnType} from './usePortalContainer'; +export type {UsePortalContainerResult} from './usePortalContainer'; diff --git a/src/hooks/usePortalContainer/usePortalContainer.ts b/src/hooks/usePortalContainer/usePortalContainer.ts index d05b08303b..e85939edef 100644 --- a/src/hooks/usePortalContainer/usePortalContainer.ts +++ b/src/hooks/usePortalContainer/usePortalContainer.ts @@ -2,9 +2,9 @@ import React from 'react'; import {PortalContext} from './PortalProvider'; -export type UsePortalContainerReturnType = HTMLElement | null; +export type UsePortalContainerResult = HTMLElement | null; -export function usePortalContainer(): UsePortalContainerReturnType { +export function usePortalContainer(): UsePortalContainerResult { const context = React.useContext(PortalContext); let defaultContainer = null; diff --git a/src/hooks/useVirtualElementRef/README.md b/src/hooks/useVirtualElementRef/README.md index 4ed780d9f8..ef30665da4 100644 --- a/src/hooks/useVirtualElementRef/README.md +++ b/src/hooks/useVirtualElementRef/README.md @@ -12,13 +12,13 @@ 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` | | +| Name | Description | Type | Default | +| :------------- | :----------------------------------------------- | :----------------------------------------: | :-----: | +| rect | Position of virtual element relative 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` | +| Name | Description | Type | +| :--- | :----------------------- | :---------------: | +| ref | Virtual element ref link | `React.RefObject` | diff --git a/src/hooks/useVirtualElementRef/index.ts b/src/hooks/useVirtualElementRef/index.ts index 5f154ad945..47af80691d 100644 --- a/src/hooks/useVirtualElementRef/index.ts +++ b/src/hooks/useVirtualElementRef/index.ts @@ -2,5 +2,5 @@ export {useVirtualElementRef} from './useVirtualElementRef'; export type { VirtualElementRect, UseVirtualElementRefProps, - UseVirtualElementRefReturnType, + UseVirtualElementRefResult, } from './useVirtualElementRef'; diff --git a/src/hooks/useVirtualElementRef/useVirtualElementRef.ts b/src/hooks/useVirtualElementRef/useVirtualElementRef.ts index b3d4a39af9..d45af8bdfd 100644 --- a/src/hooks/useVirtualElementRef/useVirtualElementRef.ts +++ b/src/hooks/useVirtualElementRef/useVirtualElementRef.ts @@ -11,7 +11,7 @@ export type VirtualElementRect = { export interface UseVirtualElementRefProps { /** - * Position of virtual element in relation to viewport + * Position of virtual element relative to viewport */ rect?: VirtualElementRect | null; @@ -21,14 +21,14 @@ export interface UseVirtualElementRefProps { contextElement?: Element; } -export type UseVirtualElementRefReturnType = React.MutableRefObject; +export type UseVirtualElementRefResult = React.MutableRefObject; const initialPosition = {top: 0, right: 0, bottom: 0, left: 0}; // React hook for creating virtual element for popup export function useVirtualElementRef( props: UseVirtualElementRefProps = {}, -): UseVirtualElementRefReturnType { +): UseVirtualElementRefResult { const {rect, contextElement} = props; const rectRef = React.useRef(initialPosition);