@doctolib/react-form
Advanced tools
Comparing version 1.5.0 to 3.0.0
@@ -5,6 +5,4 @@ 'use strict'; | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
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 _extends3 = _interopRequireDefault(_extends2); | ||
var _react = require('react'); | ||
@@ -44,4 +42,2 @@ | ||
mixins: [_formsyReact2.default.Mixin, _ControlMixin2.default, _reactAddonsPureRenderMixin2.default], | ||
getDefaultProps: function getDefaultProps() { | ||
@@ -51,2 +47,3 @@ return { value: DEFAULT_VALUE, options: [] }; | ||
mixins: [_formsyReact2.default.Mixin, _ControlMixin2.default, _reactAddonsPureRenderMixin2.default], | ||
@@ -63,3 +60,2 @@ /** | ||
/** | ||
@@ -75,3 +71,3 @@ * Render checkbox input. | ||
var checked = this.props.value === DEFAULT_VALUE || this.props.value === null ? null : this.props.value.indexOf(entry.value) !== -1; | ||
var props = (0, _extends3.default)({}, this.getControlProps(), { | ||
var props = _extends({}, this.getControlProps(), { | ||
id: null, | ||
@@ -96,3 +92,2 @@ className: className === 'form-control' ? null : className, | ||
/** | ||
@@ -99,0 +94,0 @@ * Called when the value changes. |
@@ -5,17 +5,5 @@ 'use strict'; | ||
var _stringify = require('babel-runtime/core-js/json/stringify'); | ||
var _stringify2 = _interopRequireDefault(_stringify); | ||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties'); | ||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); | ||
var _keys = require('babel-runtime/core-js/object/keys'); | ||
var _keys2 = _interopRequireDefault(_keys); | ||
var _react = require('react'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
@@ -51,3 +39,2 @@ exports.default = { | ||
/** | ||
@@ -61,4 +48,3 @@ * Get an array of options from props. | ||
if (!Array.isArray(options)) return (0, _keys2.default)(options).map(function (key) { | ||
if (!Array.isArray(options)) return Object.keys(options).map(function (key) { | ||
return { value: String(key), label: options[key] }; | ||
@@ -68,7 +54,6 @@ }); | ||
return options.map(function (entry) { | ||
return entry = typeof entry === 'string' ? { value: entry, label: entry } : entry; | ||
return typeof entry === 'string' ? { value: entry, label: entry } : entry; | ||
}); | ||
}, | ||
// from https://github.com/twisty/formsy-react-components/ | ||
@@ -83,11 +68,13 @@ hashString: function hashString(string) { | ||
// from https://github.com/twisty/formsy-react-components/ | ||
getId: function getId() { | ||
var _props = this.props; | ||
var leftAddon = _props.leftAddon; | ||
var | ||
/* eslint-disable no-unused-vars */ | ||
leftAddon = _props.leftAddon; | ||
var rightAddon = _props.rightAddon; | ||
var hashProps = (0, _objectWithoutProperties3.default)(_props, ['leftAddon', 'rightAddon']); | ||
return this.props.id || this.props.name.split('[').join('_').replace(']', '') + this.hashString((0, _stringify2.default)(hashProps)); | ||
var hashProps = _objectWithoutProperties(_props, ['leftAddon', 'rightAddon']); | ||
return this.props.id || this.props.name.split('[').join('_').replace(']', '') + this.hashString(JSON.stringify(hashProps)); | ||
}, | ||
@@ -94,0 +81,0 @@ getControlProps: function getControlProps() { |
'use strict'; | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
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 _extends3 = _interopRequireDefault(_extends2); | ||
var _react = require('react'); | ||
@@ -21,3 +19,3 @@ | ||
render: function render() { | ||
return _react2.default.createElement(Component, (0, _extends3.default)({ | ||
return _react2.default.createElement(Component, _extends({ | ||
setValidations: this.setValidations, | ||
@@ -24,0 +22,0 @@ setValue: this.setValue, |
@@ -5,6 +5,4 @@ 'use strict'; | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
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 _extends3 = _interopRequireDefault(_extends2); | ||
var _react = require('react'); | ||
@@ -47,4 +45,2 @@ | ||
mixins: [_formsyReact2.default.Mixin, _ControlMixin2.default, _reactAddonsPureRenderMixin2.default], | ||
getDefaultProps: function getDefaultProps() { | ||
@@ -56,2 +52,3 @@ return { | ||
mixins: [_formsyReact2.default.Mixin, _ControlMixin2.default, _reactAddonsPureRenderMixin2.default], | ||
@@ -80,7 +77,7 @@ /** | ||
var controlProps = (0, _extends3.default)({}, this.getControlProps(), { | ||
var controlProps = _extends({}, this.getControlProps(), { | ||
autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, autoFocus: autoFocus, | ||
maxLength: maxLength, placeholder: placeholder, onChange: onChange, type: type | ||
}); | ||
var wrapperProps = (0, _extends3.default)({}, this.getWrapperProps(), { | ||
var wrapperProps = _extends({}, this.getWrapperProps(), { | ||
hasAddon: Boolean(this.props.leftAddon || this.props.rightAddon) | ||
@@ -87,0 +84,0 @@ }); |
@@ -5,10 +5,4 @@ 'use strict'; | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
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 _extends3 = _interopRequireDefault(_extends2); | ||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties'); | ||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); | ||
var _react = require('react'); | ||
@@ -32,2 +26,4 @@ | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
exports.default = _react2.default.createClass({ | ||
@@ -46,8 +42,13 @@ displayName: 'InputAddon', | ||
var _props = this.props; | ||
var children = _props.children; | ||
var | ||
/* eslint-disable no-unused-vars */ | ||
control = _props.control; | ||
var | ||
/* eslint-enable no-unused-vars */ | ||
children = _props.children; | ||
var className = _props.className; | ||
var control = _props.control; | ||
var props = (0, _objectWithoutProperties3.default)(_props, ['children', 'className', 'control']); | ||
var spanProps = (0, _extends3.default)({}, props, { | ||
var props = _objectWithoutProperties(_props, ['control', 'children', 'className']); | ||
var spanProps = _extends({}, props, { | ||
className: (0, _classnames2.default)('input-group-addon', className) | ||
@@ -54,0 +55,0 @@ }); |
@@ -5,6 +5,4 @@ 'use strict'; | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
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 _extends3 = _interopRequireDefault(_extends2); | ||
var _react = require('react'); | ||
@@ -42,4 +40,2 @@ | ||
mixins: [_formsyReact2.default.Mixin, _ControlMixin2.default, _reactAddonsPureRenderMixin2.default], | ||
getDefaultProps: function getDefaultProps() { | ||
@@ -49,2 +45,3 @@ return { options: [] }; | ||
mixins: [_formsyReact2.default.Mixin, _ControlMixin2.default, _reactAddonsPureRenderMixin2.default], | ||
@@ -61,3 +58,2 @@ /** | ||
/** | ||
@@ -73,3 +69,3 @@ * Render radio input. | ||
var checked = this.props.value === undefined || this.props.value === null ? null : entry.value === this.props.value; | ||
var props = (0, _extends3.default)({}, this.getControlProps(), { | ||
var props = _extends({}, this.getControlProps(), { | ||
id: null, | ||
@@ -94,3 +90,2 @@ className: className === 'form-control' ? null : className, | ||
/** | ||
@@ -97,0 +92,0 @@ * Called when the value changes. |
@@ -5,6 +5,4 @@ 'use strict'; | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
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 _extends3 = _interopRequireDefault(_extends2); | ||
var _react = require('react'); | ||
@@ -45,4 +43,2 @@ | ||
mixins: [_formsyReact2.default.Mixin, _ControlMixin2.default, _reactAddonsPureRenderMixin2.default], | ||
getDefaultProps: function getDefaultProps() { | ||
@@ -52,2 +48,3 @@ return { options: [] }; | ||
mixins: [_formsyReact2.default.Mixin, _ControlMixin2.default, _reactAddonsPureRenderMixin2.default], | ||
@@ -63,3 +60,2 @@ /** | ||
if (!placeholder) return null; | ||
@@ -74,3 +70,2 @@ | ||
/** | ||
@@ -86,3 +81,2 @@ * Render options. | ||
/** | ||
@@ -107,3 +101,2 @@ * Render option. | ||
/** | ||
@@ -121,3 +114,2 @@ * Called when the value changes. | ||
var controlProps = this.getControlProps(); | ||
@@ -131,3 +123,3 @@ var className = (0, _classnames2.default)(controlProps.className, { placeholder: !this.getValue() }); | ||
'select', | ||
(0, _extends3.default)({}, controlProps, { onChange: onChange, className: className }), | ||
_extends({}, controlProps, { onChange: onChange, className: className }), | ||
this.renderPlaceHolder(), | ||
@@ -134,0 +126,0 @@ this.renderOptions() |
@@ -5,6 +5,4 @@ 'use strict'; | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
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 _extends3 = _interopRequireDefault(_extends2); | ||
var _react = require('react'); | ||
@@ -59,9 +57,8 @@ | ||
return _react2.default.createElement( | ||
_ControlWrapper2.default, | ||
this.getWrapperProps(), | ||
_react2.default.createElement('textarea', (0, _extends3.default)({}, this.getControlProps(), { maxLength: maxLength, rows: rows, placeholder: placeholder, onChange: onChange })) | ||
_react2.default.createElement('textarea', _extends({}, this.getControlProps(), { maxLength: maxLength, rows: rows, placeholder: placeholder, onChange: onChange })) | ||
); | ||
} | ||
}); |
{ | ||
"name": "@doctolib/react-form", | ||
"version": "1.5.0", | ||
"version": "3.0.0", | ||
"description": "Set of React form components based on react-formsy.", | ||
@@ -31,20 +31,22 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@doctolib/gulp-tasks": "^4.0.0", | ||
"babel-eslint": "^5.0.0-beta6", | ||
"babel-plugin-transform-runtime": "^6.3.13", | ||
"babel-preset-doctolib": "^1.1.3", | ||
"babel-preset-es2015": "^6.3.13", | ||
"babel-preset-react": "^6.3.13", | ||
"@doctolib/gulp-tasks": "^5.0.0", | ||
"babel-eslint": "^6.0.2", | ||
"babel-plugin-transform-runtime": "^6.7.5", | ||
"babel-preset-doctolib": "^2.0.0", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-react": "^6.5.0", | ||
"babel-runtime": "^6.6.1", | ||
"chai": "^3.4.0", | ||
"chai-dom": "^1.2.0", | ||
"eslint": "^1.7.3", | ||
"eslint-config-doctolib": "^1.0.2", | ||
"eslint-plugin-mocha": "^1.0.0", | ||
"eslint-plugin-react": "^3.6.3", | ||
"gulp": "^3.9.0", | ||
"react": "^0.14.0", | ||
"react-addons-pure-render-mixin": "^0.14.0", | ||
"react-addons-test-utils": "^0.14.2", | ||
"react-bootstrap": "^0.28.1", | ||
"react-dom": "^0.14.0", | ||
"dirty-chai": "^1.2.2", | ||
"eslint": "^2.8.0", | ||
"eslint-config-doctolib": "^2.0.0", | ||
"eslint-plugin-mocha": "^2.2.0", | ||
"eslint-plugin-react": "^5.0.0", | ||
"gulp": "^3.9.1", | ||
"react": "^15.0.1", | ||
"react-addons-pure-render-mixin": "^15.0.1", | ||
"react-addons-test-utils": "^15.0.1", | ||
"react-bootstrap": "^0.28.5", | ||
"react-dom": "^15.0.1", | ||
"sinon": "^1.17.2", | ||
@@ -57,3 +59,2 @@ "sinon-chai": "^2.8.0" | ||
"dependencies": { | ||
"babel-runtime": "^6.0.14", | ||
"classnames": "^2.2.0", | ||
@@ -63,6 +64,7 @@ "formsy-react": "^0.17.0" | ||
"peerDependencies": { | ||
"react": "^0.14.0", | ||
"react-addons-pure-render-mixin": "^0.14.0", | ||
"react-bootstrap": "^0.28.1" | ||
"react": "^15.0.1", | ||
"react-dom": "^15.0.1", | ||
"react-addons-pure-render-mixin": "^15.0.1", | ||
"react-bootstrap": "^0.28.5" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29087
22
652
+ Addedcreate-react-class@15.7.0(transitive)
+ Addedencoding@0.1.13(transitive)
+ Addedfbjs@0.8.18(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisomorphic-fetch@2.2.1(transitive)
+ Addednode-fetch@1.7.3(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedprop-types@15.8.1(transitive)
+ Addedreact@15.7.0(transitive)
+ Addedreact-addons-pure-render-mixin@15.6.3(transitive)
+ Addedreact-dom@15.7.0(transitive)
+ Addedreact-is@16.13.1(transitive)
+ Addedsetimmediate@1.0.5(transitive)
+ Addedwhatwg-fetch@3.6.20(transitive)
- Removedbabel-runtime@^6.0.14
- Removedbabel-runtime@6.26.0(transitive)
- Removedcore-js@2.6.12(transitive)
- Removedreact@19.0.0(transitive)
- Removedreact-addons-pure-render-mixin@0.14.8(transitive)
- Removedreact-dom@19.0.0(transitive)
- Removedregenerator-runtime@0.11.1(transitive)
- Removedscheduler@0.25.0(transitive)