-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: relocate useFocusWithin hook (#1084)
- Loading branch information
Showing
10 changed files
with
39 additions
and
5 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 was deleted.
Oops, something went wrong.
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--> | ||
|
||
# useFocusWithin | ||
|
||
<!--/GITHUB_BLOCK--> | ||
|
||
```tsx | ||
import {useFocusWithin} from '@gravity-ui/uikit'; | ||
``` | ||
|
||
The `useFocusWithin` hook that handles focus events for the target and its descendants | ||
|
||
## Properties | ||
|
||
| Name | Description | Type | Default | | ||
| :------------------ | :---------------------------------------------------------------------------- | :--------------------------------: | :-----: | | ||
| isDisabled | Whether the focus within events should be disabled | `boolean` | | | ||
| onFocusWithin | Handler that is called when the target element or a descendant receives focus | `(e: React.FocusEvent) => void` | | | ||
| onBlurWithin | Handler that is called when the target element and all descendants lose focus | `(e: React.FocusEvent) => void` | | | ||
| onFocusWithinChange | Handler that is called when the the focus within state changes | `(isFocusWithin: boolean) => void` | | | ||
|
||
## Result | ||
|
||
`onFocus` and `onBlur` handlers. `{focusWithinProps: {onFocus, onBlur}}` |
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,2 @@ | ||
export {useFocusWithin} from './useFocusWithin'; | ||
export type {UseFocusWithinProps, FocusWithinProps, UseFocusWithinResult} from './useFocusWithin'; |
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
File renamed without changes.