Skip to content

Commit 0ad8118

Browse files
fhendersonFrancois Henderson
and
Francois Henderson
authored
build(dependencies): Update dependencies, React and Node version target (#20)
Co-authored-by: Francois Henderson <[email protected]>
1 parent a4e729e commit 0ad8118

File tree

8 files changed

+31290
-6008
lines changed

8 files changed

+31290
-6008
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
/coverage
55
*.sublime-project
66
*.sublime-workspace
7+
.idea

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- "8.11.1"
3+
- "16.0.0"
44
before_install:
55
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.6.0
66
- export PATH="$HOME/.yarn/bin:$PATH"

jest.setup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
const Enzyme = require('enzyme');
2-
const Adapter = require('enzyme-adapter-react-16');
2+
const Adapter = require('enzyme-adapter-react-17-updated');
33

44
Enzyme.configure({ adapter: new Adapter() });

package-lock.json

+24,613
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+28-29
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-scroll-into-view-if-needed",
3-
"version": "2.1.8",
3+
"version": "3.0.0",
44
"description": "A thin component wrapper around scroll-into-view-if-needed",
55
"main": "dist/umd/index.js",
66
"module": "dist/es/index.js",
@@ -28,37 +28,36 @@
2828
},
2929
"peerDependencies": {
3030
"prop-types": ">=15",
31-
"react": ">=16"
31+
"react": ">=17"
3232
},
33-
"dependencies": {},
3433
"devDependencies": {
35-
"@babel/cli": "^7.4.4",
36-
"@babel/core": "^7.4.4",
37-
"@babel/plugin-proposal-class-properties": "^7.4.4",
38-
"@babel/preset-env": "^7.4.4",
39-
"@babel/preset-react": "^7.0.0",
40-
"@commitlint/config-conventional": "^7.6.0",
34+
"@babel/cli": "^7.13.16",
35+
"@babel/core": "^7.14.2",
36+
"@babel/plugin-proposal-class-properties": "^7.13.0",
37+
"@babel/preset-env": "^7.14.2",
38+
"@babel/preset-react": "^7.13.13",
39+
"@commitlint/config-conventional": "^12.1.4",
4140
"babel-eslint": "^10.0.1",
42-
"commitlint": "^7.6.1",
43-
"coveralls": "^3.0.3",
44-
"cross-env": "^5.2.0",
45-
"enzyme": "^3.9.0",
46-
"enzyme-adapter-react-16": "^1.12.1",
47-
"enzyme-to-json": "^3.3.5",
48-
"eslint": "^5.16.0",
49-
"eslint-config-airbnb": "^17.1.0",
50-
"eslint-plugin-import": "^2.17.2",
51-
"eslint-plugin-jsx-a11y": "^6.2.1",
52-
"eslint-plugin-react": "^7.13.0",
53-
"husky": "^2.2.0",
54-
"jest": "^24.8.0",
41+
"commitlint": "^12.1.4",
42+
"coveralls": "^3.1.0",
43+
"cross-env": "^7.0.3",
44+
"enzyme": "^3.11.0",
45+
"enzyme-adapter-react-17-updated": "^1.0.2",
46+
"enzyme-to-json": "^3.6.2",
47+
"eslint": "^7.26.0",
48+
"eslint-config-airbnb": "^18.2.1",
49+
"eslint-plugin-import": "^2.22.1",
50+
"eslint-plugin-jsx-a11y": "^6.4.1",
51+
"eslint-plugin-react": "^7.23.2",
52+
"husky": "^6.0.0",
53+
"jest": "^26.6.3",
5554
"prop-types": "^15.7.2",
56-
"react": "^16.8.6",
57-
"react-dom": "^16.8.6",
58-
"rollup": "^1.11.3",
59-
"rollup-plugin-babel": "^4.3.2",
60-
"rollup-plugin-commonjs": "^9.3.4",
61-
"rollup-plugin-node-resolve": "^4.2.3",
62-
"scroll-into-view-if-needed": "^2.2.20"
55+
"react": "^17.0.2",
56+
"react-dom": "^17.0.2",
57+
"rollup": "^2.47.0",
58+
"rollup-plugin-babel": "^4.4.0",
59+
"rollup-plugin-commonjs": "^10.1.0",
60+
"rollup-plugin-node-resolve": "^5.2.0",
61+
"scroll-into-view-if-needed": "^2.2.28"
6362
}
6463
}

src/__tests__/__snapshots__/index.test.js.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Render in inactive state, then toggle active state 1`] = `
3+
exports['Render in inactive state, then toggle active state 1'] = `
44
<div>
55
<MockChild />
66
</div>
77
`;
88

9-
exports[`Render with no props 1`] = `
9+
exports['Render with no props 1'] = `
1010
<div>
1111
<MockChild />
1212
</div>

src/index.js

+47-48
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,6 @@ import PropTypes from 'prop-types';
44
import scrollIntoViewIfNeeded from 'scroll-into-view-if-needed';
55

66
export default class ScrollIntoViewIfNeeded extends PureComponent {
7-
static propTypes = {
8-
active: PropTypes.bool,
9-
children: PropTypes.node.isRequired,
10-
elementType: PropTypes.string,
11-
// this shape should mirror the scroll-into-view-if-needed options
12-
options: PropTypes.shape({
13-
behavior: PropTypes.oneOfType([
14-
PropTypes.oneOf([
15-
'auto',
16-
'smooth',
17-
'instant',
18-
]),
19-
PropTypes.func,
20-
]),
21-
block: PropTypes.oneOf([
22-
'center',
23-
'end',
24-
'nearest',
25-
'start',
26-
]),
27-
inline: PropTypes.oneOf([
28-
'center',
29-
'end',
30-
'nearest',
31-
'start',
32-
]),
33-
scrollMode: PropTypes.oneOf([
34-
'always',
35-
'if-needed',
36-
]),
37-
boundary: PropTypes.oneOfType([
38-
// eslint-disable-next-line no-undef
39-
PropTypes.instanceOf(Element),
40-
PropTypes.func,
41-
]),
42-
skipOverflowHiddenElements: PropTypes.bool,
43-
}),
44-
};
45-
46-
static defaultProps = {
47-
active: true,
48-
elementType: 'div',
49-
options: {
50-
behavior: 'smooth',
51-
scrollMode: 'if-needed',
52-
},
53-
};
54-
557
constructor() {
568
super();
579
this.node = createRef();
@@ -88,3 +40,50 @@ export default class ScrollIntoViewIfNeeded extends PureComponent {
8840
return createElement(elementType, { ref: this.node, ...wrapperProps }, children);
8941
}
9042
}
43+
ScrollIntoViewIfNeeded.propTypes = {
44+
active: PropTypes.bool,
45+
children: PropTypes.node.isRequired,
46+
elementType: PropTypes.string,
47+
// this shape should mirror the scroll-into-view-if-needed options
48+
options: PropTypes.shape({
49+
behavior: PropTypes.oneOfType([
50+
PropTypes.oneOf([
51+
'auto',
52+
'smooth',
53+
'instant',
54+
]),
55+
PropTypes.func,
56+
]),
57+
block: PropTypes.oneOf([
58+
'center',
59+
'end',
60+
'nearest',
61+
'start',
62+
]),
63+
inline: PropTypes.oneOf([
64+
'center',
65+
'end',
66+
'nearest',
67+
'start',
68+
]),
69+
scrollMode: PropTypes.oneOf([
70+
'always',
71+
'if-needed',
72+
]),
73+
boundary: PropTypes.oneOfType([
74+
// eslint-disable-next-line no-undef
75+
PropTypes.instanceOf(Element),
76+
PropTypes.func,
77+
]),
78+
skipOverflowHiddenElements: PropTypes.bool,
79+
}),
80+
};
81+
82+
ScrollIntoViewIfNeeded.defaultProps = {
83+
active: true,
84+
elementType: 'div',
85+
options: {
86+
behavior: 'smooth',
87+
scrollMode: 'if-needed',
88+
},
89+
};

0 commit comments

Comments
 (0)