Skip to content

Commit

Permalink
[changed] use 'react-prop-types' instead of 'utils/CustomPropTypes'
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKVal committed Aug 27, 2015
1 parent 0a22241 commit b9a4477
Show file tree
Hide file tree
Showing 27 changed files with 48 additions and 432 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
"react": "^0.13.3",
"react-component-metadata": "^1.3.0",
"react-hot-loader": "^1.2.8",
"react-prop-types": "^0.2.2",
"react-router": "^0.13.3",
"rimraf": "^2.4.2",
"semver": "^5.0.1",
Expand Down
6 changes: 3 additions & 3 deletions src/BootstrapMixin.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import styleMaps from './styleMaps';
import CustomPropTypes from './utils/CustomPropTypes';
import { keyOf } from 'react-prop-types';

const BootstrapMixin = {
propTypes: {
/**
* bootstrap className
* @private
*/
bsClass: CustomPropTypes.keyOf(styleMaps.CLASSES),
bsClass: keyOf(styleMaps.CLASSES),
/**
* Style variants
* @type {("default"|"primary"|"success"|"info"|"warning"|"danger"|"link")}
Expand All @@ -18,7 +18,7 @@ const BootstrapMixin = {
* Size variants
* @type {("xsmall"|"small"|"medium"|"large"|"xs"|"sm"|"md"|"lg")}
*/
bsSize: CustomPropTypes.keyOf(styleMaps.SIZES)
bsSize: keyOf(styleMaps.SIZES)
},

getBsClassSet() {
Expand Down
4 changes: 2 additions & 2 deletions src/Button.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import classNames from 'classnames';
import BootstrapMixin from './BootstrapMixin';
import CustomPropTypes from './utils/CustomPropTypes';
import { elementType } from 'react-prop-types';
import ButtonInput from './ButtonInput';

const Button = React.createClass({
Expand All @@ -16,7 +16,7 @@ const Button = React.createClass({
/**
* You can use a custom element for this component
*/
componentClass: CustomPropTypes.elementType,
componentClass: elementType,
href: React.PropTypes.string,
target: React.PropTypes.string,
/**
Expand Down
4 changes: 2 additions & 2 deletions src/ButtonGroup.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import classNames from 'classnames';
import BootstrapMixin from './BootstrapMixin';
import CustomPropTypes from './utils/CustomPropTypes';
import { all } from 'react-prop-types';

const ButtonGroup = React.createClass({
mixins: [BootstrapMixin],
Expand All @@ -13,7 +13,7 @@ const ButtonGroup = React.createClass({
* Display block buttons, only useful when used with the "vertical" prop.
* @type {bool}
*/
block: CustomPropTypes.all([
block: all([
React.PropTypes.bool,
function(props, propName, componentName) {
if (props.block && !props.vertical) {
Expand Down
4 changes: 2 additions & 2 deletions src/Col.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import classNames from 'classnames';
import styleMaps from './styleMaps';
import CustomPropTypes from './utils/CustomPropTypes';
import { elementType } from 'react-prop-types';

const Col = React.createClass({
propTypes: {
Expand Down Expand Up @@ -136,7 +136,7 @@ const Col = React.createClass({
/**
* You can use a custom element for this component
*/
componentClass: CustomPropTypes.elementType
componentClass: elementType
},

getDefaultProps() {
Expand Down
4 changes: 2 additions & 2 deletions src/Collapse.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import Transition from 'react-overlays/lib/Transition';
import domUtils from './utils/domUtils';
import CustomPropTypes from './utils/CustomPropTypes';
import { all } from 'react-prop-types';
import deprecationWarning from './utils/deprecationWarning';
import createChainedFunction from './utils/createChainedFunction';

Expand Down Expand Up @@ -145,7 +145,7 @@ Collapse.propTypes = {
* duration
* @private
*/
duration: CustomPropTypes.all([
duration: all([
React.PropTypes.number,
(props)=> {
if (props.duration != null){
Expand Down
7 changes: 4 additions & 3 deletions src/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import CustomPropTypes from './utils/CustomPropTypes';
import createChainedFunction from './utils/createChainedFunction';
import find from 'lodash/collection/find';
import omit from 'lodash/object/omit';
import { all, elementType, isRequiredForA11y } from 'react-prop-types';

const TOGGLE_REF = 'toggle-btn';

Expand Down Expand Up @@ -229,20 +230,20 @@ Dropdown.propTypes = {
* @type {string|number}
* @required
*/
id: CustomPropTypes.isRequiredForA11y(
id: isRequiredForA11y(
React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.number
])
),

componentClass: CustomPropTypes.elementType,
componentClass: elementType,

/**
* The children of a Dropdown may be a `<Dropdown.Toggle/>` or a `<Dropdown.Menu/>`.
* @type {node}
*/
children: CustomPropTypes.all([
children: all([
CustomPropTypes.requiredRoles(TOGGLE_ROLE, MENU_ROLE),
CustomPropTypes.exclusiveRoles(MENU_ROLE)
]),
Expand Down
4 changes: 2 additions & 2 deletions src/DropdownButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import BootstrapMixin from './BootstrapMixin';
import Dropdown from './Dropdown';
import NavDropdown from './NavDropdown';
import CustomPropTypes from './utils/CustomPropTypes';
import { all } from 'react-prop-types';
import deprecationWarning from './utils/deprecationWarning';
import omit from 'lodash/object/omit';

Expand Down Expand Up @@ -46,7 +46,7 @@ DropdownButton.propTypes = {
* @type {bool}
* @deprecated Use the `NavDropdown` instead.
*/
navItem: CustomPropTypes.all([
navItem: all([
React.PropTypes.bool,
function(props, propName, componentName) {
if (props.navItem) {
Expand Down
4 changes: 2 additions & 2 deletions src/DropdownToggle.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import classNames from 'classnames';
import Button from './Button';
import CustomPropTypes from './utils/CustomPropTypes';
import { singlePropFrom } from 'react-prop-types';
import SafeAnchor from './SafeAnchor';

const CARET = <span> <span className='caret' /></span>;
Expand Down Expand Up @@ -29,7 +29,7 @@ export default class DropdownToggle extends React.Component {
}
}

const titleAndChildrenValidation = CustomPropTypes.singlePropFrom([
const titleAndChildrenValidation = singlePropFrom([
'title',
'children'
]);
Expand Down
5 changes: 2 additions & 3 deletions src/Fade.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import Transition from 'react-overlays/lib/Transition';
import CustomPropTypes from './utils/CustomPropTypes';
import { all } from 'react-prop-types';
import deprecationWarning from './utils/deprecationWarning';

class Fade extends React.Component {
Expand Down Expand Up @@ -51,7 +51,7 @@ Fade.propTypes = {
* duration
* @private
*/
duration: CustomPropTypes.all([
duration: all([
React.PropTypes.number,
(props)=> {
if (props.duration != null){
Expand Down Expand Up @@ -95,4 +95,3 @@ Fade.defaultProps = {
};

export default Fade;

4 changes: 2 additions & 2 deletions src/Grid.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import classNames from 'classnames';
import CustomPropTypes from './utils/CustomPropTypes';
import { elementType } from 'react-prop-types';

const Grid = React.createClass({
propTypes: {
Expand All @@ -13,7 +13,7 @@ const Grid = React.createClass({
/**
* You can use a custom element for this component
*/
componentClass: CustomPropTypes.elementType
componentClass: elementType
},

getDefaultProps() {
Expand Down
4 changes: 2 additions & 2 deletions src/Jumbotron.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import classNames from 'classnames';
import CustomPropTypes from './utils/CustomPropTypes';
import { elementType } from 'react-prop-types';

const Jumbotron = React.createClass({
propTypes: {
/**
* You can use a custom element for this component
*/
componentClass: CustomPropTypes.elementType
componentClass: elementType
},

getDefaultProps() {
Expand Down
4 changes: 2 additions & 2 deletions src/MenuItem.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import classnames from 'classnames';
import CustomPropTypes from './utils/CustomPropTypes';
import { all } from 'react-prop-types';
import SafeAnchor from './SafeAnchor';

export default class MenuItem extends React.Component {
Expand Down Expand Up @@ -62,7 +62,7 @@ export default class MenuItem extends React.Component {

MenuItem.propTypes = {
disabled: React.PropTypes.bool,
divider: CustomPropTypes.all([
divider: all([
React.PropTypes.bool,
function(props, propName, componentName) {
if (props.divider && props.children) {
Expand Down
4 changes: 2 additions & 2 deletions src/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import domUtils from './utils/domUtils';
import getScrollbarSize from 'dom-helpers/util/scrollbarSize';
import EventListener from './utils/EventListener';
import createChainedFunction from './utils/createChainedFunction';
import CustomPropTypes from './utils/CustomPropTypes';
import { elementType } from 'react-prop-types';

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

/**
* When `true` The modal will automatically shift focus to itself when it opens, and replace it to the last focused element when it closes.
Expand Down
4 changes: 2 additions & 2 deletions src/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import classNames from 'classnames';

import ValidComponentChildren from './utils/ValidComponentChildren';
import createChainedFunction from './utils/createChainedFunction';
import CustomPropTypes from './utils/CustomPropTypes';
import { elementType } from 'react-prop-types';

const Navbar = React.createClass({
mixins: [BootstrapMixin],
Expand All @@ -19,7 +19,7 @@ const Navbar = React.createClass({
/**
* You can use a custom element for this component
*/
componentClass: CustomPropTypes.elementType,
componentClass: elementType,
brand: React.PropTypes.node,
toggleButton: React.PropTypes.node,
toggleNavKey: React.PropTypes.oneOfType([
Expand Down
4 changes: 2 additions & 2 deletions src/Overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React, { cloneElement } from 'react';
import BaseOverlay from 'react-overlays/lib/Overlay';
import CustomPropTypes from './utils/CustomPropTypes';
import { elementType } from 'react-prop-types';
import Fade from './Fade';
import classNames from 'classnames';

Expand Down Expand Up @@ -57,7 +57,7 @@ Overlay.propTypes = {
*/
animation: React.PropTypes.oneOfType([
React.PropTypes.bool,
CustomPropTypes.elementType
elementType
]),

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import classNames from 'classnames';
import BootstrapMixin from './BootstrapMixin';
import PaginationButton from './PaginationButton';
import CustomPropTypes from './utils/CustomPropTypes';
import { elementType } from 'react-prop-types';
import SafeAnchor from './SafeAnchor';

const Pagination = React.createClass({
Expand All @@ -21,7 +21,7 @@ const Pagination = React.createClass({
/**
* You can use a custom element for the buttons
*/
buttonComponentClass: CustomPropTypes.elementType
buttonComponentClass: elementType
},

getDefaultProps() {
Expand Down
4 changes: 2 additions & 2 deletions src/PaginationButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import classNames from 'classnames';
import BootstrapMixin from './BootstrapMixin';
import createSelectedEvent from './utils/createSelectedEvent';
import CustomPropTypes from './utils/CustomPropTypes';
import { elementType } from 'react-prop-types';

const PaginationButton = React.createClass({
mixins: [BootstrapMixin],
Expand All @@ -19,7 +19,7 @@ const PaginationButton = React.createClass({
/**
* You can use a custom element for this component
*/
buttonComponentClass: CustomPropTypes.elementType
buttonComponentClass: elementType
},

getDefaultProps() {
Expand Down
4 changes: 2 additions & 2 deletions src/Popover.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import classNames from 'classnames';
import BootstrapMixin from './BootstrapMixin';
import CustomPropTypes from './utils/CustomPropTypes';
import { isRequiredForA11y } from 'react-prop-types';

const Popover = React.createClass({

Expand All @@ -13,7 +13,7 @@ const Popover = React.createClass({
* @type {string}
* @required
*/
id: CustomPropTypes.isRequiredForA11y(React.PropTypes.string),
id: isRequiredForA11y(React.PropTypes.string),

/**
* Sets the direction the Popover is positioned towards.
Expand Down
1 change: 0 additions & 1 deletion src/Portal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ export default deprecationWarning.wrapper(Portal, {
'http://react-bootstrap.github.io/react-overlays/examples/#portal and ' +
'https://github.com/react-bootstrap/react-bootstrap/issues/1084'
});

4 changes: 2 additions & 2 deletions src/Row.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import classNames from 'classnames';
import CustomPropTypes from './utils/CustomPropTypes';
import { elementType } from 'react-prop-types';

const Row = React.createClass({
propTypes: {
/**
* You can use a custom element for this component
*/
componentClass: CustomPropTypes.elementType
componentClass: elementType
},

getDefaultProps() {
Expand Down
4 changes: 2 additions & 2 deletions src/Tooltip.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import classNames from 'classnames';
import BootstrapMixin from './BootstrapMixin';
import CustomPropTypes from './utils/CustomPropTypes';
import { isRequiredForA11y } from 'react-prop-types';

const Tooltip = React.createClass({
mixins: [BootstrapMixin],
Expand All @@ -12,7 +12,7 @@ const Tooltip = React.createClass({
* @type {string}
* @required
*/
id: CustomPropTypes.isRequiredForA11y(React.PropTypes.string),
id: isRequiredForA11y(React.PropTypes.string),

/**
* Sets the direction the Tooltip is positioned towards.
Expand Down

0 comments on commit b9a4477

Please sign in to comment.