diff --git a/lib/Wrapper.js b/lib/Wrapper.js index d4a58321..3d8d260c 100644 --- a/lib/Wrapper.js +++ b/lib/Wrapper.js @@ -232,23 +232,23 @@ exports.default = function (Component) { value: function render() { var innerRef = this.props.innerRef; - var propsForElement = _extends({ - getErrorMessage: this.getErrorMessage, - getErrorMessages: this.getErrorMessages, - getValue: this.getValue, - hasValue: this.hasValue, - isFormDisabled: this.isFormDisabled, - isValid: this.isValid, - isPristine: this.isPristine, - isFormSubmitted: this.isFormSubmitted, - isRequired: this.isRequired, + var propsForElement = _extends({}, this.props, { + errorMessage: this.getErrorMessage(), + errorMessages: this.getErrorMessages(), + hasValue: this.hasValue(), + isFormDisabled: this.isFormDisabled(), + isFormSubmitted: this.isFormSubmitted(), + isPristine: this.isPristine(), + isRequired: this.isRequired(), + isValid: this.isValid(), isValidValue: this.isValidValue, resetValue: this.resetValue, setValidations: this.setValidations, setValue: this.setValue, - showRequired: this.showRequired, - showError: this.showError - }, this.props); + showError: this.showError(), + showRequired: this.showRequired(), + value: this.getValue() + }); if (innerRef) { propsForElement.ref = innerRef; diff --git a/release/formsy-react.js b/release/formsy-react.js index 086644ec..b12d2fe7 100644 --- a/release/formsy-react.js +++ b/release/formsy-react.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.Formsy=t(require("react")):e.Formsy=t(e.React)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,r){e.exports=r(5)()},function(t,r){t.exports=e},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default={arraysDiffer:function(e,t){var r=this,n=!1;return e.length!==t.length?n=!0:e.forEach(function(e,i){r.isSame(e,t[i])||(n=!0)},this),n},objectsDiffer:function(e,t){var r=this,n=!1;return Object.keys(e).length!==Object.keys(t).length?n=!0:Object.keys(e).forEach(function(i){r.isSame(e[i],t[i])||(n=!0)},this),n},isSame:function(e,t){return(void 0===e?"undefined":n(e))===(void 0===t?"undefined":n(t))&&(Array.isArray(e)&&Array.isArray(t)?!this.arraysDiffer(e,t):"function"==typeof e?e.toString()===t.toString():"object"===(void 0===e?"undefined":n(e))&&null!==e&&null!==t?!this.objectsDiffer(e,t):e===t)},find:function(e,t){for(var r=0,n=e.length;r=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Wrapper=t.withFormsy=t.validationRules=t.propTypes=t.addValidationRule=void 0;var s=Object.assign||function(e){for(var t=1;t0&&r.setInputValidationErrors(r.props.validationErrors);var e=r.inputs.map(function(e){return e.props.name});y.default.arraysDiffer(r.prevInputNames,e)&&r.validateForm()},r.getCurrentValues=function(){return r.inputs.reduce(function(e,t){var r=t.props.name,n=Object.assign({},e);return n[r]=t.state.value,n},{})},r.getModel=function(){var e=r.getCurrentValues();return r.mapModel(e)},r.getPristineValues=function(){return r.inputs.reduce(function(e,t){var r=t.props.name,n=Object.assign({},e);return n[r]=t.props.value,n},{})},r.setFormPristine=function(e){r.setState({formSubmitted:!e}),r.inputs.forEach(function(t){t.setState({formSubmitted:!e,isPristine:e})})},r.setInputValidationErrors=function(e){r.inputs.forEach(function(t){var r=t.props.name,n=[{isValid:!(r in e),validationError:"string"==typeof e[r]?[e[r]]:e[r]}];t.setState.apply(t,n)})},r.isFormDisabled=function(){return r.props.disabled},r.mapModel=function(e){return r.props.mapping?r.props.mapping(e):c.default.toObj(Object.keys(e).reduce(function(t,r){for(var n=r.split("."),i=t;n.length;){var o=n.shift();i[o]=n.length?i[o]||{}:e[r],i=i[o]}return t},{}))},r.reset=function(e){r.setFormPristine(!0),r.resetModel(e)},r.resetInternal=function(e){e.preventDefault(),r.reset(),r.props.onReset&&r.props.onReset()},r.resetModel=function(e){r.inputs.forEach(function(t){var r=t.props.name;e&&Object.prototype.hasOwnProperty.call(e,r)?t.setValue(e[r]):t.resetValue()}),r.validateForm()},r.runValidation=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.state.value,n=r.getCurrentValues(),i=e.props,o=i.validationError,a=i.validationErrors,u=y.default.runRules(t,n,e.validations,g.default),s=y.default.runRules(t,n,e.requiredValidations,g.default),l=!!Object.keys(e.requiredValidations).length&&!!s.success.length,f=!(u.failed.length||r.props.validationErrors&&r.props.validationErrors[e.props.name]);return{isRequired:l,isValid:!l&&f,error:function(){if(f&&!l)return[];if(u.errors.length)return u.errors;if(r.props.validationErrors&&r.props.validationErrors[e.props.name])return"string"==typeof r.props.validationErrors[e.props.name]?[r.props.validationErrors[e.props.name]]:r.props.validationErrors[e.props.name];if(l){var t=a[s.success[0]];return t?[t]:null}return u.failed.length?u.failed.map(function(e){return a[e]?a[e]:o}).filter(function(e,t,r){return r.indexOf(e)===t}):void 0}()}},r.attachToForm=function(e){-1===r.inputs.indexOf(e)&&r.inputs.push(e),r.validate(e)},r.detachFromForm=function(e){var t=r.inputs.indexOf(e);-1!==t&&(r.inputs=r.inputs.slice(0,t).concat(r.inputs.slice(t+1))),r.validateForm()},r.isChanged=function(){return!y.default.isSame(r.getPristineValues(),r.getCurrentValues())},r.submit=function(e){e&&e.preventDefault&&e.preventDefault(),r.setFormPristine(!1);var t=r.getModel();r.props.onSubmit(t,r.resetModel,r.updateInputsWithError),r.state.isValid?r.props.onValidSubmit(t,r.resetModel,r.updateInputsWithError):r.props.onInvalidSubmit(t,r.resetModel,r.updateInputsWithError)},r.updateInputsWithError=function(e){Object.keys(e).forEach(function(t){var n=y.default.find(r.inputs,function(e){return e.props.name===t});if(!n)throw new Error("You are trying to update an input that does not exist. Verify errors object with input names. "+JSON.stringify(e));var i=[{isValid:r.props.preventExternalInvalidation,externalError:"string"==typeof e[t]?[e[t]]:e[t]}];n.setState.apply(n,i)})},r.validate=function(e){r.state.canChange&&r.props.onChange(r.getModel(),r.isChanged());var t=r.runValidation(e);e.setState({isValid:t.isValid,isRequired:t.isRequired,validationError:t.error,externalError:null},r.validateForm)},r.validateForm=function(){var e=function(){var e=r.inputs.every(function(e){return e.state.isValid});r.setState({isValid:e}),e?r.props.onValid():r.props.onInvalid(),r.setState({canChange:!0})};r.inputs.forEach(function(t,n){var i=r.runValidation(t);i.isValid&&t.state.externalError&&(i.isValid=!1),t.setState({isValid:i.isValid,isRequired:i.isRequired,validationError:i.error,externalError:!i.isValid&&t.state.externalError?t.state.externalError:null},n===r.inputs.length-1?e:null)}),r.inputs.length||r.setState({canChange:!0})},r.render=function(){var e=r.props,t=(e.getErrorMessage,e.getErrorMessages,e.getValue,e.hasValue,e.isFormDisabled,e.isFormSubmitted,e.isPristine,e.isRequired,e.isValid,e.isValidValue,e.mapping,e.onChange,e.onInvalidSubmit,e.onInvalid,e.onReset,e.onSubmit,e.onValid,e.onValidSubmit,e.preventExternalInvalidation,e.resetValue,e.setValidations,e.setValue,e.showError,e.showRequired,e.validationErrors,i(e,["getErrorMessage","getErrorMessages","getValue","hasValue","isFormDisabled","isFormSubmitted","isPristine","isRequired","isValid","isValidValue","mapping","onChange","onInvalidSubmit","onInvalid","onReset","onSubmit","onValid","onValidSubmit","preventExternalInvalidation","resetValue","setValidations","setValue","showError","showRequired","validationErrors"]));return h.default.createElement("form",s({onReset:r.resetInternal,onSubmit:r.submit},t,{disabled:!1}),r.props.children)},r.state={isValid:!0,isSubmitting:!1,canChange:!1},r.inputs=[],r}return u(t,e),t}(h.default.Component);S.displayName="Formsy",S.defaultProps={children:null,disabled:!1,getErrorMessage:function(){},getErrorMessages:function(){},getValue:function(){},hasValue:function(){},isFormDisabled:function(){},isFormSubmitted:function(){},isPristine:function(){},isRequired:function(){},isValid:function(){},isValidValue:function(){},mapping:null,onChange:function(){},onError:function(){},onInvalid:function(){},onInvalidSubmit:function(){},onReset:function(){},onSubmit:function(){},onValid:function(){},onValidSubmit:function(){},preventExternalInvalidation:!1,resetValue:function(){},setValidations:function(){},setValue:function(){},showError:function(){},showRequired:function(){},validationErrors:null},S.propTypes={children:p.default.node,disabled:p.default.bool,getErrorMessage:p.default.func,getErrorMessages:p.default.func,getValue:p.default.func,hasValue:p.default.func,isFormDisabled:p.default.func,isFormSubmitted:p.default.func,isPristine:p.default.func,isRequired:p.default.func,isValid:p.default.func,isValidValue:p.default.func,mapping:p.default.func,onChange:p.default.func,onInvalid:p.default.func,onInvalidSubmit:p.default.func,onReset:p.default.func,onSubmit:p.default.func,onValid:p.default.func,onValidSubmit:p.default.func,preventExternalInvalidation:p.default.bool,resetValue:p.default.func,setValidations:p.default.func,setValue:p.default.func,showError:p.default.func,showRequired:p.default.func,validationErrors:p.default.object},S.childContextTypes={formsy:p.default.object};var O=function(e,t){g.default[e]=t},R=E.default,j=!1,w=function(e){return j||(console.warn("Wrapper has been renamed to withFormsy. Importing Wrapper from formsy-react is depreacted and will be removed in the future. Please rename your Wrapper imports to withFormsy."),j=!0),R(e)};t.addValidationRule=O,t.propTypes=V.propTypes,t.validationRules=g.default,t.withFormsy=R,t.Wrapper=w,t.default=S},function(e,t){function r(e){return Object.keys(e).reduce(function(t,r){var n=r.match(/[^\[]*/i),i=r.match(/\[.*?\]/g)||[];i=[n[0]].concat(i).map(function(e){return e.replace(/\[|\]/g,"")});for(var o=t;i.length;){var a=i.shift();a in o?o=o[a]:(o[a]=i.length?isNaN(i[0])?{}:[]:e[r],o=o[a])}return t},{})}function n(e){function t(e,r,n){return Array.isArray(n)||"[object Object]"===Object.prototype.toString.call(n)?(Object.keys(n).forEach(function(i){t(e,r+"["+i+"]",n[i])}),e):(e[r]=n,e)}return Object.keys(e).reduce(function(r,n){return t(r,n,e[n])},{})}e.exports={fromObj:n,toObj:r}},function(e,t,r){"use strict";var n=r(6),i=r(7),o=r(8);e.exports=function(){function e(e,t,r,n,a,u){u!==o&&i(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=n,r.PropTypes=r,r}},function(e,t,r){"use strict";function n(e){return function(){return e}}var i=function(){};i.thatReturns=n,i.thatReturnsFalse=n(!1),i.thatReturnsTrue=n(!0),i.thatReturnsNull=n(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(e){return e},e.exports=i},function(e,t,r){"use strict";function n(e,t,r,n,o,a,u,s){if(i(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[r,n,o,a,u,s],c=0;l=new Error(t.replace(/%s/g,function(){return f[c++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var i=function(e){};e.exports=n},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return null!==e&&void 0!==e},i=function(e){return""===e},o={isDefaultRequiredValue:function(e,t){return void 0===t||null===t||""===t},isExisty:function(e,t){return n(t)},matchRegexp:function(e,t,r){return!n(t)||i(t)||r.test(t)},isUndefined:function(e,t){return void 0===t},isEmptyString:function(e,t){return i(t)},isEmail:function(e,t){return o.matchRegexp(e,t,/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i)},isUrl:function(e,t){return o.matchRegexp(e,t,/^(?:\w+:)?\/\/([^\s.]+\.\S{2}|localhost[:?\d]*)\S*$/i)},isTrue:function(e,t){return!0===t},isFalse:function(e,t){return!1===t},isNumeric:function(e,t){return"number"==typeof t||o.matchRegexp(e,t,/^[-+]?(?:\d*[.])?\d+$/)},isAlpha:function(e,t){return o.matchRegexp(e,t,/^[A-Z]+$/i)},isAlphanumeric:function(e,t){return o.matchRegexp(e,t,/^[0-9A-Z]+$/i)},isInt:function(e,t){return o.matchRegexp(e,t,/^(?:[-+]?(?:0|[1-9]\d*))$/)},isFloat:function(e,t){return o.matchRegexp(e,t,/^(?:[-+]?(?:\d+))?(?:\.\d*)?(?:[eE][+-]?(?:\d+))?$/)},isWords:function(e,t){return o.matchRegexp(e,t,/^[A-Z\s]+$/i)},isSpecialWords:function(e,t){return o.matchRegexp(e,t,/^[A-Z\s\u00C0-\u017F]+$/i)},isLength:function(e,t,r){return!n(t)||i(t)||t.length===r},equals:function(e,t,r){return!n(t)||i(t)||t===r},equalsField:function(e,t,r){return t===e[r]},maxLength:function(e,t,r){return!n(t)||t.length<=r},minLength:function(e,t,r){return!n(t)||i(t)||t.length>=r}};t.default=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.propTypes=void 0;var u=Object.assign||function(e){for(var t=1;t1)throw new Error("Formsy does not support multiple args on string validations. Use object format of validations instead.");var i=Object.assign({},e);return i[n]=!r.length||r[0],i},{}):e||{}},v={innerRef:f.default.func,name:f.default.string.isRequired,required:f.default.oneOfType([f.default.bool,f.default.object,f.default.string]),validations:f.default.oneOfType([f.default.object,f.default.string]),value:f.default.any};t.propTypes=v,t.default=function(e){var t=function(t){function r(e){i(this,r);var t=o(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e));return t.getErrorMessage=function(){var e=t.getErrorMessages();return e.length?e[0]:null},t.getErrorMessages=function(){return!t.isValid()||t.showRequired()?t.state.externalError||t.state.validationError||[]:[]},t.getValue=function(){return t.state.value},t.setValidations=function(e,r){t.validations=h(e)||{},t.requiredValidations=!0===r?{isDefaultRequiredValue:!0}:h(r)},t.setValue=function(e){arguments.length>1&&void 0!==arguments[1]&&!arguments[1]?t.setState({value:e}):t.setState({value:e,isPristine:!1},function(){t.context.formsy.validate(t)})},t.hasValue=function(){return""!==t.state.value},t.isFormDisabled=function(){return t.context.formsy.isFormDisabled()},t.isFormSubmitted=function(){return t.state.formSubmitted},t.isPristine=function(){return t.state.isPristine},t.isRequired=function(){return!!t.props.required},t.isValid=function(){return t.state.isValid},t.isValidValue=function(e){return t.context.formsy.isValidValue.call(null,t,e)},t.resetValue=function(){t.setState({value:t.state.pristineValue,isPristine:!0},function(){t.context.formsy.validate(t)})},t.showError=function(){return!t.showRequired()&&!t.isValid()},t.showRequired=function(){return t.state.isRequired},t.state={value:e.value,isRequired:!1,isValid:!0,isPristine:!0,pristineValue:e.value,validationError:[],externalError:null,formSubmitted:!1},t}return a(r,t),s(r,[{key:"componentWillMount",value:function(){var e=this;if(!this.props.name)throw new Error("Form Input requires a name property when used");!function(){e.setValidations(e.props.validations,e.props.required),e.context.formsy.attachToForm(e)}()}},{key:"componentWillReceiveProps",value:function(e){this.setValidations(e.validations,e.required)}},{key:"componentDidUpdate",value:function(e){m.default.isSame(this.props.value,e.value)||this.setValue(this.props.value),m.default.isSame(this.props.validations,e.validations)&&m.default.isSame(this.props.required,e.required)||this.context.formsy.validate(this)}},{key:"componentWillUnmount",value:function(){this.context.formsy.detachFromForm(this)}},{key:"render",value:function(){var t=this.props.innerRef,r=u({getErrorMessage:this.getErrorMessage,getErrorMessages:this.getErrorMessages,getValue:this.getValue,hasValue:this.hasValue,isFormDisabled:this.isFormDisabled,isValid:this.isValid,isPristine:this.isPristine,isFormSubmitted:this.isFormSubmitted,isRequired:this.isRequired,isValidValue:this.isValidValue,resetValue:this.resetValue,setValidations:this.setValidations,setValue:this.setValue,showRequired:this.showRequired,showError:this.showError},this.props);return t&&(r.ref=t),d.default.createElement(e,r)}}]),r}(d.default.Component);return t.displayName="Formsy("+function(e){return e.displayName||e.name||("string"==typeof e?e:"Component")}(e)+")",t.contextTypes={formsy:f.default.object},t.defaultProps={innerRef:function(){},required:!1,validationError:"",validationErrors:{},validations:null,value:e.defaultValue},t.propTypes=v,t}}])}); +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.Formsy=t(require("react")):e.Formsy=t(e.React)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,r){e.exports=r(5)()},function(t,r){t.exports=e},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default={arraysDiffer:function(e,t){var r=this,n=!1;return e.length!==t.length?n=!0:e.forEach(function(e,i){r.isSame(e,t[i])||(n=!0)},this),n},objectsDiffer:function(e,t){var r=this,n=!1;return Object.keys(e).length!==Object.keys(t).length?n=!0:Object.keys(e).forEach(function(i){r.isSame(e[i],t[i])||(n=!0)},this),n},isSame:function(e,t){return(void 0===e?"undefined":n(e))===(void 0===t?"undefined":n(t))&&(Array.isArray(e)&&Array.isArray(t)?!this.arraysDiffer(e,t):"function"==typeof e?e.toString()===t.toString():"object"===(void 0===e?"undefined":n(e))&&null!==e&&null!==t?!this.objectsDiffer(e,t):e===t)},find:function(e,t){for(var r=0,n=e.length;r=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Wrapper=t.withFormsy=t.validationRules=t.propTypes=t.addValidationRule=void 0;var s=Object.assign||function(e){for(var t=1;t0&&r.setInputValidationErrors(r.props.validationErrors);var e=r.inputs.map(function(e){return e.props.name});y.default.arraysDiffer(r.prevInputNames,e)&&r.validateForm()},r.getCurrentValues=function(){return r.inputs.reduce(function(e,t){var r=t.props.name,n=Object.assign({},e);return n[r]=t.state.value,n},{})},r.getModel=function(){var e=r.getCurrentValues();return r.mapModel(e)},r.getPristineValues=function(){return r.inputs.reduce(function(e,t){var r=t.props.name,n=Object.assign({},e);return n[r]=t.props.value,n},{})},r.setFormPristine=function(e){r.setState({formSubmitted:!e}),r.inputs.forEach(function(t){t.setState({formSubmitted:!e,isPristine:e})})},r.setInputValidationErrors=function(e){r.inputs.forEach(function(t){var r=t.props.name,n=[{isValid:!(r in e),validationError:"string"==typeof e[r]?[e[r]]:e[r]}];t.setState.apply(t,n)})},r.isFormDisabled=function(){return r.props.disabled},r.mapModel=function(e){return r.props.mapping?r.props.mapping(e):c.default.toObj(Object.keys(e).reduce(function(t,r){for(var n=r.split("."),i=t;n.length;){var o=n.shift();i[o]=n.length?i[o]||{}:e[r],i=i[o]}return t},{}))},r.reset=function(e){r.setFormPristine(!0),r.resetModel(e)},r.resetInternal=function(e){e.preventDefault(),r.reset(),r.props.onReset&&r.props.onReset()},r.resetModel=function(e){r.inputs.forEach(function(t){var r=t.props.name;e&&Object.prototype.hasOwnProperty.call(e,r)?t.setValue(e[r]):t.resetValue()}),r.validateForm()},r.runValidation=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.state.value,n=r.getCurrentValues(),i=e.props,o=i.validationError,a=i.validationErrors,u=y.default.runRules(t,n,e.validations,g.default),s=y.default.runRules(t,n,e.requiredValidations,g.default),l=!!Object.keys(e.requiredValidations).length&&!!s.success.length,f=!(u.failed.length||r.props.validationErrors&&r.props.validationErrors[e.props.name]);return{isRequired:l,isValid:!l&&f,error:function(){if(f&&!l)return[];if(u.errors.length)return u.errors;if(r.props.validationErrors&&r.props.validationErrors[e.props.name])return"string"==typeof r.props.validationErrors[e.props.name]?[r.props.validationErrors[e.props.name]]:r.props.validationErrors[e.props.name];if(l){var t=a[s.success[0]];return t?[t]:null}return u.failed.length?u.failed.map(function(e){return a[e]?a[e]:o}).filter(function(e,t,r){return r.indexOf(e)===t}):void 0}()}},r.attachToForm=function(e){-1===r.inputs.indexOf(e)&&r.inputs.push(e),r.validate(e)},r.detachFromForm=function(e){var t=r.inputs.indexOf(e);-1!==t&&(r.inputs=r.inputs.slice(0,t).concat(r.inputs.slice(t+1))),r.validateForm()},r.isChanged=function(){return!y.default.isSame(r.getPristineValues(),r.getCurrentValues())},r.submit=function(e){e&&e.preventDefault&&e.preventDefault(),r.setFormPristine(!1);var t=r.getModel();r.props.onSubmit(t,r.resetModel,r.updateInputsWithError),r.state.isValid?r.props.onValidSubmit(t,r.resetModel,r.updateInputsWithError):r.props.onInvalidSubmit(t,r.resetModel,r.updateInputsWithError)},r.updateInputsWithError=function(e){Object.keys(e).forEach(function(t){var n=y.default.find(r.inputs,function(e){return e.props.name===t});if(!n)throw new Error("You are trying to update an input that does not exist. Verify errors object with input names. "+JSON.stringify(e));var i=[{isValid:r.props.preventExternalInvalidation,externalError:"string"==typeof e[t]?[e[t]]:e[t]}];n.setState.apply(n,i)})},r.validate=function(e){r.state.canChange&&r.props.onChange(r.getModel(),r.isChanged());var t=r.runValidation(e);e.setState({isValid:t.isValid,isRequired:t.isRequired,validationError:t.error,externalError:null},r.validateForm)},r.validateForm=function(){var e=function(){var e=r.inputs.every(function(e){return e.state.isValid});r.setState({isValid:e}),e?r.props.onValid():r.props.onInvalid(),r.setState({canChange:!0})};r.inputs.forEach(function(t,n){var i=r.runValidation(t);i.isValid&&t.state.externalError&&(i.isValid=!1),t.setState({isValid:i.isValid,isRequired:i.isRequired,validationError:i.error,externalError:!i.isValid&&t.state.externalError?t.state.externalError:null},n===r.inputs.length-1?e:null)}),r.inputs.length||r.setState({canChange:!0})},r.render=function(){var e=r.props,t=(e.getErrorMessage,e.getErrorMessages,e.getValue,e.hasValue,e.isFormDisabled,e.isFormSubmitted,e.isPristine,e.isRequired,e.isValid,e.isValidValue,e.mapping,e.onChange,e.onInvalidSubmit,e.onInvalid,e.onReset,e.onSubmit,e.onValid,e.onValidSubmit,e.preventExternalInvalidation,e.resetValue,e.setValidations,e.setValue,e.showError,e.showRequired,e.validationErrors,i(e,["getErrorMessage","getErrorMessages","getValue","hasValue","isFormDisabled","isFormSubmitted","isPristine","isRequired","isValid","isValidValue","mapping","onChange","onInvalidSubmit","onInvalid","onReset","onSubmit","onValid","onValidSubmit","preventExternalInvalidation","resetValue","setValidations","setValue","showError","showRequired","validationErrors"]));return h.default.createElement("form",s({onReset:r.resetInternal,onSubmit:r.submit},t,{disabled:!1}),r.props.children)},r.state={isValid:!0,isSubmitting:!1,canChange:!1},r.inputs=[],r}return u(t,e),t}(h.default.Component);S.displayName="Formsy",S.defaultProps={children:null,disabled:!1,getErrorMessage:function(){},getErrorMessages:function(){},getValue:function(){},hasValue:function(){},isFormDisabled:function(){},isFormSubmitted:function(){},isPristine:function(){},isRequired:function(){},isValid:function(){},isValidValue:function(){},mapping:null,onChange:function(){},onError:function(){},onInvalid:function(){},onInvalidSubmit:function(){},onReset:function(){},onSubmit:function(){},onValid:function(){},onValidSubmit:function(){},preventExternalInvalidation:!1,resetValue:function(){},setValidations:function(){},setValue:function(){},showError:function(){},showRequired:function(){},validationErrors:null},S.propTypes={children:p.default.node,disabled:p.default.bool,getErrorMessage:p.default.func,getErrorMessages:p.default.func,getValue:p.default.func,hasValue:p.default.func,isFormDisabled:p.default.func,isFormSubmitted:p.default.func,isPristine:p.default.func,isRequired:p.default.func,isValid:p.default.func,isValidValue:p.default.func,mapping:p.default.func,onChange:p.default.func,onInvalid:p.default.func,onInvalidSubmit:p.default.func,onReset:p.default.func,onSubmit:p.default.func,onValid:p.default.func,onValidSubmit:p.default.func,preventExternalInvalidation:p.default.bool,resetValue:p.default.func,setValidations:p.default.func,setValue:p.default.func,showError:p.default.func,showRequired:p.default.func,validationErrors:p.default.object},S.childContextTypes={formsy:p.default.object};var O=function(e,t){g.default[e]=t},R=E.default,j=!1,w=function(e){return j||(console.warn("Wrapper has been renamed to withFormsy. Importing Wrapper from formsy-react is depreacted and will be removed in the future. Please rename your Wrapper imports to withFormsy."),j=!0),R(e)};t.addValidationRule=O,t.propTypes=V.propTypes,t.validationRules=g.default,t.withFormsy=R,t.Wrapper=w,t.default=S},function(e,t){function r(e){return Object.keys(e).reduce(function(t,r){var n=r.match(/[^\[]*/i),i=r.match(/\[.*?\]/g)||[];i=[n[0]].concat(i).map(function(e){return e.replace(/\[|\]/g,"")});for(var o=t;i.length;){var a=i.shift();a in o?o=o[a]:(o[a]=i.length?isNaN(i[0])?{}:[]:e[r],o=o[a])}return t},{})}function n(e){function t(e,r,n){return Array.isArray(n)||"[object Object]"===Object.prototype.toString.call(n)?(Object.keys(n).forEach(function(i){t(e,r+"["+i+"]",n[i])}),e):(e[r]=n,e)}return Object.keys(e).reduce(function(r,n){return t(r,n,e[n])},{})}e.exports={fromObj:n,toObj:r}},function(e,t,r){"use strict";var n=r(6),i=r(7),o=r(8);e.exports=function(){function e(e,t,r,n,a,u){u!==o&&i(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=n,r.PropTypes=r,r}},function(e,t,r){"use strict";function n(e){return function(){return e}}var i=function(){};i.thatReturns=n,i.thatReturnsFalse=n(!1),i.thatReturnsTrue=n(!0),i.thatReturnsNull=n(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(e){return e},e.exports=i},function(e,t,r){"use strict";function n(e,t,r,n,o,a,u,s){if(i(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[r,n,o,a,u,s],c=0;l=new Error(t.replace(/%s/g,function(){return f[c++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var i=function(e){};e.exports=n},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return null!==e&&void 0!==e},i=function(e){return""===e},o={isDefaultRequiredValue:function(e,t){return void 0===t||null===t||""===t},isExisty:function(e,t){return n(t)},matchRegexp:function(e,t,r){return!n(t)||i(t)||r.test(t)},isUndefined:function(e,t){return void 0===t},isEmptyString:function(e,t){return i(t)},isEmail:function(e,t){return o.matchRegexp(e,t,/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i)},isUrl:function(e,t){return o.matchRegexp(e,t,/^(?:\w+:)?\/\/([^\s.]+\.\S{2}|localhost[:?\d]*)\S*$/i)},isTrue:function(e,t){return!0===t},isFalse:function(e,t){return!1===t},isNumeric:function(e,t){return"number"==typeof t||o.matchRegexp(e,t,/^[-+]?(?:\d*[.])?\d+$/)},isAlpha:function(e,t){return o.matchRegexp(e,t,/^[A-Z]+$/i)},isAlphanumeric:function(e,t){return o.matchRegexp(e,t,/^[0-9A-Z]+$/i)},isInt:function(e,t){return o.matchRegexp(e,t,/^(?:[-+]?(?:0|[1-9]\d*))$/)},isFloat:function(e,t){return o.matchRegexp(e,t,/^(?:[-+]?(?:\d+))?(?:\.\d*)?(?:[eE][+-]?(?:\d+))?$/)},isWords:function(e,t){return o.matchRegexp(e,t,/^[A-Z\s]+$/i)},isSpecialWords:function(e,t){return o.matchRegexp(e,t,/^[A-Z\s\u00C0-\u017F]+$/i)},isLength:function(e,t,r){return!n(t)||i(t)||t.length===r},equals:function(e,t,r){return!n(t)||i(t)||t===r},equalsField:function(e,t,r){return t===e[r]},maxLength:function(e,t,r){return!n(t)||t.length<=r},minLength:function(e,t,r){return!n(t)||i(t)||t.length>=r}};t.default=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.propTypes=void 0;var u=Object.assign||function(e){for(var t=1;t1)throw new Error("Formsy does not support multiple args on string validations. Use object format of validations instead.");var i=Object.assign({},e);return i[n]=!r.length||r[0],i},{}):e||{}},v={innerRef:f.default.func,name:f.default.string.isRequired,required:f.default.oneOfType([f.default.bool,f.default.object,f.default.string]),validations:f.default.oneOfType([f.default.object,f.default.string]),value:f.default.any};t.propTypes=v,t.default=function(e){var t=function(t){function r(e){i(this,r);var t=o(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e));return t.getErrorMessage=function(){var e=t.getErrorMessages();return e.length?e[0]:null},t.getErrorMessages=function(){return!t.isValid()||t.showRequired()?t.state.externalError||t.state.validationError||[]:[]},t.getValue=function(){return t.state.value},t.setValidations=function(e,r){t.validations=h(e)||{},t.requiredValidations=!0===r?{isDefaultRequiredValue:!0}:h(r)},t.setValue=function(e){arguments.length>1&&void 0!==arguments[1]&&!arguments[1]?t.setState({value:e}):t.setState({value:e,isPristine:!1},function(){t.context.formsy.validate(t)})},t.hasValue=function(){return""!==t.state.value},t.isFormDisabled=function(){return t.context.formsy.isFormDisabled()},t.isFormSubmitted=function(){return t.state.formSubmitted},t.isPristine=function(){return t.state.isPristine},t.isRequired=function(){return!!t.props.required},t.isValid=function(){return t.state.isValid},t.isValidValue=function(e){return t.context.formsy.isValidValue.call(null,t,e)},t.resetValue=function(){t.setState({value:t.state.pristineValue,isPristine:!0},function(){t.context.formsy.validate(t)})},t.showError=function(){return!t.showRequired()&&!t.isValid()},t.showRequired=function(){return t.state.isRequired},t.state={value:e.value,isRequired:!1,isValid:!0,isPristine:!0,pristineValue:e.value,validationError:[],externalError:null,formSubmitted:!1},t}return a(r,t),s(r,[{key:"componentWillMount",value:function(){var e=this;if(!this.props.name)throw new Error("Form Input requires a name property when used");!function(){e.setValidations(e.props.validations,e.props.required),e.context.formsy.attachToForm(e)}()}},{key:"componentWillReceiveProps",value:function(e){this.setValidations(e.validations,e.required)}},{key:"componentDidUpdate",value:function(e){m.default.isSame(this.props.value,e.value)||this.setValue(this.props.value),m.default.isSame(this.props.validations,e.validations)&&m.default.isSame(this.props.required,e.required)||this.context.formsy.validate(this)}},{key:"componentWillUnmount",value:function(){this.context.formsy.detachFromForm(this)}},{key:"render",value:function(){var t=this.props.innerRef,r=u({},this.props,{errorMessage:this.getErrorMessage(),errorMessages:this.getErrorMessages(),hasValue:this.hasValue(),isFormDisabled:this.isFormDisabled(),isFormSubmitted:this.isFormSubmitted(),isPristine:this.isPristine(),isRequired:this.isRequired(),isValid:this.isValid(),isValidValue:this.isValidValue,resetValue:this.resetValue,setValidations:this.setValidations,setValue:this.setValue,showError:this.showError(),showRequired:this.showRequired(),value:this.getValue()});return t&&(r.ref=t),d.default.createElement(e,r)}}]),r}(d.default.Component);return t.displayName="Formsy("+function(e){return e.displayName||e.name||("string"==typeof e?e:"Component")}(e)+")",t.contextTypes={formsy:f.default.object},t.defaultProps={innerRef:function(){},required:!1,validationError:"",validationErrors:{},validations:null,value:e.defaultValue},t.propTypes=v,t}}])}); //# sourceMappingURL=formsy-react.js.map \ No newline at end of file diff --git a/release/formsy-react.js.map b/release/formsy-react.js.map index ef7ec871..5d96c302 100644 --- a/release/formsy-react.js.map +++ b/release/formsy-react.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///formsy-react.js","webpack:///webpack/bootstrap 188674a4bc655818ba08","webpack:///./node_modules/prop-types/index.js","webpack:///external {\"root\":\"React\",\"commonjs2\":\"react\",\"commonjs\":\"react\",\"amd\":\"react\",\"umd\":\"react\"}","webpack:///./src/utils.js","webpack:///./src/index.js","webpack:///./node_modules/form-data-to-object/index.js","webpack:///./node_modules/prop-types/factoryWithThrowingShims.js","webpack:///./node_modules/fbjs/lib/emptyFunction.js","webpack:///./node_modules/fbjs/lib/invariant.js","webpack:///./node_modules/prop-types/lib/ReactPropTypesSecret.js","webpack:///./src/validationRules.js","webpack:///./src/Wrapper.js"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_1__","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","value","_typeof","Symbol","iterator","obj","constructor","default","arraysDiffer","a","b","_this","isDifferent","length","forEach","item","index","isSame","objectsDiffer","_this2","keys","key","Array","isArray","toString","find","collection","fn","runRules","currentValues","validations","validationRules","results","errors","failed","success","validationMethod","Error","validation","push","_interopRequireDefault","_objectWithoutProperties","target","indexOf","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","writable","setPrototypeOf","__proto__","Wrapper","withFormsy","propTypes","addValidationRule","undefined","_extends","assign","arguments","source","_formDataToObject","_formDataToObject2","_propTypes","_propTypes2","_react","_react2","_utils","_utils2","_validationRules","_validationRules2","_Wrapper","_Wrapper2","Formsy","_React$Component","props","getPrototypeOf","getChildContext","formsy","attachToForm","detachFromForm","validate","isFormDisabled","isValidValue","component","runValidation","isValid","componentDidMount","validateForm","componentWillUpdate","prevInputNames","inputs","map","componentDidUpdate","validationErrors","setInputValidationErrors","newInputNames","getCurrentValues","reduce","data","dataCopy","state","getModel","mapModel","getPristineValues","setFormPristine","isPristine","setState","formSubmitted","args","validationError","apply","disabled","model","mapping","toObj","mappedModel","keyArray","split","base","currentKey","shift","reset","resetModel","resetInternal","event","preventDefault","onReset","setValue","resetValue","_component$props","validationResults","requiredResults","requiredValidations","isRequired","error","filter","x","pos","arr","componentPos","slice","concat","isChanged","submit","onSubmit","updateInputsWithError","onValidSubmit","onInvalidSubmit","input","JSON","stringify","preventExternalInvalidation","externalError","canChange","onChange","onValidationComplete","allIsValid","every","onValid","onInvalid","render","_this$props","nonFormsyProps","getErrorMessage","getErrorMessages","getValue","hasValue","isFormSubmitted","setValidations","showError","showRequired","createElement","children","isSubmitting","Component","displayName","defaultProps","onError","node","bool","func","childContextTypes","didWarnAboutWrapperDeprecation","deprecatedWrapper","console","warn","output","parentKey","match","paths","replace","currentPath","pathKey","isNaN","fromObj","recur","newObj","propName","currVal","v","emptyFunction","invariant","ReactPropTypesSecret","shim","componentName","location","propFullName","secret","getShim","ReactPropTypes","array","number","string","symbol","any","arrayOf","element","instanceOf","objectOf","oneOf","oneOfType","shape","exact","checkPropTypes","PropTypes","makeEmptyFunction","arg","thatReturns","thatReturnsFalse","thatReturnsTrue","thatReturnsNull","thatReturnsThis","thatReturnsArgument","condition","format","e","f","validateFormat","argIndex","framesToPop","isExisty","isEmpty","isDefaultRequiredValue","values","matchRegexp","regexp","test","isUndefined","isEmptyString","isEmail","isUrl","isTrue","isFalse","isNumeric","isAlpha","isAlphanumeric","isInt","isFloat","isWords","isSpecialWords","isLength","equals","eql","equalsField","field","maxLength","minLength","_createClass","defineProperties","descriptor","protoProps","staticProps","convertValidationsToObject","validationsAccumulator","validateMethod","parse","validationsAccumulatorCopy","innerRef","required","WrappedComponent","messages","context","pristineValue","nextProps","prevProps","propsForElement","ref","contextTypes","defaultValue"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,Q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T,EAAiBlO,UAAYA,EAEtBkO","file":"formsy-react.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Formsy\"] = factory(require(\"react\"));\n\telse\n\t\troot[\"Formsy\"] = factory(root[\"React\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Formsy\"] = factory(require(\"react\"));\n\telse\n\t\troot[\"Formsy\"] = factory(root[\"React\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 3);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (false) {\n var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&\n Symbol.for &&\n Symbol.for('react.element')) ||\n 0xeac7;\n\n var isValidElement = function(object) {\n return typeof object === 'object' &&\n object !== null &&\n object.$$typeof === REACT_ELEMENT_TYPE;\n };\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = __webpack_require__(5)();\n}\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.default = {\n arraysDiffer: function arraysDiffer(a, b) {\n var _this = this;\n\n var isDifferent = false;\n if (a.length !== b.length) {\n isDifferent = true;\n } else {\n a.forEach(function (item, index) {\n if (!_this.isSame(item, b[index])) {\n isDifferent = true;\n }\n }, this);\n }\n return isDifferent;\n },\n objectsDiffer: function objectsDiffer(a, b) {\n var _this2 = this;\n\n var isDifferent = false;\n if (Object.keys(a).length !== Object.keys(b).length) {\n isDifferent = true;\n } else {\n Object.keys(a).forEach(function (key) {\n if (!_this2.isSame(a[key], b[key])) {\n isDifferent = true;\n }\n }, this);\n }\n return isDifferent;\n },\n isSame: function isSame(a, b) {\n if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) !== (typeof b === 'undefined' ? 'undefined' : _typeof(b))) {\n return false;\n } else if (Array.isArray(a) && Array.isArray(b)) {\n return !this.arraysDiffer(a, b);\n } else if (typeof a === 'function') {\n return a.toString() === b.toString();\n } else if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) === 'object' && a !== null && b !== null) {\n return !this.objectsDiffer(a, b);\n }\n\n return a === b;\n },\n find: function find(collection, fn) {\n for (var i = 0, l = collection.length; i < l; i += 1) {\n var item = collection[i];\n if (fn(item)) {\n return item;\n }\n }\n return null;\n },\n runRules: function runRules(value, currentValues, validations, validationRules) {\n var results = {\n errors: [],\n failed: [],\n success: []\n };\n\n if (Object.keys(validations).length) {\n Object.keys(validations).forEach(function (validationMethod) {\n if (validationRules[validationMethod] && typeof validations[validationMethod] === 'function') {\n throw new Error('Formsy does not allow you to override default validations: ' + validationMethod);\n }\n\n if (!validationRules[validationMethod] && typeof validations[validationMethod] !== 'function') {\n throw new Error('Formsy does not have the validation rule: ' + validationMethod);\n }\n\n if (typeof validations[validationMethod] === 'function') {\n var validation = validations[validationMethod](currentValues, value);\n if (typeof validation === 'string') {\n results.errors.push(validation);\n results.failed.push(validationMethod);\n } else if (!validation) {\n results.failed.push(validationMethod);\n }\n return;\n } else if (typeof validations[validationMethod] !== 'function') {\n var _validation = validationRules[validationMethod](currentValues, value, validations[validationMethod]);\n\n if (typeof _validation === 'string') {\n results.errors.push(_validation);\n results.failed.push(validationMethod);\n } else if (!_validation) {\n results.failed.push(validationMethod);\n } else {\n results.success.push(validationMethod);\n }\n return;\n }\n\n results.success.push(validationMethod);\n });\n }\n\n return results;\n }\n};\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Wrapper = exports.withFormsy = exports.validationRules = exports.propTypes = exports.addValidationRule = undefined;\n\nvar _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; };\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _formDataToObject = __webpack_require__(4);\n\nvar _formDataToObject2 = _interopRequireDefault(_formDataToObject);\n\nvar _propTypes = __webpack_require__(0);\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _react = __webpack_require__(1);\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _utils = __webpack_require__(2);\n\nvar _utils2 = _interopRequireDefault(_utils);\n\nvar _validationRules = __webpack_require__(9);\n\nvar _validationRules2 = _interopRequireDefault(_validationRules);\n\nvar _Wrapper = __webpack_require__(10);\n\nvar _Wrapper2 = _interopRequireDefault(_Wrapper);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _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; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/* eslint-disable react/no-unused-state, react/default-props-match-prop-types */\n\nvar Formsy = function (_React$Component) {\n _inherits(Formsy, _React$Component);\n\n function Formsy(props) {\n _classCallCheck(this, Formsy);\n\n var _this = _possibleConstructorReturn(this, (Formsy.__proto__ || Object.getPrototypeOf(Formsy)).call(this, props));\n\n _this.getChildContext = function () {\n return {\n formsy: {\n attachToForm: _this.attachToForm,\n detachFromForm: _this.detachFromForm,\n validate: _this.validate,\n isFormDisabled: _this.isFormDisabled,\n isValidValue: function isValidValue(component, value) {\n return _this.runValidation(component, value).isValid;\n }\n }\n };\n };\n\n _this.componentDidMount = function () {\n _this.validateForm();\n };\n\n _this.componentWillUpdate = function () {\n // Keep a reference to input names before form updates,\n // to check if inputs has changed after render\n _this.prevInputNames = _this.inputs.map(function (component) {\n return component.props.name;\n });\n };\n\n _this.componentDidUpdate = function () {\n if (_this.props.validationErrors && _typeof(_this.props.validationErrors) === 'object' && Object.keys(_this.props.validationErrors).length > 0) {\n _this.setInputValidationErrors(_this.props.validationErrors);\n }\n\n var newInputNames = _this.inputs.map(function (component) {\n return component.props.name;\n });\n if (_utils2.default.arraysDiffer(_this.prevInputNames, newInputNames)) {\n _this.validateForm();\n }\n };\n\n _this.getCurrentValues = function () {\n return _this.inputs.reduce(function (data, component) {\n var name = component.props.name;\n\n var dataCopy = Object.assign({}, data); // avoid param reassignment\n dataCopy[name] = component.state.value;\n return dataCopy;\n }, {});\n };\n\n _this.getModel = function () {\n var currentValues = _this.getCurrentValues();\n return _this.mapModel(currentValues);\n };\n\n _this.getPristineValues = function () {\n return _this.inputs.reduce(function (data, component) {\n var name = component.props.name;\n\n var dataCopy = Object.assign({}, data); // avoid param reassignment\n dataCopy[name] = component.props.value;\n return dataCopy;\n }, {});\n };\n\n _this.setFormPristine = function (isPristine) {\n _this.setState({\n formSubmitted: !isPristine\n });\n\n // Iterate through each component and set it as pristine\n // or \"dirty\".\n _this.inputs.forEach(function (component) {\n component.setState({\n formSubmitted: !isPristine,\n isPristine: isPristine\n });\n });\n };\n\n _this.setInputValidationErrors = function (errors) {\n _this.inputs.forEach(function (component) {\n var name = component.props.name;\n\n var args = [{\n isValid: !(name in errors),\n validationError: typeof errors[name] === 'string' ? [errors[name]] : errors[name]\n }];\n component.setState.apply(component, args);\n });\n };\n\n _this.isFormDisabled = function () {\n return _this.props.disabled;\n };\n\n _this.mapModel = function (model) {\n if (_this.props.mapping) {\n return _this.props.mapping(model);\n }\n\n return _formDataToObject2.default.toObj(Object.keys(model).reduce(function (mappedModel, key) {\n var keyArray = key.split('.');\n var base = mappedModel;\n while (keyArray.length) {\n var currentKey = keyArray.shift();\n base[currentKey] = keyArray.length ? base[currentKey] || {} : model[key];\n base = base[currentKey];\n }\n return mappedModel;\n }, {}));\n };\n\n _this.reset = function (data) {\n _this.setFormPristine(true);\n _this.resetModel(data);\n };\n\n _this.resetInternal = function (event) {\n event.preventDefault();\n _this.reset();\n if (_this.props.onReset) {\n _this.props.onReset();\n }\n };\n\n _this.resetModel = function (data) {\n _this.inputs.forEach(function (component) {\n var name = component.props.name;\n\n if (data && Object.prototype.hasOwnProperty.call(data, name)) {\n component.setValue(data[name]);\n } else {\n component.resetValue();\n }\n });\n _this.validateForm();\n };\n\n _this.runValidation = function (component) {\n var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : component.state.value;\n\n var currentValues = _this.getCurrentValues();\n var _component$props = component.props,\n validationError = _component$props.validationError,\n validationErrors = _component$props.validationErrors;\n\n\n var validationResults = _utils2.default.runRules(value, currentValues, component.validations, _validationRules2.default);\n\n var requiredResults = _utils2.default.runRules(value, currentValues, component.requiredValidations, _validationRules2.default);\n\n var isRequired = Object.keys(component.requiredValidations).length ? !!requiredResults.success.length : false;\n var isValid = !validationResults.failed.length && !(_this.props.validationErrors && _this.props.validationErrors[component.props.name]);\n\n return {\n isRequired: isRequired,\n isValid: isRequired ? false : isValid,\n error: function () {\n if (isValid && !isRequired) {\n return [];\n }\n\n if (validationResults.errors.length) {\n return validationResults.errors;\n }\n\n if (_this.props.validationErrors && _this.props.validationErrors[component.props.name]) {\n return typeof _this.props.validationErrors[component.props.name] === 'string' ? [_this.props.validationErrors[component.props.name]] : _this.props.validationErrors[component.props.name];\n }\n\n if (isRequired) {\n var error = validationErrors[requiredResults.success[0]];\n return error ? [error] : null;\n }\n\n if (validationResults.failed.length) {\n return validationResults.failed.map(function (failed) {\n return validationErrors[failed] ? validationErrors[failed] : validationError;\n }).filter(function (x, pos, arr) {\n return arr.indexOf(x) === pos;\n }); // remove duplicates\n }\n\n return undefined;\n }()\n };\n };\n\n _this.attachToForm = function (component) {\n if (_this.inputs.indexOf(component) === -1) {\n _this.inputs.push(component);\n }\n\n _this.validate(component);\n };\n\n _this.detachFromForm = function (component) {\n var componentPos = _this.inputs.indexOf(component);\n\n if (componentPos !== -1) {\n _this.inputs = _this.inputs.slice(0, componentPos).concat(_this.inputs.slice(componentPos + 1));\n }\n\n _this.validateForm();\n };\n\n _this.isChanged = function () {\n return !_utils2.default.isSame(_this.getPristineValues(), _this.getCurrentValues());\n };\n\n _this.submit = function (event) {\n if (event && event.preventDefault) {\n event.preventDefault();\n }\n\n // Trigger form as not pristine.\n // If any inputs have not been touched yet this will make them dirty\n // so validation becomes visible (if based on isPristine)\n _this.setFormPristine(false);\n var model = _this.getModel();\n _this.props.onSubmit(model, _this.resetModel, _this.updateInputsWithError);\n if (_this.state.isValid) {\n _this.props.onValidSubmit(model, _this.resetModel, _this.updateInputsWithError);\n } else {\n _this.props.onInvalidSubmit(model, _this.resetModel, _this.updateInputsWithError);\n }\n };\n\n _this.updateInputsWithError = function (errors) {\n Object.keys(errors).forEach(function (name) {\n var component = _utils2.default.find(_this.inputs, function (input) {\n return input.props.name === name;\n });\n if (!component) {\n throw new Error('You are trying to update an input that does not exist. Verify errors object with input names. ' + JSON.stringify(errors));\n }\n var args = [{\n isValid: _this.props.preventExternalInvalidation,\n externalError: typeof errors[name] === 'string' ? [errors[name]] : errors[name]\n }];\n component.setState.apply(component, args);\n });\n };\n\n _this.validate = function (component) {\n // Trigger onChange\n if (_this.state.canChange) {\n _this.props.onChange(_this.getModel(), _this.isChanged());\n }\n\n var validation = _this.runValidation(component);\n // Run through the validations, split them up and call\n // the validator IF there is a value or it is required\n component.setState({\n isValid: validation.isValid,\n isRequired: validation.isRequired,\n validationError: validation.error,\n externalError: null\n }, _this.validateForm);\n };\n\n _this.validateForm = function () {\n // We need a callback as we are validating all inputs again. This will\n // run when the last component has set its state\n var onValidationComplete = function onValidationComplete() {\n var allIsValid = _this.inputs.every(function (component) {\n return component.state.isValid;\n });\n\n _this.setState({\n isValid: allIsValid\n });\n\n if (allIsValid) {\n _this.props.onValid();\n } else {\n _this.props.onInvalid();\n }\n\n // Tell the form that it can start to trigger change events\n _this.setState({\n canChange: true\n });\n };\n\n // Run validation again in case affected by other inputs. The\n // last component validated will run the onValidationComplete callback\n _this.inputs.forEach(function (component, index) {\n var validation = _this.runValidation(component);\n if (validation.isValid && component.state.externalError) {\n validation.isValid = false;\n }\n component.setState({\n isValid: validation.isValid,\n isRequired: validation.isRequired,\n validationError: validation.error,\n externalError: !validation.isValid && component.state.externalError ? component.state.externalError : null\n }, index === _this.inputs.length - 1 ? onValidationComplete : null);\n });\n\n // If there are no inputs, set state where form is ready to trigger\n // change event. New inputs might be added later\n if (!_this.inputs.length) {\n _this.setState({\n canChange: true\n });\n }\n };\n\n _this.render = function () {\n var _this$props = _this.props,\n getErrorMessage = _this$props.getErrorMessage,\n getErrorMessages = _this$props.getErrorMessages,\n getValue = _this$props.getValue,\n hasValue = _this$props.hasValue,\n isFormDisabled = _this$props.isFormDisabled,\n isFormSubmitted = _this$props.isFormSubmitted,\n isPristine = _this$props.isPristine,\n isRequired = _this$props.isRequired,\n isValid = _this$props.isValid,\n isValidValue = _this$props.isValidValue,\n mapping = _this$props.mapping,\n onChange = _this$props.onChange,\n onInvalidSubmit = _this$props.onInvalidSubmit,\n onInvalid = _this$props.onInvalid,\n onReset = _this$props.onReset,\n onSubmit = _this$props.onSubmit,\n onValid = _this$props.onValid,\n onValidSubmit = _this$props.onValidSubmit,\n preventExternalInvalidation = _this$props.preventExternalInvalidation,\n resetValue = _this$props.resetValue,\n setValidations = _this$props.setValidations,\n setValue = _this$props.setValue,\n showError = _this$props.showError,\n showRequired = _this$props.showRequired,\n validationErrors = _this$props.validationErrors,\n nonFormsyProps = _objectWithoutProperties(_this$props, ['getErrorMessage', 'getErrorMessages', 'getValue', 'hasValue', 'isFormDisabled', 'isFormSubmitted', 'isPristine', 'isRequired', 'isValid', 'isValidValue', 'mapping', 'onChange', 'onInvalidSubmit', 'onInvalid', 'onReset', 'onSubmit', 'onValid', 'onValidSubmit', 'preventExternalInvalidation', 'resetValue', 'setValidations', 'setValue', 'showError', 'showRequired', 'validationErrors']);\n\n return _react2.default.createElement('form', _extends({\n onReset: _this.resetInternal,\n onSubmit: _this.submit\n }, nonFormsyProps, {\n disabled: false\n }), _this.props.children);\n };\n\n _this.state = {\n isValid: true,\n isSubmitting: false,\n canChange: false\n };\n _this.inputs = [];\n return _this;\n }\n\n // Reset each key in the model to the original / initial / specified value\n\n\n // Checks validation on current value or a passed value\n\n\n // Method put on each input component to register\n // itself to the form\n\n\n // Method put on each input component to unregister\n // itself from the form\n\n\n // Checks if the values have changed from their initial value\n\n\n // Update model, submit to url prop and send the model\n\n\n // Go through errors from server and grab the components\n // stored in the inputs map. Change their state to invalid\n // and set the serverError message\n\n\n // Use the binded values and the actual input value to\n // validate the input and set its state. Then check the\n // state of the form itself\n\n\n // Validate the form by going through all child input components\n // and check their state\n\n\n return Formsy;\n}(_react2.default.Component);\n\nFormsy.displayName = 'Formsy';\n\nFormsy.defaultProps = {\n children: null,\n disabled: false,\n getErrorMessage: function getErrorMessage() {},\n getErrorMessages: function getErrorMessages() {},\n getValue: function getValue() {},\n hasValue: function hasValue() {},\n isFormDisabled: function isFormDisabled() {},\n isFormSubmitted: function isFormSubmitted() {},\n isPristine: function isPristine() {},\n isRequired: function isRequired() {},\n isValid: function isValid() {},\n isValidValue: function isValidValue() {},\n mapping: null,\n onChange: function onChange() {},\n onError: function onError() {},\n onInvalid: function onInvalid() {},\n onInvalidSubmit: function onInvalidSubmit() {},\n onReset: function onReset() {},\n onSubmit: function onSubmit() {},\n onValid: function onValid() {},\n onValidSubmit: function onValidSubmit() {},\n preventExternalInvalidation: false,\n resetValue: function resetValue() {},\n setValidations: function setValidations() {},\n setValue: function setValue() {},\n showError: function showError() {},\n showRequired: function showRequired() {},\n validationErrors: null\n};\n\nFormsy.propTypes = {\n children: _propTypes2.default.node,\n disabled: _propTypes2.default.bool,\n getErrorMessage: _propTypes2.default.func,\n getErrorMessages: _propTypes2.default.func,\n getValue: _propTypes2.default.func,\n hasValue: _propTypes2.default.func,\n isFormDisabled: _propTypes2.default.func,\n isFormSubmitted: _propTypes2.default.func,\n isPristine: _propTypes2.default.func,\n isRequired: _propTypes2.default.func,\n isValid: _propTypes2.default.func,\n isValidValue: _propTypes2.default.func,\n mapping: _propTypes2.default.func,\n onChange: _propTypes2.default.func,\n onInvalid: _propTypes2.default.func,\n onInvalidSubmit: _propTypes2.default.func,\n onReset: _propTypes2.default.func,\n onSubmit: _propTypes2.default.func,\n onValid: _propTypes2.default.func,\n onValidSubmit: _propTypes2.default.func,\n preventExternalInvalidation: _propTypes2.default.bool,\n resetValue: _propTypes2.default.func,\n setValidations: _propTypes2.default.func,\n setValue: _propTypes2.default.func,\n showError: _propTypes2.default.func,\n showRequired: _propTypes2.default.func,\n validationErrors: _propTypes2.default.object // eslint-disable-line\n};\n\nFormsy.childContextTypes = {\n formsy: _propTypes2.default.object\n};\n\nvar addValidationRule = function addValidationRule(name, func) {\n _validationRules2.default[name] = func;\n};\n\nvar withFormsy = _Wrapper2.default;\n\nvar didWarnAboutWrapperDeprecation = false;\n\nvar deprecatedWrapper = function deprecatedWrapper(Component) {\n if (!didWarnAboutWrapperDeprecation) {\n // eslint-disable-next-line no-console\n console.warn('Wrapper has been renamed to withFormsy. Importing Wrapper from formsy-react is depreacted and will be removed in the future. Please rename your Wrapper imports to withFormsy.');\n didWarnAboutWrapperDeprecation = true;\n }\n\n return withFormsy(Component);\n};\n\nexports.addValidationRule = addValidationRule;\nexports.propTypes = _Wrapper.propTypes;\nexports.validationRules = _validationRules2.default;\nexports.withFormsy = withFormsy;\nexports.Wrapper = deprecatedWrapper;\nexports.default = Formsy;\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports) {\n\nfunction toObj(source) {\n return Object.keys(source).reduce(function (output, key) {\n var parentKey = key.match(/[^\\[]*/i);\n var paths = key.match(/\\[.*?\\]/g) || [];\n paths = [parentKey[0]].concat(paths).map(function (key) {\n return key.replace(/\\[|\\]/g, '');\n });\n var currentPath = output;\n while (paths.length) {\n var pathKey = paths.shift();\n\n if (pathKey in currentPath) {\n currentPath = currentPath[pathKey];\n } else {\n currentPath[pathKey] = paths.length ? isNaN(paths[0]) ? {} : [] : source[key];\n currentPath = currentPath[pathKey];\n }\n }\n\n return output;\n }, {});\n}\n\nfunction fromObj(obj) {\n function recur(newObj, propName, currVal) {\n if (Array.isArray(currVal) || Object.prototype.toString.call(currVal) === '[object Object]') {\n Object.keys(currVal).forEach(function(v) {\n recur(newObj, propName + \"[\" + v + \"]\", currVal[v]);\n });\n return newObj;\n }\n\n newObj[propName] = currVal;\n return newObj;\n }\n\n var keys = Object.keys(obj);\n return keys.reduce(function(newObj, propName) {\n return recur(newObj, propName, obj[propName]);\n }, {});\n}\n\nmodule.exports = {\n fromObj: fromObj,\n toObj: toObj\n}\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\n\nvar emptyFunction = __webpack_require__(6);\nvar invariant = __webpack_require__(7);\nvar ReactPropTypesSecret = __webpack_require__(8);\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n invariant(\n false,\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim\n };\n\n ReactPropTypes.checkPropTypes = emptyFunction;\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nfunction makeEmptyFunction(arg) {\n return function () {\n return arg;\n };\n}\n\n/**\n * This function accepts and discards inputs; it has no side effects. This is\n * primarily useful idiomatically for overridable function endpoints which\n * always need to be callable, since JS lacks a null-call idiom ala Cocoa.\n */\nvar emptyFunction = function emptyFunction() {};\n\nemptyFunction.thatReturns = makeEmptyFunction;\nemptyFunction.thatReturnsFalse = makeEmptyFunction(false);\nemptyFunction.thatReturnsTrue = makeEmptyFunction(true);\nemptyFunction.thatReturnsNull = makeEmptyFunction(null);\nemptyFunction.thatReturnsThis = function () {\n return this;\n};\nemptyFunction.thatReturnsArgument = function (arg) {\n return arg;\n};\n\nmodule.exports = emptyFunction;\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar validateFormat = function validateFormat(format) {};\n\nif (false) {\n validateFormat = function validateFormat(format) {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n };\n}\n\nfunction invariant(condition, format, a, b, c, d, e, f) {\n validateFormat(format);\n\n if (!condition) {\n var error;\n if (format === undefined) {\n error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n error = new Error(format.replace(/%s/g, function () {\n return args[argIndex++];\n }));\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n}\n\nmodule.exports = invariant;\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar _isExisty = function _isExisty(value) {\n return value !== null && value !== undefined;\n};\nvar isEmpty = function isEmpty(value) {\n return value === '';\n};\n\nvar validations = {\n isDefaultRequiredValue: function isDefaultRequiredValue(values, value) {\n return value === undefined || value === null || value === '';\n },\n isExisty: function isExisty(values, value) {\n return _isExisty(value);\n },\n matchRegexp: function matchRegexp(values, value, regexp) {\n return !_isExisty(value) || isEmpty(value) || regexp.test(value);\n },\n isUndefined: function isUndefined(values, value) {\n return value === undefined;\n },\n isEmptyString: function isEmptyString(values, value) {\n return isEmpty(value);\n },\n isEmail: function isEmail(values, value) {\n // Regex from http://emailregex.com/\n return validations.matchRegexp(values, value, /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/i);\n },\n isUrl: function isUrl(values, value) {\n return validations.matchRegexp(values, value, /^(?:\\w+:)?\\/\\/([^\\s.]+\\.\\S{2}|localhost[:?\\d]*)\\S*$/i);\n },\n isTrue: function isTrue(values, value) {\n return value === true;\n },\n isFalse: function isFalse(values, value) {\n return value === false;\n },\n isNumeric: function isNumeric(values, value) {\n if (typeof value === 'number') {\n return true;\n }\n return validations.matchRegexp(values, value, /^[-+]?(?:\\d*[.])?\\d+$/);\n },\n isAlpha: function isAlpha(values, value) {\n return validations.matchRegexp(values, value, /^[A-Z]+$/i);\n },\n isAlphanumeric: function isAlphanumeric(values, value) {\n return validations.matchRegexp(values, value, /^[0-9A-Z]+$/i);\n },\n isInt: function isInt(values, value) {\n return validations.matchRegexp(values, value, /^(?:[-+]?(?:0|[1-9]\\d*))$/);\n },\n isFloat: function isFloat(values, value) {\n return validations.matchRegexp(values, value, /^(?:[-+]?(?:\\d+))?(?:\\.\\d*)?(?:[eE][+-]?(?:\\d+))?$/);\n },\n isWords: function isWords(values, value) {\n return validations.matchRegexp(values, value, /^[A-Z\\s]+$/i);\n },\n isSpecialWords: function isSpecialWords(values, value) {\n return validations.matchRegexp(values, value, /^[A-Z\\s\\u00C0-\\u017F]+$/i);\n },\n isLength: function isLength(values, value, length) {\n return !_isExisty(value) || isEmpty(value) || value.length === length;\n },\n equals: function equals(values, value, eql) {\n return !_isExisty(value) || isEmpty(value) || value === eql;\n },\n equalsField: function equalsField(values, value, field) {\n return value === values[field];\n },\n maxLength: function maxLength(values, value, length) {\n return !_isExisty(value) || value.length <= length;\n },\n minLength: function minLength(values, value, length) {\n return !_isExisty(value) || isEmpty(value) || value.length >= length;\n }\n};\n\nexports.default = validations;\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.propTypes = undefined;\n\nvar _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; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _propTypes = __webpack_require__(0);\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _react = __webpack_require__(1);\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _utils = __webpack_require__(2);\n\nvar _utils2 = _interopRequireDefault(_utils);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/* eslint-disable react/default-props-match-prop-types */\n\nvar convertValidationsToObject = function convertValidationsToObject(validations) {\n if (typeof validations === 'string') {\n return validations.split(/,(?![^{[]*[}\\]])/g).reduce(function (validationsAccumulator, validation) {\n var args = validation.split(':');\n var validateMethod = args.shift();\n\n args = args.map(function (arg) {\n try {\n return JSON.parse(arg);\n } catch (e) {\n return arg; // It is a string if it can not parse it\n }\n });\n\n if (args.length > 1) {\n throw new Error('Formsy does not support multiple args on string validations. Use object format of validations instead.');\n }\n\n // Avoid parameter reassignment\n var validationsAccumulatorCopy = Object.assign({}, validationsAccumulator);\n validationsAccumulatorCopy[validateMethod] = args.length ? args[0] : true;\n return validationsAccumulatorCopy;\n }, {});\n }\n\n return validations || {};\n};\n\nvar propTypes = {\n innerRef: _propTypes2.default.func,\n name: _propTypes2.default.string.isRequired,\n required: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.object, _propTypes2.default.string]),\n validations: _propTypes2.default.oneOfType([_propTypes2.default.object, _propTypes2.default.string]),\n value: _propTypes2.default.any // eslint-disable-line react/forbid-prop-types\n};\n\nexports.propTypes = propTypes;\n\nexports.default = function (Component) {\n var WrappedComponent = function (_React$Component) {\n _inherits(WrappedComponent, _React$Component);\n\n function WrappedComponent(props) {\n _classCallCheck(this, WrappedComponent);\n\n var _this = _possibleConstructorReturn(this, (WrappedComponent.__proto__ || Object.getPrototypeOf(WrappedComponent)).call(this, props));\n\n _this.getErrorMessage = function () {\n var messages = _this.getErrorMessages();\n return messages.length ? messages[0] : null;\n };\n\n _this.getErrorMessages = function () {\n if (!_this.isValid() || _this.showRequired()) {\n return _this.state.externalError || _this.state.validationError || [];\n }\n return [];\n };\n\n _this.getValue = function () {\n return _this.state.value;\n };\n\n _this.setValidations = function (validations, required) {\n // Add validations to the store itself as the props object can not be modified\n _this.validations = convertValidationsToObject(validations) || {};\n _this.requiredValidations = required === true ? { isDefaultRequiredValue: true } : convertValidationsToObject(required);\n };\n\n _this.setValue = function (value) {\n var validate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n if (!validate) {\n _this.setState({\n value: value\n });\n } else {\n _this.setState({\n value: value,\n isPristine: false\n }, function () {\n _this.context.formsy.validate(_this);\n });\n }\n };\n\n _this.hasValue = function () {\n return _this.state.value !== '';\n };\n\n _this.isFormDisabled = function () {\n return _this.context.formsy.isFormDisabled();\n };\n\n _this.isFormSubmitted = function () {\n return _this.state.formSubmitted;\n };\n\n _this.isPristine = function () {\n return _this.state.isPristine;\n };\n\n _this.isRequired = function () {\n return !!_this.props.required;\n };\n\n _this.isValid = function () {\n return _this.state.isValid;\n };\n\n _this.isValidValue = function (value) {\n return _this.context.formsy.isValidValue.call(null, _this, value);\n };\n\n _this.resetValue = function () {\n _this.setState({\n value: _this.state.pristineValue,\n isPristine: true\n }, function () {\n _this.context.formsy.validate(_this);\n });\n };\n\n _this.showError = function () {\n return !_this.showRequired() && !_this.isValid();\n };\n\n _this.showRequired = function () {\n return _this.state.isRequired;\n };\n\n _this.state = {\n value: props.value,\n isRequired: false,\n isValid: true,\n isPristine: true,\n pristineValue: props.value,\n validationError: [],\n externalError: null,\n formSubmitted: false\n };\n return _this;\n }\n\n _createClass(WrappedComponent, [{\n key: 'componentWillMount',\n value: function componentWillMount() {\n var _this2 = this;\n\n var configure = function configure() {\n _this2.setValidations(_this2.props.validations, _this2.props.required);\n\n // Pass a function instead?\n _this2.context.formsy.attachToForm(_this2);\n };\n\n if (!this.props.name) {\n throw new Error('Form Input requires a name property when used');\n }\n\n configure();\n }\n\n // We have to make sure the validate method is kept when new props are added\n\n }, {\n key: 'componentWillReceiveProps',\n value: function componentWillReceiveProps(nextProps) {\n this.setValidations(nextProps.validations, nextProps.required);\n }\n }, {\n key: 'componentDidUpdate',\n value: function componentDidUpdate(prevProps) {\n // If the value passed has changed, set it. If value is not passed it will\n // internally update, and this will never run\n if (!_utils2.default.isSame(this.props.value, prevProps.value)) {\n this.setValue(this.props.value);\n }\n\n // If validations or required is changed, run a new validation\n if (!_utils2.default.isSame(this.props.validations, prevProps.validations) || !_utils2.default.isSame(this.props.required, prevProps.required)) {\n this.context.formsy.validate(this);\n }\n }\n\n // Detach it when component unmounts\n\n }, {\n key: 'componentWillUnmount',\n value: function componentWillUnmount() {\n this.context.formsy.detachFromForm(this);\n }\n\n // By default, we validate after the value has been set.\n // A user can override this and pass a second parameter of `false` to skip validation.\n\n }, {\n key: 'render',\n value: function render() {\n var innerRef = this.props.innerRef;\n\n var propsForElement = _extends({\n getErrorMessage: this.getErrorMessage,\n getErrorMessages: this.getErrorMessages,\n getValue: this.getValue,\n hasValue: this.hasValue,\n isFormDisabled: this.isFormDisabled,\n isValid: this.isValid,\n isPristine: this.isPristine,\n isFormSubmitted: this.isFormSubmitted,\n isRequired: this.isRequired,\n isValidValue: this.isValidValue,\n resetValue: this.resetValue,\n setValidations: this.setValidations,\n setValue: this.setValue,\n showRequired: this.showRequired,\n showError: this.showError\n }, this.props);\n\n if (innerRef) {\n propsForElement.ref = innerRef;\n }\n\n return _react2.default.createElement(Component, propsForElement);\n }\n }]);\n\n return WrappedComponent;\n }(_react2.default.Component);\n\n function getDisplayName(component) {\n return component.displayName || component.name || (typeof component === 'string' ? component : 'Component');\n }\n\n WrappedComponent.displayName = 'Formsy(' + getDisplayName(Component) + ')';\n\n WrappedComponent.contextTypes = {\n formsy: _propTypes2.default.object // What about required?\n };\n\n WrappedComponent.defaultProps = {\n innerRef: function innerRef() {},\n required: false,\n validationError: '',\n validationErrors: {},\n validations: null,\n value: Component.defaultValue\n };\n\n WrappedComponent.propTypes = propTypes;\n\n return WrappedComponent;\n};\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// formsy-react.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 188674a4bc655818ba08","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&\n Symbol.for &&\n Symbol.for('react.element')) ||\n 0xeac7;\n\n var isValidElement = function(object) {\n return typeof object === 'object' &&\n object !== null &&\n object.$$typeof === REACT_ELEMENT_TYPE;\n };\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/prop-types/index.js\n// module id = 0\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"root\":\"React\",\"commonjs2\":\"react\",\"commonjs\":\"react\",\"amd\":\"react\",\"umd\":\"react\"}\n// module id = 1\n// module chunks = 0","export default {\n arraysDiffer(a, b) {\n let isDifferent = false;\n if (a.length !== b.length) {\n isDifferent = true;\n } else {\n a.forEach((item, index) => {\n if (!this.isSame(item, b[index])) {\n isDifferent = true;\n }\n }, this);\n }\n return isDifferent;\n },\n\n objectsDiffer(a, b) {\n let isDifferent = false;\n if (Object.keys(a).length !== Object.keys(b).length) {\n isDifferent = true;\n } else {\n Object.keys(a).forEach((key) => {\n if (!this.isSame(a[key], b[key])) {\n isDifferent = true;\n }\n }, this);\n }\n return isDifferent;\n },\n\n isSame(a, b) {\n if (typeof a !== typeof b) {\n return false;\n } else if (Array.isArray(a) && Array.isArray(b)) {\n return !this.arraysDiffer(a, b);\n } else if (typeof a === 'function') {\n return a.toString() === b.toString();\n } else if (typeof a === 'object' && a !== null && b !== null) {\n return !this.objectsDiffer(a, b);\n }\n\n return a === b;\n },\n\n find(collection, fn) {\n for (let i = 0, l = collection.length; i < l; i += 1) {\n const item = collection[i];\n if (fn(item)) {\n return item;\n }\n }\n return null;\n },\n\n runRules(value, currentValues, validations, validationRules) {\n const results = {\n errors: [],\n failed: [],\n success: [],\n };\n\n if (Object.keys(validations).length) {\n Object.keys(validations).forEach((validationMethod) => {\n if (validationRules[validationMethod] && typeof validations[validationMethod] === 'function') {\n throw new Error(`Formsy does not allow you to override default validations: ${validationMethod}`);\n }\n\n if (!validationRules[validationMethod] && typeof validations[validationMethod] !== 'function') {\n throw new Error(`Formsy does not have the validation rule: ${validationMethod}`);\n }\n\n if (typeof validations[validationMethod] === 'function') {\n const validation = validations[validationMethod](currentValues, value);\n if (typeof validation === 'string') {\n results.errors.push(validation);\n results.failed.push(validationMethod);\n } else if (!validation) {\n results.failed.push(validationMethod);\n }\n return;\n } else if (typeof validations[validationMethod] !== 'function') {\n const validation = validationRules[validationMethod](\n currentValues,\n value,\n validations[validationMethod],\n );\n\n if (typeof validation === 'string') {\n results.errors.push(validation);\n results.failed.push(validationMethod);\n } else if (!validation) {\n results.failed.push(validationMethod);\n } else {\n results.success.push(validationMethod);\n }\n return;\n }\n\n results.success.push(validationMethod);\n });\n }\n\n return results;\n },\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/utils.js","import formDataToObject from 'form-data-to-object';\nimport PropTypes from 'prop-types';\nimport React from 'react';\n\nimport utils from './utils';\nimport validationRules from './validationRules';\nimport Wrapper, { propTypes } from './Wrapper';\n\n/* eslint-disable react/no-unused-state, react/default-props-match-prop-types */\n\nclass Formsy extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n isValid: true,\n isSubmitting: false,\n canChange: false,\n };\n this.inputs = [];\n }\n\n getChildContext = () => (\n {\n formsy: {\n attachToForm: this.attachToForm,\n detachFromForm: this.detachFromForm,\n validate: this.validate,\n isFormDisabled: this.isFormDisabled,\n isValidValue: (component, value) => this.runValidation(component, value).isValid,\n },\n }\n )\n\n componentDidMount = () => {\n this.validateForm();\n }\n\n componentWillUpdate = () => {\n // Keep a reference to input names before form updates,\n // to check if inputs has changed after render\n this.prevInputNames = this.inputs.map(component => component.props.name);\n }\n\n componentDidUpdate = () => {\n if (this.props.validationErrors && typeof this.props.validationErrors === 'object' && Object.keys(this.props.validationErrors).length > 0) {\n this.setInputValidationErrors(this.props.validationErrors);\n }\n\n const newInputNames = this.inputs.map(component => component.props.name);\n if (utils.arraysDiffer(this.prevInputNames, newInputNames)) {\n this.validateForm();\n }\n }\n\n getCurrentValues = () => (\n this.inputs.reduce((data, component) => {\n const { name } = component.props;\n const dataCopy = Object.assign({}, data); // avoid param reassignment\n dataCopy[name] = component.state.value;\n return dataCopy;\n }, {})\n )\n\n getModel = () => {\n const currentValues = this.getCurrentValues();\n return this.mapModel(currentValues);\n }\n\n getPristineValues = () => (\n this.inputs.reduce((data, component) => {\n const { name } = component.props;\n const dataCopy = Object.assign({}, data); // avoid param reassignment\n dataCopy[name] = component.props.value;\n return dataCopy;\n }, {})\n )\n\n setFormPristine = (isPristine) => {\n this.setState({\n formSubmitted: !isPristine,\n });\n\n // Iterate through each component and set it as pristine\n // or \"dirty\".\n this.inputs.forEach((component) => {\n component.setState({\n formSubmitted: !isPristine,\n isPristine,\n });\n });\n }\n\n setInputValidationErrors = (errors) => {\n this.inputs.forEach((component) => {\n const { name } = component.props;\n const args = [{\n isValid: !(name in errors),\n validationError: typeof errors[name] === 'string' ? [errors[name]] : errors[name],\n }];\n component.setState(...args);\n });\n }\n\n isFormDisabled = () => this.props.disabled;\n\n mapModel = (model) => {\n if (this.props.mapping) {\n return this.props.mapping(model);\n }\n\n return formDataToObject.toObj(Object.keys(model).reduce((mappedModel, key) => {\n const keyArray = key.split('.');\n let base = mappedModel;\n while (keyArray.length) {\n const currentKey = keyArray.shift();\n base[currentKey] = (keyArray.length ? base[currentKey] || {} : model[key]);\n base = base[currentKey];\n }\n return mappedModel;\n }, {}));\n }\n\n reset = (data) => {\n this.setFormPristine(true);\n this.resetModel(data);\n }\n\n resetInternal = (event) => {\n event.preventDefault();\n this.reset();\n if (this.props.onReset) {\n this.props.onReset();\n }\n }\n\n // Reset each key in the model to the original / initial / specified value\n resetModel = (data) => {\n this.inputs.forEach((component) => {\n const { name } = component.props;\n if (data && Object.prototype.hasOwnProperty.call(data, name)) {\n component.setValue(data[name]);\n } else {\n component.resetValue();\n }\n });\n this.validateForm();\n }\n\n // Checks validation on current value or a passed value\n runValidation = (component, value = component.state.value) => {\n const currentValues = this.getCurrentValues();\n const {\n validationError,\n validationErrors,\n } = component.props;\n\n const validationResults = utils.runRules(\n value,\n currentValues,\n component.validations,\n validationRules,\n );\n\n const requiredResults = utils.runRules(\n value,\n currentValues,\n component.requiredValidations,\n validationRules,\n );\n\n const isRequired = Object.keys(component.requiredValidations).length ?\n !!requiredResults.success.length : false;\n const isValid = !validationResults.failed.length &&\n !(this.props.validationErrors && this.props.validationErrors[component.props.name]);\n\n return {\n isRequired,\n isValid: isRequired ? false : isValid,\n error: (() => {\n if (isValid && !isRequired) {\n return [];\n }\n\n if (validationResults.errors.length) {\n return validationResults.errors;\n }\n\n if (this.props.validationErrors && this.props.validationErrors[component.props.name]) {\n return typeof this.props.validationErrors[component.props.name] === 'string' ? [this.props.validationErrors[component.props.name]] : this.props.validationErrors[component.props.name];\n }\n\n if (isRequired) {\n const error = validationErrors[requiredResults.success[0]];\n return error ? [error] : null;\n }\n\n if (validationResults.failed.length) {\n return validationResults.failed.map(failed =>\n (validationErrors[failed] ? validationErrors[failed] : validationError))\n .filter((x, pos, arr) => arr.indexOf(x) === pos); // remove duplicates\n }\n\n return undefined;\n })(),\n };\n }\n\n // Method put on each input component to register\n // itself to the form\n attachToForm = (component) => {\n if (this.inputs.indexOf(component) === -1) {\n this.inputs.push(component);\n }\n\n this.validate(component);\n }\n\n // Method put on each input component to unregister\n // itself from the form\n detachFromForm = (component) => {\n const componentPos = this.inputs.indexOf(component);\n\n if (componentPos !== -1) {\n this.inputs = this.inputs.slice(0, componentPos).concat(this.inputs.slice(componentPos + 1));\n }\n\n this.validateForm();\n }\n\n // Checks if the values have changed from their initial value\n isChanged = () => !utils.isSame(this.getPristineValues(), this.getCurrentValues());\n\n // Update model, submit to url prop and send the model\n submit = (event) => {\n if (event && event.preventDefault) {\n event.preventDefault();\n }\n\n // Trigger form as not pristine.\n // If any inputs have not been touched yet this will make them dirty\n // so validation becomes visible (if based on isPristine)\n this.setFormPristine(false);\n const model = this.getModel();\n this.props.onSubmit(model, this.resetModel, this.updateInputsWithError);\n if (this.state.isValid) {\n this.props.onValidSubmit(model, this.resetModel, this.updateInputsWithError);\n } else {\n this.props.onInvalidSubmit(model, this.resetModel, this.updateInputsWithError);\n }\n }\n\n // Go through errors from server and grab the components\n // stored in the inputs map. Change their state to invalid\n // and set the serverError message\n updateInputsWithError = (errors) => {\n Object.keys(errors).forEach((name) => {\n const component = utils.find(this.inputs, input => input.props.name === name);\n if (!component) {\n throw new Error(`You are trying to update an input that does not exist. Verify errors object with input names. ${JSON.stringify(errors)}`);\n }\n const args = [{\n isValid: this.props.preventExternalInvalidation,\n externalError: typeof errors[name] === 'string' ? [errors[name]] : errors[name],\n }];\n component.setState(...args);\n });\n }\n\n // Use the binded values and the actual input value to\n // validate the input and set its state. Then check the\n // state of the form itself\n validate = (component) => {\n // Trigger onChange\n if (this.state.canChange) {\n this.props.onChange(this.getModel(), this.isChanged());\n }\n\n const validation = this.runValidation(component);\n // Run through the validations, split them up and call\n // the validator IF there is a value or it is required\n component.setState({\n isValid: validation.isValid,\n isRequired: validation.isRequired,\n validationError: validation.error,\n externalError: null,\n }, this.validateForm);\n }\n\n // Validate the form by going through all child input components\n // and check their state\n validateForm = () => {\n // We need a callback as we are validating all inputs again. This will\n // run when the last component has set its state\n const onValidationComplete = () => {\n const allIsValid = this.inputs.every(component => component.state.isValid);\n\n this.setState({\n isValid: allIsValid,\n });\n\n if (allIsValid) {\n this.props.onValid();\n } else {\n this.props.onInvalid();\n }\n\n // Tell the form that it can start to trigger change events\n this.setState({\n canChange: true,\n });\n };\n\n // Run validation again in case affected by other inputs. The\n // last component validated will run the onValidationComplete callback\n this.inputs.forEach((component, index) => {\n const validation = this.runValidation(component);\n if (validation.isValid && component.state.externalError) {\n validation.isValid = false;\n }\n component.setState({\n isValid: validation.isValid,\n isRequired: validation.isRequired,\n validationError: validation.error,\n externalError: !validation.isValid && component.state.externalError ?\n component.state.externalError : null,\n }, index === this.inputs.length - 1 ? onValidationComplete : null);\n });\n\n // If there are no inputs, set state where form is ready to trigger\n // change event. New inputs might be added later\n if (!this.inputs.length) {\n this.setState({\n canChange: true,\n });\n }\n }\n\n render = () => {\n const {\n getErrorMessage,\n getErrorMessages,\n getValue,\n hasValue,\n isFormDisabled,\n isFormSubmitted,\n isPristine,\n isRequired,\n isValid,\n isValidValue,\n mapping,\n onChange,\n // onError,\n onInvalidSubmit,\n onInvalid,\n onReset,\n onSubmit,\n onValid,\n onValidSubmit,\n preventExternalInvalidation,\n // reset,\n resetValue,\n setValidations,\n setValue,\n showError,\n showRequired,\n validationErrors,\n ...nonFormsyProps\n } = this.props;\n\n return React.createElement(\n 'form',\n {\n onReset: this.resetInternal,\n onSubmit: this.submit,\n ...nonFormsyProps,\n disabled: false,\n },\n this.props.children,\n );\n }\n}\n\nFormsy.displayName = 'Formsy';\n\nFormsy.defaultProps = {\n children: null,\n disabled: false,\n getErrorMessage: () => {},\n getErrorMessages: () => {},\n getValue: () => {},\n hasValue: () => {},\n isFormDisabled: () => {},\n isFormSubmitted: () => {},\n isPristine: () => {},\n isRequired: () => {},\n isValid: () => {},\n isValidValue: () => {},\n mapping: null,\n onChange: () => {},\n onError: () => {},\n onInvalid: () => {},\n onInvalidSubmit: () => {},\n onReset: () => {},\n onSubmit: () => {},\n onValid: () => {},\n onValidSubmit: () => {},\n preventExternalInvalidation: false,\n resetValue: () => {},\n setValidations: () => {},\n setValue: () => {},\n showError: () => {},\n showRequired: () => {},\n validationErrors: null,\n};\n\nFormsy.propTypes = {\n children: PropTypes.node,\n disabled: PropTypes.bool,\n getErrorMessage: PropTypes.func,\n getErrorMessages: PropTypes.func,\n getValue: PropTypes.func,\n hasValue: PropTypes.func,\n isFormDisabled: PropTypes.func,\n isFormSubmitted: PropTypes.func,\n isPristine: PropTypes.func,\n isRequired: PropTypes.func,\n isValid: PropTypes.func,\n isValidValue: PropTypes.func,\n mapping: PropTypes.func,\n onChange: PropTypes.func,\n onInvalid: PropTypes.func,\n onInvalidSubmit: PropTypes.func,\n onReset: PropTypes.func,\n onSubmit: PropTypes.func,\n onValid: PropTypes.func,\n onValidSubmit: PropTypes.func,\n preventExternalInvalidation: PropTypes.bool,\n resetValue: PropTypes.func,\n setValidations: PropTypes.func,\n setValue: PropTypes.func,\n showError: PropTypes.func,\n showRequired: PropTypes.func,\n validationErrors: PropTypes.object, // eslint-disable-line\n};\n\nFormsy.childContextTypes = {\n formsy: PropTypes.object,\n};\n\nconst addValidationRule = (name, func) => {\n validationRules[name] = func;\n};\n\nconst withFormsy = Wrapper;\n\nlet didWarnAboutWrapperDeprecation = false;\n\nconst deprecatedWrapper = (Component) => {\n if (!didWarnAboutWrapperDeprecation) {\n // eslint-disable-next-line no-console\n console.warn('Wrapper has been renamed to withFormsy. Importing Wrapper from formsy-react is depreacted and will be removed in the future. Please rename your Wrapper imports to withFormsy.');\n didWarnAboutWrapperDeprecation = true;\n }\n\n return withFormsy(Component);\n};\n\nexport {\n addValidationRule,\n propTypes,\n validationRules,\n withFormsy,\n deprecatedWrapper as Wrapper,\n};\n\nexport default Formsy;\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","function toObj(source) {\n return Object.keys(source).reduce(function (output, key) {\n var parentKey = key.match(/[^\\[]*/i);\n var paths = key.match(/\\[.*?\\]/g) || [];\n paths = [parentKey[0]].concat(paths).map(function (key) {\n return key.replace(/\\[|\\]/g, '');\n });\n var currentPath = output;\n while (paths.length) {\n var pathKey = paths.shift();\n\n if (pathKey in currentPath) {\n currentPath = currentPath[pathKey];\n } else {\n currentPath[pathKey] = paths.length ? isNaN(paths[0]) ? {} : [] : source[key];\n currentPath = currentPath[pathKey];\n }\n }\n\n return output;\n }, {});\n}\n\nfunction fromObj(obj) {\n function recur(newObj, propName, currVal) {\n if (Array.isArray(currVal) || Object.prototype.toString.call(currVal) === '[object Object]') {\n Object.keys(currVal).forEach(function(v) {\n recur(newObj, propName + \"[\" + v + \"]\", currVal[v]);\n });\n return newObj;\n }\n\n newObj[propName] = currVal;\n return newObj;\n }\n\n var keys = Object.keys(obj);\n return keys.reduce(function(newObj, propName) {\n return recur(newObj, propName, obj[propName]);\n }, {});\n}\n\nmodule.exports = {\n fromObj: fromObj,\n toObj: toObj\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/form-data-to-object/index.js\n// module id = 4\n// module chunks = 0","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar emptyFunction = require('fbjs/lib/emptyFunction');\nvar invariant = require('fbjs/lib/invariant');\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n invariant(\n false,\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim\n };\n\n ReactPropTypes.checkPropTypes = emptyFunction;\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/prop-types/factoryWithThrowingShims.js\n// module id = 5\n// module chunks = 0","\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nfunction makeEmptyFunction(arg) {\n return function () {\n return arg;\n };\n}\n\n/**\n * This function accepts and discards inputs; it has no side effects. This is\n * primarily useful idiomatically for overridable function endpoints which\n * always need to be callable, since JS lacks a null-call idiom ala Cocoa.\n */\nvar emptyFunction = function emptyFunction() {};\n\nemptyFunction.thatReturns = makeEmptyFunction;\nemptyFunction.thatReturnsFalse = makeEmptyFunction(false);\nemptyFunction.thatReturnsTrue = makeEmptyFunction(true);\nemptyFunction.thatReturnsNull = makeEmptyFunction(null);\nemptyFunction.thatReturnsThis = function () {\n return this;\n};\nemptyFunction.thatReturnsArgument = function (arg) {\n return arg;\n};\n\nmodule.exports = emptyFunction;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/fbjs/lib/emptyFunction.js\n// module id = 6\n// module chunks = 0","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n'use strict';\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar validateFormat = function validateFormat(format) {};\n\nif (process.env.NODE_ENV !== 'production') {\n validateFormat = function validateFormat(format) {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n };\n}\n\nfunction invariant(condition, format, a, b, c, d, e, f) {\n validateFormat(format);\n\n if (!condition) {\n var error;\n if (format === undefined) {\n error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n error = new Error(format.replace(/%s/g, function () {\n return args[argIndex++];\n }));\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n}\n\nmodule.exports = invariant;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/fbjs/lib/invariant.js\n// module id = 7\n// module chunks = 0","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/prop-types/lib/ReactPropTypesSecret.js\n// module id = 8\n// module chunks = 0","const isExisty = value => value !== null && value !== undefined;\nconst isEmpty = value => value === '';\n\nconst validations = {\n isDefaultRequiredValue(values, value) {\n return value === undefined || value === null || value === '';\n },\n isExisty(values, value) {\n return isExisty(value);\n },\n matchRegexp(values, value, regexp) {\n return !isExisty(value) || isEmpty(value) || regexp.test(value);\n },\n isUndefined(values, value) {\n return value === undefined;\n },\n isEmptyString(values, value) {\n return isEmpty(value);\n },\n isEmail(values, value) {\n // Regex from http://emailregex.com/\n return validations.matchRegexp(values, value, /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/i);\n },\n isUrl(values, value) {\n return validations.matchRegexp(values, value, /^(?:\\w+:)?\\/\\/([^\\s.]+\\.\\S{2}|localhost[:?\\d]*)\\S*$/i);\n },\n isTrue(values, value) {\n return value === true;\n },\n isFalse(values, value) {\n return value === false;\n },\n isNumeric(values, value) {\n if (typeof value === 'number') {\n return true;\n }\n return validations.matchRegexp(values, value, /^[-+]?(?:\\d*[.])?\\d+$/);\n },\n isAlpha(values, value) {\n return validations.matchRegexp(values, value, /^[A-Z]+$/i);\n },\n isAlphanumeric(values, value) {\n return validations.matchRegexp(values, value, /^[0-9A-Z]+$/i);\n },\n isInt(values, value) {\n return validations.matchRegexp(values, value, /^(?:[-+]?(?:0|[1-9]\\d*))$/);\n },\n isFloat(values, value) {\n return validations.matchRegexp(values, value, /^(?:[-+]?(?:\\d+))?(?:\\.\\d*)?(?:[eE][+-]?(?:\\d+))?$/);\n },\n isWords(values, value) {\n return validations.matchRegexp(values, value, /^[A-Z\\s]+$/i);\n },\n isSpecialWords(values, value) {\n return validations.matchRegexp(values, value, /^[A-Z\\s\\u00C0-\\u017F]+$/i);\n },\n isLength(values, value, length) {\n return !isExisty(value) || isEmpty(value) || value.length === length;\n },\n equals(values, value, eql) {\n return !isExisty(value) || isEmpty(value) || value === eql;\n },\n equalsField(values, value, field) {\n return value === values[field];\n },\n maxLength(values, value, length) {\n return !isExisty(value) || value.length <= length;\n },\n minLength(values, value, length) {\n return !isExisty(value) || isEmpty(value) || value.length >= length;\n },\n};\n\nexport default validations;\n\n\n\n// WEBPACK FOOTER //\n// ./src/validationRules.js","import PropTypes from 'prop-types';\nimport React from 'react';\nimport utils from './utils';\n\n/* eslint-disable react/default-props-match-prop-types */\n\nconst convertValidationsToObject = (validations) => {\n if (typeof validations === 'string') {\n return validations.split(/,(?![^{[]*[}\\]])/g).reduce((validationsAccumulator, validation) => {\n let args = validation.split(':');\n const validateMethod = args.shift();\n\n args = args.map((arg) => {\n try {\n return JSON.parse(arg);\n } catch (e) {\n return arg; // It is a string if it can not parse it\n }\n });\n\n if (args.length > 1) {\n throw new Error('Formsy does not support multiple args on string validations. Use object format of validations instead.');\n }\n\n // Avoid parameter reassignment\n const validationsAccumulatorCopy = Object.assign({}, validationsAccumulator);\n validationsAccumulatorCopy[validateMethod] = args.length ? args[0] : true;\n return validationsAccumulatorCopy;\n }, {});\n }\n\n return validations || {};\n};\n\nconst propTypes = {\n innerRef: PropTypes.func,\n name: PropTypes.string.isRequired,\n required: PropTypes.oneOfType([\n PropTypes.bool,\n PropTypes.object,\n PropTypes.string,\n ]),\n validations: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.string,\n ]),\n value: PropTypes.any, // eslint-disable-line react/forbid-prop-types\n};\n\nexport {\n propTypes,\n};\n\nexport default (Component) => {\n class WrappedComponent extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n value: props.value,\n isRequired: false,\n isValid: true,\n isPristine: true,\n pristineValue: props.value,\n validationError: [],\n externalError: null,\n formSubmitted: false,\n };\n }\n\n componentWillMount() {\n const configure = () => {\n this.setValidations(this.props.validations, this.props.required);\n\n // Pass a function instead?\n this.context.formsy.attachToForm(this);\n };\n\n if (!this.props.name) {\n throw new Error('Form Input requires a name property when used');\n }\n\n configure();\n }\n\n // We have to make sure the validate method is kept when new props are added\n componentWillReceiveProps(nextProps) {\n this.setValidations(nextProps.validations, nextProps.required);\n }\n\n componentDidUpdate(prevProps) {\n // If the value passed has changed, set it. If value is not passed it will\n // internally update, and this will never run\n if (!utils.isSame(this.props.value, prevProps.value)) {\n this.setValue(this.props.value);\n }\n\n // If validations or required is changed, run a new validation\n if (!utils.isSame(this.props.validations, prevProps.validations) ||\n !utils.isSame(this.props.required, prevProps.required)) {\n this.context.formsy.validate(this);\n }\n }\n\n // Detach it when component unmounts\n componentWillUnmount() {\n this.context.formsy.detachFromForm(this);\n }\n\n getErrorMessage = () => {\n const messages = this.getErrorMessages();\n return messages.length ? messages[0] : null;\n }\n\n getErrorMessages = () => {\n if (!this.isValid() || this.showRequired()) {\n return this.state.externalError || this.state.validationError || [];\n }\n return [];\n }\n\n getValue = () => this.state.value;\n\n setValidations = (validations, required) => {\n // Add validations to the store itself as the props object can not be modified\n this.validations = convertValidationsToObject(validations) || {};\n this.requiredValidations = required === true ? { isDefaultRequiredValue: true } :\n convertValidationsToObject(required);\n }\n\n // By default, we validate after the value has been set.\n // A user can override this and pass a second parameter of `false` to skip validation.\n setValue = (value, validate = true) => {\n if (!validate) {\n this.setState({\n value,\n });\n } else {\n this.setState({\n value,\n isPristine: false,\n }, () => {\n this.context.formsy.validate(this);\n });\n }\n }\n\n hasValue = () => this.state.value !== '';\n\n isFormDisabled = () => this.context.formsy.isFormDisabled();\n\n isFormSubmitted = () => this.state.formSubmitted;\n\n isPristine = () => this.state.isPristine;\n\n isRequired = () => !!this.props.required;\n\n isValid = () => this.state.isValid;\n\n isValidValue = value =>\n this.context.formsy.isValidValue.call(null, this, value);\n\n resetValue = () => {\n this.setState({\n value: this.state.pristineValue,\n isPristine: true,\n }, () => {\n this.context.formsy.validate(this);\n });\n }\n\n showError = () => !this.showRequired() && !this.isValid();\n\n showRequired = () => this.state.isRequired;\n\n render() {\n const { innerRef } = this.props;\n const propsForElement = {\n getErrorMessage: this.getErrorMessage,\n getErrorMessages: this.getErrorMessages,\n getValue: this.getValue,\n hasValue: this.hasValue,\n isFormDisabled: this.isFormDisabled,\n isValid: this.isValid,\n isPristine: this.isPristine,\n isFormSubmitted: this.isFormSubmitted,\n isRequired: this.isRequired,\n isValidValue: this.isValidValue,\n resetValue: this.resetValue,\n setValidations: this.setValidations,\n setValue: this.setValue,\n showRequired: this.showRequired,\n showError: this.showError,\n ...this.props,\n };\n\n if (innerRef) {\n propsForElement.ref = innerRef;\n }\n\n return React.createElement(Component, propsForElement);\n }\n }\n\n function getDisplayName(component) {\n return (\n component.displayName ||\n component.name ||\n (typeof component === 'string' ? component : 'Component')\n );\n }\n\n WrappedComponent.displayName = `Formsy(${getDisplayName(Component)})`;\n\n WrappedComponent.contextTypes = {\n formsy: PropTypes.object, // What about required?\n };\n\n WrappedComponent.defaultProps = {\n innerRef: () => {},\n required: false,\n validationError: '',\n validationErrors: {},\n validations: null,\n value: Component.defaultValue,\n };\n\n WrappedComponent.propTypes = propTypes;\n\n return WrappedComponent;\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/Wrapper.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///formsy-react.js","webpack:///webpack/bootstrap 0585d53e8003c01a0ced","webpack:///./node_modules/prop-types/index.js","webpack:///external {\"root\":\"React\",\"commonjs2\":\"react\",\"commonjs\":\"react\",\"amd\":\"react\",\"umd\":\"react\"}","webpack:///./src/utils.js","webpack:///./src/index.js","webpack:///./node_modules/form-data-to-object/index.js","webpack:///./node_modules/prop-types/factoryWithThrowingShims.js","webpack:///./node_modules/fbjs/lib/emptyFunction.js","webpack:///./node_modules/fbjs/lib/invariant.js","webpack:///./node_modules/prop-types/lib/ReactPropTypesSecret.js","webpack:///./src/validationRules.js","webpack:///./src/Wrapper.js"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_1__","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","value","_typeof","Symbol","iterator","obj","constructor","default","arraysDiffer","a","b","_this","isDifferent","length","forEach","item","index","isSame","objectsDiffer","_this2","keys","key","Array","isArray","toString","find","collection","fn","runRules","currentValues","validations","validationRules","results","errors","failed","success","validationMethod","Error","validation","push","_interopRequireDefault","_objectWithoutProperties","target","indexOf","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","writable","setPrototypeOf","__proto__","Wrapper","withFormsy","propTypes","addValidationRule","undefined","_extends","assign","arguments","source","_formDataToObject","_formDataToObject2","_propTypes","_propTypes2","_react","_react2","_utils","_utils2","_validationRules","_validationRules2","_Wrapper","_Wrapper2","Formsy","_React$Component","props","getPrototypeOf","getChildContext","formsy","attachToForm","detachFromForm","validate","isFormDisabled","isValidValue","component","runValidation","isValid","componentDidMount","validateForm","componentWillUpdate","prevInputNames","inputs","map","componentDidUpdate","validationErrors","setInputValidationErrors","newInputNames","getCurrentValues","reduce","data","dataCopy","state","getModel","mapModel","getPristineValues","setFormPristine","isPristine","setState","formSubmitted","args","validationError","apply","disabled","model","mapping","toObj","mappedModel","keyArray","split","base","currentKey","shift","reset","resetModel","resetInternal","event","preventDefault","onReset","setValue","resetValue","_component$props","validationResults","requiredResults","requiredValidations","isRequired","error","filter","x","pos","arr","componentPos","slice","concat","isChanged","submit","onSubmit","updateInputsWithError","onValidSubmit","onInvalidSubmit","input","JSON","stringify","preventExternalInvalidation","externalError","canChange","onChange","onValidationComplete","allIsValid","every","onValid","onInvalid","render","_this$props","nonFormsyProps","getErrorMessage","getErrorMessages","getValue","hasValue","isFormSubmitted","setValidations","showError","showRequired","createElement","children","isSubmitting","Component","displayName","defaultProps","onError","node","bool","func","childContextTypes","didWarnAboutWrapperDeprecation","deprecatedWrapper","console","warn","output","parentKey","match","paths","replace","currentPath","pathKey","isNaN","fromObj","recur","newObj","propName","currVal","v","emptyFunction","invariant","ReactPropTypesSecret","shim","componentName","location","propFullName","secret","getShim","ReactPropTypes","array","number","string","symbol","any","arrayOf","element","instanceOf","objectOf","oneOf","oneOfType","shape","exact","checkPropTypes","PropTypes","makeEmptyFunction","arg","thatReturns","thatReturnsFalse","thatReturnsTrue","thatReturnsNull","thatReturnsThis","thatReturnsArgument","condition","format","e","f","validateFormat","argIndex","framesToPop","isExisty","isEmpty","isDefaultRequiredValue","values","matchRegexp","regexp","test","isUndefined","isEmptyString","isEmail","isUrl","isTrue","isFalse","isNumeric","isAlpha","isAlphanumeric","isInt","isFloat","isWords","isSpecialWords","isLength","equals","eql","equalsField","field","maxLength","minLength","_createClass","defineProperties","descriptor","protoProps","staticProps","convertValidationsToObject","validationsAccumulator","validateMethod","parse","validationsAccumulatorCopy","innerRef","required","WrappedComponent","messages","context","pristineValue","nextProps","prevProps","propsForElement","errorMessage","errorMessages","ref","contextTypes","defaultValue"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,UACA,kBAAAC,gBAAAC,IACAD,QAAA,SAAAJ,GACA,gBAAAC,SACAA,QAAA,OAAAD,EAAAG,QAAA,UAEAJ,EAAA,OAAAC,EAAAD,EAAA,QACCO,KAAA,SAAAC,GACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAT,OAGA,IAAAC,GAAAS,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAZ,WAUA,OANAO,GAAAE,GAAAI,KAAAZ,EAAAD,QAAAC,IAAAD,QAAAQ,GAGAP,EAAAW,GAAA,EAGAX,EAAAD,QAvBA,GAAAU,KA4DA,OAhCAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,SAAAhB,EAAAiB,EAAAC,GACAV,EAAAW,EAAAnB,EAAAiB,IACAG,O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KyM,kBACtB9D,WAAY3I,KAAK2I,aACjB4B,WAAYvK,KAAKuK,aACjBhD,QAASvH,KAAKuH,UACdH,aAAcpH,KAAKoH,aACnB8C,WAAYlK,KAAKkK,WACjBwC,eAAgB1M,KAAK0M,eACrBzC,SAAUjK,KAAKiK,SACf0C,UAAW3M,KAAK2M,YAChBC,aAAc5M,KAAK4M,eACnBhL,MAAO5B,KAAKuM,YAOd,OAJIgH,KACFQ,EAAgBG,IAAMX,GAGjBpN,EAAAjE,QAAM2K,cAAcG,EAAW+G,OAlJdN,GACGtN,EAAAjE,QAAM8K,UA8KrC,OAjBAyG,GAAiBxG,YAAjB,UARA,SAAwB5F,GACtB,MACEA,GAAU4F,aACV5F,EAAUzG,OACY,gBAAdyG,GAAyBA,EAAY,cAIO2F,GAAxD,IAEAyG,EAAiBU,cACfpN,OAAQd,EAAA/D,QAAUZ,QAGpBmS,EAAiBvG,cACfqG,SAAU,aACVC,UAAU,EACVzK,gBAAiB,GACjBhB,oBACAtE,YAAa,KACb7B,MAAOoL,EAAUoH,cAGnBX,EAAiBlO,UAAYA,EAEtBkO","file":"formsy-react.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Formsy\"] = factory(require(\"react\"));\n\telse\n\t\troot[\"Formsy\"] = factory(root[\"React\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Formsy\"] = factory(require(\"react\"));\n\telse\n\t\troot[\"Formsy\"] = factory(root[\"React\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 3);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (false) {\n var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&\n Symbol.for &&\n Symbol.for('react.element')) ||\n 0xeac7;\n\n var isValidElement = function(object) {\n return typeof object === 'object' &&\n object !== null &&\n object.$$typeof === REACT_ELEMENT_TYPE;\n };\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = __webpack_require__(5)();\n}\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.default = {\n arraysDiffer: function arraysDiffer(a, b) {\n var _this = this;\n\n var isDifferent = false;\n if (a.length !== b.length) {\n isDifferent = true;\n } else {\n a.forEach(function (item, index) {\n if (!_this.isSame(item, b[index])) {\n isDifferent = true;\n }\n }, this);\n }\n return isDifferent;\n },\n objectsDiffer: function objectsDiffer(a, b) {\n var _this2 = this;\n\n var isDifferent = false;\n if (Object.keys(a).length !== Object.keys(b).length) {\n isDifferent = true;\n } else {\n Object.keys(a).forEach(function (key) {\n if (!_this2.isSame(a[key], b[key])) {\n isDifferent = true;\n }\n }, this);\n }\n return isDifferent;\n },\n isSame: function isSame(a, b) {\n if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) !== (typeof b === 'undefined' ? 'undefined' : _typeof(b))) {\n return false;\n } else if (Array.isArray(a) && Array.isArray(b)) {\n return !this.arraysDiffer(a, b);\n } else if (typeof a === 'function') {\n return a.toString() === b.toString();\n } else if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) === 'object' && a !== null && b !== null) {\n return !this.objectsDiffer(a, b);\n }\n\n return a === b;\n },\n find: function find(collection, fn) {\n for (var i = 0, l = collection.length; i < l; i += 1) {\n var item = collection[i];\n if (fn(item)) {\n return item;\n }\n }\n return null;\n },\n runRules: function runRules(value, currentValues, validations, validationRules) {\n var results = {\n errors: [],\n failed: [],\n success: []\n };\n\n if (Object.keys(validations).length) {\n Object.keys(validations).forEach(function (validationMethod) {\n if (validationRules[validationMethod] && typeof validations[validationMethod] === 'function') {\n throw new Error('Formsy does not allow you to override default validations: ' + validationMethod);\n }\n\n if (!validationRules[validationMethod] && typeof validations[validationMethod] !== 'function') {\n throw new Error('Formsy does not have the validation rule: ' + validationMethod);\n }\n\n if (typeof validations[validationMethod] === 'function') {\n var validation = validations[validationMethod](currentValues, value);\n if (typeof validation === 'string') {\n results.errors.push(validation);\n results.failed.push(validationMethod);\n } else if (!validation) {\n results.failed.push(validationMethod);\n }\n return;\n } else if (typeof validations[validationMethod] !== 'function') {\n var _validation = validationRules[validationMethod](currentValues, value, validations[validationMethod]);\n\n if (typeof _validation === 'string') {\n results.errors.push(_validation);\n results.failed.push(validationMethod);\n } else if (!_validation) {\n results.failed.push(validationMethod);\n } else {\n results.success.push(validationMethod);\n }\n return;\n }\n\n results.success.push(validationMethod);\n });\n }\n\n return results;\n }\n};\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Wrapper = exports.withFormsy = exports.validationRules = exports.propTypes = exports.addValidationRule = undefined;\n\nvar _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; };\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _formDataToObject = __webpack_require__(4);\n\nvar _formDataToObject2 = _interopRequireDefault(_formDataToObject);\n\nvar _propTypes = __webpack_require__(0);\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _react = __webpack_require__(1);\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _utils = __webpack_require__(2);\n\nvar _utils2 = _interopRequireDefault(_utils);\n\nvar _validationRules = __webpack_require__(9);\n\nvar _validationRules2 = _interopRequireDefault(_validationRules);\n\nvar _Wrapper = __webpack_require__(10);\n\nvar _Wrapper2 = _interopRequireDefault(_Wrapper);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _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; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/* eslint-disable react/no-unused-state, react/default-props-match-prop-types */\n\nvar Formsy = function (_React$Component) {\n _inherits(Formsy, _React$Component);\n\n function Formsy(props) {\n _classCallCheck(this, Formsy);\n\n var _this = _possibleConstructorReturn(this, (Formsy.__proto__ || Object.getPrototypeOf(Formsy)).call(this, props));\n\n _this.getChildContext = function () {\n return {\n formsy: {\n attachToForm: _this.attachToForm,\n detachFromForm: _this.detachFromForm,\n validate: _this.validate,\n isFormDisabled: _this.isFormDisabled,\n isValidValue: function isValidValue(component, value) {\n return _this.runValidation(component, value).isValid;\n }\n }\n };\n };\n\n _this.componentDidMount = function () {\n _this.validateForm();\n };\n\n _this.componentWillUpdate = function () {\n // Keep a reference to input names before form updates,\n // to check if inputs has changed after render\n _this.prevInputNames = _this.inputs.map(function (component) {\n return component.props.name;\n });\n };\n\n _this.componentDidUpdate = function () {\n if (_this.props.validationErrors && _typeof(_this.props.validationErrors) === 'object' && Object.keys(_this.props.validationErrors).length > 0) {\n _this.setInputValidationErrors(_this.props.validationErrors);\n }\n\n var newInputNames = _this.inputs.map(function (component) {\n return component.props.name;\n });\n if (_utils2.default.arraysDiffer(_this.prevInputNames, newInputNames)) {\n _this.validateForm();\n }\n };\n\n _this.getCurrentValues = function () {\n return _this.inputs.reduce(function (data, component) {\n var name = component.props.name;\n\n var dataCopy = Object.assign({}, data); // avoid param reassignment\n dataCopy[name] = component.state.value;\n return dataCopy;\n }, {});\n };\n\n _this.getModel = function () {\n var currentValues = _this.getCurrentValues();\n return _this.mapModel(currentValues);\n };\n\n _this.getPristineValues = function () {\n return _this.inputs.reduce(function (data, component) {\n var name = component.props.name;\n\n var dataCopy = Object.assign({}, data); // avoid param reassignment\n dataCopy[name] = component.props.value;\n return dataCopy;\n }, {});\n };\n\n _this.setFormPristine = function (isPristine) {\n _this.setState({\n formSubmitted: !isPristine\n });\n\n // Iterate through each component and set it as pristine\n // or \"dirty\".\n _this.inputs.forEach(function (component) {\n component.setState({\n formSubmitted: !isPristine,\n isPristine: isPristine\n });\n });\n };\n\n _this.setInputValidationErrors = function (errors) {\n _this.inputs.forEach(function (component) {\n var name = component.props.name;\n\n var args = [{\n isValid: !(name in errors),\n validationError: typeof errors[name] === 'string' ? [errors[name]] : errors[name]\n }];\n component.setState.apply(component, args);\n });\n };\n\n _this.isFormDisabled = function () {\n return _this.props.disabled;\n };\n\n _this.mapModel = function (model) {\n if (_this.props.mapping) {\n return _this.props.mapping(model);\n }\n\n return _formDataToObject2.default.toObj(Object.keys(model).reduce(function (mappedModel, key) {\n var keyArray = key.split('.');\n var base = mappedModel;\n while (keyArray.length) {\n var currentKey = keyArray.shift();\n base[currentKey] = keyArray.length ? base[currentKey] || {} : model[key];\n base = base[currentKey];\n }\n return mappedModel;\n }, {}));\n };\n\n _this.reset = function (data) {\n _this.setFormPristine(true);\n _this.resetModel(data);\n };\n\n _this.resetInternal = function (event) {\n event.preventDefault();\n _this.reset();\n if (_this.props.onReset) {\n _this.props.onReset();\n }\n };\n\n _this.resetModel = function (data) {\n _this.inputs.forEach(function (component) {\n var name = component.props.name;\n\n if (data && Object.prototype.hasOwnProperty.call(data, name)) {\n component.setValue(data[name]);\n } else {\n component.resetValue();\n }\n });\n _this.validateForm();\n };\n\n _this.runValidation = function (component) {\n var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : component.state.value;\n\n var currentValues = _this.getCurrentValues();\n var _component$props = component.props,\n validationError = _component$props.validationError,\n validationErrors = _component$props.validationErrors;\n\n\n var validationResults = _utils2.default.runRules(value, currentValues, component.validations, _validationRules2.default);\n\n var requiredResults = _utils2.default.runRules(value, currentValues, component.requiredValidations, _validationRules2.default);\n\n var isRequired = Object.keys(component.requiredValidations).length ? !!requiredResults.success.length : false;\n var isValid = !validationResults.failed.length && !(_this.props.validationErrors && _this.props.validationErrors[component.props.name]);\n\n return {\n isRequired: isRequired,\n isValid: isRequired ? false : isValid,\n error: function () {\n if (isValid && !isRequired) {\n return [];\n }\n\n if (validationResults.errors.length) {\n return validationResults.errors;\n }\n\n if (_this.props.validationErrors && _this.props.validationErrors[component.props.name]) {\n return typeof _this.props.validationErrors[component.props.name] === 'string' ? [_this.props.validationErrors[component.props.name]] : _this.props.validationErrors[component.props.name];\n }\n\n if (isRequired) {\n var error = validationErrors[requiredResults.success[0]];\n return error ? [error] : null;\n }\n\n if (validationResults.failed.length) {\n return validationResults.failed.map(function (failed) {\n return validationErrors[failed] ? validationErrors[failed] : validationError;\n }).filter(function (x, pos, arr) {\n return arr.indexOf(x) === pos;\n }); // remove duplicates\n }\n\n return undefined;\n }()\n };\n };\n\n _this.attachToForm = function (component) {\n if (_this.inputs.indexOf(component) === -1) {\n _this.inputs.push(component);\n }\n\n _this.validate(component);\n };\n\n _this.detachFromForm = function (component) {\n var componentPos = _this.inputs.indexOf(component);\n\n if (componentPos !== -1) {\n _this.inputs = _this.inputs.slice(0, componentPos).concat(_this.inputs.slice(componentPos + 1));\n }\n\n _this.validateForm();\n };\n\n _this.isChanged = function () {\n return !_utils2.default.isSame(_this.getPristineValues(), _this.getCurrentValues());\n };\n\n _this.submit = function (event) {\n if (event && event.preventDefault) {\n event.preventDefault();\n }\n\n // Trigger form as not pristine.\n // If any inputs have not been touched yet this will make them dirty\n // so validation becomes visible (if based on isPristine)\n _this.setFormPristine(false);\n var model = _this.getModel();\n _this.props.onSubmit(model, _this.resetModel, _this.updateInputsWithError);\n if (_this.state.isValid) {\n _this.props.onValidSubmit(model, _this.resetModel, _this.updateInputsWithError);\n } else {\n _this.props.onInvalidSubmit(model, _this.resetModel, _this.updateInputsWithError);\n }\n };\n\n _this.updateInputsWithError = function (errors) {\n Object.keys(errors).forEach(function (name) {\n var component = _utils2.default.find(_this.inputs, function (input) {\n return input.props.name === name;\n });\n if (!component) {\n throw new Error('You are trying to update an input that does not exist. Verify errors object with input names. ' + JSON.stringify(errors));\n }\n var args = [{\n isValid: _this.props.preventExternalInvalidation,\n externalError: typeof errors[name] === 'string' ? [errors[name]] : errors[name]\n }];\n component.setState.apply(component, args);\n });\n };\n\n _this.validate = function (component) {\n // Trigger onChange\n if (_this.state.canChange) {\n _this.props.onChange(_this.getModel(), _this.isChanged());\n }\n\n var validation = _this.runValidation(component);\n // Run through the validations, split them up and call\n // the validator IF there is a value or it is required\n component.setState({\n isValid: validation.isValid,\n isRequired: validation.isRequired,\n validationError: validation.error,\n externalError: null\n }, _this.validateForm);\n };\n\n _this.validateForm = function () {\n // We need a callback as we are validating all inputs again. This will\n // run when the last component has set its state\n var onValidationComplete = function onValidationComplete() {\n var allIsValid = _this.inputs.every(function (component) {\n return component.state.isValid;\n });\n\n _this.setState({\n isValid: allIsValid\n });\n\n if (allIsValid) {\n _this.props.onValid();\n } else {\n _this.props.onInvalid();\n }\n\n // Tell the form that it can start to trigger change events\n _this.setState({\n canChange: true\n });\n };\n\n // Run validation again in case affected by other inputs. The\n // last component validated will run the onValidationComplete callback\n _this.inputs.forEach(function (component, index) {\n var validation = _this.runValidation(component);\n if (validation.isValid && component.state.externalError) {\n validation.isValid = false;\n }\n component.setState({\n isValid: validation.isValid,\n isRequired: validation.isRequired,\n validationError: validation.error,\n externalError: !validation.isValid && component.state.externalError ? component.state.externalError : null\n }, index === _this.inputs.length - 1 ? onValidationComplete : null);\n });\n\n // If there are no inputs, set state where form is ready to trigger\n // change event. New inputs might be added later\n if (!_this.inputs.length) {\n _this.setState({\n canChange: true\n });\n }\n };\n\n _this.render = function () {\n var _this$props = _this.props,\n getErrorMessage = _this$props.getErrorMessage,\n getErrorMessages = _this$props.getErrorMessages,\n getValue = _this$props.getValue,\n hasValue = _this$props.hasValue,\n isFormDisabled = _this$props.isFormDisabled,\n isFormSubmitted = _this$props.isFormSubmitted,\n isPristine = _this$props.isPristine,\n isRequired = _this$props.isRequired,\n isValid = _this$props.isValid,\n isValidValue = _this$props.isValidValue,\n mapping = _this$props.mapping,\n onChange = _this$props.onChange,\n onInvalidSubmit = _this$props.onInvalidSubmit,\n onInvalid = _this$props.onInvalid,\n onReset = _this$props.onReset,\n onSubmit = _this$props.onSubmit,\n onValid = _this$props.onValid,\n onValidSubmit = _this$props.onValidSubmit,\n preventExternalInvalidation = _this$props.preventExternalInvalidation,\n resetValue = _this$props.resetValue,\n setValidations = _this$props.setValidations,\n setValue = _this$props.setValue,\n showError = _this$props.showError,\n showRequired = _this$props.showRequired,\n validationErrors = _this$props.validationErrors,\n nonFormsyProps = _objectWithoutProperties(_this$props, ['getErrorMessage', 'getErrorMessages', 'getValue', 'hasValue', 'isFormDisabled', 'isFormSubmitted', 'isPristine', 'isRequired', 'isValid', 'isValidValue', 'mapping', 'onChange', 'onInvalidSubmit', 'onInvalid', 'onReset', 'onSubmit', 'onValid', 'onValidSubmit', 'preventExternalInvalidation', 'resetValue', 'setValidations', 'setValue', 'showError', 'showRequired', 'validationErrors']);\n\n return _react2.default.createElement('form', _extends({\n onReset: _this.resetInternal,\n onSubmit: _this.submit\n }, nonFormsyProps, {\n disabled: false\n }), _this.props.children);\n };\n\n _this.state = {\n isValid: true,\n isSubmitting: false,\n canChange: false\n };\n _this.inputs = [];\n return _this;\n }\n\n // Reset each key in the model to the original / initial / specified value\n\n\n // Checks validation on current value or a passed value\n\n\n // Method put on each input component to register\n // itself to the form\n\n\n // Method put on each input component to unregister\n // itself from the form\n\n\n // Checks if the values have changed from their initial value\n\n\n // Update model, submit to url prop and send the model\n\n\n // Go through errors from server and grab the components\n // stored in the inputs map. Change their state to invalid\n // and set the serverError message\n\n\n // Use the binded values and the actual input value to\n // validate the input and set its state. Then check the\n // state of the form itself\n\n\n // Validate the form by going through all child input components\n // and check their state\n\n\n return Formsy;\n}(_react2.default.Component);\n\nFormsy.displayName = 'Formsy';\n\nFormsy.defaultProps = {\n children: null,\n disabled: false,\n getErrorMessage: function getErrorMessage() {},\n getErrorMessages: function getErrorMessages() {},\n getValue: function getValue() {},\n hasValue: function hasValue() {},\n isFormDisabled: function isFormDisabled() {},\n isFormSubmitted: function isFormSubmitted() {},\n isPristine: function isPristine() {},\n isRequired: function isRequired() {},\n isValid: function isValid() {},\n isValidValue: function isValidValue() {},\n mapping: null,\n onChange: function onChange() {},\n onError: function onError() {},\n onInvalid: function onInvalid() {},\n onInvalidSubmit: function onInvalidSubmit() {},\n onReset: function onReset() {},\n onSubmit: function onSubmit() {},\n onValid: function onValid() {},\n onValidSubmit: function onValidSubmit() {},\n preventExternalInvalidation: false,\n resetValue: function resetValue() {},\n setValidations: function setValidations() {},\n setValue: function setValue() {},\n showError: function showError() {},\n showRequired: function showRequired() {},\n validationErrors: null\n};\n\nFormsy.propTypes = {\n children: _propTypes2.default.node,\n disabled: _propTypes2.default.bool,\n getErrorMessage: _propTypes2.default.func,\n getErrorMessages: _propTypes2.default.func,\n getValue: _propTypes2.default.func,\n hasValue: _propTypes2.default.func,\n isFormDisabled: _propTypes2.default.func,\n isFormSubmitted: _propTypes2.default.func,\n isPristine: _propTypes2.default.func,\n isRequired: _propTypes2.default.func,\n isValid: _propTypes2.default.func,\n isValidValue: _propTypes2.default.func,\n mapping: _propTypes2.default.func,\n onChange: _propTypes2.default.func,\n onInvalid: _propTypes2.default.func,\n onInvalidSubmit: _propTypes2.default.func,\n onReset: _propTypes2.default.func,\n onSubmit: _propTypes2.default.func,\n onValid: _propTypes2.default.func,\n onValidSubmit: _propTypes2.default.func,\n preventExternalInvalidation: _propTypes2.default.bool,\n resetValue: _propTypes2.default.func,\n setValidations: _propTypes2.default.func,\n setValue: _propTypes2.default.func,\n showError: _propTypes2.default.func,\n showRequired: _propTypes2.default.func,\n validationErrors: _propTypes2.default.object // eslint-disable-line\n};\n\nFormsy.childContextTypes = {\n formsy: _propTypes2.default.object\n};\n\nvar addValidationRule = function addValidationRule(name, func) {\n _validationRules2.default[name] = func;\n};\n\nvar withFormsy = _Wrapper2.default;\n\nvar didWarnAboutWrapperDeprecation = false;\n\nvar deprecatedWrapper = function deprecatedWrapper(Component) {\n if (!didWarnAboutWrapperDeprecation) {\n // eslint-disable-next-line no-console\n console.warn('Wrapper has been renamed to withFormsy. Importing Wrapper from formsy-react is depreacted and will be removed in the future. Please rename your Wrapper imports to withFormsy.');\n didWarnAboutWrapperDeprecation = true;\n }\n\n return withFormsy(Component);\n};\n\nexports.addValidationRule = addValidationRule;\nexports.propTypes = _Wrapper.propTypes;\nexports.validationRules = _validationRules2.default;\nexports.withFormsy = withFormsy;\nexports.Wrapper = deprecatedWrapper;\nexports.default = Formsy;\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports) {\n\nfunction toObj(source) {\n return Object.keys(source).reduce(function (output, key) {\n var parentKey = key.match(/[^\\[]*/i);\n var paths = key.match(/\\[.*?\\]/g) || [];\n paths = [parentKey[0]].concat(paths).map(function (key) {\n return key.replace(/\\[|\\]/g, '');\n });\n var currentPath = output;\n while (paths.length) {\n var pathKey = paths.shift();\n\n if (pathKey in currentPath) {\n currentPath = currentPath[pathKey];\n } else {\n currentPath[pathKey] = paths.length ? isNaN(paths[0]) ? {} : [] : source[key];\n currentPath = currentPath[pathKey];\n }\n }\n\n return output;\n }, {});\n}\n\nfunction fromObj(obj) {\n function recur(newObj, propName, currVal) {\n if (Array.isArray(currVal) || Object.prototype.toString.call(currVal) === '[object Object]') {\n Object.keys(currVal).forEach(function(v) {\n recur(newObj, propName + \"[\" + v + \"]\", currVal[v]);\n });\n return newObj;\n }\n\n newObj[propName] = currVal;\n return newObj;\n }\n\n var keys = Object.keys(obj);\n return keys.reduce(function(newObj, propName) {\n return recur(newObj, propName, obj[propName]);\n }, {});\n}\n\nmodule.exports = {\n fromObj: fromObj,\n toObj: toObj\n}\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\n\nvar emptyFunction = __webpack_require__(6);\nvar invariant = __webpack_require__(7);\nvar ReactPropTypesSecret = __webpack_require__(8);\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n invariant(\n false,\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim\n };\n\n ReactPropTypes.checkPropTypes = emptyFunction;\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nfunction makeEmptyFunction(arg) {\n return function () {\n return arg;\n };\n}\n\n/**\n * This function accepts and discards inputs; it has no side effects. This is\n * primarily useful idiomatically for overridable function endpoints which\n * always need to be callable, since JS lacks a null-call idiom ala Cocoa.\n */\nvar emptyFunction = function emptyFunction() {};\n\nemptyFunction.thatReturns = makeEmptyFunction;\nemptyFunction.thatReturnsFalse = makeEmptyFunction(false);\nemptyFunction.thatReturnsTrue = makeEmptyFunction(true);\nemptyFunction.thatReturnsNull = makeEmptyFunction(null);\nemptyFunction.thatReturnsThis = function () {\n return this;\n};\nemptyFunction.thatReturnsArgument = function (arg) {\n return arg;\n};\n\nmodule.exports = emptyFunction;\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar validateFormat = function validateFormat(format) {};\n\nif (false) {\n validateFormat = function validateFormat(format) {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n };\n}\n\nfunction invariant(condition, format, a, b, c, d, e, f) {\n validateFormat(format);\n\n if (!condition) {\n var error;\n if (format === undefined) {\n error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n error = new Error(format.replace(/%s/g, function () {\n return args[argIndex++];\n }));\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n}\n\nmodule.exports = invariant;\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar _isExisty = function _isExisty(value) {\n return value !== null && value !== undefined;\n};\nvar isEmpty = function isEmpty(value) {\n return value === '';\n};\n\nvar validations = {\n isDefaultRequiredValue: function isDefaultRequiredValue(values, value) {\n return value === undefined || value === null || value === '';\n },\n isExisty: function isExisty(values, value) {\n return _isExisty(value);\n },\n matchRegexp: function matchRegexp(values, value, regexp) {\n return !_isExisty(value) || isEmpty(value) || regexp.test(value);\n },\n isUndefined: function isUndefined(values, value) {\n return value === undefined;\n },\n isEmptyString: function isEmptyString(values, value) {\n return isEmpty(value);\n },\n isEmail: function isEmail(values, value) {\n // Regex from http://emailregex.com/\n return validations.matchRegexp(values, value, /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/i);\n },\n isUrl: function isUrl(values, value) {\n return validations.matchRegexp(values, value, /^(?:\\w+:)?\\/\\/([^\\s.]+\\.\\S{2}|localhost[:?\\d]*)\\S*$/i);\n },\n isTrue: function isTrue(values, value) {\n return value === true;\n },\n isFalse: function isFalse(values, value) {\n return value === false;\n },\n isNumeric: function isNumeric(values, value) {\n if (typeof value === 'number') {\n return true;\n }\n return validations.matchRegexp(values, value, /^[-+]?(?:\\d*[.])?\\d+$/);\n },\n isAlpha: function isAlpha(values, value) {\n return validations.matchRegexp(values, value, /^[A-Z]+$/i);\n },\n isAlphanumeric: function isAlphanumeric(values, value) {\n return validations.matchRegexp(values, value, /^[0-9A-Z]+$/i);\n },\n isInt: function isInt(values, value) {\n return validations.matchRegexp(values, value, /^(?:[-+]?(?:0|[1-9]\\d*))$/);\n },\n isFloat: function isFloat(values, value) {\n return validations.matchRegexp(values, value, /^(?:[-+]?(?:\\d+))?(?:\\.\\d*)?(?:[eE][+-]?(?:\\d+))?$/);\n },\n isWords: function isWords(values, value) {\n return validations.matchRegexp(values, value, /^[A-Z\\s]+$/i);\n },\n isSpecialWords: function isSpecialWords(values, value) {\n return validations.matchRegexp(values, value, /^[A-Z\\s\\u00C0-\\u017F]+$/i);\n },\n isLength: function isLength(values, value, length) {\n return !_isExisty(value) || isEmpty(value) || value.length === length;\n },\n equals: function equals(values, value, eql) {\n return !_isExisty(value) || isEmpty(value) || value === eql;\n },\n equalsField: function equalsField(values, value, field) {\n return value === values[field];\n },\n maxLength: function maxLength(values, value, length) {\n return !_isExisty(value) || value.length <= length;\n },\n minLength: function minLength(values, value, length) {\n return !_isExisty(value) || isEmpty(value) || value.length >= length;\n }\n};\n\nexports.default = validations;\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.propTypes = undefined;\n\nvar _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; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _propTypes = __webpack_require__(0);\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _react = __webpack_require__(1);\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _utils = __webpack_require__(2);\n\nvar _utils2 = _interopRequireDefault(_utils);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/* eslint-disable react/default-props-match-prop-types */\n\nvar convertValidationsToObject = function convertValidationsToObject(validations) {\n if (typeof validations === 'string') {\n return validations.split(/,(?![^{[]*[}\\]])/g).reduce(function (validationsAccumulator, validation) {\n var args = validation.split(':');\n var validateMethod = args.shift();\n\n args = args.map(function (arg) {\n try {\n return JSON.parse(arg);\n } catch (e) {\n return arg; // It is a string if it can not parse it\n }\n });\n\n if (args.length > 1) {\n throw new Error('Formsy does not support multiple args on string validations. Use object format of validations instead.');\n }\n\n // Avoid parameter reassignment\n var validationsAccumulatorCopy = Object.assign({}, validationsAccumulator);\n validationsAccumulatorCopy[validateMethod] = args.length ? args[0] : true;\n return validationsAccumulatorCopy;\n }, {});\n }\n\n return validations || {};\n};\n\nvar propTypes = {\n innerRef: _propTypes2.default.func,\n name: _propTypes2.default.string.isRequired,\n required: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.object, _propTypes2.default.string]),\n validations: _propTypes2.default.oneOfType([_propTypes2.default.object, _propTypes2.default.string]),\n value: _propTypes2.default.any // eslint-disable-line react/forbid-prop-types\n};\n\nexports.propTypes = propTypes;\n\nexports.default = function (Component) {\n var WrappedComponent = function (_React$Component) {\n _inherits(WrappedComponent, _React$Component);\n\n function WrappedComponent(props) {\n _classCallCheck(this, WrappedComponent);\n\n var _this = _possibleConstructorReturn(this, (WrappedComponent.__proto__ || Object.getPrototypeOf(WrappedComponent)).call(this, props));\n\n _this.getErrorMessage = function () {\n var messages = _this.getErrorMessages();\n return messages.length ? messages[0] : null;\n };\n\n _this.getErrorMessages = function () {\n if (!_this.isValid() || _this.showRequired()) {\n return _this.state.externalError || _this.state.validationError || [];\n }\n return [];\n };\n\n _this.getValue = function () {\n return _this.state.value;\n };\n\n _this.setValidations = function (validations, required) {\n // Add validations to the store itself as the props object can not be modified\n _this.validations = convertValidationsToObject(validations) || {};\n _this.requiredValidations = required === true ? { isDefaultRequiredValue: true } : convertValidationsToObject(required);\n };\n\n _this.setValue = function (value) {\n var validate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n if (!validate) {\n _this.setState({\n value: value\n });\n } else {\n _this.setState({\n value: value,\n isPristine: false\n }, function () {\n _this.context.formsy.validate(_this);\n });\n }\n };\n\n _this.hasValue = function () {\n return _this.state.value !== '';\n };\n\n _this.isFormDisabled = function () {\n return _this.context.formsy.isFormDisabled();\n };\n\n _this.isFormSubmitted = function () {\n return _this.state.formSubmitted;\n };\n\n _this.isPristine = function () {\n return _this.state.isPristine;\n };\n\n _this.isRequired = function () {\n return !!_this.props.required;\n };\n\n _this.isValid = function () {\n return _this.state.isValid;\n };\n\n _this.isValidValue = function (value) {\n return _this.context.formsy.isValidValue.call(null, _this, value);\n };\n\n _this.resetValue = function () {\n _this.setState({\n value: _this.state.pristineValue,\n isPristine: true\n }, function () {\n _this.context.formsy.validate(_this);\n });\n };\n\n _this.showError = function () {\n return !_this.showRequired() && !_this.isValid();\n };\n\n _this.showRequired = function () {\n return _this.state.isRequired;\n };\n\n _this.state = {\n value: props.value,\n isRequired: false,\n isValid: true,\n isPristine: true,\n pristineValue: props.value,\n validationError: [],\n externalError: null,\n formSubmitted: false\n };\n return _this;\n }\n\n _createClass(WrappedComponent, [{\n key: 'componentWillMount',\n value: function componentWillMount() {\n var _this2 = this;\n\n var configure = function configure() {\n _this2.setValidations(_this2.props.validations, _this2.props.required);\n\n // Pass a function instead?\n _this2.context.formsy.attachToForm(_this2);\n };\n\n if (!this.props.name) {\n throw new Error('Form Input requires a name property when used');\n }\n\n configure();\n }\n\n // We have to make sure the validate method is kept when new props are added\n\n }, {\n key: 'componentWillReceiveProps',\n value: function componentWillReceiveProps(nextProps) {\n this.setValidations(nextProps.validations, nextProps.required);\n }\n }, {\n key: 'componentDidUpdate',\n value: function componentDidUpdate(prevProps) {\n // If the value passed has changed, set it. If value is not passed it will\n // internally update, and this will never run\n if (!_utils2.default.isSame(this.props.value, prevProps.value)) {\n this.setValue(this.props.value);\n }\n\n // If validations or required is changed, run a new validation\n if (!_utils2.default.isSame(this.props.validations, prevProps.validations) || !_utils2.default.isSame(this.props.required, prevProps.required)) {\n this.context.formsy.validate(this);\n }\n }\n\n // Detach it when component unmounts\n\n }, {\n key: 'componentWillUnmount',\n value: function componentWillUnmount() {\n this.context.formsy.detachFromForm(this);\n }\n\n // By default, we validate after the value has been set.\n // A user can override this and pass a second parameter of `false` to skip validation.\n\n }, {\n key: 'render',\n value: function render() {\n var innerRef = this.props.innerRef;\n\n var propsForElement = _extends({}, this.props, {\n errorMessage: this.getErrorMessage(),\n errorMessages: this.getErrorMessages(),\n hasValue: this.hasValue(),\n isFormDisabled: this.isFormDisabled(),\n isFormSubmitted: this.isFormSubmitted(),\n isPristine: this.isPristine(),\n isRequired: this.isRequired(),\n isValid: this.isValid(),\n isValidValue: this.isValidValue,\n resetValue: this.resetValue,\n setValidations: this.setValidations,\n setValue: this.setValue,\n showError: this.showError(),\n showRequired: this.showRequired(),\n value: this.getValue()\n });\n\n if (innerRef) {\n propsForElement.ref = innerRef;\n }\n\n return _react2.default.createElement(Component, propsForElement);\n }\n }]);\n\n return WrappedComponent;\n }(_react2.default.Component);\n\n function getDisplayName(component) {\n return component.displayName || component.name || (typeof component === 'string' ? component : 'Component');\n }\n\n WrappedComponent.displayName = 'Formsy(' + getDisplayName(Component) + ')';\n\n WrappedComponent.contextTypes = {\n formsy: _propTypes2.default.object // What about required?\n };\n\n WrappedComponent.defaultProps = {\n innerRef: function innerRef() {},\n required: false,\n validationError: '',\n validationErrors: {},\n validations: null,\n value: Component.defaultValue\n };\n\n WrappedComponent.propTypes = propTypes;\n\n return WrappedComponent;\n};\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// formsy-react.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 0585d53e8003c01a0ced","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&\n Symbol.for &&\n Symbol.for('react.element')) ||\n 0xeac7;\n\n var isValidElement = function(object) {\n return typeof object === 'object' &&\n object !== null &&\n object.$$typeof === REACT_ELEMENT_TYPE;\n };\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/prop-types/index.js\n// module id = 0\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"root\":\"React\",\"commonjs2\":\"react\",\"commonjs\":\"react\",\"amd\":\"react\",\"umd\":\"react\"}\n// module id = 1\n// module chunks = 0","export default {\n arraysDiffer(a, b) {\n let isDifferent = false;\n if (a.length !== b.length) {\n isDifferent = true;\n } else {\n a.forEach((item, index) => {\n if (!this.isSame(item, b[index])) {\n isDifferent = true;\n }\n }, this);\n }\n return isDifferent;\n },\n\n objectsDiffer(a, b) {\n let isDifferent = false;\n if (Object.keys(a).length !== Object.keys(b).length) {\n isDifferent = true;\n } else {\n Object.keys(a).forEach((key) => {\n if (!this.isSame(a[key], b[key])) {\n isDifferent = true;\n }\n }, this);\n }\n return isDifferent;\n },\n\n isSame(a, b) {\n if (typeof a !== typeof b) {\n return false;\n } else if (Array.isArray(a) && Array.isArray(b)) {\n return !this.arraysDiffer(a, b);\n } else if (typeof a === 'function') {\n return a.toString() === b.toString();\n } else if (typeof a === 'object' && a !== null && b !== null) {\n return !this.objectsDiffer(a, b);\n }\n\n return a === b;\n },\n\n find(collection, fn) {\n for (let i = 0, l = collection.length; i < l; i += 1) {\n const item = collection[i];\n if (fn(item)) {\n return item;\n }\n }\n return null;\n },\n\n runRules(value, currentValues, validations, validationRules) {\n const results = {\n errors: [],\n failed: [],\n success: [],\n };\n\n if (Object.keys(validations).length) {\n Object.keys(validations).forEach((validationMethod) => {\n if (validationRules[validationMethod] && typeof validations[validationMethod] === 'function') {\n throw new Error(`Formsy does not allow you to override default validations: ${validationMethod}`);\n }\n\n if (!validationRules[validationMethod] && typeof validations[validationMethod] !== 'function') {\n throw new Error(`Formsy does not have the validation rule: ${validationMethod}`);\n }\n\n if (typeof validations[validationMethod] === 'function') {\n const validation = validations[validationMethod](currentValues, value);\n if (typeof validation === 'string') {\n results.errors.push(validation);\n results.failed.push(validationMethod);\n } else if (!validation) {\n results.failed.push(validationMethod);\n }\n return;\n } else if (typeof validations[validationMethod] !== 'function') {\n const validation = validationRules[validationMethod](\n currentValues,\n value,\n validations[validationMethod],\n );\n\n if (typeof validation === 'string') {\n results.errors.push(validation);\n results.failed.push(validationMethod);\n } else if (!validation) {\n results.failed.push(validationMethod);\n } else {\n results.success.push(validationMethod);\n }\n return;\n }\n\n results.success.push(validationMethod);\n });\n }\n\n return results;\n },\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/utils.js","import formDataToObject from 'form-data-to-object';\nimport PropTypes from 'prop-types';\nimport React from 'react';\n\nimport utils from './utils';\nimport validationRules from './validationRules';\nimport Wrapper, { propTypes } from './Wrapper';\n\n/* eslint-disable react/no-unused-state, react/default-props-match-prop-types */\n\nclass Formsy extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n isValid: true,\n isSubmitting: false,\n canChange: false,\n };\n this.inputs = [];\n }\n\n getChildContext = () => (\n {\n formsy: {\n attachToForm: this.attachToForm,\n detachFromForm: this.detachFromForm,\n validate: this.validate,\n isFormDisabled: this.isFormDisabled,\n isValidValue: (component, value) => this.runValidation(component, value).isValid,\n },\n }\n )\n\n componentDidMount = () => {\n this.validateForm();\n }\n\n componentWillUpdate = () => {\n // Keep a reference to input names before form updates,\n // to check if inputs has changed after render\n this.prevInputNames = this.inputs.map(component => component.props.name);\n }\n\n componentDidUpdate = () => {\n if (this.props.validationErrors && typeof this.props.validationErrors === 'object' && Object.keys(this.props.validationErrors).length > 0) {\n this.setInputValidationErrors(this.props.validationErrors);\n }\n\n const newInputNames = this.inputs.map(component => component.props.name);\n if (utils.arraysDiffer(this.prevInputNames, newInputNames)) {\n this.validateForm();\n }\n }\n\n getCurrentValues = () => (\n this.inputs.reduce((data, component) => {\n const { name } = component.props;\n const dataCopy = Object.assign({}, data); // avoid param reassignment\n dataCopy[name] = component.state.value;\n return dataCopy;\n }, {})\n )\n\n getModel = () => {\n const currentValues = this.getCurrentValues();\n return this.mapModel(currentValues);\n }\n\n getPristineValues = () => (\n this.inputs.reduce((data, component) => {\n const { name } = component.props;\n const dataCopy = Object.assign({}, data); // avoid param reassignment\n dataCopy[name] = component.props.value;\n return dataCopy;\n }, {})\n )\n\n setFormPristine = (isPristine) => {\n this.setState({\n formSubmitted: !isPristine,\n });\n\n // Iterate through each component and set it as pristine\n // or \"dirty\".\n this.inputs.forEach((component) => {\n component.setState({\n formSubmitted: !isPristine,\n isPristine,\n });\n });\n }\n\n setInputValidationErrors = (errors) => {\n this.inputs.forEach((component) => {\n const { name } = component.props;\n const args = [{\n isValid: !(name in errors),\n validationError: typeof errors[name] === 'string' ? [errors[name]] : errors[name],\n }];\n component.setState(...args);\n });\n }\n\n isFormDisabled = () => this.props.disabled;\n\n mapModel = (model) => {\n if (this.props.mapping) {\n return this.props.mapping(model);\n }\n\n return formDataToObject.toObj(Object.keys(model).reduce((mappedModel, key) => {\n const keyArray = key.split('.');\n let base = mappedModel;\n while (keyArray.length) {\n const currentKey = keyArray.shift();\n base[currentKey] = (keyArray.length ? base[currentKey] || {} : model[key]);\n base = base[currentKey];\n }\n return mappedModel;\n }, {}));\n }\n\n reset = (data) => {\n this.setFormPristine(true);\n this.resetModel(data);\n }\n\n resetInternal = (event) => {\n event.preventDefault();\n this.reset();\n if (this.props.onReset) {\n this.props.onReset();\n }\n }\n\n // Reset each key in the model to the original / initial / specified value\n resetModel = (data) => {\n this.inputs.forEach((component) => {\n const { name } = component.props;\n if (data && Object.prototype.hasOwnProperty.call(data, name)) {\n component.setValue(data[name]);\n } else {\n component.resetValue();\n }\n });\n this.validateForm();\n }\n\n // Checks validation on current value or a passed value\n runValidation = (component, value = component.state.value) => {\n const currentValues = this.getCurrentValues();\n const {\n validationError,\n validationErrors,\n } = component.props;\n\n const validationResults = utils.runRules(\n value,\n currentValues,\n component.validations,\n validationRules,\n );\n\n const requiredResults = utils.runRules(\n value,\n currentValues,\n component.requiredValidations,\n validationRules,\n );\n\n const isRequired = Object.keys(component.requiredValidations).length ?\n !!requiredResults.success.length : false;\n const isValid = !validationResults.failed.length &&\n !(this.props.validationErrors && this.props.validationErrors[component.props.name]);\n\n return {\n isRequired,\n isValid: isRequired ? false : isValid,\n error: (() => {\n if (isValid && !isRequired) {\n return [];\n }\n\n if (validationResults.errors.length) {\n return validationResults.errors;\n }\n\n if (this.props.validationErrors && this.props.validationErrors[component.props.name]) {\n return typeof this.props.validationErrors[component.props.name] === 'string' ? [this.props.validationErrors[component.props.name]] : this.props.validationErrors[component.props.name];\n }\n\n if (isRequired) {\n const error = validationErrors[requiredResults.success[0]];\n return error ? [error] : null;\n }\n\n if (validationResults.failed.length) {\n return validationResults.failed.map(failed =>\n (validationErrors[failed] ? validationErrors[failed] : validationError))\n .filter((x, pos, arr) => arr.indexOf(x) === pos); // remove duplicates\n }\n\n return undefined;\n })(),\n };\n }\n\n // Method put on each input component to register\n // itself to the form\n attachToForm = (component) => {\n if (this.inputs.indexOf(component) === -1) {\n this.inputs.push(component);\n }\n\n this.validate(component);\n }\n\n // Method put on each input component to unregister\n // itself from the form\n detachFromForm = (component) => {\n const componentPos = this.inputs.indexOf(component);\n\n if (componentPos !== -1) {\n this.inputs = this.inputs.slice(0, componentPos).concat(this.inputs.slice(componentPos + 1));\n }\n\n this.validateForm();\n }\n\n // Checks if the values have changed from their initial value\n isChanged = () => !utils.isSame(this.getPristineValues(), this.getCurrentValues());\n\n // Update model, submit to url prop and send the model\n submit = (event) => {\n if (event && event.preventDefault) {\n event.preventDefault();\n }\n\n // Trigger form as not pristine.\n // If any inputs have not been touched yet this will make them dirty\n // so validation becomes visible (if based on isPristine)\n this.setFormPristine(false);\n const model = this.getModel();\n this.props.onSubmit(model, this.resetModel, this.updateInputsWithError);\n if (this.state.isValid) {\n this.props.onValidSubmit(model, this.resetModel, this.updateInputsWithError);\n } else {\n this.props.onInvalidSubmit(model, this.resetModel, this.updateInputsWithError);\n }\n }\n\n // Go through errors from server and grab the components\n // stored in the inputs map. Change their state to invalid\n // and set the serverError message\n updateInputsWithError = (errors) => {\n Object.keys(errors).forEach((name) => {\n const component = utils.find(this.inputs, input => input.props.name === name);\n if (!component) {\n throw new Error(`You are trying to update an input that does not exist. Verify errors object with input names. ${JSON.stringify(errors)}`);\n }\n const args = [{\n isValid: this.props.preventExternalInvalidation,\n externalError: typeof errors[name] === 'string' ? [errors[name]] : errors[name],\n }];\n component.setState(...args);\n });\n }\n\n // Use the binded values and the actual input value to\n // validate the input and set its state. Then check the\n // state of the form itself\n validate = (component) => {\n // Trigger onChange\n if (this.state.canChange) {\n this.props.onChange(this.getModel(), this.isChanged());\n }\n\n const validation = this.runValidation(component);\n // Run through the validations, split them up and call\n // the validator IF there is a value or it is required\n component.setState({\n isValid: validation.isValid,\n isRequired: validation.isRequired,\n validationError: validation.error,\n externalError: null,\n }, this.validateForm);\n }\n\n // Validate the form by going through all child input components\n // and check their state\n validateForm = () => {\n // We need a callback as we are validating all inputs again. This will\n // run when the last component has set its state\n const onValidationComplete = () => {\n const allIsValid = this.inputs.every(component => component.state.isValid);\n\n this.setState({\n isValid: allIsValid,\n });\n\n if (allIsValid) {\n this.props.onValid();\n } else {\n this.props.onInvalid();\n }\n\n // Tell the form that it can start to trigger change events\n this.setState({\n canChange: true,\n });\n };\n\n // Run validation again in case affected by other inputs. The\n // last component validated will run the onValidationComplete callback\n this.inputs.forEach((component, index) => {\n const validation = this.runValidation(component);\n if (validation.isValid && component.state.externalError) {\n validation.isValid = false;\n }\n component.setState({\n isValid: validation.isValid,\n isRequired: validation.isRequired,\n validationError: validation.error,\n externalError: !validation.isValid && component.state.externalError ?\n component.state.externalError : null,\n }, index === this.inputs.length - 1 ? onValidationComplete : null);\n });\n\n // If there are no inputs, set state where form is ready to trigger\n // change event. New inputs might be added later\n if (!this.inputs.length) {\n this.setState({\n canChange: true,\n });\n }\n }\n\n render = () => {\n const {\n getErrorMessage,\n getErrorMessages,\n getValue,\n hasValue,\n isFormDisabled,\n isFormSubmitted,\n isPristine,\n isRequired,\n isValid,\n isValidValue,\n mapping,\n onChange,\n // onError,\n onInvalidSubmit,\n onInvalid,\n onReset,\n onSubmit,\n onValid,\n onValidSubmit,\n preventExternalInvalidation,\n // reset,\n resetValue,\n setValidations,\n setValue,\n showError,\n showRequired,\n validationErrors,\n ...nonFormsyProps\n } = this.props;\n\n return React.createElement(\n 'form',\n {\n onReset: this.resetInternal,\n onSubmit: this.submit,\n ...nonFormsyProps,\n disabled: false,\n },\n this.props.children,\n );\n }\n}\n\nFormsy.displayName = 'Formsy';\n\nFormsy.defaultProps = {\n children: null,\n disabled: false,\n getErrorMessage: () => {},\n getErrorMessages: () => {},\n getValue: () => {},\n hasValue: () => {},\n isFormDisabled: () => {},\n isFormSubmitted: () => {},\n isPristine: () => {},\n isRequired: () => {},\n isValid: () => {},\n isValidValue: () => {},\n mapping: null,\n onChange: () => {},\n onError: () => {},\n onInvalid: () => {},\n onInvalidSubmit: () => {},\n onReset: () => {},\n onSubmit: () => {},\n onValid: () => {},\n onValidSubmit: () => {},\n preventExternalInvalidation: false,\n resetValue: () => {},\n setValidations: () => {},\n setValue: () => {},\n showError: () => {},\n showRequired: () => {},\n validationErrors: null,\n};\n\nFormsy.propTypes = {\n children: PropTypes.node,\n disabled: PropTypes.bool,\n getErrorMessage: PropTypes.func,\n getErrorMessages: PropTypes.func,\n getValue: PropTypes.func,\n hasValue: PropTypes.func,\n isFormDisabled: PropTypes.func,\n isFormSubmitted: PropTypes.func,\n isPristine: PropTypes.func,\n isRequired: PropTypes.func,\n isValid: PropTypes.func,\n isValidValue: PropTypes.func,\n mapping: PropTypes.func,\n onChange: PropTypes.func,\n onInvalid: PropTypes.func,\n onInvalidSubmit: PropTypes.func,\n onReset: PropTypes.func,\n onSubmit: PropTypes.func,\n onValid: PropTypes.func,\n onValidSubmit: PropTypes.func,\n preventExternalInvalidation: PropTypes.bool,\n resetValue: PropTypes.func,\n setValidations: PropTypes.func,\n setValue: PropTypes.func,\n showError: PropTypes.func,\n showRequired: PropTypes.func,\n validationErrors: PropTypes.object, // eslint-disable-line\n};\n\nFormsy.childContextTypes = {\n formsy: PropTypes.object,\n};\n\nconst addValidationRule = (name, func) => {\n validationRules[name] = func;\n};\n\nconst withFormsy = Wrapper;\n\nlet didWarnAboutWrapperDeprecation = false;\n\nconst deprecatedWrapper = (Component) => {\n if (!didWarnAboutWrapperDeprecation) {\n // eslint-disable-next-line no-console\n console.warn('Wrapper has been renamed to withFormsy. Importing Wrapper from formsy-react is depreacted and will be removed in the future. Please rename your Wrapper imports to withFormsy.');\n didWarnAboutWrapperDeprecation = true;\n }\n\n return withFormsy(Component);\n};\n\nexport {\n addValidationRule,\n propTypes,\n validationRules,\n withFormsy,\n deprecatedWrapper as Wrapper,\n};\n\nexport default Formsy;\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","function toObj(source) {\n return Object.keys(source).reduce(function (output, key) {\n var parentKey = key.match(/[^\\[]*/i);\n var paths = key.match(/\\[.*?\\]/g) || [];\n paths = [parentKey[0]].concat(paths).map(function (key) {\n return key.replace(/\\[|\\]/g, '');\n });\n var currentPath = output;\n while (paths.length) {\n var pathKey = paths.shift();\n\n if (pathKey in currentPath) {\n currentPath = currentPath[pathKey];\n } else {\n currentPath[pathKey] = paths.length ? isNaN(paths[0]) ? {} : [] : source[key];\n currentPath = currentPath[pathKey];\n }\n }\n\n return output;\n }, {});\n}\n\nfunction fromObj(obj) {\n function recur(newObj, propName, currVal) {\n if (Array.isArray(currVal) || Object.prototype.toString.call(currVal) === '[object Object]') {\n Object.keys(currVal).forEach(function(v) {\n recur(newObj, propName + \"[\" + v + \"]\", currVal[v]);\n });\n return newObj;\n }\n\n newObj[propName] = currVal;\n return newObj;\n }\n\n var keys = Object.keys(obj);\n return keys.reduce(function(newObj, propName) {\n return recur(newObj, propName, obj[propName]);\n }, {});\n}\n\nmodule.exports = {\n fromObj: fromObj,\n toObj: toObj\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/form-data-to-object/index.js\n// module id = 4\n// module chunks = 0","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar emptyFunction = require('fbjs/lib/emptyFunction');\nvar invariant = require('fbjs/lib/invariant');\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n invariant(\n false,\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim\n };\n\n ReactPropTypes.checkPropTypes = emptyFunction;\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/prop-types/factoryWithThrowingShims.js\n// module id = 5\n// module chunks = 0","\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nfunction makeEmptyFunction(arg) {\n return function () {\n return arg;\n };\n}\n\n/**\n * This function accepts and discards inputs; it has no side effects. This is\n * primarily useful idiomatically for overridable function endpoints which\n * always need to be callable, since JS lacks a null-call idiom ala Cocoa.\n */\nvar emptyFunction = function emptyFunction() {};\n\nemptyFunction.thatReturns = makeEmptyFunction;\nemptyFunction.thatReturnsFalse = makeEmptyFunction(false);\nemptyFunction.thatReturnsTrue = makeEmptyFunction(true);\nemptyFunction.thatReturnsNull = makeEmptyFunction(null);\nemptyFunction.thatReturnsThis = function () {\n return this;\n};\nemptyFunction.thatReturnsArgument = function (arg) {\n return arg;\n};\n\nmodule.exports = emptyFunction;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/fbjs/lib/emptyFunction.js\n// module id = 6\n// module chunks = 0","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n'use strict';\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar validateFormat = function validateFormat(format) {};\n\nif (process.env.NODE_ENV !== 'production') {\n validateFormat = function validateFormat(format) {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n };\n}\n\nfunction invariant(condition, format, a, b, c, d, e, f) {\n validateFormat(format);\n\n if (!condition) {\n var error;\n if (format === undefined) {\n error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n error = new Error(format.replace(/%s/g, function () {\n return args[argIndex++];\n }));\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n}\n\nmodule.exports = invariant;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/fbjs/lib/invariant.js\n// module id = 7\n// module chunks = 0","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/prop-types/lib/ReactPropTypesSecret.js\n// module id = 8\n// module chunks = 0","const isExisty = value => value !== null && value !== undefined;\nconst isEmpty = value => value === '';\n\nconst validations = {\n isDefaultRequiredValue(values, value) {\n return value === undefined || value === null || value === '';\n },\n isExisty(values, value) {\n return isExisty(value);\n },\n matchRegexp(values, value, regexp) {\n return !isExisty(value) || isEmpty(value) || regexp.test(value);\n },\n isUndefined(values, value) {\n return value === undefined;\n },\n isEmptyString(values, value) {\n return isEmpty(value);\n },\n isEmail(values, value) {\n // Regex from http://emailregex.com/\n return validations.matchRegexp(values, value, /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/i);\n },\n isUrl(values, value) {\n return validations.matchRegexp(values, value, /^(?:\\w+:)?\\/\\/([^\\s.]+\\.\\S{2}|localhost[:?\\d]*)\\S*$/i);\n },\n isTrue(values, value) {\n return value === true;\n },\n isFalse(values, value) {\n return value === false;\n },\n isNumeric(values, value) {\n if (typeof value === 'number') {\n return true;\n }\n return validations.matchRegexp(values, value, /^[-+]?(?:\\d*[.])?\\d+$/);\n },\n isAlpha(values, value) {\n return validations.matchRegexp(values, value, /^[A-Z]+$/i);\n },\n isAlphanumeric(values, value) {\n return validations.matchRegexp(values, value, /^[0-9A-Z]+$/i);\n },\n isInt(values, value) {\n return validations.matchRegexp(values, value, /^(?:[-+]?(?:0|[1-9]\\d*))$/);\n },\n isFloat(values, value) {\n return validations.matchRegexp(values, value, /^(?:[-+]?(?:\\d+))?(?:\\.\\d*)?(?:[eE][+-]?(?:\\d+))?$/);\n },\n isWords(values, value) {\n return validations.matchRegexp(values, value, /^[A-Z\\s]+$/i);\n },\n isSpecialWords(values, value) {\n return validations.matchRegexp(values, value, /^[A-Z\\s\\u00C0-\\u017F]+$/i);\n },\n isLength(values, value, length) {\n return !isExisty(value) || isEmpty(value) || value.length === length;\n },\n equals(values, value, eql) {\n return !isExisty(value) || isEmpty(value) || value === eql;\n },\n equalsField(values, value, field) {\n return value === values[field];\n },\n maxLength(values, value, length) {\n return !isExisty(value) || value.length <= length;\n },\n minLength(values, value, length) {\n return !isExisty(value) || isEmpty(value) || value.length >= length;\n },\n};\n\nexport default validations;\n\n\n\n// WEBPACK FOOTER //\n// ./src/validationRules.js","import PropTypes from 'prop-types';\nimport React from 'react';\nimport utils from './utils';\n\n/* eslint-disable react/default-props-match-prop-types */\n\nconst convertValidationsToObject = (validations) => {\n if (typeof validations === 'string') {\n return validations.split(/,(?![^{[]*[}\\]])/g).reduce((validationsAccumulator, validation) => {\n let args = validation.split(':');\n const validateMethod = args.shift();\n\n args = args.map((arg) => {\n try {\n return JSON.parse(arg);\n } catch (e) {\n return arg; // It is a string if it can not parse it\n }\n });\n\n if (args.length > 1) {\n throw new Error('Formsy does not support multiple args on string validations. Use object format of validations instead.');\n }\n\n // Avoid parameter reassignment\n const validationsAccumulatorCopy = Object.assign({}, validationsAccumulator);\n validationsAccumulatorCopy[validateMethod] = args.length ? args[0] : true;\n return validationsAccumulatorCopy;\n }, {});\n }\n\n return validations || {};\n};\n\nconst propTypes = {\n innerRef: PropTypes.func,\n name: PropTypes.string.isRequired,\n required: PropTypes.oneOfType([\n PropTypes.bool,\n PropTypes.object,\n PropTypes.string,\n ]),\n validations: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.string,\n ]),\n value: PropTypes.any, // eslint-disable-line react/forbid-prop-types\n};\n\nexport {\n propTypes,\n};\n\nexport default (Component) => {\n class WrappedComponent extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n value: props.value,\n isRequired: false,\n isValid: true,\n isPristine: true,\n pristineValue: props.value,\n validationError: [],\n externalError: null,\n formSubmitted: false,\n };\n }\n\n componentWillMount() {\n const configure = () => {\n this.setValidations(this.props.validations, this.props.required);\n\n // Pass a function instead?\n this.context.formsy.attachToForm(this);\n };\n\n if (!this.props.name) {\n throw new Error('Form Input requires a name property when used');\n }\n\n configure();\n }\n\n // We have to make sure the validate method is kept when new props are added\n componentWillReceiveProps(nextProps) {\n this.setValidations(nextProps.validations, nextProps.required);\n }\n\n componentDidUpdate(prevProps) {\n // If the value passed has changed, set it. If value is not passed it will\n // internally update, and this will never run\n if (!utils.isSame(this.props.value, prevProps.value)) {\n this.setValue(this.props.value);\n }\n\n // If validations or required is changed, run a new validation\n if (!utils.isSame(this.props.validations, prevProps.validations) ||\n !utils.isSame(this.props.required, prevProps.required)) {\n this.context.formsy.validate(this);\n }\n }\n\n // Detach it when component unmounts\n componentWillUnmount() {\n this.context.formsy.detachFromForm(this);\n }\n\n getErrorMessage = () => {\n const messages = this.getErrorMessages();\n return messages.length ? messages[0] : null;\n }\n\n getErrorMessages = () => {\n if (!this.isValid() || this.showRequired()) {\n return this.state.externalError || this.state.validationError || [];\n }\n return [];\n }\n\n getValue = () => this.state.value;\n\n setValidations = (validations, required) => {\n // Add validations to the store itself as the props object can not be modified\n this.validations = convertValidationsToObject(validations) || {};\n this.requiredValidations = required === true ? { isDefaultRequiredValue: true } :\n convertValidationsToObject(required);\n }\n\n // By default, we validate after the value has been set.\n // A user can override this and pass a second parameter of `false` to skip validation.\n setValue = (value, validate = true) => {\n if (!validate) {\n this.setState({\n value,\n });\n } else {\n this.setState({\n value,\n isPristine: false,\n }, () => {\n this.context.formsy.validate(this);\n });\n }\n }\n\n hasValue = () => this.state.value !== '';\n\n isFormDisabled = () => this.context.formsy.isFormDisabled();\n\n isFormSubmitted = () => this.state.formSubmitted;\n\n isPristine = () => this.state.isPristine;\n\n isRequired = () => !!this.props.required;\n\n isValid = () => this.state.isValid;\n\n isValidValue = value =>\n this.context.formsy.isValidValue.call(null, this, value);\n\n resetValue = () => {\n this.setState({\n value: this.state.pristineValue,\n isPristine: true,\n }, () => {\n this.context.formsy.validate(this);\n });\n }\n\n showError = () => !this.showRequired() && !this.isValid();\n\n showRequired = () => this.state.isRequired;\n\n render() {\n const { innerRef } = this.props;\n const propsForElement = {\n ...this.props,\n errorMessage: this.getErrorMessage(),\n errorMessages: this.getErrorMessages(),\n hasValue: this.hasValue(),\n isFormDisabled: this.isFormDisabled(),\n isFormSubmitted: this.isFormSubmitted(),\n isPristine: this.isPristine(),\n isRequired: this.isRequired(),\n isValid: this.isValid(),\n isValidValue: this.isValidValue,\n resetValue: this.resetValue,\n setValidations: this.setValidations,\n setValue: this.setValue,\n showError: this.showError(),\n showRequired: this.showRequired(),\n value: this.getValue(),\n };\n\n if (innerRef) {\n propsForElement.ref = innerRef;\n }\n\n return React.createElement(Component, propsForElement);\n }\n }\n\n function getDisplayName(component) {\n return (\n component.displayName ||\n component.name ||\n (typeof component === 'string' ? component : 'Component')\n );\n }\n\n WrappedComponent.displayName = `Formsy(${getDisplayName(Component)})`;\n\n WrappedComponent.contextTypes = {\n formsy: PropTypes.object, // What about required?\n };\n\n WrappedComponent.defaultProps = {\n innerRef: () => {},\n required: false,\n validationError: '',\n validationErrors: {},\n validations: null,\n value: Component.defaultValue,\n };\n\n WrappedComponent.propTypes = propTypes;\n\n return WrappedComponent;\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/Wrapper.js"],"sourceRoot":""} \ No newline at end of file diff --git a/src/Wrapper.js b/src/Wrapper.js index 7df87a04..6d8c0f4f 100644 --- a/src/Wrapper.js +++ b/src/Wrapper.js @@ -175,22 +175,22 @@ export default (Component) => { render() { const { innerRef } = this.props; const propsForElement = { - getErrorMessage: this.getErrorMessage, - getErrorMessages: this.getErrorMessages, - getValue: this.getValue, - hasValue: this.hasValue, - isFormDisabled: this.isFormDisabled, - isValid: this.isValid, - isPristine: this.isPristine, - isFormSubmitted: this.isFormSubmitted, - isRequired: this.isRequired, + ...this.props, + errorMessage: this.getErrorMessage(), + errorMessages: this.getErrorMessages(), + hasValue: this.hasValue(), + isFormDisabled: this.isFormDisabled(), + isFormSubmitted: this.isFormSubmitted(), + isPristine: this.isPristine(), + isRequired: this.isRequired(), + isValid: this.isValid(), isValidValue: this.isValidValue, resetValue: this.resetValue, setValidations: this.setValidations, setValue: this.setValue, - showRequired: this.showRequired, - showError: this.showError, - ...this.props, + showError: this.showError(), + showRequired: this.showRequired(), + value: this.getValue(), }; if (innerRef) { diff --git a/tests/Element-spec.js b/tests/Element-spec.js index 514df0d7..0b869c75 100644 --- a/tests/Element-spec.js +++ b/tests/Element-spec.js @@ -9,7 +9,7 @@ import immediate from './utils/immediate'; export default { - 'should return passed and setValue() value when using getValue()': function (test) { + 'should pass down correct value prop after using setValue()': function (test) { const form = TestUtils.renderIntoDocument( @@ -33,7 +33,7 @@ export default { this.props.setValue(event.target.value, false); } render() { - return ; + return ; } }) const form = TestUtils.renderIntoDocument( @@ -60,7 +60,7 @@ export default { this.props.setValue(event.target.value, false); } render() { - return ; + return ; } }) const form = TestUtils.renderIntoDocument( @@ -105,10 +105,10 @@ export default { 'should return error message passed when calling getErrorMessage()': function (test) { - let getErrorMessage = null; + let errorMessage = null; const Input = InputFactory({ componentDidMount: function() { - getErrorMessage = this.props.getErrorMessage; + errorMessage = this.props.errorMessage; } }); TestUtils.renderIntoDocument( @@ -117,7 +117,7 @@ export default { ); - test.equal(getErrorMessage(), 'Has to be email'); + test.equal(errorMessage, 'Has to be email'); test.done(); @@ -127,8 +127,8 @@ export default { let isValid = null; const Input = InputFactory({ - componentDidMount: function() { - isValid = this.props.isValid; + componentWillReceiveProps: function(nextProps) { + isValid = nextProps.isValid; } }); const form = TestUtils.renderIntoDocument( @@ -137,10 +137,10 @@ export default { ); - test.equal(isValid(), false); + test.equal(isValid, false); const input = TestUtils.findRenderedDOMComponentWithTag(form, 'INPUT'); TestUtils.Simulate.change(input, {target: {value: 'foo@foo.com'}}); - test.equal(isValid(), true); + test.equal(isValid, true); test.done(); @@ -162,9 +162,9 @@ export default { ); - test.equal(isRequireds[0](), false); - test.equal(isRequireds[1](), true); - test.equal(isRequireds[2](), true); + test.equal(isRequireds[0], false); + test.equal(isRequireds[1], true); + test.equal(isRequireds[2], true); test.done(); @@ -186,9 +186,9 @@ export default { ); - test.equal(showRequireds[0](), false); - test.equal(showRequireds[1](), true); - test.equal(showRequireds[2](), false); + test.equal(showRequireds[0], false); + test.equal(showRequireds[1], true); + test.equal(showRequireds[2], false); test.done(); @@ -198,8 +198,8 @@ export default { let isPristine = null; const Input = InputFactory({ - componentDidMount: function() { - isPristine = this.props.isPristine; + componentWillReceiveProps: function(nextProps) { + isPristine = nextProps.isPristine; } }); const form = TestUtils.renderIntoDocument( @@ -208,10 +208,10 @@ export default { ); - test.equal(isPristine(), true); + test.equal(isPristine, true); const input = TestUtils.findRenderedDOMComponentWithTag(form, 'INPUT'); TestUtils.Simulate.change(input, {target: {value: 'foo'}}); - test.equal(isPristine(), false); + test.equal(isPristine, false); test.done(); @@ -594,7 +594,7 @@ export default { shouldComponentUpdate: function() { return false }, render: function() { renderSpy(); - return ; + return ; } }); @@ -613,21 +613,10 @@ export default { 'binds all necessary methods': function (test) { const onInputRef = input => { [ - 'getErrorMessage', - 'getErrorMessages', - 'getValue', - 'hasValue', - 'isFormDisabled', - 'isValid', - 'isPristine', - 'isFormSubmitted', - 'isRequired', 'isValidValue', 'resetValue', 'setValidations', 'setValue', - 'showRequired', - 'showError', ].forEach(fnName => { const fn = input[fnName]; try { diff --git a/tests/Rules-equals-spec.js b/tests/Rules-equals-spec.js index 673a3346..e529dd32 100644 --- a/tests/Rules-equals-spec.js +++ b/tests/Rules-equals-spec.js @@ -7,7 +7,7 @@ import { InputFactory } from './utils/TestInput'; const TestInput = InputFactory({ render: function() { - return ; + return ; } }); diff --git a/tests/Rules-isAlpha-spec.js b/tests/Rules-isAlpha-spec.js index f3b4e9c4..6c303307 100644 --- a/tests/Rules-isAlpha-spec.js +++ b/tests/Rules-isAlpha-spec.js @@ -6,7 +6,7 @@ import { InputFactory } from './utils/TestInput'; const TestInput = InputFactory({ render: function() { - return ; + return ; } }); diff --git a/tests/Rules-isAlphanumeric-spec.js b/tests/Rules-isAlphanumeric-spec.js index 8fa7c248..f21ef077 100644 --- a/tests/Rules-isAlphanumeric-spec.js +++ b/tests/Rules-isAlphanumeric-spec.js @@ -6,7 +6,7 @@ import { InputFactory } from './utils/TestInput'; const TestInput = InputFactory({ render() { - return ; + return ; } }); diff --git a/tests/Rules-isEmail-spec.js b/tests/Rules-isEmail-spec.js index c152c8d8..80ffebfb 100644 --- a/tests/Rules-isEmail-spec.js +++ b/tests/Rules-isEmail-spec.js @@ -6,7 +6,7 @@ import { InputFactory } from './utils/TestInput'; const TestInput = InputFactory({ render() { - return ; + return ; } }); diff --git a/tests/Rules-isEmptyString-spec.js b/tests/Rules-isEmptyString-spec.js index 95994357..93f23b26 100644 --- a/tests/Rules-isEmptyString-spec.js +++ b/tests/Rules-isEmptyString-spec.js @@ -6,7 +6,7 @@ import { InputFactory } from './utils/TestInput'; const TestInput = InputFactory({ render() { - return ; + return ; } }); diff --git a/tests/Rules-isExisty-spec.js b/tests/Rules-isExisty-spec.js index 086294e6..c672a942 100644 --- a/tests/Rules-isExisty-spec.js +++ b/tests/Rules-isExisty-spec.js @@ -6,7 +6,7 @@ import { InputFactory } from './utils/TestInput'; const TestInput = InputFactory({ render() { - return ; + return ; } }); diff --git a/tests/Rules-isFloat-spec.js b/tests/Rules-isFloat-spec.js index 3c6b01c6..36b212ea 100644 --- a/tests/Rules-isFloat-spec.js +++ b/tests/Rules-isFloat-spec.js @@ -6,7 +6,7 @@ import { InputFactory } from './utils/TestInput'; const TestInput = InputFactory({ render() { - return ; + return ; } }); diff --git a/tests/Rules-isInt-spec.js b/tests/Rules-isInt-spec.js index 28261e89..e083b121 100644 --- a/tests/Rules-isInt-spec.js +++ b/tests/Rules-isInt-spec.js @@ -6,7 +6,7 @@ import { InputFactory } from './utils/TestInput'; const TestInput = InputFactory({ render() { - return ; + return ; } }); diff --git a/tests/Rules-isLength-spec.js b/tests/Rules-isLength-spec.js index 85a3fd2d..c415b3ef 100644 --- a/tests/Rules-isLength-spec.js +++ b/tests/Rules-isLength-spec.js @@ -6,7 +6,7 @@ import { InputFactory } from './utils/TestInput'; const TestInput = InputFactory({ render() { - return ; + return ; } }); diff --git a/tests/Rules-isNumeric-spec.js b/tests/Rules-isNumeric-spec.js index 67928e26..af7ab7ff 100644 --- a/tests/Rules-isNumeric-spec.js +++ b/tests/Rules-isNumeric-spec.js @@ -6,7 +6,7 @@ import { InputFactory } from './utils/TestInput'; const TestInput = InputFactory({ render() { - return ; + return ; } }); diff --git a/tests/Rules-isUrl-spec.js b/tests/Rules-isUrl-spec.js index 86ae30fb..82f3aeb2 100644 --- a/tests/Rules-isUrl-spec.js +++ b/tests/Rules-isUrl-spec.js @@ -6,7 +6,7 @@ import { InputFactory } from './utils/TestInput'; const TestInput = InputFactory({ render() { - return ; + return ; } }); diff --git a/tests/Rules-isWords-spec.js b/tests/Rules-isWords-spec.js index 5cc390f5..450d0db8 100644 --- a/tests/Rules-isWords-spec.js +++ b/tests/Rules-isWords-spec.js @@ -6,7 +6,7 @@ import { InputFactory } from './utils/TestInput'; const TestInput = InputFactory({ render() { - return ; + return ; } }); diff --git a/tests/Rules-maxLength-spec.js b/tests/Rules-maxLength-spec.js index 980cb727..67e8616e 100644 --- a/tests/Rules-maxLength-spec.js +++ b/tests/Rules-maxLength-spec.js @@ -6,7 +6,7 @@ import { InputFactory } from './utils/TestInput'; const TestInput = InputFactory({ render() { - return ; + return ; } }); diff --git a/tests/Rules-minLength-spec.js b/tests/Rules-minLength-spec.js index 00b16d27..843c522d 100644 --- a/tests/Rules-minLength-spec.js +++ b/tests/Rules-minLength-spec.js @@ -6,7 +6,7 @@ import { InputFactory } from './utils/TestInput'; const TestInput = InputFactory({ render() { - return ; + return ; } }); diff --git a/tests/Validation-spec.js b/tests/Validation-spec.js index 63635d8b..150683b2 100644 --- a/tests/Validation-spec.js +++ b/tests/Validation-spec.js @@ -14,7 +14,7 @@ class MyTest extends React.Component { } render() { - return ; + return ; } } const FormsyTest = withFormsy(MyTest); @@ -125,7 +125,7 @@ export default { let isValid = false; const CustomInput = InputFactory({ componentDidMount: function() { - isValid = this.props.isValid(); + isValid = this.props.isValid; } }); const form = TestUtils.renderIntoDocument( diff --git a/tests/ValidationDeprecated-spec.js b/tests/ValidationDeprecated-spec.js index 36a7b935..2dc9f30a 100644 --- a/tests/ValidationDeprecated-spec.js +++ b/tests/ValidationDeprecated-spec.js @@ -14,7 +14,7 @@ class MyTest extends React.Component { } render() { - return ; + return ; } } const FormsyTest = Wrapper(MyTest); @@ -108,7 +108,7 @@ export default { let isValid = false; const CustomInput = InputFactory({ componentDidMount: function() { - isValid = this.props.isValid(); + isValid = this.props.isValid; } }); const form = TestUtils.renderIntoDocument( diff --git a/tests/utils/TestInput.js b/tests/utils/TestInput.js index 50e43bee..5d456b5d 100644 --- a/tests/utils/TestInput.js +++ b/tests/utils/TestInput.js @@ -9,7 +9,7 @@ class TestInput extends React.Component { } render() { - return ; + return ; } }