@availity/hooks 3.1.1 → 3.2.1
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 +31 -3
- package/README.md +19 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/jest.config.js +7 -0
- package/package.json +16 -10
- package/project.json +36 -0
- package/src/useWindowDimensions.js +26 -0
- package/tsconfig.json +5 -0
- package/tsconfig.spec.json +10 -0
- package/types/useToggle.d.ts +1 -1
- package/types/useWindowDimensions.d.ts +8 -0
- package/LICENSE +0 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
|
+
|
|
5
|
+
## [3.2.1](https://github.com/Availity/availity-react/compare/@availity/hooks@3.2.0...@availity/hooks@3.2.1) (2022-05-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* upgrade yup and update sb stories ([68aeafe](https://github.com/Availity/availity-react/commit/68aeafe4fd7d90d7c88dbb24636ba7770fe87aa3))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# 3.2.0 (2022-02-18)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **hooks:** add documentation to sidebar, some formatting ([fbd9964](https://github.com/Availity/availity-react/commit/fbd99648c18993394f773d8540c1be023acf6e5b))
|
|
20
|
+
* **hooks:** add useWindowDimensionsHook ([203d9c0](https://github.com/Availity/availity-react/commit/203d9c0a31362ec084c94c4ae50ab4b6efbc876b))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## [3.1.2](https://github.com/Availity/availity-react/compare/@availity/hooks@3.1.1...@availity/hooks@3.1.2) (2021-12-20)
|
|
27
|
+
|
|
28
|
+
**Note:** Version bump only for package @availity/hooks
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
2
32
|
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
33
|
|
|
6
34
|
## 3.1.1 (2021-12-14)
|
|
7
35
|
|
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/jest.config.js
ADDED
package/package.json
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/hooks",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "A group of pre-built hooks that are common in most apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
7
|
-
"availity"
|
|
7
|
+
"availity",
|
|
8
|
+
"hooks"
|
|
8
9
|
],
|
|
10
|
+
"homepage": "https://availity.github.io/availity-react/components/hooks/index",
|
|
9
11
|
"bugs": {
|
|
10
12
|
"url": "https://github.com/Availity/availity-react/issues"
|
|
11
13
|
},
|
|
12
14
|
"repository": {
|
|
13
15
|
"type": "git",
|
|
14
|
-
"url": "https://github.com/Availity/availity-react.git"
|
|
16
|
+
"url": "https://github.com/Availity/availity-react.git",
|
|
17
|
+
"directory": "packages/hooks"
|
|
15
18
|
},
|
|
16
19
|
"license": "MIT",
|
|
17
20
|
"author": "Kyle Gray <kyle.gray@availity.com>",
|
|
18
21
|
"main": "index.js",
|
|
19
22
|
"types": "index.d.ts",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"publish": "yarn npm publish --tolerate-republish --access public",
|
|
25
|
+
"publish:canary": "yarn npm publish --access public --tag canary"
|
|
26
|
+
},
|
|
20
27
|
"dependencies": {
|
|
21
|
-
"prop-types": "^15.
|
|
22
|
-
"react-query": "^3.
|
|
28
|
+
"prop-types": "^15.8.1",
|
|
29
|
+
"react-query": "^3.39.0"
|
|
23
30
|
},
|
|
24
31
|
"devDependencies": {
|
|
25
|
-
"@availity/api-axios": "^
|
|
26
|
-
"axios": "^0.21.
|
|
32
|
+
"@availity/api-axios": "^7.0.1",
|
|
33
|
+
"axios": "^0.21.4",
|
|
27
34
|
"react": "^17.0.2",
|
|
28
35
|
"react-dom": "^17.0.2"
|
|
29
36
|
},
|
|
@@ -34,6 +41,5 @@
|
|
|
34
41
|
},
|
|
35
42
|
"publishConfig": {
|
|
36
43
|
"access": "public"
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
}
|
|
44
|
+
}
|
|
45
|
+
}
|
package/project.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": "packages/hooks",
|
|
3
|
+
"projectType": "library",
|
|
4
|
+
"targets": {
|
|
5
|
+
"test": {
|
|
6
|
+
"executor": "@nrwl/jest:jest",
|
|
7
|
+
"outputs": ["coverage/hooks"],
|
|
8
|
+
"options": { "jestConfig": "packages/hooks/jest.config.js", "passWithNoTests": true }
|
|
9
|
+
},
|
|
10
|
+
"version": {
|
|
11
|
+
"executor": "@jscutlery/semver:version",
|
|
12
|
+
"options": {
|
|
13
|
+
"preset": "angular",
|
|
14
|
+
"commitMessageFormat": "chore(${projectName}): release version ${version} [skip ci]",
|
|
15
|
+
"tagPrefix": "@availity/${projectName}@",
|
|
16
|
+
"baseBranch": "master"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"lint": {
|
|
20
|
+
"executor": "@nrwl/linter:eslint",
|
|
21
|
+
"options": {
|
|
22
|
+
"eslintConfig": ".eslintrc.yaml",
|
|
23
|
+
"lintFilePatterns": ["packages/hooks/**/*.{js,ts}"],
|
|
24
|
+
"silent": false,
|
|
25
|
+
"fix": false,
|
|
26
|
+
"cache": true,
|
|
27
|
+
"cacheLocation": "./node_modules/.cache/hooks/.eslintcache",
|
|
28
|
+
"maxWarnings": -1,
|
|
29
|
+
"quiet": false,
|
|
30
|
+
"noEslintrc": false,
|
|
31
|
+
"hasTypeAwareRules": true,
|
|
32
|
+
"cacheStrategy": "metadata"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -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;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"types": ["jest", "node", "@testing-library/jest-dom"],
|
|
7
|
+
"allowJs": true
|
|
8
|
+
},
|
|
9
|
+
"include": ["**/*.test.js", "**/*.test.ts", "**/*.test.tsx", "**/*.d.ts"]
|
|
10
|
+
}
|
package/types/useToggle.d.ts
CHANGED
package/LICENSE
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2017-present Availity, LLC
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
-
a copy of this software and associated documentation files (the
|
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
-
the following conditions:
|
|
10
|
-
|
|
11
|
-
The above copyright notice and this permission notice shall be
|
|
12
|
-
included in all copies or substantial portions of the Software.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|