@availity/hooks 3.0.7-ts.13 → 3.2.0
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/CHANGELOG.md +39 -0
- package/README.md +19 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +16 -13
- package/src/useWindowDimensions.js +26 -0
- package/types/useWindowDimensions.d.ts +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,45 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 3.2.0 (2022-02-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **hooks:** add documentation to sidebar, some formatting ([fbd9964](https://github.com/Availity/availity-react/commit/fbd99648c18993394f773d8540c1be023acf6e5b))
|
|
12
|
+
* **hooks:** add useWindowDimensionsHook ([203d9c0](https://github.com/Availity/availity-react/commit/203d9c0a31362ec084c94c4ae50ab4b6efbc876b))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [3.1.2](https://github.com/Availity/availity-react/compare/@availity/hooks@3.1.1...@availity/hooks@3.1.2) (2021-12-20)
|
|
19
|
+
|
|
20
|
+
**Note:** Version bump only for package @availity/hooks
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 3.1.1 (2021-12-14)
|
|
27
|
+
|
|
28
|
+
**Note:** Version bump only for package @availity/hooks
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
# 3.1.0 (2021-11-15)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
* move storybook, stories, and fix hmr ([2f65f71](https://github.com/Availity/availity-react/commit/2f65f71769d2d981e22700b87a09516833588f64))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
6
45
|
## [3.0.6](https://github.com/Availity/availity-react/compare/@availity/hooks@3.0.5...@availity/hooks@3.0.6) (2021-10-28)
|
|
7
46
|
|
|
8
47
|
**Note:** Version bump only for package @availity/hooks
|
package/README.md
CHANGED
|
@@ -3,5 +3,23 @@
|
|
|
3
3
|
> Re-usable hooks for components and apps.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@availity/hooks)
|
|
6
|
+
[](https://www.npmjs.com/package/@availity/hooks)
|
|
7
|
+
[](https://github.com/Availity/availity-react/blob/master/packages/hooks/package.json)
|
|
6
8
|
|
|
7
|
-
##
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
### NPM
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @availity/hooks
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Yarn
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
yarn add @availity/hooks
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
Check out more documentation at [availity.github.io](https://availity.github.io/availity-react/components/hooks/index)
|
package/index.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export { default as useCurrentUser } from './types/useCurrentUser';
|
|
|
7
7
|
export { default as useProviders } from './types/useProviders';
|
|
8
8
|
export { default as usePermissions } from './types/usePermissions';
|
|
9
9
|
export { default as useOrganizations } from './types/useOrganizations';
|
|
10
|
+
export { default as useWindowDimensions } from './types/useWindowDimensions';
|
package/index.js
CHANGED
|
@@ -7,3 +7,4 @@ export { default as useCurrentUser } from './src/useCurrentUser';
|
|
|
7
7
|
export { default as useProviders } from './src/useProviders';
|
|
8
8
|
export { default as usePermissions } from './src/usePermissions';
|
|
9
9
|
export { default as useOrganizations } from './src/useOrganizations';
|
|
10
|
+
export { default as useWindowDimensions } from './src/useWindowDimensions';
|
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/hooks",
|
|
3
|
-
"version": "3.0
|
|
4
|
-
"author": "Kyle Gray <kyle.gray@availity.com>",
|
|
3
|
+
"version": "3.2.0",
|
|
5
4
|
"description": "A group of pre-built hooks that are common in most apps",
|
|
6
|
-
"main": "index.js",
|
|
7
|
-
"types": "index.d.ts",
|
|
8
5
|
"keywords": [
|
|
9
6
|
"react",
|
|
10
|
-
"availity"
|
|
7
|
+
"availity",
|
|
8
|
+
"hooks"
|
|
11
9
|
],
|
|
12
|
-
"
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "https://github.com/Availity/availity-react.git"
|
|
15
|
-
},
|
|
10
|
+
"homepage": "https://availity.github.io/availity-react/components/hooks/index",
|
|
16
11
|
"bugs": {
|
|
17
12
|
"url": "https://github.com/Availity/availity-react/issues"
|
|
18
13
|
},
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/Availity/availity-react.git",
|
|
17
|
+
"directory": "packages/hooks"
|
|
22
18
|
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "Kyle Gray <kyle.gray@availity.com>",
|
|
21
|
+
"main": "index.js",
|
|
22
|
+
"types": "index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"prop-types": "^15.7.2",
|
|
25
25
|
"react-query": "^3.29.0"
|
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"axios": "^0.21.1",
|
|
36
36
|
"react": ">=16.8.0"
|
|
37
37
|
},
|
|
38
|
-
"
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"gitHead": "abf384b83ac5948b55377ccca91cbdb8ea81f753"
|
|
39
42
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
const getWindowDimensions = () => {
|
|
4
|
+
const { innerWidth: width, innerHeight: height } = window;
|
|
5
|
+
return {
|
|
6
|
+
width,
|
|
7
|
+
height,
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const useWindowDimensions = () => {
|
|
12
|
+
const [windowDimensions, setWindowDimensions] = useState(getWindowDimensions());
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const handleResize = () => {
|
|
16
|
+
setWindowDimensions(getWindowDimensions());
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
window.addEventListener('resize', handleResize);
|
|
20
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
21
|
+
}, []);
|
|
22
|
+
|
|
23
|
+
return windowDimensions;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default useWindowDimensions;
|