Skip to content

Commit

Permalink
fix: start refactor hooks: useOutsideClick (#1035)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaCG authored Oct 3, 2023
1 parent 3d24eb0 commit 6ad4a78
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
/src/components/Toaster @ogonkov
/src/components/theme @resure
/src/components/Pagination @jhoncool

/src/hooks/useOutsideClick @NikitaCG

# Allow everyone to update dependencies
/package.json
/package-lock.json
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"lint:js": "eslint --ext .js,.jsx,.ts,.tsx .",
"lint:styles": "stylelint '{styles,src}/**/*.scss'",
"lint:prettier": "prettier --check '**/*.md'",
"lint:prettier:fix": "prettier --write '**/*.md'",
"lint": "run-p lint:*",
"typecheck": "tsc --noEmit",
"prepublishOnly": "npm run build"
Expand Down
1 change: 0 additions & 1 deletion src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,3 @@ export * from './utils/useFileInput/useFileInput';
export {useActionHandlers} from './utils/useActionHandlers';
export {useUniqId} from './utils/useUniqId';
export {getLayersCount} from './utils/LayerManager';
export * from './utils/useOutsideClick';
1 change: 1 addition & 0 deletions src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './useOutsideClick';
18 changes: 18 additions & 0 deletions src/hooks/useOutsideClick/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--GITHUB_BLOCK-->

# useOutsideClick

<!--/GITHUB_BLOCK-->

```tsx
import {useOutsideClick} from '@gravity-ui/uikit';
```

The `useOutsideClick` hook helps to track the click outside of the tracked element.

## Properties

| Name | Description | Type | Default |
| :------ | :---------------------------------------------------------------- | :---------------: | :-----: |
| ref | Ref-link to target of observation | `React.RefObject` | |
| handler | Callback when a click is triggered outside the observation target | `() => void` | |
File renamed without changes.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './components';
export * from './hooks';

0 comments on commit 6ad4a78

Please sign in to comment.