Skip to content

Commit

Permalink
Merge pull request #36 from galileo/update-to-prop-types-as-an-differ…
Browse files Browse the repository at this point in the history
…ent-package

Use the prop-types library
  • Loading branch information
kaivi authored Jun 1, 2017
2 parents d347da2 + 9785429 commit ebbe5ef
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 61 deletions.
38 changes: 21 additions & 17 deletions lib/RIEBase.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
"use strict";
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _react = require("react");
var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
Expand Down Expand Up @@ -67,8 +71,8 @@ var RIEBase = function (_React$Component) {

_this.render = function () {
return _react2.default.createElement(
"span",
_extends({}, _this.props.defaultProps, { tabindex: "0", className: _this.makeClassString(), onClick: _this.elementClick }),
'span',
_extends({}, _this.props.defaultProps, { tabindex: '0', className: _this.makeClassString(), onClick: _this.elementClick }),
_this.props.value
);
};
Expand All @@ -90,18 +94,18 @@ var RIEBase = function (_React$Component) {
}(_react2.default.Component);

RIEBase.propTypes = {
value: _react2.default.PropTypes.any.isRequired,
change: _react2.default.PropTypes.func.isRequired,
propName: _react2.default.PropTypes.string.isRequired,
editProps: _react2.default.PropTypes.object,
defaultProps: _react2.default.PropTypes.object,
isDisabled: _react2.default.PropTypes.bool,
validate: _react2.default.PropTypes.func,
shouldBlockWhileLoading: _react2.default.PropTypes.bool,
classLoading: _react2.default.PropTypes.string,
classEditing: _react2.default.PropTypes.string,
classDisabled: _react2.default.PropTypes.string,
classInvalid: _react2.default.PropTypes.string,
className: _react2.default.PropTypes.string
value: _propTypes2.default.any.isRequired,
change: _propTypes2.default.func.isRequired,
propName: _propTypes2.default.string.isRequired,
editProps: _propTypes2.default.object,
defaultProps: _propTypes2.default.object,
isDisabled: _propTypes2.default.bool,
validate: _propTypes2.default.func,
shouldBlockWhileLoading: _propTypes2.default.bool,
classLoading: _propTypes2.default.string,
classEditing: _propTypes2.default.string,
classDisabled: _propTypes2.default.string,
classInvalid: _propTypes2.default.string,
className: _propTypes2.default.string
};
exports.default = RIEBase;
6 changes: 5 additions & 1 deletion lib/RIENumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _RIEStatefulBase2 = require('./RIEStatefulBase');

var _RIEStatefulBase3 = _interopRequireDefault(_RIEStatefulBase2);
Expand Down Expand Up @@ -73,6 +77,6 @@ var RIENumber = function (_RIEStatefulBase) {
}(_RIEStatefulBase3.default);

RIENumber.propTypes = {
format: _react2.default.PropTypes.func
format: _propTypes2.default.func
};
exports.default = RIENumber;
6 changes: 5 additions & 1 deletion lib/RIESelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ var _reactDom = require('react-dom');

var _reactDom2 = _interopRequireDefault(_reactDom);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _RIEStatefulBase2 = require('./RIEStatefulBase');

var _RIEStatefulBase3 = _interopRequireDefault(_RIEStatefulBase2);
Expand Down Expand Up @@ -89,6 +93,6 @@ var RIESelect = function (_RIEStatefulBase) {
}(_RIEStatefulBase3.default);

RIESelect.propTypes = {
options: _react2.default.PropTypes.array.isRequired
options: _propTypes2.default.array.isRequired
};
exports.default = RIESelect;
24 changes: 14 additions & 10 deletions lib/RIETags.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ var _reactDom = require('react-dom');

var _reactDom2 = _interopRequireDefault(_reactDom);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _RIEStatefulBase2 = require('./RIEStatefulBase');

var _RIEStatefulBase3 = _interopRequireDefault(_RIEStatefulBase2);
Expand Down Expand Up @@ -60,9 +64,9 @@ var RIETag = function (_React$Component) {
}(_react2.default.Component);

RIETag.propTypes = {
text: _react2.default.PropTypes.string.isRequired,
removeHandler: _react2.default.PropTypes.func,
className: _react2.default.PropTypes.string
text: _propTypes2.default.string.isRequired,
removeHandler: _propTypes2.default.func,
className: _propTypes2.default.string
};

var RIETags = function (_RIEStatefulBase) {
Expand Down Expand Up @@ -171,12 +175,12 @@ var RIETags = function (_RIEStatefulBase) {
}(_RIEStatefulBase3.default);

RIETags.propTyes = {
value: _react2.default.PropTypes.object.isRequired,
maxTags: _react2.default.PropTypes.number,
minTags: _react2.default.PropTypes.number,
separator: _react2.default.PropTypes.string,
elementClass: _react2.default.PropTypes.string,
blurDelay: _react2.default.PropTypes.number,
placeholder: _react2.default.PropTypes.string
value: _propTypes2.default.object.isRequired,
maxTags: _propTypes2.default.number,
minTags: _propTypes2.default.number,
separator: _propTypes2.default.string,
elementClass: _propTypes2.default.string,
blurDelay: _propTypes2.default.number,
placeholder: _propTypes2.default.string
};
exports.default = RIETags;
8 changes: 6 additions & 2 deletions lib/RIEToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _RIEBase2 = require('./RIEBase');

var _RIEBase3 = _interopRequireDefault(_RIEBase2);
Expand Down Expand Up @@ -58,7 +62,7 @@ var RIEToggle = function (_RIEBase) {
}(_RIEBase3.default);

RIEToggle.propTypes = {
textTrue: _react2.default.PropTypes.string,
textFalse: _react2.default.PropTypes.string
textTrue: _propTypes2.default.string,
textFalse: _propTypes2.default.string
};
exports.default = RIEToggle;
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
},
"peerDependencies": {
"react": "^0.14.0 || ^15.0.0",
"react-dom": "^0.14.0 || ^15.0.0"
"react-dom": "^0.14.0 || ^15.0.0",
"prop-types": "^15.5.8"
},
"devDependencies": {
"babel-cli": "^6.4.0",
Expand Down
29 changes: 14 additions & 15 deletions src/RIEBase.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';

export default class RIEBase extends React.Component {
constructor(props){
Expand All @@ -17,21 +18,19 @@ export default class RIEBase extends React.Component {
}

static propTypes = {
value: React.PropTypes.any.isRequired,
change: React.PropTypes.func.isRequired,
propName: React.PropTypes.string.isRequired,
editProps: React.PropTypes.object,
defaultProps: React.PropTypes.object,
isDisabled: React.PropTypes.bool,
validate: React.PropTypes.func,
shouldBlockWhileLoading: React.PropTypes.bool,
classLoading: React.PropTypes.string,
classEditing: React.PropTypes.string,
classDisabled: React.PropTypes.string,
classInvalid: React.PropTypes.string,
className: React.PropTypes.string,
onFinish: React.PropTypes.func,
onStart: React.PropTypes.func
value: PropTypes.any.isRequired,
change: PropTypes.func.isRequired,
propName: PropTypes.string.isRequired,
editProps: PropTypes.object,
defaultProps: PropTypes.object,
isDisabled: PropTypes.bool,
validate: PropTypes.func,
shouldBlockWhileLoading: PropTypes.bool,
classLoading: PropTypes.string,
classEditing: PropTypes.string,
classDisabled: PropTypes.string,
classInvalid: PropTypes.string,
className: PropTypes.string
};

doValidations = (value) => {
Expand Down
3 changes: 2 additions & 1 deletion src/RIENumber.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import RIEStatefulBase from './RIEStatefulBase';

export default class RIENumber extends RIEStatefulBase {
Expand All @@ -8,7 +9,7 @@ export default class RIENumber extends RIEStatefulBase {
}

static propTypes = {
format: React.PropTypes.func
format: PropTypes.func
};

validate = (value) => {
Expand Down
3 changes: 2 additions & 1 deletion src/RIESelect.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import RIEStatefulBase from './RIEStatefulBase';

export default class RIESelect extends RIEStatefulBase {
static propTypes = {
options: React.PropTypes.array.isRequired
options: PropTypes.array.isRequired
};

finishEditing = () => {
Expand Down
21 changes: 11 additions & 10 deletions src/RIETags.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import RIEStatefulBase from './RIEStatefulBase';

class RIETag extends React.Component {
Expand All @@ -8,9 +9,9 @@ class RIETag extends React.Component {
}

static propTypes = {
text: React.PropTypes.string.isRequired,
removeHandler: React.PropTypes.func,
className: React.PropTypes.string
text: PropTypes.string.isRequired,
removeHandler: PropTypes.func,
className: PropTypes.string
};

remove = () => {
Expand All @@ -31,13 +32,13 @@ export default class RIETags extends RIEStatefulBase {
}

static propTyes = {
value: React.PropTypes.object.isRequired,
maxTags: React.PropTypes.number,
minTags: React.PropTypes.number,
separator: React.PropTypes.string,
elementClass: React.PropTypes.string,
blurDelay: React.PropTypes.number,
placeholder: React.PropTypes.string
value: PropTypes.object.isRequired,
maxTags: PropTypes.number,
minTags: PropTypes.number,
separator: PropTypes.string,
elementClass: PropTypes.string,
blurDelay: PropTypes.number,
placeholder: PropTypes.string
};

addTag = (tag) => {
Expand Down
5 changes: 3 additions & 2 deletions src/RIEToggle.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import RIEBase from './RIEBase';

export default class RIEToggle extends RIEBase {

static propTypes = {
textTrue: React.PropTypes.string,
textFalse: React.PropTypes.string
textTrue: PropTypes.string,
textFalse: PropTypes.string
};

elementClick = (e) => {
Expand Down

0 comments on commit ebbe5ef

Please sign in to comment.