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

+1
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

+3-3
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

+2-2
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

+2-2
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

+2-2
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

+2-2
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

+4-3
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

+2-2
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

+2-2
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

+2-3
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-

src/Grid.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import classNames from 'classnames';
3-
import CustomPropTypes from './utils/CustomPropTypes';
3+
import { elementType } from 'react-prop-types';
44

55
const Grid = React.createClass({
66
propTypes: {
@@ -13,7 +13,7 @@ const Grid = React.createClass({
1313
/**
1414
* You can use a custom element for this component
1515
*/
16-
componentClass: CustomPropTypes.elementType
16+
componentClass: elementType
1717
},
1818

1919
getDefaultProps() {

src/Jumbotron.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React from 'react';
22
import classNames from 'classnames';
3-
import CustomPropTypes from './utils/CustomPropTypes';
3+
import { elementType } from 'react-prop-types';
44

55
const Jumbotron = React.createClass({
66
propTypes: {
77
/**
88
* You can use a custom element for this component
99
*/
10-
componentClass: CustomPropTypes.elementType
10+
componentClass: elementType
1111
},
1212

1313
getDefaultProps() {

src/MenuItem.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import classnames from 'classnames';
3-
import CustomPropTypes from './utils/CustomPropTypes';
3+
import { all } from 'react-prop-types';
44
import SafeAnchor from './SafeAnchor';
55

66
export default class MenuItem extends React.Component {
@@ -62,7 +62,7 @@ export default class MenuItem extends React.Component {
6262

6363
MenuItem.propTypes = {
6464
disabled: React.PropTypes.bool,
65-
divider: CustomPropTypes.all([
65+
divider: all([
6666
React.PropTypes.bool,
6767
function(props, propName, componentName) {
6868
if (props.divider && props.children) {

src/Modal.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import domUtils from './utils/domUtils';
55
import getScrollbarSize from 'dom-helpers/util/scrollbarSize';
66
import EventListener from './utils/EventListener';
77
import createChainedFunction from './utils/createChainedFunction';
8-
import CustomPropTypes from './utils/CustomPropTypes';
8+
import { elementType } from 'react-prop-types';
99

1010
import Portal from 'react-overlays/lib/Portal';
1111
import Fade from './Fade';
@@ -93,7 +93,7 @@ const Modal = React.createClass({
9393
* A Component type that provides the modal content Markup. This is a useful prop when you want to use your own
9494
* styles and markup to create a custom modal component.
9595
*/
96-
dialogComponent: CustomPropTypes.elementType,
96+
dialogComponent: elementType,
9797

9898
/**
9999
* When `true` The modal will automatically shift focus to itself when it opens, and replace it to the last focused element when it closes.

src/Navbar.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import classNames from 'classnames';
44

55
import ValidComponentChildren from './utils/ValidComponentChildren';
66
import createChainedFunction from './utils/createChainedFunction';
7-
import CustomPropTypes from './utils/CustomPropTypes';
7+
import { elementType } from 'react-prop-types';
88

99
const Navbar = React.createClass({
1010
mixins: [BootstrapMixin],
@@ -19,7 +19,7 @@ const Navbar = React.createClass({
1919
/**
2020
* You can use a custom element for this component
2121
*/
22-
componentClass: CustomPropTypes.elementType,
22+
componentClass: elementType,
2323
brand: React.PropTypes.node,
2424
toggleButton: React.PropTypes.node,
2525
toggleNavKey: React.PropTypes.oneOfType([

src/Overlay.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import React, { cloneElement } from 'react';
55
import BaseOverlay from 'react-overlays/lib/Overlay';
6-
import CustomPropTypes from './utils/CustomPropTypes';
6+
import { elementType } from 'react-prop-types';
77
import Fade from './Fade';
88
import classNames from 'classnames';
99

@@ -57,7 +57,7 @@ Overlay.propTypes = {
5757
*/
5858
animation: React.PropTypes.oneOfType([
5959
React.PropTypes.bool,
60-
CustomPropTypes.elementType
60+
elementType
6161
]),
6262

6363
/**

src/Pagination.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import classNames from 'classnames';
33
import BootstrapMixin from './BootstrapMixin';
44
import PaginationButton from './PaginationButton';
5-
import CustomPropTypes from './utils/CustomPropTypes';
5+
import { elementType } from 'react-prop-types';
66
import SafeAnchor from './SafeAnchor';
77

88
const Pagination = React.createClass({
@@ -21,7 +21,7 @@ const Pagination = React.createClass({
2121
/**
2222
* You can use a custom element for the buttons
2323
*/
24-
buttonComponentClass: CustomPropTypes.elementType
24+
buttonComponentClass: elementType
2525
},
2626

2727
getDefaultProps() {

src/PaginationButton.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import classNames from 'classnames';
33
import BootstrapMixin from './BootstrapMixin';
44
import createSelectedEvent from './utils/createSelectedEvent';
5-
import CustomPropTypes from './utils/CustomPropTypes';
5+
import { elementType } from 'react-prop-types';
66

77
const PaginationButton = React.createClass({
88
mixins: [BootstrapMixin],
@@ -19,7 +19,7 @@ const PaginationButton = React.createClass({
1919
/**
2020
* You can use a custom element for this component
2121
*/
22-
buttonComponentClass: CustomPropTypes.elementType
22+
buttonComponentClass: elementType
2323
},
2424

2525
getDefaultProps() {

src/Popover.js

+2-2
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 { isRequiredForA11y } from 'react-prop-types';
55

66
const Popover = React.createClass({
77

@@ -13,7 +13,7 @@ const Popover = React.createClass({
1313
* @type {string}
1414
* @required
1515
*/
16-
id: CustomPropTypes.isRequiredForA11y(React.PropTypes.string),
16+
id: isRequiredForA11y(React.PropTypes.string),
1717

1818
/**
1919
* Sets the direction the Popover is positioned towards.

src/Portal.js

-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ export default deprecationWarning.wrapper(Portal, {
88
'http://react-bootstrap.github.io/react-overlays/examples/#portal and ' +
99
'https://github.com/react-bootstrap/react-bootstrap/issues/1084'
1010
});
11-

src/Row.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React from 'react';
22
import classNames from 'classnames';
3-
import CustomPropTypes from './utils/CustomPropTypes';
3+
import { elementType } from 'react-prop-types';
44

55
const Row = React.createClass({
66
propTypes: {
77
/**
88
* You can use a custom element for this component
99
*/
10-
componentClass: CustomPropTypes.elementType
10+
componentClass: elementType
1111
},
1212

1313
getDefaultProps() {

src/Tooltip.js

+2-2
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 { isRequiredForA11y } from 'react-prop-types';
55

66
const Tooltip = React.createClass({
77
mixins: [BootstrapMixin],
@@ -12,7 +12,7 @@ const Tooltip = React.createClass({
1212
* @type {string}
1313
* @required
1414
*/
15-
id: CustomPropTypes.isRequiredForA11y(React.PropTypes.string),
15+
id: isRequiredForA11y(React.PropTypes.string),
1616

1717
/**
1818
* Sets the direction the Tooltip is positioned towards.

0 commit comments

Comments
 (0)