Skip to content

Commit b9a4477

Browse files
committed
[changed] use 'react-prop-types' instead of 'utils/CustomPropTypes'
1 parent 0a22241 commit b9a4477

27 files changed

+48
-432
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
"react": "^0.13.3",
9696
"react-component-metadata": "^1.3.0",
9797
"react-hot-loader": "^1.2.8",
98+
"react-prop-types": "^0.2.2",
9899
"react-router": "^0.13.3",
99100
"rimraf": "^2.4.2",
100101
"semver": "^5.0.1",

src/BootstrapMixin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React from 'react';
22
import styleMaps from './styleMaps';
3-
import CustomPropTypes from './utils/CustomPropTypes';
3+
import { keyOf } from 'react-prop-types';
44

55
const BootstrapMixin = {
66
propTypes: {
77
/**
88
* bootstrap className
99
* @private
1010
*/
11-
bsClass: CustomPropTypes.keyOf(styleMaps.CLASSES),
11+
bsClass: keyOf(styleMaps.CLASSES),
1212
/**
1313
* Style variants
1414
* @type {("default"|"primary"|"success"|"info"|"warning"|"danger"|"link")}
@@ -18,7 +18,7 @@ const BootstrapMixin = {
1818
* Size variants
1919
* @type {("xsmall"|"small"|"medium"|"large"|"xs"|"sm"|"md"|"lg")}
2020
*/
21-
bsSize: CustomPropTypes.keyOf(styleMaps.SIZES)
21+
bsSize: keyOf(styleMaps.SIZES)
2222
},
2323

2424
getBsClassSet() {

src/Button.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import classNames from 'classnames';
33
import BootstrapMixin from './BootstrapMixin';
4-
import CustomPropTypes from './utils/CustomPropTypes';
4+
import { elementType } from 'react-prop-types';
55
import ButtonInput from './ButtonInput';
66

77
const Button = React.createClass({
@@ -16,7 +16,7 @@ const Button = React.createClass({
1616
/**
1717
* You can use a custom element for this component
1818
*/
19-
componentClass: CustomPropTypes.elementType,
19+
componentClass: elementType,
2020
href: React.PropTypes.string,
2121
target: React.PropTypes.string,
2222
/**

src/ButtonGroup.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import classNames from 'classnames';
33
import BootstrapMixin from './BootstrapMixin';
4-
import CustomPropTypes from './utils/CustomPropTypes';
4+
import { all } from 'react-prop-types';
55

66
const ButtonGroup = React.createClass({
77
mixins: [BootstrapMixin],
@@ -13,7 +13,7 @@ const ButtonGroup = React.createClass({
1313
* Display block buttons, only useful when used with the "vertical" prop.
1414
* @type {bool}
1515
*/
16-
block: CustomPropTypes.all([
16+
block: all([
1717
React.PropTypes.bool,
1818
function(props, propName, componentName) {
1919
if (props.block && !props.vertical) {

src/Col.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import classNames from 'classnames';
33
import styleMaps from './styleMaps';
4-
import CustomPropTypes from './utils/CustomPropTypes';
4+
import { elementType } from 'react-prop-types';
55

66
const Col = React.createClass({
77
propTypes: {
@@ -136,7 +136,7 @@ const Col = React.createClass({
136136
/**
137137
* You can use a custom element for this component
138138
*/
139-
componentClass: CustomPropTypes.elementType
139+
componentClass: elementType
140140
},
141141

142142
getDefaultProps() {

src/Collapse.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import Transition from 'react-overlays/lib/Transition';
33
import domUtils from './utils/domUtils';
4-
import CustomPropTypes from './utils/CustomPropTypes';
4+
import { all } from 'react-prop-types';
55
import deprecationWarning from './utils/deprecationWarning';
66
import createChainedFunction from './utils/createChainedFunction';
77

@@ -145,7 +145,7 @@ Collapse.propTypes = {
145145
* duration
146146
* @private
147147
*/
148-
duration: CustomPropTypes.all([
148+
duration: all([
149149
React.PropTypes.number,
150150
(props)=> {
151151
if (props.duration != null){

src/Dropdown.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import CustomPropTypes from './utils/CustomPropTypes';
99
import createChainedFunction from './utils/createChainedFunction';
1010
import find from 'lodash/collection/find';
1111
import omit from 'lodash/object/omit';
12+
import { all, elementType, isRequiredForA11y } from 'react-prop-types';
1213

1314
const TOGGLE_REF = 'toggle-btn';
1415

@@ -229,20 +230,20 @@ Dropdown.propTypes = {
229230
* @type {string|number}
230231
* @required
231232
*/
232-
id: CustomPropTypes.isRequiredForA11y(
233+
id: isRequiredForA11y(
233234
React.PropTypes.oneOfType([
234235
React.PropTypes.string,
235236
React.PropTypes.number
236237
])
237238
),
238239

239-
componentClass: CustomPropTypes.elementType,
240+
componentClass: elementType,
240241

241242
/**
242243
* The children of a Dropdown may be a `<Dropdown.Toggle/>` or a `<Dropdown.Menu/>`.
243244
* @type {node}
244245
*/
245-
children: CustomPropTypes.all([
246+
children: all([
246247
CustomPropTypes.requiredRoles(TOGGLE_ROLE, MENU_ROLE),
247248
CustomPropTypes.exclusiveRoles(MENU_ROLE)
248249
]),

src/DropdownButton.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import BootstrapMixin from './BootstrapMixin';
33
import Dropdown from './Dropdown';
44
import NavDropdown from './NavDropdown';
5-
import CustomPropTypes from './utils/CustomPropTypes';
5+
import { all } from 'react-prop-types';
66
import deprecationWarning from './utils/deprecationWarning';
77
import omit from 'lodash/object/omit';
88

@@ -46,7 +46,7 @@ DropdownButton.propTypes = {
4646
* @type {bool}
4747
* @deprecated Use the `NavDropdown` instead.
4848
*/
49-
navItem: CustomPropTypes.all([
49+
navItem: all([
5050
React.PropTypes.bool,
5151
function(props, propName, componentName) {
5252
if (props.navItem) {

src/DropdownToggle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import classNames from 'classnames';
33
import Button from './Button';
4-
import CustomPropTypes from './utils/CustomPropTypes';
4+
import { singlePropFrom } from 'react-prop-types';
55
import SafeAnchor from './SafeAnchor';
66

77
const CARET = <span> <span className='caret' /></span>;
@@ -29,7 +29,7 @@ export default class DropdownToggle extends React.Component {
2929
}
3030
}
3131

32-
const titleAndChildrenValidation = CustomPropTypes.singlePropFrom([
32+
const titleAndChildrenValidation = singlePropFrom([
3333
'title',
3434
'children'
3535
]);

src/Fade.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import Transition from 'react-overlays/lib/Transition';
3-
import CustomPropTypes from './utils/CustomPropTypes';
3+
import { all } from 'react-prop-types';
44
import deprecationWarning from './utils/deprecationWarning';
55

66
class Fade extends React.Component {
@@ -51,7 +51,7 @@ Fade.propTypes = {
5151
* duration
5252
* @private
5353
*/
54-
duration: CustomPropTypes.all([
54+
duration: all([
5555
React.PropTypes.number,
5656
(props)=> {
5757
if (props.duration != null){
@@ -95,4 +95,3 @@ Fade.defaultProps = {
9595
};
9696

9797
export default Fade;
98-

0 commit comments

Comments
 (0)