Skip to content

Commit 071d62c

Browse files
authored
Merge pull request #47 from ai/size
Reduce size
2 parents 2c8a8b3 + 866662a commit 071d62c

File tree

10 files changed

+83
-48
lines changed

10 files changed

+83
-48
lines changed

.babelrc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
],
88
"plugins": [
99
"@babel/plugin-proposal-class-properties",
10-
"@babel/plugin-transform-runtime"
10+
"@babel/plugin-transform-runtime",
11+
[
12+
"transform-react-remove-prop-types",
13+
{
14+
"mode": "wrap"
15+
}
16+
]
1117
]
1218
},
1319
"es2015": {
@@ -22,7 +28,13 @@
2228
],
2329
"plugins": [
2430
"@babel/plugin-proposal-class-properties",
25-
"@babel/plugin-transform-runtime"
31+
"@babel/plugin-transform-runtime",
32+
[
33+
"transform-react-remove-prop-types",
34+
{
35+
"mode": "wrap"
36+
}
37+
]
2638
]
2739
}
2840
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"@storybook/addon-links": "^3.2.14",
5353
"@storybook/react": "^3.2.14",
5454
"babel-eslint": "^9.0.0",
55+
"babel-plugin-transform-react-remove-prop-types": "^0.4.19",
5556
"chai": "^4.1.0",
5657
"chai-enzyme": "^1.0.0-beta.0",
5758
"enzyme": "^3.3.0",

src/AutoFocusInside.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ const AutoFocusInside = ({ disabled, children, className }) => (
99
</div>
1010
);
1111

12-
if (process.env.NODE_ENV !== 'production') {
13-
AutoFocusInside.propTypes = {
14-
children: PropTypes.node.isRequired,
15-
disabled: PropTypes.bool,
16-
className: PropTypes.string,
17-
};
18-
}
12+
AutoFocusInside.propTypes = {
13+
children: PropTypes.node.isRequired,
14+
disabled: PropTypes.bool,
15+
className: PropTypes.string,
16+
};
1917

2018
AutoFocusInside.defaultProps = {
2119
disabled: false,

src/FreeFocusInside.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ const FreeFocusInside = ({ children, className }) => (
99
</div>
1010
);
1111

12-
if (process.env.NODE_ENV !== 'production') {
13-
FreeFocusInside.propTypes = {
14-
children: PropTypes.node.isRequired,
15-
className: PropTypes.string,
16-
};
17-
}
12+
FreeFocusInside.propTypes = {
13+
children: PropTypes.node.isRequired,
14+
className: PropTypes.string,
15+
};
1816

1917
FreeFocusInside.defaultProps = {
2018
disabled: false,

src/Lock.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ class FocusLock extends Component {
7575
} = this.props;
7676
const { observed } = this.state;
7777

78-
if (typeof allowTextSelection !== 'undefined') {
79-
// eslint-disable-next-line no-console
80-
console.warn('React-Focus-Lock: allowTextSelection is deprecated and enabled by default');
78+
if (process.env.NODE_ENV !== 'production') {
79+
if (typeof allowTextSelection !== 'undefined') {
80+
// eslint-disable-next-line no-console
81+
console.warn('React-Focus-Lock: allowTextSelection is deprecated and enabled by default');
82+
}
8183
}
8284

8385
const lockProps = {
@@ -116,29 +118,27 @@ class FocusLock extends Component {
116118
}
117119
}
118120

119-
if (process.env.NODE_ENV !== 'production') {
120-
FocusLock.propTypes = {
121-
children: PropTypes.node.isRequired,
122-
disabled: PropTypes.bool,
123-
returnFocus: PropTypes.bool,
124-
noFocusGuards: PropTypes.bool,
121+
FocusLock.propTypes = {
122+
children: PropTypes.node.isRequired,
123+
disabled: PropTypes.bool,
124+
returnFocus: PropTypes.bool,
125+
noFocusGuards: PropTypes.bool,
125126

126-
allowTextSelection: PropTypes.bool,
127-
autoFocus: PropTypes.bool,
128-
persistentFocus: PropTypes.bool,
127+
allowTextSelection: PropTypes.bool,
128+
autoFocus: PropTypes.bool,
129+
persistentFocus: PropTypes.bool,
129130

130-
group: PropTypes.string,
131-
className: PropTypes.string,
131+
group: PropTypes.string,
132+
className: PropTypes.string,
132133

133-
whiteList: PropTypes.func,
134+
whiteList: PropTypes.func,
134135

135-
as: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
136-
lockProps: PropTypes.object,
136+
as: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
137+
lockProps: PropTypes.object,
137138

138-
onActivation: PropTypes.func,
139-
onDeactivation: PropTypes.func,
140-
};
141-
}
139+
onActivation: PropTypes.func,
140+
onDeactivation: PropTypes.func,
141+
};
142142

143143
FocusLock.defaultProps = {
144144
disabled: false,

src/MoveFocusInside.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ export default class MoveFocusInside extends Component {
4747
}
4848
}
4949

50-
if (process.env.NODE_ENV !== 'production') {
51-
MoveFocusInside.propTypes = {
52-
children: PropTypes.node.isRequired,
53-
disabled: PropTypes.bool,
54-
className: PropTypes.string,
55-
};
56-
}
50+
MoveFocusInside.propTypes = {
51+
children: PropTypes.node.isRequired,
52+
disabled: PropTypes.bool,
53+
className: PropTypes.string,
54+
};

src/Trap.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,9 @@ const FocusTrap = ({ children }) => (
8989
</div>
9090
);
9191

92-
if (process.env.NODE_ENV !== 'production') {
93-
FocusTrap.propTypes = {
94-
children: PropTypes.node.isRequired,
95-
};
96-
}
92+
FocusTrap.propTypes = {
93+
children: PropTypes.node.isRequired,
94+
};
9795

9896
const attachHandler = () => {
9997
document.addEventListener('focusin', onTrap, true);

src/util/.babelrc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"env": {
3+
"cjs": {
4+
"presets": [
5+
"@babel/preset-env",
6+
"@babel/preset-react"
7+
],
8+
"plugins": [
9+
]
10+
},
11+
"es2015": {
12+
"presets": [
13+
[
14+
"@babel/preset-env",
15+
{
16+
"modules": false
17+
}
18+
],
19+
"@babel/preset-react"
20+
],
21+
"plugins": [
22+
]
23+
}
24+
}
25+
}
File renamed without changes.

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2410,6 +2410,11 @@ babel-plugin-transform-react-jsx@6.24.1, babel-plugin-transform-react-jsx@^6.24.
24102410
babel-plugin-syntax-jsx "^6.8.0"
24112411
babel-runtime "^6.22.0"
24122412

2413+
babel-plugin-transform-react-remove-prop-types@^0.4.19:
2414+
version "0.4.19"
2415+
resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.19.tgz#dc9d8fb176a407a75efe73f231550450e29a3b17"
2416+
integrity sha512-f49NsaohQ1ByY20nUrpc30QFdbeT4ntV4PAL2vSZe6uCB5nqAcqXS/qzU+aI6ZfYhWASx5eIsTFvFrs1B2ffGg==
2417+
24132418
babel-plugin-transform-regenerator@6.26.0, babel-plugin-transform-regenerator@^6.22.0, babel-plugin-transform-regenerator@^6.26.0, babel-plugin-transform-regenerator@^6.5.0:
24142419
version "6.26.0"
24152420
resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz#e0703696fbde27f0a3efcacf8b4dca2f7b3a8f2f"

0 commit comments

Comments
 (0)