diff --git a/components/affix/index.tsx b/components/affix/index.tsx index feb49a0932..9543e99915 100644 --- a/components/affix/index.tsx +++ b/components/affix/index.tsx @@ -1,5 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; +import PropTypes from 'prop-types'; import addEventListener from 'rc-util/lib/Dom/addEventListener'; import classNames from 'classnames'; import shallowequal from 'shallowequal'; @@ -60,9 +61,9 @@ export interface AffixProps { export default class Affix extends React.Component { static propTypes = { - offsetTop: React.PropTypes.number, - offsetBottom: React.PropTypes.number, - target: React.PropTypes.func, + offsetTop: PropTypes.number, + offsetBottom: PropTypes.number, + target: PropTypes.func, }; scrollEvent: any; diff --git a/components/anchor/AnchorLink.tsx b/components/anchor/AnchorLink.tsx index 04b291cd00..1a7e9d2f76 100644 --- a/components/anchor/AnchorLink.tsx +++ b/components/anchor/AnchorLink.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import classNames from 'classnames'; import AnchorHelper, { scrollTo } from './anchorHelper'; @@ -18,7 +19,7 @@ export interface AnchorLinkProps { export default class AnchorLink extends React.Component { static __ANT_ANCHOR_LINK = true; static contextTypes = { - anchorHelper: React.PropTypes.any, + anchorHelper: PropTypes.any, }; static defaultProps = { diff --git a/components/anchor/index.tsx b/components/anchor/index.tsx index f34d6d6a2f..4b9150eece 100644 --- a/components/anchor/index.tsx +++ b/components/anchor/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import classNames from 'classnames'; import addEventListener from 'rc-util/lib/Dom/addEventListener'; import AnchorLink from './AnchorLink'; @@ -27,7 +28,7 @@ export default class Anchor extends React.Component { }; static childContextTypes = { - anchorHelper: React.PropTypes.any, + anchorHelper: PropTypes.any, }; refs: { diff --git a/components/breadcrumb/Breadcrumb.tsx b/components/breadcrumb/Breadcrumb.tsx index 409bd91344..03a4577636 100755 --- a/components/breadcrumb/Breadcrumb.tsx +++ b/components/breadcrumb/Breadcrumb.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import { cloneElement } from 'react'; import warning from '../_util/warning'; import BreadcrumbItem from './BreadcrumbItem'; @@ -43,12 +44,12 @@ export default class Breadcrumb extends React.Component { }; static propTypes = { - prefixCls: React.PropTypes.string, - separator: React.PropTypes.node, - routes: React.PropTypes.array, - params: React.PropTypes.object, - linkRender: React.PropTypes.func, - nameRender: React.PropTypes.func, + prefixCls: PropTypes.string, + separator: PropTypes.node, + routes: PropTypes.array, + params: PropTypes.object, + linkRender: PropTypes.func, + nameRender: PropTypes.func, }; componentDidMount() { diff --git a/components/button/button.tsx b/components/button/button.tsx index f80477bb8e..473393dc5d 100644 --- a/components/button/button.tsx +++ b/components/button/button.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import classNames from 'classnames'; import Icon from '../icon'; import omit from 'omit.js'; @@ -60,14 +61,14 @@ export default class Button extends React.Component { }; static propTypes = { - type: React.PropTypes.string, - shape: React.PropTypes.oneOf(['circle', 'circle-outline']), - size: React.PropTypes.oneOf(['large', 'default', 'small']), - htmlType: React.PropTypes.oneOf(['submit', 'button', 'reset']), - onClick: React.PropTypes.func, - loading: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.object]), - className: React.PropTypes.string, - icon: React.PropTypes.string, + type: PropTypes.string, + shape: PropTypes.oneOf(['circle', 'circle-outline']), + size: PropTypes.oneOf(['large', 'default', 'small']), + htmlType: PropTypes.oneOf(['submit', 'button', 'reset']), + onClick: PropTypes.func, + loading: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]), + className: PropTypes.string, + icon: PropTypes.string, }; timeout: number; diff --git a/components/checkbox/Group.tsx b/components/checkbox/Group.tsx index f7fa34fcda..41959a47cb 100644 --- a/components/checkbox/Group.tsx +++ b/components/checkbox/Group.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import classNames from 'classnames'; import Checkbox from './Checkbox'; import PureRenderMixin from 'rc-util/lib/PureRenderMixin'; @@ -34,10 +35,10 @@ export default class CheckboxGroup extends React.Component { static contextTypes = { - antLocale: React.PropTypes.object, + antLocale: PropTypes.object, }; static defaultProps = { prefixCls: 'ant-calendar', diff --git a/components/date-picker/createPicker.tsx b/components/date-picker/createPicker.tsx index 9f2231856f..fd4d14c923 100644 --- a/components/date-picker/createPicker.tsx +++ b/components/date-picker/createPicker.tsx @@ -1,5 +1,6 @@ import React from 'react'; import moment from 'moment'; +import PropTypes from 'prop-types'; import MonthCalendar from 'rc-calendar/lib/MonthCalendar'; import RcDatePicker from 'rc-calendar/lib/Picker'; import classNames from 'classnames'; @@ -18,7 +19,7 @@ export default function createPicker(TheCalendar) { // use class typescript error const CalenderWrapper = React.createClass({ contextTypes: { - antLocale: React.PropTypes.object, + antLocale: PropTypes.object, }, getDefaultProps() { return { diff --git a/components/form/FormItem.tsx b/components/form/FormItem.tsx index 060343630a..23dd80f7ed 100644 --- a/components/form/FormItem.tsx +++ b/components/form/FormItem.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import classNames from 'classnames'; import PureRenderMixin from 'rc-util/lib/PureRenderMixin'; import Row from '../row'; @@ -41,22 +42,22 @@ export default class FormItem extends React.Component { }; static propTypes = { - prefixCls: React.PropTypes.string, - label: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.node]), - labelCol: React.PropTypes.object, - help: React.PropTypes.oneOfType([React.PropTypes.node, React.PropTypes.bool]), - validateStatus: React.PropTypes.oneOf(['', 'success', 'warning', 'error', 'validating']), - hasFeedback: React.PropTypes.bool, - wrapperCol: React.PropTypes.object, - className: React.PropTypes.string, - id: React.PropTypes.string, - children: React.PropTypes.node, - colon: React.PropTypes.bool, + prefixCls: PropTypes.string, + label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), + labelCol: PropTypes.object, + help: PropTypes.oneOfType([PropTypes.node, PropTypes.bool]), + validateStatus: PropTypes.oneOf(['', 'success', 'warning', 'error', 'validating']), + hasFeedback: PropTypes.bool, + wrapperCol: PropTypes.object, + className: PropTypes.string, + id: PropTypes.string, + children: PropTypes.node, + colon: PropTypes.bool, }; static contextTypes = { - form: React.PropTypes.object, - vertical: React.PropTypes.bool, + form: PropTypes.object, + vertical: PropTypes.bool, }; context: FormItemContext; diff --git a/components/grid/row.tsx b/components/grid/row.tsx index 3dfbf680bb..b0cc99492c 100644 --- a/components/grid/row.tsx +++ b/components/grid/row.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { Children, cloneElement } from 'react'; import classNames from 'classnames'; import assign from 'object-assign'; +import PropTypes from 'prop-types'; export interface RowProps { className?: string; @@ -19,13 +20,13 @@ export default class Row extends React.Component { }; static propTypes = { - type: React.PropTypes.string, - align: React.PropTypes.string, - justify: React.PropTypes.string, - className: React.PropTypes.string, - children: React.PropTypes.node, - gutter: React.PropTypes.number, - prefixCls: React.PropTypes.string, + type: PropTypes.string, + align: PropTypes.string, + justify: PropTypes.string, + className: PropTypes.string, + children: PropTypes.node, + gutter: PropTypes.number, + prefixCls: PropTypes.string, }; render() { const { type, justify, align, className, gutter, style, children, diff --git a/components/locale-provider/index.tsx b/components/locale-provider/index.tsx index 4075d2481f..ad6ca50ef5 100644 --- a/components/locale-provider/index.tsx +++ b/components/locale-provider/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import { changeConfirmLocale } from '../modal/locale'; export interface LocaleProviderProps { @@ -18,11 +19,11 @@ export interface LocaleProviderProps { export default class LocaleProvider extends React.Component { static propTypes = { - locale: React.PropTypes.object, + locale: PropTypes.object, }; static childContextTypes = { - antLocale: React.PropTypes.object, + antLocale: PropTypes.object, }; getChildContext() { diff --git a/components/modal/Modal.tsx b/components/modal/Modal.tsx index 60f0acb891..c178f97465 100644 --- a/components/modal/Modal.tsx +++ b/components/modal/Modal.tsx @@ -1,6 +1,6 @@ -import { PropTypes } from 'react'; import React from 'react'; import Dialog from 'rc-dialog'; +import PropTypes from 'prop-types'; import addEventListener from 'rc-util/lib/Dom/addEventListener'; import Button from '../button'; @@ -93,7 +93,7 @@ export default class Modal extends React.Component { }; static contextTypes = { - antLocale: React.PropTypes.object, + antLocale: PropTypes.object, }; context: ModalContext; diff --git a/components/select/index.tsx b/components/select/index.tsx index 926a8a77cd..4ade7cb16c 100755 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import RcSelect, { Option, OptGroup } from 'rc-select'; import classNames from 'classnames'; import warning from '../_util/warning'; @@ -90,7 +91,7 @@ export default class Select extends React.Component { }; static contextTypes = { - antLocale: React.PropTypes.object, + antLocale: PropTypes.object, }; context: SelectContext; diff --git a/components/table/Table.tsx b/components/table/Table.tsx index 7a45783c37..b391c6632c 100755 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -1,5 +1,6 @@ import React from 'react'; import RcTable from 'rc-table'; +import PropTypes from 'prop-types'; import classNames from 'classnames'; import assign from 'object-assign'; import Pagination, { PaginationProps } from '../pagination'; @@ -102,21 +103,21 @@ export default class Table extends React.Component, any> { static ColumnGroup = ColumnGroup; static propTypes = { - dataSource: React.PropTypes.array, - columns: React.PropTypes.array, - prefixCls: React.PropTypes.string, - useFixedHeader: React.PropTypes.bool, - rowSelection: React.PropTypes.object, - className: React.PropTypes.string, - size: React.PropTypes.string, - loading: React.PropTypes.oneOfType([ - React.PropTypes.bool, - React.PropTypes.object, + dataSource: PropTypes.array, + columns: PropTypes.array, + prefixCls: PropTypes.string, + useFixedHeader: PropTypes.bool, + rowSelection: PropTypes.object, + className: PropTypes.string, + size: PropTypes.string, + loading: PropTypes.oneOfType([ + PropTypes.bool, + PropTypes.object, ]), - bordered: React.PropTypes.bool, - onChange: React.PropTypes.func, - locale: React.PropTypes.object, - dropdownPrefixCls: React.PropTypes.string, + bordered: PropTypes.bool, + onChange: PropTypes.func, + locale: PropTypes.object, + dropdownPrefixCls: PropTypes.string, }; static defaultProps = { @@ -135,7 +136,7 @@ export default class Table extends React.Component, any> { }; static contextTypes = { - antLocale: React.PropTypes.object, + antLocale: PropTypes.object, }; context: TableContext; diff --git a/components/upload/Upload.tsx b/components/upload/Upload.tsx index 93191a463e..24cdb2bcd2 100644 --- a/components/upload/Upload.tsx +++ b/components/upload/Upload.tsx @@ -1,5 +1,6 @@ import React from 'react'; import RcUpload from 'rc-upload'; +import PropTypes from 'prop-types'; import classNames from 'classnames'; import assign from 'object-assign'; import Dragger from './Dragger'; @@ -41,7 +42,7 @@ export default class Upload extends React.Component { }; static contextTypes = { - antLocale: React.PropTypes.object, + antLocale: PropTypes.object, }; context: UploadContext; diff --git a/package.json b/package.json index fa70ea1c13..0d0f340c74 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "moment": "^2.18.1", "object-assign": "~4.1.0", "omit.js": "^0.1.0", + "prop-types": "^15.5.7", "rc-animate": "~2.3.0", "rc-calendar": "~7.8.0", "rc-cascader": "~0.11.0", diff --git a/site/theme/template/Content/ComponentDoc.jsx b/site/theme/template/Content/ComponentDoc.jsx index 4a8f62460a..31ab3e3f3a 100644 --- a/site/theme/template/Content/ComponentDoc.jsx +++ b/site/theme/template/Content/ComponentDoc.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import DocumentTitle from 'react-document-title'; import { FormattedMessage } from 'react-intl'; import classNames from 'classnames'; @@ -9,7 +10,7 @@ import EditButton from './EditButton'; export default class ComponentDoc extends React.Component { static contextTypes = { - intl: React.PropTypes.object, + intl: PropTypes.object, } constructor(props) { diff --git a/site/theme/template/Content/Demo.jsx b/site/theme/template/Content/Demo.jsx index 1571eec63b..4a0a66a1f2 100644 --- a/site/theme/template/Content/Demo.jsx +++ b/site/theme/template/Content/Demo.jsx @@ -1,5 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; +import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import CopyToClipboard from 'react-copy-to-clipboard'; import classNames from 'classnames'; @@ -9,7 +10,7 @@ import BrowserFrame from '../BrowserFrame'; export default class Demo extends React.Component { static contextTypes = { - intl: React.PropTypes.object, + intl: PropTypes.object, } constructor(props) { diff --git a/site/theme/template/Layout/index.jsx b/site/theme/template/Layout/index.jsx index 162469e59f..3f8edbcfa9 100644 --- a/site/theme/template/Layout/index.jsx +++ b/site/theme/template/Layout/index.jsx @@ -1,5 +1,6 @@ import React, { cloneElement } from 'react'; import ReactDOM from 'react-dom'; +import PropTypes from 'prop-types'; import { addLocaleData, IntlProvider } from 'react-intl'; import { LocaleProvider } from 'antd'; import enUS from 'antd/lib/locale-provider/en_US'; @@ -22,7 +23,7 @@ if (typeof window !== 'undefined') { export default class Layout extends React.Component { static contextTypes = { - router: React.PropTypes.object.isRequired, + router: PropTypes.object.isRequired, } constructor(props) {