diff --git a/release/formsy-react.js b/release/formsy-react.js index 6c3255c..3bf0374 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 s(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.withFormsy=t.propTypes=t.addValidationRule=void 0;var u=Object.assign||function(e){for(var t=1;t0&&this.setInputValidationErrors(this.props.validationErrors);var e=this.inputs.map(function(e){return e.props.name});b.default.arraysDiffer(this.prevInputNames,e)&&this.validateForm()}},{key:"attachToForm",value:function(e){-1===this.inputs.indexOf(e)&&this.inputs.push(e),this.validate(e)}},{key:"detachFromForm",value:function(e){var t=this.inputs.indexOf(e);-1!==t&&(this.inputs=this.inputs.slice(0,t).concat(this.inputs.slice(t+1))),this.validateForm()}},{key:"getCurrentValues",value:function(){return this.inputs.reduce(function(e,t){var r=t.props.name,n=Object.assign({},e);return n[r]=t.state.value,n},{})}},{key:"getModel",value:function(){var e=this.getCurrentValues();return this.mapModel(e)}},{key:"getPristineValues",value:function(){return this.inputs.reduce(function(e,t){var r=t.props.name,n=Object.assign({},e);return n[r]=t.props.value,n},{})}},{key:"isChanged",value:function(){return!b.default.isSame(this.getPristineValues(),this.getCurrentValues())}},{key:"isFormDisabled",value:function(){return this.props.disabled}},{key:"mapModel",value:function(e){return this.props.mapping?this.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},{}))}},{key:"reset",value:function(e){this.setFormPristine(!0),this.resetModel(e)}},{key:"resetModel",value:function(e){this.inputs.forEach(function(t){var r=t.props.name;e&&Object.prototype.hasOwnProperty.call(e,r)?t.setValue(e[r]):t.resetValue()}),this.validateForm()}},{key:"runValidation",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.state.value,n=this.getCurrentValues(),i=e.props.validationErrors,o=e.props.validationError,a=b.default.runRules(r,n,e.validations,V.default),s=b.default.runRules(r,n,e.requiredValidations,V.default),u=!!Object.keys(e.requiredValidations).length&&!!s.success.length,l=!(a.failed.length||this.props.validationErrors&&this.props.validationErrors[e.props.name]);return{isRequired:u,isValid:!u&&l,error:function(){if(l&&!u)return[];if(a.errors.length)return a.errors;if(t.props.validationErrors&&t.props.validationErrors[e.props.name])return"string"==typeof t.props.validationErrors[e.props.name]?[t.props.validationErrors[e.props.name]]:t.props.validationErrors[e.props.name];if(u){var r=i[s.success[0]];return r?[r]:null}return a.failed.length?a.failed.map(function(e){return i[e]?i[e]:o}).filter(function(e,t,r){return r.indexOf(e)===t}):void 0}()}}},{key:"setInputValidationErrors",value:function(e){this.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)})}},{key:"setFormPristine",value:function(e){this.setState({formSubmitted:!e}),this.inputs.forEach(function(t){t.setState({formSubmitted:!e,isPristine:e})})}},{key:"submit",value:function(e){e&&e.preventDefault&&e.preventDefault(),this.setFormPristine(!1);var t=this.getModel();this.props.onSubmit(t,this.resetModel,this.updateInputsWithError),this.state.isValid?this.props.onValidSubmit(t,this.resetModel,this.updateInputsWithError):this.props.onInvalidSubmit(t,this.resetModel,this.updateInputsWithError)}},{key:"updateInputsWithError",value:function(e){var t=this;Object.keys(e).forEach(function(r){var n=b.default.find(t.inputs,function(e){return e.props.name===r});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:t.props.preventExternalInvalidation,externalError:"string"==typeof e[r]?[e[r]]:e[r]}];n.setState.apply(n,i)})}},{key:"validate",value:function(e){this.state.canChange&&this.props.onChange(this.getCurrentValues(),this.isChanged());var t=this.runValidation(e);e.setState({isValid:t.isValid,isRequired:t.isRequired,validationError:t.error,externalError:null},this.validateForm)}},{key:"validateForm",value:function(){var e=this,t=function(){var t=e.inputs.every(function(e){return e.state.isValid});e.setState({isValid:t}),t?e.props.onValid():e.props.onInvalid(),e.setState({canChange:!0})};this.inputs.forEach(function(r,n){var i=e.runValidation(r);i.isValid&&r.state.externalError&&(i.isValid=!1),r.setState({isValid:i.isValid,isRequired:i.isRequired,validationError:i.error,externalError:!i.isValid&&r.state.externalError?r.state.externalError:null},n===e.inputs.length-1?t:null)}),this.inputs.length||this.setState({canChange:!0})}},{key:"render",value:function(){var e=this.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.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","onSubmit","onValid","onValidSubmit","preventExternalInvalidation","resetValue","setValidations","setValue","showError","showRequired","validationErrors"]));return m.default.createElement("form",u({onSubmit:this.submit},t),this.props.children)}}]),t}(m.default.Component);O.displayName="Formsy",O.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(){},onSubmit:function(){},onValid:function(){},onValidSubmit:function(){},preventExternalInvalidation:!1,resetValue:function(){},setValidations:function(){},setValue:function(){},showError:function(){},showRequired:function(){},validationErrors:null},O.propTypes={children:h.default.node,disabled:h.default.bool,getErrorMessage:h.default.func,getErrorMessages:h.default.func,getValue:h.default.func,hasValue:h.default.func,isFormDisabled:h.default.func,isFormSubmitted:h.default.func,isPristine:h.default.func,isRequired:h.default.func,isValid:h.default.func,isValidValue:h.default.func,mapping:h.default.object,preventExternalInvalidation:h.default.bool,onChange:h.default.func,onInvalid:h.default.func,onInvalidSubmit:h.default.func,onSubmit:h.default.func,onValid:h.default.func,onValidSubmit:h.default.func,resetValue:h.default.func,setValidations:h.default.func,setValue:h.default.func,showError:h.default.func,showRequired:h.default.func,validationErrors:h.default.object},O.childContextTypes={formsy:h.default.object};var F=function(e,t){V.default[e]=t},w=S.default;t.addValidationRule=F,t.propTypes=E.propTypes,t.withFormsy=w,t.default=O},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,s){s!==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};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,s,u){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,s,u],d=0;l=new Error(t.replace(/%s/g,function(){return f[d++]})),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||""===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,/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-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 s=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||{}},m={innerRef:f.default.func,name:f.default.string.isRequired,required:f.default.bool,validations:f.default.oneOfType([f.default.object,f.default.string]),value:f.default.string};t.propTypes=m,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.state={value:e.value,isRequired:!1,isValid:!0,isPristine:!0,pristineValue:e.value,validationError:[],externalError:null,formSubmitted:!1},t.getErrorMessage=t.getErrorMessage.bind(t),t.getErrorMessages=t.getErrorMessages.bind(t),t.getValue=t.getValue.bind(t),t.isFormDisabled=t.isFormDisabled.bind(t),t.isPristine=t.isPristine.bind(t),t.isRequired=t.isRequired.bind(t),t.isValid=t.isValid.bind(t),t.resetValue=t.resetValue.bind(t),t.setValue=t.setValue.bind(t),t.showRequired=t.showRequired.bind(t),t}return a(r,t),u(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){h.default.isSame(this.props.value,e.value)||this.setValue(this.props.value),h.default.isSame(this.props.validations,e.validations)&&h.default.isSame(this.props.required,e.required)||this.context.formsy.validate(this)}},{key:"componentWillUnmount",value:function(){this.context.formsy.detachFromForm(this)}},{key:"getErrorMessage",value:function(){var e=this.getErrorMessages();return e.length?e[0]:null}},{key:"getErrorMessages",value:function(){return!this.isValid()||this.showRequired()?this.state.externalError||this.state.validationError||[]:[]}},{key:"getValue",value:function(){return this.state.value}},{key:"hasValue",value:function(){return""!==this.state.value}},{key:"isFormDisabled",value:function(){return this.context.formsy.isFormDisabled()}},{key:"isFormSubmitted",value:function(){return this.state.formSubmitted}},{key:"isPristine",value:function(){return this.state.isPristine}},{key:"isRequired",value:function(){return!!this.props.required}},{key:"isValid",value:function(){return this.state.isValid}},{key:"isValidValue",value:function(e){return this.context.formsy.isValidValue.call(null,this,e)}},{key:"resetValue",value:function(){var e=this;this.setState({value:this.state.pristineValue,isPristine:!0},function(){e.context.formsy.validate(e)})}},{key:"setValidations",value:function(e,t){this.validations=v(e)||{},this.requiredValidations=!0===t?{isDefaultRequiredValue:!0}:v(t)}},{key:"setValue",value:function(e){var t=this;arguments.length>1&&void 0!==arguments[1]&&!arguments[1]?this.setState({value:e}):this.setState({value:e,isPristine:!1},function(){t.context.formsy.validate(t)})}},{key:"showError",value:function(){return!this.showRequired()&&!this.isValid()}},{key:"showRequired",value:function(){return this.state.isRequired}},{key:"render",value:function(){var t=this.props.innerRef,r=s({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),c.default.createElement(e,r)}}]),r}(c.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=m,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 s(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.withFormsy=t.propTypes=t.addValidationRule=void 0;var u=Object.assign||function(e){for(var t=1;t0&&this.setInputValidationErrors(this.props.validationErrors);var e=this.inputs.map(function(e){return e.props.name});b.default.arraysDiffer(this.prevInputNames,e)&&this.validateForm()}},{key:"attachToForm",value:function(e){-1===this.inputs.indexOf(e)&&this.inputs.push(e),this.validate(e)}},{key:"detachFromForm",value:function(e){var t=this.inputs.indexOf(e);-1!==t&&(this.inputs=this.inputs.slice(0,t).concat(this.inputs.slice(t+1))),this.validateForm()}},{key:"getCurrentValues",value:function(){return this.inputs.reduce(function(e,t){var r=t.props.name,n=Object.assign({},e);return n[r]=t.state.value,n},{})}},{key:"getModel",value:function(){var e=this.getCurrentValues();return this.mapModel(e)}},{key:"getPristineValues",value:function(){return this.inputs.reduce(function(e,t){var r=t.props.name,n=Object.assign({},e);return n[r]=t.props.value,n},{})}},{key:"isChanged",value:function(){return!b.default.isSame(this.getPristineValues(),this.getCurrentValues())}},{key:"isFormDisabled",value:function(){return this.props.disabled}},{key:"mapModel",value:function(e){return this.props.mapping?this.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},{}))}},{key:"reset",value:function(e){this.setFormPristine(!0),this.resetModel(e)}},{key:"resetInternal",value:function(e){e.preventDefault(),this.reset(),this.props.onReset&&this.props.onReset()}},{key:"resetModel",value:function(e){this.inputs.forEach(function(t){var r=t.props.name;e&&Object.prototype.hasOwnProperty.call(e,r)?t.setValue(e[r]):t.resetValue()}),this.validateForm()}},{key:"runValidation",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.state.value,n=this.getCurrentValues(),i=e.props.validationErrors,o=e.props.validationError,s=b.default.runRules(r,n,e.validations,V.default),a=b.default.runRules(r,n,e.requiredValidations,V.default),u=!!Object.keys(e.requiredValidations).length&&!!a.success.length,l=!(s.failed.length||this.props.validationErrors&&this.props.validationErrors[e.props.name]);return{isRequired:u,isValid:!u&&l,error:function(){if(l&&!u)return[];if(s.errors.length)return s.errors;if(t.props.validationErrors&&t.props.validationErrors[e.props.name])return"string"==typeof t.props.validationErrors[e.props.name]?[t.props.validationErrors[e.props.name]]:t.props.validationErrors[e.props.name];if(u){var r=i[a.success[0]];return r?[r]:null}return s.failed.length?s.failed.map(function(e){return i[e]?i[e]:o}).filter(function(e,t,r){return r.indexOf(e)===t}):void 0}()}}},{key:"setInputValidationErrors",value:function(e){this.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)})}},{key:"setFormPristine",value:function(e){this.setState({formSubmitted:!e}),this.inputs.forEach(function(t){t.setState({formSubmitted:!e,isPristine:e})})}},{key:"submit",value:function(e){e&&e.preventDefault&&e.preventDefault(),this.setFormPristine(!1);var t=this.getModel();this.props.onSubmit(t,this.resetModel,this.updateInputsWithError),this.state.isValid?this.props.onValidSubmit(t,this.resetModel,this.updateInputsWithError):this.props.onInvalidSubmit(t,this.resetModel,this.updateInputsWithError)}},{key:"updateInputsWithError",value:function(e){var t=this;Object.keys(e).forEach(function(r){var n=b.default.find(t.inputs,function(e){return e.props.name===r});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:t.props.preventExternalInvalidation,externalError:"string"==typeof e[r]?[e[r]]:e[r]}];n.setState.apply(n,i)})}},{key:"validate",value:function(e){this.state.canChange&&this.props.onChange(this.getCurrentValues(),this.isChanged());var t=this.runValidation(e);e.setState({isValid:t.isValid,isRequired:t.isRequired,validationError:t.error,externalError:null},this.validateForm)}},{key:"validateForm",value:function(){var e=this,t=function(){var t=e.inputs.every(function(e){return e.state.isValid});e.setState({isValid:t}),t?e.props.onValid():e.props.onInvalid(),e.setState({canChange:!0})};this.inputs.forEach(function(r,n){var i=e.runValidation(r);i.isValid&&r.state.externalError&&(i.isValid=!1),r.setState({isValid:i.isValid,isRequired:i.isRequired,validationError:i.error,externalError:!i.isValid&&r.state.externalError?r.state.externalError:null},n===e.inputs.length-1?t:null)}),this.inputs.length||this.setState({canChange:!0})}},{key:"render",value:function(){var e=this.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 m.default.createElement("form",u({onReset:this.resetInternal,onSubmit:this.submit},t),this.props.children)}}]),t}(m.default.Component);O.displayName="Formsy",O.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},O.propTypes={children:h.default.node,disabled:h.default.bool,getErrorMessage:h.default.func,getErrorMessages:h.default.func,getValue:h.default.func,hasValue:h.default.func,isFormDisabled:h.default.func,isFormSubmitted:h.default.func,isPristine:h.default.func,isRequired:h.default.func,isValid:h.default.func,isValidValue:h.default.func,mapping:h.default.object,preventExternalInvalidation:h.default.bool,onChange:h.default.func,onInvalid:h.default.func,onInvalidSubmit:h.default.func,onReset:h.default.func,onSubmit:h.default.func,onValid:h.default.func,onValidSubmit:h.default.func,resetValue:h.default.func,setValidations:h.default.func,setValue:h.default.func,showError:h.default.func,showRequired:h.default.func,validationErrors:h.default.object},O.childContextTypes={formsy:h.default.object};var R=function(e,t){V.default[e]=t},F=S.default;t.addValidationRule=R,t.propTypes=E.propTypes,t.withFormsy=F,t.default=O},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 s=i.shift();s in o?o=o[s]:(o[s]=i.length?isNaN(i[0])?{}:[]:e[r],o=o[s])}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,s,a){a!==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};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,s,a,u){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,s,a,u],d=0;l=new Error(t.replace(/%s/g,function(){return f[d++]})),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||""===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,/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-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 s(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 a=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||{}},m={innerRef:f.default.func,name:f.default.string.isRequired,required:f.default.bool,validations:f.default.oneOfType([f.default.object,f.default.string]),value:f.default.oneOfType([f.default.bool,f.default.string])};t.propTypes=m,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.state={value:e.value,isRequired:!1,isValid:!0,isPristine:!0,pristineValue:e.value,validationError:[],externalError:null,formSubmitted:!1},t.getErrorMessage=t.getErrorMessage.bind(t),t.getErrorMessages=t.getErrorMessages.bind(t),t.getValue=t.getValue.bind(t),t.isFormDisabled=t.isFormDisabled.bind(t),t.isPristine=t.isPristine.bind(t),t.isRequired=t.isRequired.bind(t),t.isValid=t.isValid.bind(t),t.resetValue=t.resetValue.bind(t),t.setValue=t.setValue.bind(t),t.showRequired=t.showRequired.bind(t),t}return s(r,t),u(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){h.default.isSame(this.props.value,e.value)||this.setValue(this.props.value),h.default.isSame(this.props.validations,e.validations)&&h.default.isSame(this.props.required,e.required)||this.context.formsy.validate(this)}},{key:"componentWillUnmount",value:function(){this.context.formsy.detachFromForm(this)}},{key:"getErrorMessage",value:function(){var e=this.getErrorMessages();return e.length?e[0]:null}},{key:"getErrorMessages",value:function(){return!this.isValid()||this.showRequired()?this.state.externalError||this.state.validationError||[]:[]}},{key:"getValue",value:function(){return this.state.value}},{key:"hasValue",value:function(){return""!==this.state.value}},{key:"isFormDisabled",value:function(){return this.context.formsy.isFormDisabled()}},{key:"isFormSubmitted",value:function(){return this.state.formSubmitted}},{key:"isPristine",value:function(){return this.state.isPristine}},{key:"isRequired",value:function(){return!!this.props.required}},{key:"isValid",value:function(){return this.state.isValid}},{key:"isValidValue",value:function(e){return this.context.formsy.isValidValue.call(null,this,e)}},{key:"resetValue",value:function(){var e=this;this.setState({value:this.state.pristineValue,isPristine:!0},function(){e.context.formsy.validate(e)})}},{key:"setValidations",value:function(e,t){this.validations=v(e)||{},this.requiredValidations=!0===t?{isDefaultRequiredValue:!0}:v(t)}},{key:"setValue",value:function(e){var t=this;arguments.length>1&&void 0!==arguments[1]&&!arguments[1]?this.setState({value:e}):this.setState({value:e,isPristine:!1},function(){t.context.formsy.validate(t)})}},{key:"showError",value:function(){return!this.showRequired()&&!this.isValid()}},{key:"showRequired",value:function(){return this.state.isRequired}},{key:"render",value:function(){var t=this.props.innerRef,r=a({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),c.default.createElement(e,r)}}]),r}(c.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=m,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 9ab9e23..26a5e43 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 361977019373f0255897","webpack:///./node_modules/prop-types/index.js","webpack:///external \"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__","withFormsy","propTypes","addValidationRule","undefined","_extends","assign","arguments","source","_createClass","defineProperties","props","descriptor","protoProps","staticProps","_formDataToObject","_formDataToObject2","_propTypes","_propTypes2","_react","_react2","_utils","_utils2","_validationRules","_validationRules2","_Wrapper","_Wrapper2","Formsy","_React$Component","getPrototypeOf","state","isValid","isSubmitting","canChange","inputs","attachToForm","bind","detachFromForm","getCurrentValues","getPristineValues","isChanged","isFormDisabled","reset","runValidation","submit","updateInputsWithError","validate","validateForm","formsy","isValidValue","component","prevInputNames","map","validationErrors","setInputValidationErrors","newInputNames","componentPos","slice","concat","reduce","data","dataCopy","mapModel","disabled","model","mapping","toObj","mappedModel","keyArray","split","base","currentKey","shift","setFormPristine","resetModel","setValue","resetValue","_this3","validationError","validationResults","requiredResults","requiredValidations","isRequired","error","filter","x","pos","arr","args","setState","apply","isPristine","formSubmitted","event","preventDefault","getModel","onSubmit","onValidSubmit","onInvalidSubmit","_this4","input","JSON","stringify","preventExternalInvalidation","externalError","onChange","_this5","onValidationComplete","allIsValid","every","onValid","onInvalid","_props","nonFormsyProps","getErrorMessage","getErrorMessages","getValue","hasValue","isFormSubmitted","setValidations","showError","showRequired","createElement","children","Component","displayName","defaultProps","onError","node","bool","func","childContextTypes","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","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","convertValidationsToObject","validationsAccumulator","validateMethod","parse","validationsAccumulatorCopy","innerRef","required","WrappedComponent","pristineValue","context","nextProps","prevProps","messages","propsForElement","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,OAAAC,eAAArB,EAAAiB,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAV,EAAAiB,EA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SACf5E,eAAgB7H,KAAK6H,eACrBV,QAASnH,KAAKmH,QACd4D,WAAY/K,KAAK+K,WACjB2B,gBAAiB1M,KAAK0M,gBACtBpC,WAAYtK,KAAKsK,WACjBjC,aAAcrI,KAAKqI,aACnB2B,WAAYhK,KAAKgK,WACjB2C,eAAgB3M,KAAK2M,eACrB5C,SAAU/J,KAAK+J,SACf8C,aAAc7M,KAAK6M,aACnBD,UAAW5M,KAAK4M,WACb5M,KAAK+F,MAOV,OAJI8M,KACFQ,EAAgBC,IAAMT,GAGjBrM,EAAAtE,QAAM4K,cAAcE,EAAWqG,OA9KdN,GACGvM,EAAAtE,QAAM8K,UA0MrC,OAjBA+F,GAAiB9F,YAAjB,UARA,SAAwB3E,GACtB,MACEA,GAAU2E,aACV3E,EAAU1H,OACY,gBAAd0H,GAAyBA,EAAY,cAIO0E,GAAxD,IAEA+F,EAAiBQ,cACfnL,OAAQ9B,EAAApE,QAAUZ,QAGpByR,EAAiB7F,cACf2F,SAAU,aACVC,UAAU,EACV5I,gBAAiB,GACjBzB,oBACAhF,YAAa,KACb7B,MAAOoL,EAAUwG,cAGnBT,EAAiBzN,UAAYA,EAEtByN","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 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 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.withFormsy = 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 _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 _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\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.state = {\n isValid: true,\n isSubmitting: false,\n canChange: false\n };\n _this.inputs = [];\n _this.attachToForm = _this.attachToForm.bind(_this);\n _this.detachFromForm = _this.detachFromForm.bind(_this);\n _this.getCurrentValues = _this.getCurrentValues.bind(_this);\n _this.getPristineValues = _this.getPristineValues.bind(_this);\n _this.isChanged = _this.isChanged.bind(_this);\n _this.isFormDisabled = _this.isFormDisabled.bind(_this);\n _this.reset = _this.reset.bind(_this);\n _this.runValidation = _this.runValidation.bind(_this);\n _this.submit = _this.submit.bind(_this);\n _this.updateInputsWithError = _this.updateInputsWithError.bind(_this);\n _this.validate = _this.validate.bind(_this);\n _this.validateForm = _this.validateForm.bind(_this);\n return _this;\n }\n\n _createClass(Formsy, [{\n key: 'getChildContext',\n value: function getChildContext() {\n var _this2 = this;\n\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 _this2.runValidation(component, value).isValid;\n }\n }\n };\n }\n }, {\n key: 'componentDidMount',\n value: function componentDidMount() {\n this.validateForm();\n }\n }, {\n key: 'componentWillUpdate',\n value: function 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(function (component) {\n return component.props.name;\n });\n }\n }, {\n key: 'componentDidUpdate',\n value: function 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 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 // Method put on each input component to register\n // itself to the form\n\n }, {\n key: 'attachToForm',\n value: function 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\n }, {\n key: 'detachFromForm',\n value: function detachFromForm(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 key: 'getCurrentValues',\n value: function getCurrentValues() {\n return this.inputs.reduce(function (data, component) {\n var name = component.props.name;\n var dataCopy = Object.assign({}, data); // avoid param reassignment\n dataCopy[name] = component.state.value;\n return dataCopy;\n }, {});\n }\n }, {\n key: 'getModel',\n value: function getModel() {\n var currentValues = this.getCurrentValues();\n return this.mapModel(currentValues);\n }\n }, {\n key: 'getPristineValues',\n value: function getPristineValues() {\n return this.inputs.reduce(function (data, component) {\n var name = component.props.name;\n var dataCopy = Object.assign({}, data); // avoid param reassignment\n dataCopy[name] = component.props.value;\n return dataCopy;\n }, {});\n }\n\n // Checks if the values have changed from their initial value\n\n }, {\n key: 'isChanged',\n value: function isChanged() {\n return !_utils2.default.isSame(this.getPristineValues(), this.getCurrentValues());\n }\n }, {\n key: 'isFormDisabled',\n value: function isFormDisabled() {\n return this.props.disabled;\n }\n }, {\n key: 'mapModel',\n value: function mapModel(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 key: 'reset',\n value: function reset(data) {\n this.setFormPristine(true);\n this.resetModel(data);\n }\n\n // Reset each key in the model to the original / initial / specified value\n\n }, {\n key: 'resetModel',\n value: function resetModel(data) {\n this.inputs.forEach(function (component) {\n var name = component.props.name;\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\n }, {\n key: 'runValidation',\n value: function runValidation(component) {\n var _this3 = this;\n\n var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : component.state.value;\n\n var currentValues = this.getCurrentValues();\n var validationErrors = component.props.validationErrors;\n var validationError = component.props.validationError;\n\n var validationResults = _utils2.default.runRules(value, currentValues, component.validations, _validationRules2.default);\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 (_this3.props.validationErrors && _this3.props.validationErrors[component.props.name]) {\n return typeof _this3.props.validationErrors[component.props.name] === 'string' ? [_this3.props.validationErrors[component.props.name]] : _this3.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 key: 'setInputValidationErrors',\n value: function setInputValidationErrors(errors) {\n this.inputs.forEach(function (component) {\n var name = component.props.name;\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 key: 'setFormPristine',\n value: function 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(function (component) {\n component.setState({\n formSubmitted: !isPristine,\n isPristine: isPristine\n });\n });\n }\n\n // Update model, submit to url prop and send the model\n\n }, {\n key: 'submit',\n value: function 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 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 // 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 key: 'updateInputsWithError',\n value: function updateInputsWithError(errors) {\n var _this4 = this;\n\n Object.keys(errors).forEach(function (name) {\n var component = _utils2.default.find(_this4.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: _this4.props.preventExternalInvalidation,\n externalError: typeof errors[name] === 'string' ? [errors[name]] : errors[name]\n }];\n component.setState.apply(component, 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\n }, {\n key: 'validate',\n value: function validate(component) {\n // Trigger onChange\n if (this.state.canChange) {\n this.props.onChange(this.getCurrentValues(), 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 // Validate the form by going through all child input components\n // and check their state\n\n }, {\n key: 'validateForm',\n value: function validateForm() {\n var _this5 = this;\n\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 = _this5.inputs.every(function (component) {\n return component.state.isValid;\n });\n\n _this5.setState({\n isValid: allIsValid\n });\n\n if (allIsValid) {\n _this5.props.onValid();\n } else {\n _this5.props.onInvalid();\n }\n\n // Tell the form that it can start to trigger change events\n _this5.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 = _this5.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 === _this5.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 key: 'render',\n value: function render() {\n var _props = this.props,\n getErrorMessage = _props.getErrorMessage,\n getErrorMessages = _props.getErrorMessages,\n getValue = _props.getValue,\n hasValue = _props.hasValue,\n isFormDisabled = _props.isFormDisabled,\n isFormSubmitted = _props.isFormSubmitted,\n isPristine = _props.isPristine,\n isRequired = _props.isRequired,\n isValid = _props.isValid,\n isValidValue = _props.isValidValue,\n mapping = _props.mapping,\n onChange = _props.onChange,\n onInvalidSubmit = _props.onInvalidSubmit,\n onInvalid = _props.onInvalid,\n onSubmit = _props.onSubmit,\n onValid = _props.onValid,\n onValidSubmit = _props.onValidSubmit,\n preventExternalInvalidation = _props.preventExternalInvalidation,\n resetValue = _props.resetValue,\n setValidations = _props.setValidations,\n setValue = _props.setValue,\n showError = _props.showError,\n showRequired = _props.showRequired,\n validationErrors = _props.validationErrors,\n nonFormsyProps = _objectWithoutProperties(_props, ['getErrorMessage', 'getErrorMessages', 'getValue', 'hasValue', 'isFormDisabled', 'isFormSubmitted', 'isPristine', 'isRequired', 'isValid', 'isValidValue', 'mapping', 'onChange', 'onInvalidSubmit', 'onInvalid', 'onSubmit', 'onValid', 'onValidSubmit', 'preventExternalInvalidation', 'resetValue', 'setValidations', 'setValue', 'showError', 'showRequired', 'validationErrors']);\n\n return _react2.default.createElement('form', _extends({\n onSubmit: this.submit\n }, nonFormsyProps), this.props.children);\n }\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 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.object, // eslint-disable-line\n preventExternalInvalidation: _propTypes2.default.bool,\n onChange: _propTypes2.default.func,\n onInvalid: _propTypes2.default.func,\n onInvalidSubmit: _propTypes2.default.func,\n onSubmit: _propTypes2.default.func,\n onValid: _propTypes2.default.func,\n onValidSubmit: _propTypes2.default.func,\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\nexports.addValidationRule = addValidationRule;\nexports.propTypes = _Wrapper.propTypes;\nexports.withFormsy = withFormsy;\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 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 };\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 * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 === '';\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 return validations.matchRegexp(values, value, /^([\\w-]+(?:\\.[\\w-]+)*)@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-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\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.bool,\n validations: _propTypes2.default.oneOfType([_propTypes2.default.object, _propTypes2.default.string]),\n value: _propTypes2.default.string // eslint-disable-line\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.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 _this.getErrorMessage = _this.getErrorMessage.bind(_this);\n _this.getErrorMessages = _this.getErrorMessages.bind(_this);\n _this.getValue = _this.getValue.bind(_this);\n _this.isFormDisabled = _this.isFormDisabled.bind(_this);\n _this.isPristine = _this.isPristine.bind(_this);\n _this.isRequired = _this.isRequired.bind(_this);\n _this.isValid = _this.isValid.bind(_this);\n _this.resetValue = _this.resetValue.bind(_this);\n _this.setValue = _this.setValue.bind(_this);\n _this.showRequired = _this.showRequired.bind(_this);\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 key: 'getErrorMessage',\n value: function getErrorMessage() {\n var messages = this.getErrorMessages();\n return messages.length ? messages[0] : null;\n }\n }, {\n key: 'getErrorMessages',\n value: function getErrorMessages() {\n return !this.isValid() || this.showRequired() ? this.state.externalError || this.state.validationError || [] : [];\n }\n }, {\n key: 'getValue',\n value: function getValue() {\n return this.state.value;\n }\n }, {\n key: 'hasValue',\n value: function hasValue() {\n return this.state.value !== '';\n }\n }, {\n key: 'isFormDisabled',\n value: function isFormDisabled() {\n return this.context.formsy.isFormDisabled();\n }\n }, {\n key: 'isFormSubmitted',\n value: function isFormSubmitted() {\n return this.state.formSubmitted;\n }\n }, {\n key: 'isPristine',\n value: function isPristine() {\n return this.state.isPristine;\n }\n }, {\n key: 'isRequired',\n value: function isRequired() {\n return !!this.props.required;\n }\n }, {\n key: 'isValid',\n value: function isValid() {\n return this.state.isValid;\n }\n }, {\n key: 'isValidValue',\n value: function isValidValue(value) {\n return this.context.formsy.isValidValue.call(null, this, value);\n // return this.props.isValidValue.call(null, this, value);\n }\n }, {\n key: 'resetValue',\n value: function resetValue() {\n var _this3 = this;\n\n this.setState({\n value: this.state.pristineValue,\n isPristine: true\n }, function () {\n _this3.context.formsy.validate(_this3);\n });\n }\n }, {\n key: 'setValidations',\n value: function 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 } : 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\n }, {\n key: 'setValue',\n value: function setValue(value) {\n var _this4 = this;\n\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 _this4.context.formsy.validate(_this4);\n });\n }\n }\n }, {\n key: 'showError',\n value: function showError() {\n return !this.showRequired() && !this.isValid();\n }\n }, {\n key: 'showRequired',\n value: function showRequired() {\n return this.state.isRequired;\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 361977019373f0255897","/**\n * Copyright 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 \"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, 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\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\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 this.attachToForm = this.attachToForm.bind(this);\n this.detachFromForm = this.detachFromForm.bind(this);\n this.getCurrentValues = this.getCurrentValues.bind(this);\n this.getPristineValues = this.getPristineValues.bind(this);\n this.isChanged = this.isChanged.bind(this);\n this.isFormDisabled = this.isFormDisabled.bind(this);\n this.reset = this.reset.bind(this);\n this.runValidation = this.runValidation.bind(this);\n this.submit = this.submit.bind(this);\n this.updateInputsWithError = this.updateInputsWithError.bind(this);\n this.validate = this.validate.bind(this);\n this.validateForm = this.validateForm.bind(this);\n }\n\n getChildContext() {\n return {\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 // 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 getCurrentValues() {\n return this.inputs.reduce((data, component) => {\n const name = component.props.name;\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 return this.inputs.reduce((data, component) => {\n const name = component.props.name;\n const dataCopy = Object.assign({}, data); // avoid param reassignment\n dataCopy[name] = component.props.value;\n return dataCopy;\n }, {});\n }\n\n // Checks if the values have changed from their initial value\n isChanged() {\n return !utils.isSame(this.getPristineValues(), this.getCurrentValues());\n }\n\n isFormDisabled() {\n return this.props.disabled;\n }\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 // 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.name;\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 validationErrors = component.props.validationErrors;\n const validationError = component.props.validationError;\n\n const validationResults = utils.runRules(\n value, currentValues, component.validations, validationRules,\n );\n const requiredResults = utils.runRules(\n value, currentValues, component.requiredValidations, 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 setInputValidationErrors(errors) {\n this.inputs.forEach((component) => {\n const name = component.props.name;\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 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 // 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.getCurrentValues(), 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 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 onSubmit: this.submit,\n ...nonFormsyProps,\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 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.object, // eslint-disable-line\n preventExternalInvalidation: PropTypes.bool,\n onChange: PropTypes.func,\n onInvalid: PropTypes.func,\n onInvalidSubmit: PropTypes.func,\n onSubmit: PropTypes.func,\n onValid: PropTypes.func,\n onValidSubmit: PropTypes.func,\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\nexport {\n addValidationRule,\n propTypes,\n withFormsy,\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 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 };\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 * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 === '';\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 return validations.matchRegexp(values, value, /^([\\w-]+(?:\\.[\\w-]+)*)@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-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\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.bool,\n validations: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.string,\n ]),\n value: PropTypes.string, // eslint-disable-line\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 this.getErrorMessage = this.getErrorMessage.bind(this);\n this.getErrorMessages = this.getErrorMessages.bind(this);\n this.getValue = this.getValue.bind(this);\n this.isFormDisabled = this.isFormDisabled.bind(this);\n this.isPristine = this.isPristine.bind(this);\n this.isRequired = this.isRequired.bind(this);\n this.isValid = this.isValid.bind(this);\n this.resetValue = this.resetValue.bind(this);\n this.setValue = this.setValue.bind(this);\n this.showRequired = this.showRequired.bind(this);\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 return !this.isValid() || this.showRequired() ?\n (this.state.externalError || this.state.validationError || []) : [];\n }\n\n getValue() {\n return this.state.value;\n }\n\n hasValue() {\n return this.state.value !== '';\n }\n\n isFormDisabled() {\n return this.context.formsy.isFormDisabled();\n }\n\n isFormSubmitted() {\n return this.state.formSubmitted;\n }\n\n isPristine() {\n return this.state.isPristine;\n }\n\n isRequired() {\n return !!this.props.required;\n }\n\n isValid() {\n return this.state.isValid;\n }\n\n isValidValue(value) {\n return this.context.formsy.isValidValue.call(null, this, value);\n // return this.props.isValidValue.call(null, this, value);\n }\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 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 showError() {\n return !this.showRequired() && !this.isValid();\n }\n\n showRequired() {\n return this.state.isRequired;\n }\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 0caa298bf5f89146dc5c","webpack:///./node_modules/prop-types/index.js","webpack:///external \"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__","withFormsy","propTypes","addValidationRule","undefined","_extends","assign","arguments","source","_createClass","defineProperties","props","descriptor","protoProps","staticProps","_formDataToObject","_formDataToObject2","_propTypes","_propTypes2","_react","_react2","_utils","_utils2","_validationRules","_validationRules2","_Wrapper","_Wrapper2","Formsy","_React$Component","getPrototypeOf","state","isValid","isSubmitting","canChange","inputs","attachToForm","bind","detachFromForm","getCurrentValues","getPristineValues","isChanged","isFormDisabled","reset","resetModel","resetInternal","runValidation","submit","updateInputsWithError","validate","validateForm","formsy","isValidValue","component","prevInputNames","map","validationErrors","setInputValidationErrors","newInputNames","componentPos","slice","concat","reduce","data","dataCopy","mapModel","disabled","model","mapping","toObj","mappedModel","keyArray","split","base","currentKey","shift","setFormPristine","event","preventDefault","onReset","setValue","resetValue","_this3","validationError","validationResults","requiredResults","requiredValidations","isRequired","error","filter","x","pos","arr","args","setState","apply","isPristine","formSubmitted","getModel","onSubmit","onValidSubmit","onInvalidSubmit","_this4","input","JSON","stringify","preventExternalInvalidation","externalError","onChange","_this5","onValidationComplete","allIsValid","every","onValid","onInvalid","_props","nonFormsyProps","getErrorMessage","getErrorMessages","getValue","hasValue","isFormSubmitted","setValidations","showError","showRequired","createElement","children","Component","displayName","defaultProps","onError","node","bool","func","childContextTypes","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","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","convertValidationsToObject","validationsAccumulator","validateMethod","parse","validationsAccumulatorCopy","innerRef","required","WrappedComponent","pristineValue","context","nextProps","prevProps","messages","propsForElement","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,GAC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YAAjB,UARA,SAAwB3E,GACtB,MACEA,GAAU2E,aACV3E,EAAU5H,OACY,gBAAd4H,GAAyBA,EAAY,cAIO0E,GAAxD,IAEA+F,EAAiBQ,cACfnL,OAAQhC,EAAApE,QAAUZ,QAGpB2R,EAAiB7F,cACf2F,SAAU,aACVC,UAAU,EACV1I,gBAAiB,GACjB3B,oBACAlF,YAAa,KACb7B,MAAOsL,EAAUwG,cAGnBT,EAAiB3N,UAAYA,EAEtB2N","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 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 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.withFormsy = 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 _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 _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\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.state = {\n isValid: true,\n isSubmitting: false,\n canChange: false\n };\n _this.inputs = [];\n _this.attachToForm = _this.attachToForm.bind(_this);\n _this.detachFromForm = _this.detachFromForm.bind(_this);\n _this.getCurrentValues = _this.getCurrentValues.bind(_this);\n _this.getPristineValues = _this.getPristineValues.bind(_this);\n _this.isChanged = _this.isChanged.bind(_this);\n _this.isFormDisabled = _this.isFormDisabled.bind(_this);\n _this.reset = _this.reset.bind(_this);\n _this.resetModel = _this.resetModel.bind(_this);\n _this.resetInternal = _this.resetInternal.bind(_this);\n _this.runValidation = _this.runValidation.bind(_this);\n _this.submit = _this.submit.bind(_this);\n _this.updateInputsWithError = _this.updateInputsWithError.bind(_this);\n _this.validate = _this.validate.bind(_this);\n _this.validateForm = _this.validateForm.bind(_this);\n return _this;\n }\n\n _createClass(Formsy, [{\n key: 'getChildContext',\n value: function getChildContext() {\n var _this2 = this;\n\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 _this2.runValidation(component, value).isValid;\n }\n }\n };\n }\n }, {\n key: 'componentDidMount',\n value: function componentDidMount() {\n this.validateForm();\n }\n }, {\n key: 'componentWillUpdate',\n value: function 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(function (component) {\n return component.props.name;\n });\n }\n }, {\n key: 'componentDidUpdate',\n value: function 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 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 // Method put on each input component to register\n // itself to the form\n\n }, {\n key: 'attachToForm',\n value: function 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\n }, {\n key: 'detachFromForm',\n value: function detachFromForm(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 key: 'getCurrentValues',\n value: function getCurrentValues() {\n return this.inputs.reduce(function (data, component) {\n var name = component.props.name;\n var dataCopy = Object.assign({}, data); // avoid param reassignment\n dataCopy[name] = component.state.value;\n return dataCopy;\n }, {});\n }\n }, {\n key: 'getModel',\n value: function getModel() {\n var currentValues = this.getCurrentValues();\n return this.mapModel(currentValues);\n }\n }, {\n key: 'getPristineValues',\n value: function getPristineValues() {\n return this.inputs.reduce(function (data, component) {\n var name = component.props.name;\n var dataCopy = Object.assign({}, data); // avoid param reassignment\n dataCopy[name] = component.props.value;\n return dataCopy;\n }, {});\n }\n\n // Checks if the values have changed from their initial value\n\n }, {\n key: 'isChanged',\n value: function isChanged() {\n return !_utils2.default.isSame(this.getPristineValues(), this.getCurrentValues());\n }\n }, {\n key: 'isFormDisabled',\n value: function isFormDisabled() {\n return this.props.disabled;\n }\n }, {\n key: 'mapModel',\n value: function mapModel(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 key: 'reset',\n value: function reset(data) {\n this.setFormPristine(true);\n this.resetModel(data);\n }\n }, {\n key: 'resetInternal',\n value: function 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\n }, {\n key: 'resetModel',\n value: function resetModel(data) {\n this.inputs.forEach(function (component) {\n var name = component.props.name;\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\n }, {\n key: 'runValidation',\n value: function runValidation(component) {\n var _this3 = this;\n\n var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : component.state.value;\n\n var currentValues = this.getCurrentValues();\n var validationErrors = component.props.validationErrors;\n var validationError = component.props.validationError;\n\n var validationResults = _utils2.default.runRules(value, currentValues, component.validations, _validationRules2.default);\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 (_this3.props.validationErrors && _this3.props.validationErrors[component.props.name]) {\n return typeof _this3.props.validationErrors[component.props.name] === 'string' ? [_this3.props.validationErrors[component.props.name]] : _this3.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 key: 'setInputValidationErrors',\n value: function setInputValidationErrors(errors) {\n this.inputs.forEach(function (component) {\n var name = component.props.name;\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 key: 'setFormPristine',\n value: function 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(function (component) {\n component.setState({\n formSubmitted: !isPristine,\n isPristine: isPristine\n });\n });\n }\n\n // Update model, submit to url prop and send the model\n\n }, {\n key: 'submit',\n value: function 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 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 // 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 key: 'updateInputsWithError',\n value: function updateInputsWithError(errors) {\n var _this4 = this;\n\n Object.keys(errors).forEach(function (name) {\n var component = _utils2.default.find(_this4.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: _this4.props.preventExternalInvalidation,\n externalError: typeof errors[name] === 'string' ? [errors[name]] : errors[name]\n }];\n component.setState.apply(component, 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\n }, {\n key: 'validate',\n value: function validate(component) {\n // Trigger onChange\n if (this.state.canChange) {\n this.props.onChange(this.getCurrentValues(), 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 // Validate the form by going through all child input components\n // and check their state\n\n }, {\n key: 'validateForm',\n value: function validateForm() {\n var _this5 = this;\n\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 = _this5.inputs.every(function (component) {\n return component.state.isValid;\n });\n\n _this5.setState({\n isValid: allIsValid\n });\n\n if (allIsValid) {\n _this5.props.onValid();\n } else {\n _this5.props.onInvalid();\n }\n\n // Tell the form that it can start to trigger change events\n _this5.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 = _this5.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 === _this5.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 key: 'render',\n value: function render() {\n var _props = this.props,\n getErrorMessage = _props.getErrorMessage,\n getErrorMessages = _props.getErrorMessages,\n getValue = _props.getValue,\n hasValue = _props.hasValue,\n isFormDisabled = _props.isFormDisabled,\n isFormSubmitted = _props.isFormSubmitted,\n isPristine = _props.isPristine,\n isRequired = _props.isRequired,\n isValid = _props.isValid,\n isValidValue = _props.isValidValue,\n mapping = _props.mapping,\n onChange = _props.onChange,\n onInvalidSubmit = _props.onInvalidSubmit,\n onInvalid = _props.onInvalid,\n onReset = _props.onReset,\n onSubmit = _props.onSubmit,\n onValid = _props.onValid,\n onValidSubmit = _props.onValidSubmit,\n preventExternalInvalidation = _props.preventExternalInvalidation,\n resetValue = _props.resetValue,\n setValidations = _props.setValidations,\n setValue = _props.setValue,\n showError = _props.showError,\n showRequired = _props.showRequired,\n validationErrors = _props.validationErrors,\n nonFormsyProps = _objectWithoutProperties(_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), this.props.children);\n }\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.object, // eslint-disable-line\n preventExternalInvalidation: _propTypes2.default.bool,\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 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\nexports.addValidationRule = addValidationRule;\nexports.propTypes = _Wrapper.propTypes;\nexports.withFormsy = withFormsy;\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 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 };\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 * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 === '';\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 return validations.matchRegexp(values, value, /^([\\w-]+(?:\\.[\\w-]+)*)@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-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\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.bool,\n validations: _propTypes2.default.oneOfType([_propTypes2.default.object, _propTypes2.default.string]),\n value: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.string])\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.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 _this.getErrorMessage = _this.getErrorMessage.bind(_this);\n _this.getErrorMessages = _this.getErrorMessages.bind(_this);\n _this.getValue = _this.getValue.bind(_this);\n _this.isFormDisabled = _this.isFormDisabled.bind(_this);\n _this.isPristine = _this.isPristine.bind(_this);\n _this.isRequired = _this.isRequired.bind(_this);\n _this.isValid = _this.isValid.bind(_this);\n _this.resetValue = _this.resetValue.bind(_this);\n _this.setValue = _this.setValue.bind(_this);\n _this.showRequired = _this.showRequired.bind(_this);\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 key: 'getErrorMessage',\n value: function getErrorMessage() {\n var messages = this.getErrorMessages();\n return messages.length ? messages[0] : null;\n }\n }, {\n key: 'getErrorMessages',\n value: function getErrorMessages() {\n return !this.isValid() || this.showRequired() ? this.state.externalError || this.state.validationError || [] : [];\n }\n }, {\n key: 'getValue',\n value: function getValue() {\n return this.state.value;\n }\n }, {\n key: 'hasValue',\n value: function hasValue() {\n return this.state.value !== '';\n }\n }, {\n key: 'isFormDisabled',\n value: function isFormDisabled() {\n return this.context.formsy.isFormDisabled();\n }\n }, {\n key: 'isFormSubmitted',\n value: function isFormSubmitted() {\n return this.state.formSubmitted;\n }\n }, {\n key: 'isPristine',\n value: function isPristine() {\n return this.state.isPristine;\n }\n }, {\n key: 'isRequired',\n value: function isRequired() {\n return !!this.props.required;\n }\n }, {\n key: 'isValid',\n value: function isValid() {\n return this.state.isValid;\n }\n }, {\n key: 'isValidValue',\n value: function isValidValue(value) {\n return this.context.formsy.isValidValue.call(null, this, value);\n // return this.props.isValidValue.call(null, this, value);\n }\n }, {\n key: 'resetValue',\n value: function resetValue() {\n var _this3 = this;\n\n this.setState({\n value: this.state.pristineValue,\n isPristine: true\n }, function () {\n _this3.context.formsy.validate(_this3);\n });\n }\n }, {\n key: 'setValidations',\n value: function 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 } : 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\n }, {\n key: 'setValue',\n value: function setValue(value) {\n var _this4 = this;\n\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 _this4.context.formsy.validate(_this4);\n });\n }\n }\n }, {\n key: 'showError',\n value: function showError() {\n return !this.showRequired() && !this.isValid();\n }\n }, {\n key: 'showRequired',\n value: function showRequired() {\n return this.state.isRequired;\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 0caa298bf5f89146dc5c","/**\n * Copyright 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 \"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, 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\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\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 this.attachToForm = this.attachToForm.bind(this);\n this.detachFromForm = this.detachFromForm.bind(this);\n this.getCurrentValues = this.getCurrentValues.bind(this);\n this.getPristineValues = this.getPristineValues.bind(this);\n this.isChanged = this.isChanged.bind(this);\n this.isFormDisabled = this.isFormDisabled.bind(this);\n this.reset = this.reset.bind(this);\n this.resetModel = this.resetModel.bind(this);\n this.resetInternal = this.resetInternal.bind(this);\n this.runValidation = this.runValidation.bind(this);\n this.submit = this.submit.bind(this);\n this.updateInputsWithError = this.updateInputsWithError.bind(this);\n this.validate = this.validate.bind(this);\n this.validateForm = this.validateForm.bind(this);\n }\n\n getChildContext() {\n return {\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 // 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 getCurrentValues() {\n return this.inputs.reduce((data, component) => {\n const name = component.props.name;\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 return this.inputs.reduce((data, component) => {\n const name = component.props.name;\n const dataCopy = Object.assign({}, data); // avoid param reassignment\n dataCopy[name] = component.props.value;\n return dataCopy;\n }, {});\n }\n\n // Checks if the values have changed from their initial value\n isChanged() {\n return !utils.isSame(this.getPristineValues(), this.getCurrentValues());\n }\n\n isFormDisabled() {\n return this.props.disabled;\n }\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.name;\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 validationErrors = component.props.validationErrors;\n const validationError = component.props.validationError;\n\n const validationResults = utils.runRules(\n value, currentValues, component.validations, validationRules,\n );\n const requiredResults = utils.runRules(\n value, currentValues, component.requiredValidations, 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 setInputValidationErrors(errors) {\n this.inputs.forEach((component) => {\n const name = component.props.name;\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 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 // 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.getCurrentValues(), 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 },\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.object, // eslint-disable-line\n preventExternalInvalidation: PropTypes.bool,\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 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\nexport {\n addValidationRule,\n propTypes,\n withFormsy,\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 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 };\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 * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\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 === '';\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 return validations.matchRegexp(values, value, /^([\\w-]+(?:\\.[\\w-]+)*)@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-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\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.bool,\n validations: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.string,\n ]),\n value: PropTypes.oneOfType([\n PropTypes.bool,\n PropTypes.string,\n ]),\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 this.getErrorMessage = this.getErrorMessage.bind(this);\n this.getErrorMessages = this.getErrorMessages.bind(this);\n this.getValue = this.getValue.bind(this);\n this.isFormDisabled = this.isFormDisabled.bind(this);\n this.isPristine = this.isPristine.bind(this);\n this.isRequired = this.isRequired.bind(this);\n this.isValid = this.isValid.bind(this);\n this.resetValue = this.resetValue.bind(this);\n this.setValue = this.setValue.bind(this);\n this.showRequired = this.showRequired.bind(this);\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 return !this.isValid() || this.showRequired() ?\n (this.state.externalError || this.state.validationError || []) : [];\n }\n\n getValue() {\n return this.state.value;\n }\n\n hasValue() {\n return this.state.value !== '';\n }\n\n isFormDisabled() {\n return this.context.formsy.isFormDisabled();\n }\n\n isFormSubmitted() {\n return this.state.formSubmitted;\n }\n\n isPristine() {\n return this.state.isPristine;\n }\n\n isRequired() {\n return !!this.props.required;\n }\n\n isValid() {\n return this.state.isValid;\n }\n\n isValidValue(value) {\n return this.context.formsy.isValidValue.call(null, this, value);\n // return this.props.isValidValue.call(null, this, value);\n }\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 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 showError() {\n return !this.showRequired() && !this.isValid();\n }\n\n showRequired() {\n return this.state.isRequired;\n }\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 diff --git a/src/index.js b/src/index.js index d84f36c..059d369 100644 --- a/src/index.js +++ b/src/index.js @@ -22,6 +22,7 @@ class Formsy extends React.Component { this.isChanged = this.isChanged.bind(this); this.isFormDisabled = this.isFormDisabled.bind(this); this.reset = this.reset.bind(this); + this.resetModel = this.resetModel.bind(this); this.resetInternal = this.resetInternal.bind(this); this.runValidation = this.runValidation.bind(this); this.submit = this.submit.bind(this);