react-input-message
Advanced tools
Comparing version 0.13.3 to 0.14.0
@@ -44,3 +44,3 @@ 'use strict'; | ||
exports.default = function (Component) { | ||
function connectToMessageContainer(Component) { | ||
var _ref = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
@@ -71,3 +71,3 @@ | ||
MessageListener.prototype.componentWillMount = function componentWillMount() { | ||
MessageListener.prototype.componentDidMount = function componentDidMount() { | ||
var _this2 = this; | ||
@@ -148,4 +148,7 @@ | ||
return MessageListener; | ||
}; | ||
} | ||
connectToMessageContainer.resolveNames = defaultResolveNames; | ||
exports.default = connectToMessageContainer; | ||
module.exports = exports['default']; |
@@ -164,2 +164,3 @@ 'use strict'; | ||
messageContainer.onValidate(mapNames(fields), type, args); | ||
return; | ||
} | ||
@@ -166,0 +167,0 @@ |
@@ -27,2 +27,4 @@ 'use strict'; | ||
var resolveNames = _connectToMessageContainer2.default.resolveNames; | ||
var MessageTrigger = function (_React$Component) { | ||
@@ -62,7 +64,6 @@ _inherits(MessageTrigger, _React$Component); | ||
{ | ||
inject: this.inject, | ||
events: this.props.events, | ||
onEvent: this.onEvent | ||
}, | ||
this.props.children | ||
this.inject | ||
); | ||
@@ -104,12 +105,16 @@ }; | ||
events: stringOrArrayOfStrings, | ||
inject: _react2.default.PropTypes.func, | ||
for: stringOrArrayOfStrings, | ||
children: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.func, _react2.default.PropTypes.element]), | ||
group: function group(props, name, compName) { | ||
for (var _len2 = arguments.length, args = Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) { | ||
args[_key2 - 3] = arguments[_key2]; | ||
} | ||
if (!props[name] && (!props.for || !props.for.length)) { | ||
return new Error('A `group` prop is required when no `for` prop is provided' + ('for component ' + compName)); | ||
} | ||
return stringOrArrayOfStrings(props, name, compName); | ||
return stringOrArrayOfStrings.apply(undefined, [props, name, compName].concat(args)); | ||
} | ||
@@ -127,9 +132,13 @@ }; | ||
this.onEvent = function (event, handler) { | ||
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | ||
args[_key2 - 2] = arguments[_key2]; | ||
this.onEvent = function (event) { | ||
for (var _len3 = arguments.length, args = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { | ||
args[_key3 - 1] = arguments[_key3]; | ||
} | ||
var _props = _this2.props; | ||
var onValidate = _props.onValidate; | ||
var children = _props.children; | ||
var messageContainer = _this2.context.messageContainer; | ||
var handler = _react2.default.isValidElement(children) && children.props[event]; | ||
@@ -140,14 +149,18 @@ handler && handler.apply(_this2, args); | ||
messageContainer.onValidate(_this2.resolveNames(), event, args); | ||
onValidate = onValidate || messageContainer.onValidate; | ||
onValidate(resolveNames(_this2.props, messageContainer), event, args); | ||
}; | ||
this.inject = function (child) { | ||
var _props = _this2.props; | ||
var messages = _props.messages; | ||
var inject = _props.inject; | ||
this.inject = function (props) { | ||
var _props2 = _this2.props; | ||
var messages = _props2.messages; | ||
var children = _props2.children; | ||
if (!inject) return false; | ||
props.messages = messages; | ||
return inject(child, messages); | ||
if (typeof children === 'function') return children(props); | ||
return _react2.default.cloneElement(children, props); | ||
}; | ||
@@ -154,0 +167,0 @@ }; |
{ | ||
"name": "react-input-message", | ||
"description": "unopinionated form input annotation", | ||
"version": "0.13.3", | ||
"version": "0.14.0", | ||
"repository": { | ||
@@ -16,3 +16,3 @@ "url": "git://github.com/jquense/react-input-message.git" | ||
"classnames": "^2.2.3", | ||
"topeka": "^0.3.0", | ||
"topeka": "^0.4.0", | ||
"universal-promise": "^1.1.0" | ||
@@ -19,0 +19,0 @@ }, |
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
27261
578
+ Addedtopeka@0.4.1(transitive)
- Removedtopeka@0.3.6(transitive)
Updatedtopeka@^0.4.0