From 112819f699bfea7a2a137339973ba9425a95ccb3 Mon Sep 17 00:00:00 2001 From: Semigradsky Date: Tue, 19 Apr 2016 11:12:14 +0300 Subject: [PATCH] Update dependencies. Some minor changes. --- .babelrc | 7 ++++ .gitignore | 2 -- .npmignore | 11 ++++-- LICENSE | 2 +- README.md | 65 +++++++++++------------------------ bower.json | 4 +-- build/index.html | 9 ----- build/test.js | 55 ----------------------------- package.json | 28 +++++++-------- release/formsy-react.js | 2 +- release/formsy-react.js.map | 2 +- release/formsy-react.min.js | 1 - src/main.js | 2 +- tests/Rules-minLength-spec.js | 9 +++++ tests/utils/TestInput.js | 3 +- webpack.config.js | 21 ----------- 16 files changed, 65 insertions(+), 158 deletions(-) create mode 100644 .babelrc delete mode 100644 build/index.html delete mode 100644 build/test.js delete mode 100644 release/formsy-react.min.js delete mode 100644 webpack.config.js diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..2d3f655 --- /dev/null +++ b/.babelrc @@ -0,0 +1,7 @@ +{ + "presets": [ + "react", + "es2015", + "stage-2" + ] +} diff --git a/.gitignore b/.gitignore index 15d5043..491fc35 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ -.DS_Store -build node_modules lib diff --git a/.npmignore b/.npmignore index fd6703e..d2e1dc1 100644 --- a/.npmignore +++ b/.npmignore @@ -1,3 +1,8 @@ -build/ -bower.json -Gulpfile.js \ No newline at end of file +.babelrc +.editorconfig +.travis.yml +testrunner.js +webpack.production.config.js +examples/ +release/ +tests/ diff --git a/LICENSE b/LICENSE index c27110c..8b73d46 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Gloppens EDB Lag +Copyright (c) 2014-2016 Gloppens EDB Lag Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index b0cc0b4..1457b4e 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,6 @@ A form input builder and validator for React JS | [How to use](#how-to-use) | [API](/API.md) | [Examples](/examples) | |---|---|---| -### From version 0.12.0 Formsy only supports React 0.13.1 and up - ## Background I wrote an article on forms and validation with React JS, [Nailing that validation with React JS](http://christianalfoni.github.io/javascript/2014/10/22/nailing-that-validation-with-reactjs.html), the result of that was this extension. @@ -48,29 +46,29 @@ Complete API reference is available [here](/API.md). #### Formsy gives you a form straight out of the box -```javascript - /** @jsx React.DOM */ - var Formsy = require('formsy-react'); - var MyAppForm = React.createClass({ - getInitialState: function () { +```jsx + import Formsy from 'formsy-react'; + + const MyAppForm = React.createClass({ + getInitialState() { return { canSubmit: false } }, - enableButton: function () { + enableButton() { this.setState({ canSubmit: true }); }, - disableButton: function () { + disableButton() { this.setState({ canSubmit: false }); }, - submit: function (model) { + submit(model) { someDep.saveEmail(model.email); }, - render: function () { + render() { return ( @@ -84,31 +82,31 @@ Complete API reference is available [here](/API.md). This code results in a form with a submit button that will run the `submit` method when the submit button is clicked with a valid email. The submit button is disabled as long as the input is empty ([required](/API.md#required)) or the value is not an email ([isEmail](/API.md#validators)). On validation error it will show the message: "This is not a valid email". #### Building a form element (required) -```javascript - /** @jsx React.DOM */ - var Formsy = require('formsy-react'); - var MyOwnInput = React.createClass({ +```jsx + import Formsy from 'formsy-react'; + + const MyOwnInput = React.createClass({ // Add the Formsy Mixin mixins: [Formsy.Mixin], // setValue() will set the value of the component, which in // turn will validate it and the rest of the form - changeValue: function (event) { + changeValue(event) { this.setValue(event.currentTarget.value); }, - render: function () { + render() { // Set a specific className based on the validation // state of this component. showRequired() is true // when the value is empty and the required prop is // passed to the input. showError() is true when the // value typed is invalid - var className = this.showRequired() ? 'required' : this.showError() ? 'error' : null; + const className = this.showRequired() ? 'required' : this.showError() ? 'error' : null; // An error message is returned ONLY if the component is invalid // or the server has returned an error message - var errorMessage = this.getErrorMessage(); + const errorMessage = this.getErrorMessage(); return (
@@ -130,32 +128,9 @@ The form element component is what gives the form validation functionality to wh ## Contribute - Fork repo - `npm install` -- `npm start` runs the development server on `localhost:8080` +- `npm run examples` runs the development server on `localhost:8080` - `npm test` runs the tests -License -------- +## License -formsy-react is licensed under the [MIT license](LICENSE). - -> The MIT License (MIT) -> -> Copyright (c) 2015 Gloppens EDB Lag -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. +[MIT](/LICENSE) diff --git a/bower.json b/bower.json index 2c5602d..b4d7faa 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "formsy-react", - "version": "0.16.0", + "version": "0.18.0", "description": "A form input builder and validator for React JS", "repository": { "type": "git", @@ -13,7 +13,7 @@ "Gulpfile.js" ], "dependencies": { - "react": "^0.13.1" + "react": "^0.14.7 || ^15.0.0" }, "keywords": [ "react", diff --git a/build/index.html b/build/index.html deleted file mode 100644 index 0a5bfbb..0000000 --- a/build/index.html +++ /dev/null @@ -1,9 +0,0 @@ - - - Formsy Test - - -
- - - \ No newline at end of file diff --git a/build/test.js b/build/test.js deleted file mode 100644 index 39c8722..0000000 --- a/build/test.js +++ /dev/null @@ -1,55 +0,0 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var Formsy = require('./../src/main.js'); - -var Input = React.createClass({ - onChange: function (event) { - this.props.setValue(event.currentTarget.value); - }, - render: function () { - return ( -
- {this.props.showRequired() ? 'required' : ''} - -
- ); - } -}); - -Input = Formsy.HOC(Input); - -var SomeComp = React.createClass({ - getInitialState: function () { - return { - isRequired: false - }; - }, - toggleRequired: function () { - this.setState({ - isRequired: !this.state.isRequired - }); - }, - render: function () { - return ( -
- - -
- ) - } -}); - -var FormApp = React.createClass({ - onSubmit: function (model) { - console.log('model', model); - }, - render: function () { - return ( - - - - ); - } -}); - -ReactDOM.render(, document.getElementById('app')); diff --git a/package.json b/package.json index 8127744..8237263 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,6 @@ }, "main": "lib/main.js", "scripts": { - "start": "webpack-dev-server --content-base build", "deploy": "NODE_ENV=production webpack -p --config webpack.production.config.js", "test": "babel-node testrunner", "examples": "webpack-dev-server --config examples/webpack.config.js --content-base examples", @@ -24,24 +23,25 @@ "react-component" ], "dependencies": { - "form-data-to-object": "^0.1.0" + "form-data-to-object": "^0.2.0" }, "devDependencies": { - "babel": "^5.6.4", - "babel-core": "^5.1.11", - "babel-loader": "^5.0.0", + "babel-cli": "^6.6.5", + "babel-loader": "^6.2.4", + "babel-preset-es2015": "^6.6.0", + "babel-preset-react": "^6.5.0", + "babel-preset-stage-2": "^6.5.0", "jsdom": "^6.5.1", - "lolex": "^1.3.2", "nodeunit": "^0.9.1", - "react": "^0.14.0-rc1", - "react-addons-pure-render-mixin": "^0.14.2", - "react-addons-test-utils": "^0.14.0-rc1", - "react-dom": "^0.14.0-rc1", - "sinon": "^1.17.1", - "webpack": "^1.7.3", - "webpack-dev-server": "^1.7.0" + "react": "^15.0.0", + "react-addons-pure-render-mixin": "^15.0.0", + "react-addons-test-utils": "^15.0.0", + "react-dom": "^15.0.0", + "sinon": "^1.17.3", + "webpack": "^1.12.14", + "webpack-dev-server": "^1.14.1" }, "peerDependencies": { - "react": "^0.14.0" + "react": "^0.14.0 || ^15.0.0" } } diff --git a/release/formsy-react.js b/release/formsy-react.js index d46a887..3169e50 100644 --- a/release/formsy-react.js +++ b/release/formsy-react.js @@ -1,2 +1,2 @@ -!function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i(require("react")):"function"==typeof define&&define.amd?define(["react"],i):"object"==typeof exports?exports.Formsy=i(require("react")):t.Formsy=i(t.react)}(this,function(t){return function(t){function i(r){if(e[r])return e[r].exports;var n=e[r]={exports:{},id:r,loaded:!1};return t[r].call(n.exports,n,n.exports,i),n.loaded=!0,n.exports}var e={};return i.m=t,i.c=e,i.p="",i(0)}([function(t,i,e){(function(i){"use strict";var r=Object.assign||function(t){for(var i=1;i0&&this.setInputValidationErrors(this.props.validationErrors);var t=this.inputs.map(function(t){return t.props.name});a.arraysDiffer(this.prevInputNames,t)&&this.validateForm()},reset:function(t){this.setFormPristine(!0),this.resetModel(t)},submit:function(t){t&&t.preventDefault(),this.setFormPristine(!1);var i=this.getModel();this.props.onSubmit(i,this.resetModel,this.updateInputsWithError),this.state.isValid?this.props.onValidSubmit(i,this.resetModel,this.updateInputsWithError):this.props.onInvalidSubmit(i,this.resetModel,this.updateInputsWithError)},mapModel:function(t){return this.props.mapping?this.props.mapping(t):o(Object.keys(t).reduce(function(i,e){for(var r=e.split("."),n=i;r.length;){var s=r.shift();n=n[s]=r.length?n[s]||{}:t[e]}return i},{}))},getModel:function(){var t=this.getCurrentValues();return this.mapModel(t)},resetModel:function(t){this.inputs.forEach(function(i){var e=i.props.name;t&&t[e]?i.setValue(t[e]):i.resetValue()}),this.validateForm()},setInputValidationErrors:function(t){this.inputs.forEach(function(i){var e=i.props.name,r=[{_isValid:!(e in t),_validationError:"string"==typeof t[e]?[t[e]]:t[e]}];i.setState.apply(i,r)})},isChanged:function(){return!a.isSame(this.getPristineValues(),this.getCurrentValues())},getPristineValues:function(){return this.inputs.reduce(function(t,i){var e=i.props.name;return t[e]=i.props.value,t},{})},updateInputsWithError:function(t){var i=this;Object.keys(t).forEach(function(e,r){var n=a.find(i.inputs,function(t){return t.props.name===e});if(!n)throw new Error("You are trying to update an input that does not exist. Verify errors object with input names. "+JSON.stringify(t));var s=[{_isValid:i.props.preventExternalInvalidation||!1,_externalError:"string"==typeof t[e]?[t[e]]:t[e]}];n.setState.apply(n,s)})},isFormDisabled:function(){return this.props.disabled},getCurrentValues:function(){return this.inputs.reduce(function(t,i){var e=i.props.name;return t[e]=i.state._value,t},{})},setFormPristine:function(t){this.setState({_formSubmitted:!t}),this.inputs.forEach(function(i,e){i.setState({_formSubmitted:!t,_isPristine:t})})},validate:function(t){this.state.canChange&&this.props.onChange(this.getCurrentValues(),this.isChanged());var i=this.runValidation(t);t.setState({_isValid:i.isValid,_isRequired:i.isRequired,_validationError:i.error,_externalError:null},this.validateForm)},runValidation:function(t,i){var e=this.getCurrentValues(),r=t.props.validationErrors,n=t.props.validationError;i=2===arguments.length?i:t.state._value;var s=this.runRules(i,e,t._validations),u=this.runRules(i,e,t._requiredValidations);"function"==typeof t.validate&&(s.failed=t.validate()?[]:["failed"]);var o=Object.keys(t._requiredValidations).length?!!u.success.length:!1,a=!(s.failed.length||this.props.validationErrors&&this.props.validationErrors[t.props.name]);return{isRequired:o,isValid:o?!1:a,error:function(){if(a&&!o)return c;if(s.errors.length)return s.errors;if(this.props.validationErrors&&this.props.validationErrors[t.props.name])return"string"==typeof this.props.validationErrors[t.props.name]?[this.props.validationErrors[t.props.name]]:this.props.validationErrors[t.props.name];if(o){var i=r[u.success[0]];return i?[i]:null}return s.failed.length?s.failed.map(function(t){return r[t]?r[t]:n}).filter(function(t,i,e){return e.indexOf(t)===i}):void 0}.call(this)}},runRules:function(t,i,e){var r={errors:[],failed:[],success:[]};return Object.keys(e).length&&Object.keys(e).forEach(function(n){if(u[n]&&"function"==typeof e[n])throw new Error("Formsy does not allow you to override default validations: "+n);if(!u[n]&&"function"!=typeof e[n])throw new Error("Formsy does not have the validation rule: "+n);if("function"==typeof e[n]){var s=e[n](i,t);return void("string"==typeof s?(r.errors.push(s),r.failed.push(n)):s||r.failed.push(n))}if("function"!=typeof e[n]){var s=u[n](i,t,e[n]);return void("string"==typeof s?(r.errors.push(s),r.failed.push(n)):s?r.success.push(n):r.failed.push(n))}return r.success.push(n)}),r},validateForm:function(){var t=this,i=function(){var t=this.inputs.every(function(t){return t.state._isValid});this.setState({isValid:t}),t?this.props.onValid():this.props.onInvalid(),this.setState({canChange:!0})}.bind(this);this.inputs.forEach(function(e,r){var n=t.runValidation(e);n.isValid&&e.state._externalError&&(n.isValid=!1),e.setState({_isValid:n.isValid,_isRequired:n.isRequired,_validationError:n.error,_externalError:!n.isValid&&e.state._externalError?e.state._externalError:null},r===t.inputs.length-1?i:null)}),!this.inputs.length&&this.isMounted()&&this.setState({canChange:!0})},attachToForm:function(t){-1===this.inputs.indexOf(t)&&this.inputs.push(t),this.validate(t)},detachFromForm:function(t){var i=this.inputs.indexOf(t);-1!==i&&(this.inputs=this.inputs.slice(0,i).concat(this.inputs.slice(i+1))),this.validateForm()},render:function(){return n.createElement("form",r({},this.props,{onSubmit:this.submit}),this.props.children)}}),i.exports||i.module||i.define&&i.define.amd||(i.Formsy=s),t.exports=s}).call(i,function(){return this}())},function(i,e){i.exports=t},function(t,i,e){(function(i){"use strict";var r=e(3),n=i.React||e(1),s=function(t){return"string"==typeof t?t.split(/\,(?![^{\[]*[}\]])/g).reduce(function(t,i){var e=i.split(":"),r=e.shift();if(e=e.map(function(t){try{return JSON.parse(t)}catch(i){return t}}),e.length>1)throw new Error("Formsy does not support multiple args on string validations. Use object format of validations instead.");return t[r]=e.length?e[0]:!0,t},{}):t||{}};t.exports={getInitialState:function(){return{_value:this.props.value,_isRequired:!1,_isValid:!0,_isPristine:!0,_pristineValue:this.props.value,_validationError:[],_externalError:null,_formSubmitted:!1}},contextTypes:{formsy:n.PropTypes.object},getDefaultProps:function(){return{validationError:"",validationErrors:{}}},componentWillMount:function(){var t=function(){this.setValidations(this.props.validations,this.props.required),this.context.formsy.attachToForm(this)}.bind(this);if(!this.props.name)throw new Error("Form Input requires a name property when used");t()},componentWillReceiveProps:function(t){this.setValidations(t.validations,t.required)},componentDidUpdate:function(t){r.isSame(this.props.value,t.value)||this.setValue(this.props.value),r.isSame(this.props.validations,t.validations)&&r.isSame(this.props.required,t.required)||this.context.formsy.validate(this)},componentWillUnmount:function(){this.context.formsy.detachFromForm(this)},setValidations:function(t,i){this._validations=s(t)||{},this._requiredValidations=i===!0?{isDefaultRequiredValue:!0}:s(i)},setValue:function(t){this.setState({_value:t,_isPristine:!1},function(){this.context.formsy.validate(this)}.bind(this))},resetValue:function(){this.setState({_value:this.state._pristineValue,_isPristine:!0},function(){this.context.formsy.validate(this)})},getValue:function(){return this.state._value},hasValue:function(){return""!==this.state._value},getErrorMessage:function(){var t=this.getErrorMessages();return t.length?t[0]:null},getErrorMessages:function(){return!this.isValid()||this.showRequired()?this.state._externalError||this.state._validationError||[]:[]},isFormDisabled:function(){return this.context.formsy.isFormDisabled()},isValid:function(){return this.state._isValid},isPristine:function(){return this.state._isPristine},isFormSubmitted:function(){return this.state._formSubmitted},isRequired:function(){return!!this.props.required},showRequired:function(){return this.state._isRequired},showError:function(){return!this.showRequired()&&!this.isValid()},isValidValue:function(t){return this.context.formsy.isValidValue.call(null,this,t)}}}).call(i,function(){return this}())},function(t,i){"use strict";t.exports={arraysDiffer:function(t,i){var e=!1;return t.length!==i.length?e=!0:t.forEach(function(t,r){this.isSame(t,i[r])||(e=!0)},this),e},objectsDiffer:function(t,i){var e=!1;return Object.keys(t).length!==Object.keys(i).length?e=!0:Object.keys(t).forEach(function(r){this.isSame(t[r],i[r])||(e=!0)},this),e},isSame:function(t,i){return typeof t!=typeof i?!1:Array.isArray(t)?!this.arraysDiffer(t,i):"object"==typeof t&&null!==t&&null!==i?!this.objectsDiffer(t,i):t===i},find:function(t,i){for(var e=0,r=t.length;r>e;e++){var n=t[e];if(i(n))return n}return null}}},function(t,i,e){(function(i){"use strict";var r=Object.assign||function(t){for(var i=1;i=n}};t.exports=n},function(t,i){t.exports=function(t){return Object.keys(t).reduce(function(i,e){var r=e.match(/[^\[]*/i),n=e.match(/\[.*?\]/g)||[];n=[r[0]].concat(n).map(function(t){return t.replace(/\[|\]/g,"")});for(var s=i;n.length;){var u=n.shift();u in s?s=s[u]:(s[u]=n.length?isNaN(n[0])?{}:[]:t[e],s=s[u])}return i},{})}}])}); +!function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i(require("react")):"function"==typeof define&&define.amd?define(["react"],i):"object"==typeof exports?exports.Formsy=i(require("react")):t.Formsy=i(t.react)}(this,function(t){return function(t){function i(r){if(e[r])return e[r].exports;var n=e[r]={exports:{},id:r,loaded:!1};return t[r].call(n.exports,n,n.exports,i),n.loaded=!0,n.exports}var e={};return i.m=t,i.c=e,i.p="",i(0)}([function(t,i,e){(function(i){"use strict";function r(t,i){var e={};for(var r in t)i.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}var n=Object.assign||function(t){for(var i=1;i0&&this.setInputValidationErrors(this.props.validationErrors);var t=this.inputs.map(function(t){return t.props.name});d.arraysDiffer(this.prevInputNames,t)&&this.validateForm()},reset:function(t){this.setFormPristine(!0),this.resetModel(t)},submit:function(t){t&&t.preventDefault(),this.setFormPristine(!1);var i=this.getModel();this.props.onSubmit(i,this.resetModel,this.updateInputsWithError),this.state.isValid?this.props.onValidSubmit(i,this.resetModel,this.updateInputsWithError):this.props.onInvalidSubmit(i,this.resetModel,this.updateInputsWithError)},mapModel:function(t){return this.props.mapping?this.props.mapping(t):l.toObj(Object.keys(t).reduce(function(i,e){for(var r=e.split("."),n=i;r.length;){var s=r.shift();n=n[s]=r.length?n[s]||{}:t[e]}return i},{}))},getModel:function(){var t=this.getCurrentValues();return this.mapModel(t)},resetModel:function(t){this.inputs.forEach(function(i){var e=i.props.name;t&&t[e]?i.setValue(t[e]):i.resetValue()}),this.validateForm()},setInputValidationErrors:function(t){this.inputs.forEach(function(i){var e=i.props.name,r=[{_isValid:!(e in t),_validationError:"string"==typeof t[e]?[t[e]]:t[e]}];i.setState.apply(i,r)})},isChanged:function(){return!d.isSame(this.getPristineValues(),this.getCurrentValues())},getPristineValues:function(){return this.inputs.reduce(function(t,i){var e=i.props.name;return t[e]=i.props.value,t},{})},updateInputsWithError:function(t){var i=this;Object.keys(t).forEach(function(e,r){var n=d.find(i.inputs,function(t){return t.props.name===e});if(!n)throw new Error("You are trying to update an input that does not exist. Verify errors object with input names. "+JSON.stringify(t));var s=[{_isValid:i.props.preventExternalInvalidation||!1,_externalError:"string"==typeof t[e]?[t[e]]:t[e]}];n.setState.apply(n,s)})},isFormDisabled:function(){return this.props.disabled},getCurrentValues:function(){return this.inputs.reduce(function(t,i){var e=i.props.name;return t[e]=i.state._value,t},{})},setFormPristine:function(t){this.setState({_formSubmitted:!t}),this.inputs.forEach(function(i,e){i.setState({_formSubmitted:!t,_isPristine:t})})},validate:function(t){this.state.canChange&&this.props.onChange(this.getCurrentValues(),this.isChanged());var i=this.runValidation(t);t.setState({_isValid:i.isValid,_isRequired:i.isRequired,_validationError:i.error,_externalError:null},this.validateForm)},runValidation:function(t,i){var e=this.getCurrentValues(),r=t.props.validationErrors,n=t.props.validationError;i=2===arguments.length?i:t.state._value;var s=this.runRules(i,e,t._validations),u=this.runRules(i,e,t._requiredValidations);"function"==typeof t.validate&&(s.failed=t.validate()?[]:["failed"]);var o=Object.keys(t._requiredValidations).length?!!u.success.length:!1,a=!(s.failed.length||this.props.validationErrors&&this.props.validationErrors[t.props.name]);return{isRequired:o,isValid:o?!1:a,error:function(){if(a&&!o)return p;if(s.errors.length)return s.errors;if(this.props.validationErrors&&this.props.validationErrors[t.props.name])return"string"==typeof this.props.validationErrors[t.props.name]?[this.props.validationErrors[t.props.name]]:this.props.validationErrors[t.props.name];if(o){var i=r[u.success[0]];return i?[i]:null}return s.failed.length?s.failed.map(function(t){return r[t]?r[t]:n}).filter(function(t,i,e){return e.indexOf(t)===i}):void 0}.call(this)}},runRules:function(t,i,e){var r={errors:[],failed:[],success:[]};return Object.keys(e).length&&Object.keys(e).forEach(function(n){if(a[n]&&"function"==typeof e[n])throw new Error("Formsy does not allow you to override default validations: "+n);if(!a[n]&&"function"!=typeof e[n])throw new Error("Formsy does not have the validation rule: "+n);if("function"==typeof e[n]){var s=e[n](i,t);return void("string"==typeof s?(r.errors.push(s),r.failed.push(n)):s||r.failed.push(n))}if("function"!=typeof e[n]){var s=a[n](i,t,e[n]);return void("string"==typeof s?(r.errors.push(s),r.failed.push(n)):s?r.success.push(n):r.failed.push(n))}return r.success.push(n)}),r},validateForm:function(){var t=this,i=function(){var t=this.inputs.every(function(t){return t.state._isValid});this.setState({isValid:t}),t?this.props.onValid():this.props.onInvalid(),this.setState({canChange:!0})}.bind(this);this.inputs.forEach(function(e,r){var n=t.runValidation(e);n.isValid&&e.state._externalError&&(n.isValid=!1),e.setState({_isValid:n.isValid,_isRequired:n.isRequired,_validationError:n.error,_externalError:!n.isValid&&e.state._externalError?e.state._externalError:null},r===t.inputs.length-1?i:null)}),!this.inputs.length&&this.isMounted()&&this.setState({canChange:!0})},attachToForm:function(t){-1===this.inputs.indexOf(t)&&this.inputs.push(t),this.validate(t)},detachFromForm:function(t){var i=this.inputs.indexOf(t);-1!==i&&(this.inputs=this.inputs.slice(0,i).concat(this.inputs.slice(i+1))),this.validateForm()},render:function(){var t=this.props,i=(t.mapping,t.validationErrors,t.onSubmit,t.onValid,t.onInvalid,t.onInvalidSubmit,t.onChange,t.reset,t.preventExternalInvalidation,t.onSuccess,t.onError,r(t,["mapping","validationErrors","onSubmit","onValid","onInvalid","onInvalidSubmit","onChange","reset","preventExternalInvalidation","onSuccess","onError"]));return u.createElement("form",n({},i,{onSubmit:this.submit}),this.props.children)}}),i.exports||i.module||i.define&&i.define.amd||(i.Formsy=o),t.exports=o}).call(i,function(){return this}())},function(i,e){i.exports=t},function(t,i,e){(function(i){"use strict";var r=e(3),n=i.React||e(1),s=function(t){return"string"==typeof t?t.split(/\,(?![^{\[]*[}\]])/g).reduce(function(t,i){var e=i.split(":"),r=e.shift();if(e=e.map(function(t){try{return JSON.parse(t)}catch(i){return t}}),e.length>1)throw new Error("Formsy does not support multiple args on string validations. Use object format of validations instead.");return t[r]=e.length?e[0]:!0,t},{}):t||{}};t.exports={getInitialState:function(){return{_value:this.props.value,_isRequired:!1,_isValid:!0,_isPristine:!0,_pristineValue:this.props.value,_validationError:[],_externalError:null,_formSubmitted:!1}},contextTypes:{formsy:n.PropTypes.object},getDefaultProps:function(){return{validationError:"",validationErrors:{}}},componentWillMount:function(){var t=function(){this.setValidations(this.props.validations,this.props.required),this.context.formsy.attachToForm(this)}.bind(this);if(!this.props.name)throw new Error("Form Input requires a name property when used");t()},componentWillReceiveProps:function(t){this.setValidations(t.validations,t.required)},componentDidUpdate:function(t){r.isSame(this.props.value,t.value)||this.setValue(this.props.value),r.isSame(this.props.validations,t.validations)&&r.isSame(this.props.required,t.required)||this.context.formsy.validate(this)},componentWillUnmount:function(){this.context.formsy.detachFromForm(this)},setValidations:function(t,i){this._validations=s(t)||{},this._requiredValidations=i===!0?{isDefaultRequiredValue:!0}:s(i)},setValue:function(t){this.setState({_value:t,_isPristine:!1},function(){this.context.formsy.validate(this)}.bind(this))},resetValue:function(){this.setState({_value:this.state._pristineValue,_isPristine:!0},function(){this.context.formsy.validate(this)})},getValue:function(){return this.state._value},hasValue:function(){return""!==this.state._value},getErrorMessage:function(){var t=this.getErrorMessages();return t.length?t[0]:null},getErrorMessages:function(){return!this.isValid()||this.showRequired()?this.state._externalError||this.state._validationError||[]:[]},isFormDisabled:function(){return this.context.formsy.isFormDisabled()},isValid:function(){return this.state._isValid},isPristine:function(){return this.state._isPristine},isFormSubmitted:function(){return this.state._formSubmitted},isRequired:function(){return!!this.props.required},showRequired:function(){return this.state._isRequired},showError:function(){return!this.showRequired()&&!this.isValid()},isValidValue:function(t){return this.context.formsy.isValidValue.call(null,this,t)}}}).call(i,function(){return this}())},function(t,i){"use strict";var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};t.exports={arraysDiffer:function(t,i){var e=!1;return t.length!==i.length?e=!0:t.forEach(function(t,r){this.isSame(t,i[r])||(e=!0)},this),e},objectsDiffer:function(t,i){var e=!1;return Object.keys(t).length!==Object.keys(i).length?e=!0:Object.keys(t).forEach(function(r){this.isSame(t[r],i[r])||(e=!0)},this),e},isSame:function(t,i){return("undefined"==typeof t?"undefined":e(t))!==("undefined"==typeof i?"undefined":e(i))?!1:Array.isArray(t)?!this.arraysDiffer(t,i):"object"===("undefined"==typeof t?"undefined":e(t))&&null!==t&&null!==i?!this.objectsDiffer(t,i):t===i},find:function(t,i){for(var e=0,r=t.length;r>e;e++){var n=t[e];if(i(n))return n}return null}}},function(t,i,e){(function(i){"use strict";var r=Object.assign||function(t){for(var i=1;i=n}};t.exports=n},function(t,i){function e(t){return Object.keys(t).reduce(function(i,e){var r=e.match(/[^\[]*/i),n=e.match(/\[.*?\]/g)||[];n=[r[0]].concat(n).map(function(t){return t.replace(/\[|\]/g,"")});for(var s=i;n.length;){var u=n.shift();u in s?s=s[u]:(s[u]=n.length?isNaN(n[0])?{}:[]:t[e],s=s[u])}return i},{})}function r(t){function i(t,e,r){return Array.isArray(r)||"[object Object]"===Object.prototype.toString.call(r)?(Object.keys(r).forEach(function(n){i(t,e+"["+n+"]",r[n])}),t):(t[e]=r,t)}var e=Object.keys(t);return e.reduce(function(e,r){return i(e,r,t[r])},{})}t.exports={fromObj:r,toObj:e}}])}); //# 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 b6e4c4c..eee67dc 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 efaed3dbac2b1cdb31ec","webpack:///D:/Dev/git/React/formsy-react/src/main.js","webpack:///external \"react\"","webpack:///D:/Dev/git/React/formsy-react/src/Mixin.js","webpack:///D:/Dev/git/React/formsy-react/src/utils.js","webpack:///D:/Dev/git/React/formsy-react/src/Decorator.js","webpack:///D:/Dev/git/React/formsy-react/src/HOC.js","webpack:///D:/Dev/git/React/formsy-react/src/validationRules.js","webpack:///./~/form-data-to-object/index.js"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_1__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","global","_extends","Object","assign","target","i","arguments","length","source","key","prototype","hasOwnProperty","React","Formsy","validationRules","formDataToObject","utils","Mixin","HOC","Decorator","options","emptyArray","defaults","passedOptions","addValidationRule","name","func","Form","createClass","displayName","getInitialState","isValid","isSubmitting","canChange","getDefaultProps","onSuccess","onError","onSubmit","onValidSubmit","onInvalidSubmit","onSubmitted","onValid","onInvalid","onChange","validationErrors","preventExternalInvalidation","childContextTypes","formsy","PropTypes","object","getChildContext","_this","attachToForm","detachFromForm","validate","isFormDisabled","isValidValue","component","value","runValidation","componentWillMount","inputs","componentDidMount","validateForm","componentWillUpdate","prevInputNames","map","props","componentDidUpdate","keys","setInputValidationErrors","newInputNames","arraysDiffer","reset","data","setFormPristine","resetModel","submit","event","preventDefault","model","getModel","updateInputsWithError","state","mapModel","mapping","reduce","mappedModel","keyArray","split","base","currentKey","shift","currentValues","getCurrentValues","forEach","setValue","resetValue","errors","args","_isValid","_validationError","setState","apply","isChanged","isSame","getPristineValues","_this2","index","find","Error","JSON","stringify","_externalError","disabled","_value","isPristine","_formSubmitted","_isPristine","validation","_isRequired","isRequired","error","validationError","validationResults","runRules","_validations","requiredResults","_requiredValidations","failed","success","filter","x","pos","arr","indexOf","validations","results","validationMethod","push","_this3","onValidationComplete","allIsValid","every","bind","isMounted","componentPos","slice","concat","render","createElement","children","convertValidationsToObject","validateMethod","arg","parse","e","_pristineValue","contextTypes","configure","setValidations","required","context","componentWillReceiveProps","nextProps","prevProps","componentWillUnmount","isDefaultRequiredValue","getValue","hasValue","getErrorMessage","messages","getErrorMessages","showRequired","isFormSubmitted","showError","a","b","isDifferent","item","objectsDiffer","Array","isArray","collection","fn","l","Component","mixins","_isExisty","undefined","isEmpty","values","isExisty","matchRegexp","regexp","test","isUndefined","isEmptyString","isEmail","isUrl","isTrue","isFalse","isNumeric","isAlpha","isAlphanumeric","isInt","isFloat","isWords","isSpecialWords","isLength","equals","eql","equalsField","field","maxLength","minLength","output","parentKey","match","paths","replace","currentPath","pathKey","isNaN"],"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,IACAT,WACAW,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAZ,EAAAD,QAAAC,IAAAD,QAAAQ,GAGAP,EAAAW,QAAA,EAGAX,EAAAD,QAvBA,GAAAU,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDgBM,SAASP,EAAQD,EAASQ,IAEH,SAASS,GAAS,YAE9C,IAAIC,GAAWC,OAAOC,QAAU,SAAUC,GAAU,IAAK,GAAIC,GAAI,EAAGA,EAAIC,UAAUC,OAAQF,IAAK,CAAE,GAAIG,GAASF,UAAUD,EAAI,KAAK,GAAII,KAAOD,GAAcN,OAAOQ,UAAUC,eAAef,KAAKY,EAAQC,KAAQL,EAAOK,GAAOD,EAAOC,IAAY,MAAOL,I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,eACAC,IAAAF,EAAA,IAAArE,OAAAuE,GAAAzJ,IAAA,SAAAzD,GACA,MAAAA,GAAAmN,QAAA,cAIA,KADA,GAAAC,GAAAL,EACAG,EAAApN,QAAA,CAEA,GAAAuN,GAAAH,EAAA/H,OAEAkI,KAAAD,GACAA,IAAAC,IAEAD,EAAAC,GAAAH,EAAApN,OAAAwN,MAAAJ,EAAA,UAAkEnN,EAAAC,GAClEoN,IAAAC,IAKA,MAAAN","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\n **/","(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/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\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.loaded = 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// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {'use strict';\n\t\n\tvar _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\t\n\tvar React = global.React || __webpack_require__(1);\n\tvar Formsy = {};\n\tvar validationRules = __webpack_require__(6);\n\tvar formDataToObject = __webpack_require__(7);\n\tvar utils = __webpack_require__(3);\n\tvar Mixin = __webpack_require__(2);\n\tvar HOC = __webpack_require__(5);\n\tvar Decorator = __webpack_require__(4);\n\tvar options = {};\n\tvar emptyArray = [];\n\t\n\tFormsy.Mixin = Mixin;\n\tFormsy.HOC = HOC;\n\tFormsy.Decorator = Decorator;\n\t\n\tFormsy.defaults = function (passedOptions) {\n\t options = passedOptions;\n\t};\n\t\n\tFormsy.addValidationRule = function (name, func) {\n\t validationRules[name] = func;\n\t};\n\t\n\tFormsy.Form = React.createClass({\n\t displayName: 'Formsy',\n\t getInitialState: function getInitialState() {\n\t return {\n\t isValid: true,\n\t isSubmitting: false,\n\t canChange: false\n\t };\n\t },\n\t getDefaultProps: function getDefaultProps() {\n\t return {\n\t onSuccess: function onSuccess() {},\n\t onError: function onError() {},\n\t onSubmit: function onSubmit() {},\n\t onValidSubmit: function onValidSubmit() {},\n\t onInvalidSubmit: function onInvalidSubmit() {},\n\t onSubmitted: function onSubmitted() {},\n\t onValid: function onValid() {},\n\t onInvalid: function onInvalid() {},\n\t onChange: function onChange() {},\n\t validationErrors: null,\n\t preventExternalInvalidation: false\n\t };\n\t },\n\t\n\t childContextTypes: {\n\t formsy: React.PropTypes.object\n\t },\n\t getChildContext: function getChildContext() {\n\t var _this = this;\n\t\n\t return {\n\t formsy: {\n\t attachToForm: this.attachToForm,\n\t detachFromForm: this.detachFromForm,\n\t validate: this.validate,\n\t isFormDisabled: this.isFormDisabled,\n\t isValidValue: function isValidValue(component, value) {\n\t return _this.runValidation(component, value).isValid;\n\t }\n\t }\n\t };\n\t },\n\t\n\t // Add a map to store the inputs of the form, a model to store\n\t // the values of the form and register child inputs\n\t componentWillMount: function componentWillMount() {\n\t this.inputs = [];\n\t },\n\t\n\t componentDidMount: function componentDidMount() {\n\t this.validateForm();\n\t },\n\t\n\t componentWillUpdate: function componentWillUpdate() {\n\t // Keep a reference to input names before form updates,\n\t // to check if inputs has changed after render\n\t this.prevInputNames = this.inputs.map(function (component) {\n\t return component.props.name;\n\t });\n\t },\n\t\n\t componentDidUpdate: function componentDidUpdate() {\n\t\n\t if (this.props.validationErrors && typeof this.props.validationErrors === 'object' && Object.keys(this.props.validationErrors).length > 0) {\n\t this.setInputValidationErrors(this.props.validationErrors);\n\t }\n\t\n\t var newInputNames = this.inputs.map(function (component) {\n\t return component.props.name;\n\t });\n\t if (utils.arraysDiffer(this.prevInputNames, newInputNames)) {\n\t this.validateForm();\n\t }\n\t },\n\t\n\t // Allow resetting to specified data\n\t reset: function reset(data) {\n\t this.setFormPristine(true);\n\t this.resetModel(data);\n\t },\n\t\n\t // Update model, submit to url prop and send the model\n\t submit: function submit(event) {\n\t\n\t event && event.preventDefault();\n\t\n\t // Trigger form as not pristine.\n\t // If any inputs have not been touched yet this will make them dirty\n\t // so validation becomes visible (if based on isPristine)\n\t this.setFormPristine(false);\n\t var model = this.getModel();\n\t this.props.onSubmit(model, this.resetModel, this.updateInputsWithError);\n\t this.state.isValid ? this.props.onValidSubmit(model, this.resetModel, this.updateInputsWithError) : this.props.onInvalidSubmit(model, this.resetModel, this.updateInputsWithError);\n\t },\n\t\n\t mapModel: function mapModel(model) {\n\t\n\t if (this.props.mapping) {\n\t return this.props.mapping(model);\n\t } else {\n\t return formDataToObject(Object.keys(model).reduce(function (mappedModel, key) {\n\t\n\t var keyArray = key.split('.');\n\t var base = mappedModel;\n\t while (keyArray.length) {\n\t var currentKey = keyArray.shift();\n\t base = base[currentKey] = keyArray.length ? base[currentKey] || {} : model[key];\n\t }\n\t\n\t return mappedModel;\n\t }, {}));\n\t }\n\t },\n\t\n\t getModel: function getModel() {\n\t var currentValues = this.getCurrentValues();\n\t return this.mapModel(currentValues);\n\t },\n\t\n\t // Reset each key in the model to the original / initial / specified value\n\t resetModel: function resetModel(data) {\n\t this.inputs.forEach(function (component) {\n\t var name = component.props.name;\n\t if (data && data[name]) {\n\t component.setValue(data[name]);\n\t } else {\n\t component.resetValue();\n\t }\n\t });\n\t this.validateForm();\n\t },\n\t\n\t setInputValidationErrors: function setInputValidationErrors(errors) {\n\t this.inputs.forEach(function (component) {\n\t var name = component.props.name;\n\t var args = [{\n\t _isValid: !(name in errors),\n\t _validationError: typeof errors[name] === 'string' ? [errors[name]] : errors[name]\n\t }];\n\t component.setState.apply(component, args);\n\t });\n\t },\n\t\n\t // Checks if the values have changed from their initial value\n\t isChanged: function isChanged() {\n\t return !utils.isSame(this.getPristineValues(), this.getCurrentValues());\n\t },\n\t\n\t getPristineValues: function getPristineValues() {\n\t return this.inputs.reduce(function (data, component) {\n\t var name = component.props.name;\n\t data[name] = component.props.value;\n\t return data;\n\t }, {});\n\t },\n\t\n\t // Go through errors from server and grab the components\n\t // stored in the inputs map. Change their state to invalid\n\t // and set the serverError message\n\t updateInputsWithError: function updateInputsWithError(errors) {\n\t var _this2 = this;\n\t\n\t Object.keys(errors).forEach(function (name, index) {\n\t var component = utils.find(_this2.inputs, function (component) {\n\t return component.props.name === name;\n\t });\n\t if (!component) {\n\t throw new Error('You are trying to update an input that does not exist. ' + 'Verify errors object with input names. ' + JSON.stringify(errors));\n\t }\n\t var args = [{\n\t _isValid: _this2.props.preventExternalInvalidation || false,\n\t _externalError: typeof errors[name] === 'string' ? [errors[name]] : errors[name]\n\t }];\n\t component.setState.apply(component, args);\n\t });\n\t },\n\t\n\t isFormDisabled: function isFormDisabled() {\n\t return this.props.disabled;\n\t },\n\t\n\t getCurrentValues: function getCurrentValues() {\n\t return this.inputs.reduce(function (data, component) {\n\t var name = component.props.name;\n\t data[name] = component.state._value;\n\t return data;\n\t }, {});\n\t },\n\t\n\t setFormPristine: function setFormPristine(isPristine) {\n\t this.setState({\n\t _formSubmitted: !isPristine\n\t });\n\t\n\t // Iterate through each component and set it as pristine\n\t // or \"dirty\".\n\t this.inputs.forEach(function (component, index) {\n\t component.setState({\n\t _formSubmitted: !isPristine,\n\t _isPristine: isPristine\n\t });\n\t });\n\t },\n\t\n\t // Use the binded values and the actual input value to\n\t // validate the input and set its state. Then check the\n\t // state of the form itself\n\t validate: function validate(component) {\n\t\n\t // Trigger onChange\n\t if (this.state.canChange) {\n\t this.props.onChange(this.getCurrentValues(), this.isChanged());\n\t }\n\t\n\t var validation = this.runValidation(component);\n\t // Run through the validations, split them up and call\n\t // the validator IF there is a value or it is required\n\t component.setState({\n\t _isValid: validation.isValid,\n\t _isRequired: validation.isRequired,\n\t _validationError: validation.error,\n\t _externalError: null\n\t }, this.validateForm);\n\t },\n\t\n\t // Checks validation on current value or a passed value\n\t runValidation: function runValidation(component, value) {\n\t\n\t var currentValues = this.getCurrentValues();\n\t var validationErrors = component.props.validationErrors;\n\t var validationError = component.props.validationError;\n\t value = arguments.length === 2 ? value : component.state._value;\n\t\n\t var validationResults = this.runRules(value, currentValues, component._validations);\n\t var requiredResults = this.runRules(value, currentValues, component._requiredValidations);\n\t\n\t // the component defines an explicit validate function\n\t if (typeof component.validate === \"function\") {\n\t validationResults.failed = component.validate() ? [] : ['failed'];\n\t }\n\t\n\t var isRequired = Object.keys(component._requiredValidations).length ? !!requiredResults.success.length : false;\n\t var isValid = !validationResults.failed.length && !(this.props.validationErrors && this.props.validationErrors[component.props.name]);\n\t\n\t return {\n\t isRequired: isRequired,\n\t isValid: isRequired ? false : isValid,\n\t error: (function () {\n\t\n\t if (isValid && !isRequired) {\n\t return emptyArray;\n\t }\n\t\n\t if (validationResults.errors.length) {\n\t return validationResults.errors;\n\t }\n\t\n\t if (this.props.validationErrors && this.props.validationErrors[component.props.name]) {\n\t return typeof this.props.validationErrors[component.props.name] === 'string' ? [this.props.validationErrors[component.props.name]] : this.props.validationErrors[component.props.name];\n\t }\n\t\n\t if (isRequired) {\n\t var error = validationErrors[requiredResults.success[0]];\n\t return error ? [error] : null;\n\t }\n\t\n\t if (validationResults.failed.length) {\n\t return validationResults.failed.map(function (failed) {\n\t return validationErrors[failed] ? validationErrors[failed] : validationError;\n\t }).filter(function (x, pos, arr) {\n\t // Remove duplicates\n\t return arr.indexOf(x) === pos;\n\t });\n\t }\n\t }).call(this)\n\t };\n\t },\n\t\n\t runRules: function runRules(value, currentValues, validations) {\n\t\n\t var results = {\n\t errors: [],\n\t failed: [],\n\t success: []\n\t };\n\t if (Object.keys(validations).length) {\n\t Object.keys(validations).forEach(function (validationMethod) {\n\t\n\t if (validationRules[validationMethod] && typeof validations[validationMethod] === 'function') {\n\t throw new Error('Formsy does not allow you to override default validations: ' + validationMethod);\n\t }\n\t\n\t if (!validationRules[validationMethod] && typeof validations[validationMethod] !== 'function') {\n\t throw new Error('Formsy does not have the validation rule: ' + validationMethod);\n\t }\n\t\n\t if (typeof validations[validationMethod] === 'function') {\n\t var validation = validations[validationMethod](currentValues, value);\n\t if (typeof validation === 'string') {\n\t results.errors.push(validation);\n\t results.failed.push(validationMethod);\n\t } else if (!validation) {\n\t results.failed.push(validationMethod);\n\t }\n\t return;\n\t } else if (typeof validations[validationMethod] !== 'function') {\n\t var validation = validationRules[validationMethod](currentValues, value, validations[validationMethod]);\n\t if (typeof validation === 'string') {\n\t results.errors.push(validation);\n\t results.failed.push(validationMethod);\n\t } else if (!validation) {\n\t results.failed.push(validationMethod);\n\t } else {\n\t results.success.push(validationMethod);\n\t }\n\t return;\n\t }\n\t\n\t return results.success.push(validationMethod);\n\t });\n\t }\n\t\n\t return results;\n\t },\n\t\n\t // Validate the form by going through all child input components\n\t // and check their state\n\t validateForm: function validateForm() {\n\t var _this3 = this;\n\t\n\t // We need a callback as we are validating all inputs again. This will\n\t // run when the last component has set its state\n\t var onValidationComplete = (function () {\n\t var allIsValid = this.inputs.every(function (component) {\n\t return component.state._isValid;\n\t });\n\t\n\t this.setState({\n\t isValid: allIsValid\n\t });\n\t\n\t if (allIsValid) {\n\t this.props.onValid();\n\t } else {\n\t this.props.onInvalid();\n\t }\n\t\n\t // Tell the form that it can start to trigger change events\n\t this.setState({\n\t canChange: true\n\t });\n\t }).bind(this);\n\t\n\t // Run validation again in case affected by other inputs. The\n\t // last component validated will run the onValidationComplete callback\n\t this.inputs.forEach(function (component, index) {\n\t var validation = _this3.runValidation(component);\n\t if (validation.isValid && component.state._externalError) {\n\t validation.isValid = false;\n\t }\n\t component.setState({\n\t _isValid: validation.isValid,\n\t _isRequired: validation.isRequired,\n\t _validationError: validation.error,\n\t _externalError: !validation.isValid && component.state._externalError ? component.state._externalError : null\n\t }, index === _this3.inputs.length - 1 ? onValidationComplete : null);\n\t });\n\t\n\t // If there are no inputs, set state where form is ready to trigger\n\t // change event. New inputs might be added later\n\t if (!this.inputs.length && this.isMounted()) {\n\t this.setState({\n\t canChange: true\n\t });\n\t }\n\t },\n\t\n\t // Method put on each input component to register\n\t // itself to the form\n\t attachToForm: function attachToForm(component) {\n\t\n\t if (this.inputs.indexOf(component) === -1) {\n\t this.inputs.push(component);\n\t }\n\t\n\t this.validate(component);\n\t },\n\t\n\t // Method put on each input component to unregister\n\t // itself from the form\n\t detachFromForm: function detachFromForm(component) {\n\t var componentPos = this.inputs.indexOf(component);\n\t\n\t if (componentPos !== -1) {\n\t this.inputs = this.inputs.slice(0, componentPos).concat(this.inputs.slice(componentPos + 1));\n\t }\n\t\n\t this.validateForm();\n\t },\n\t render: function render() {\n\t\n\t return React.createElement(\n\t 'form',\n\t _extends({}, this.props, { onSubmit: this.submit }),\n\t this.props.children\n\t );\n\t }\n\t});\n\t\n\tif (!global.exports && !global.module && (!global.define || !global.define.amd)) {\n\t global.Formsy = Formsy;\n\t}\n\t\n\tmodule.exports = Formsy;\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {'use strict';\n\t\n\tvar utils = __webpack_require__(3);\n\tvar React = global.React || __webpack_require__(1);\n\t\n\tvar convertValidationsToObject = function convertValidationsToObject(validations) {\n\t\n\t if (typeof validations === 'string') {\n\t\n\t return validations.split(/\\,(?![^{\\[]*[}\\]])/g).reduce(function (validations, validation) {\n\t var args = validation.split(':');\n\t var validateMethod = args.shift();\n\t\n\t args = args.map(function (arg) {\n\t try {\n\t return JSON.parse(arg);\n\t } catch (e) {\n\t return arg; // It is a string if it can not parse it\n\t }\n\t });\n\t\n\t if (args.length > 1) {\n\t throw new Error('Formsy does not support multiple args on string validations. Use object format of validations instead.');\n\t }\n\t\n\t validations[validateMethod] = args.length ? args[0] : true;\n\t return validations;\n\t }, {});\n\t }\n\t\n\t return validations || {};\n\t};\n\t\n\tmodule.exports = {\n\t getInitialState: function getInitialState() {\n\t return {\n\t _value: this.props.value,\n\t _isRequired: false,\n\t _isValid: true,\n\t _isPristine: true,\n\t _pristineValue: this.props.value,\n\t _validationError: [],\n\t _externalError: null,\n\t _formSubmitted: false\n\t };\n\t },\n\t contextTypes: {\n\t formsy: React.PropTypes.object // What about required?\n\t },\n\t getDefaultProps: function getDefaultProps() {\n\t return {\n\t validationError: '',\n\t validationErrors: {}\n\t };\n\t },\n\t\n\t componentWillMount: function componentWillMount() {\n\t var configure = (function () {\n\t this.setValidations(this.props.validations, this.props.required);\n\t\n\t // Pass a function instead?\n\t this.context.formsy.attachToForm(this);\n\t //this.props._attachToForm(this);\n\t }).bind(this);\n\t\n\t if (!this.props.name) {\n\t throw new Error('Form Input requires a name property when used');\n\t }\n\t\n\t /*\r\n\t if (!this.props._attachToForm) {\r\n\t return setTimeout(function () {\r\n\t if (!this.isMounted()) return;\r\n\t if (!this.props._attachToForm) {\r\n\t throw new Error('Form Mixin requires component to be nested in a Form');\r\n\t }\r\n\t configure();\r\n\t }.bind(this), 0);\r\n\t }\r\n\t */\n\t configure();\n\t },\n\t\n\t // We have to make the validate method is kept when new props are added\n\t componentWillReceiveProps: function componentWillReceiveProps(nextProps) {\n\t this.setValidations(nextProps.validations, nextProps.required);\n\t },\n\t\n\t componentDidUpdate: function componentDidUpdate(prevProps) {\n\t\n\t // If the value passed has changed, set it. If value is not passed it will\n\t // internally update, and this will never run\n\t if (!utils.isSame(this.props.value, prevProps.value)) {\n\t this.setValue(this.props.value);\n\t }\n\t\n\t // If validations or required is changed, run a new validation\n\t if (!utils.isSame(this.props.validations, prevProps.validations) || !utils.isSame(this.props.required, prevProps.required)) {\n\t this.context.formsy.validate(this);\n\t }\n\t },\n\t\n\t // Detach it when component unmounts\n\t componentWillUnmount: function componentWillUnmount() {\n\t this.context.formsy.detachFromForm(this);\n\t //this.props._detachFromForm(this);\n\t },\n\t\n\t setValidations: function setValidations(validations, required) {\n\t\n\t // Add validations to the store itself as the props object can not be modified\n\t this._validations = convertValidationsToObject(validations) || {};\n\t this._requiredValidations = required === true ? { isDefaultRequiredValue: true } : convertValidationsToObject(required);\n\t },\n\t\n\t // We validate after the value has been set\n\t setValue: function setValue(value) {\n\t this.setState({\n\t _value: value,\n\t _isPristine: false\n\t }, (function () {\n\t this.context.formsy.validate(this);\n\t //this.props._validate(this);\n\t }).bind(this));\n\t },\n\t resetValue: function resetValue() {\n\t this.setState({\n\t _value: this.state._pristineValue,\n\t _isPristine: true\n\t }, function () {\n\t this.context.formsy.validate(this);\n\t //this.props._validate(this);\n\t });\n\t },\n\t getValue: function getValue() {\n\t return this.state._value;\n\t },\n\t hasValue: function hasValue() {\n\t return this.state._value !== '';\n\t },\n\t getErrorMessage: function getErrorMessage() {\n\t var messages = this.getErrorMessages();\n\t return messages.length ? messages[0] : null;\n\t },\n\t getErrorMessages: function getErrorMessages() {\n\t return !this.isValid() || this.showRequired() ? this.state._externalError || this.state._validationError || [] : [];\n\t },\n\t isFormDisabled: function isFormDisabled() {\n\t return this.context.formsy.isFormDisabled();\n\t //return this.props._isFormDisabled();\n\t },\n\t isValid: function isValid() {\n\t return this.state._isValid;\n\t },\n\t isPristine: function isPristine() {\n\t return this.state._isPristine;\n\t },\n\t isFormSubmitted: function isFormSubmitted() {\n\t return this.state._formSubmitted;\n\t },\n\t isRequired: function isRequired() {\n\t return !!this.props.required;\n\t },\n\t showRequired: function showRequired() {\n\t return this.state._isRequired;\n\t },\n\t showError: function showError() {\n\t return !this.showRequired() && !this.isValid();\n\t },\n\t isValidValue: function isValidValue(value) {\n\t return this.context.formsy.isValidValue.call(null, this, value);\n\t //return this.props._isValidValue.call(null, this, value);\n\t }\n\t};\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tmodule.exports = {\n\t arraysDiffer: function arraysDiffer(a, b) {\n\t var isDifferent = false;\n\t if (a.length !== b.length) {\n\t isDifferent = true;\n\t } else {\n\t a.forEach(function (item, index) {\n\t if (!this.isSame(item, b[index])) {\n\t isDifferent = true;\n\t }\n\t }, this);\n\t }\n\t return isDifferent;\n\t },\n\t\n\t objectsDiffer: function objectsDiffer(a, b) {\n\t var isDifferent = false;\n\t if (Object.keys(a).length !== Object.keys(b).length) {\n\t isDifferent = true;\n\t } else {\n\t Object.keys(a).forEach(function (key) {\n\t if (!this.isSame(a[key], b[key])) {\n\t isDifferent = true;\n\t }\n\t }, this);\n\t }\n\t return isDifferent;\n\t },\n\t\n\t isSame: function isSame(a, b) {\n\t if (typeof a !== typeof b) {\n\t return false;\n\t } else if (Array.isArray(a)) {\n\t return !this.arraysDiffer(a, b);\n\t } else if (typeof a === 'object' && a !== null && b !== null) {\n\t return !this.objectsDiffer(a, b);\n\t }\n\t\n\t return a === b;\n\t },\n\t\n\t find: function find(collection, fn) {\n\t for (var i = 0, l = collection.length; i < l; i++) {\n\t var item = collection[i];\n\t if (fn(item)) {\n\t return item;\n\t }\n\t }\n\t return null;\n\t }\n\t};\n\n/***/ },\n/* 4 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {'use strict';\n\t\n\tvar _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\t\n\tvar React = global.React || __webpack_require__(1);\n\tvar Mixin = __webpack_require__(2);\n\tmodule.exports = function () {\n\t return function (Component) {\n\t return React.createClass({\n\t mixins: [Mixin],\n\t render: function render() {\n\t return React.createElement(Component, _extends({\n\t setValidations: this.setValidations,\n\t setValue: this.setValue,\n\t resetValue: this.resetValue,\n\t getValue: this.getValue,\n\t hasValue: this.hasValue,\n\t getErrorMessage: this.getErrorMessage,\n\t getErrorMessages: this.getErrorMessages,\n\t isFormDisabled: this.isFormDisabled,\n\t isValid: this.isValid,\n\t isPristine: this.isPristine,\n\t isFormSubmitted: this.isFormSubmitted,\n\t isRequired: this.isRequired,\n\t showRequired: this.showRequired,\n\t showError: this.showError,\n\t isValidValue: this.isValidValue\n\t }, this.props));\n\t }\n\t });\n\t };\n\t};\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ },\n/* 5 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {'use strict';\n\t\n\tvar _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\t\n\tvar React = global.React || __webpack_require__(1);\n\tvar Mixin = __webpack_require__(2);\n\tmodule.exports = function (Component) {\n\t return React.createClass({\n\t mixins: [Mixin],\n\t render: function render() {\n\t return React.createElement(Component, _extends({\n\t setValidations: this.setValidations,\n\t setValue: this.setValue,\n\t resetValue: this.resetValue,\n\t getValue: this.getValue,\n\t hasValue: this.hasValue,\n\t getErrorMessage: this.getErrorMessage,\n\t getErrorMessages: this.getErrorMessages,\n\t isFormDisabled: this.isFormDisabled,\n\t isValid: this.isValid,\n\t isPristine: this.isPristine,\n\t isFormSubmitted: this.isFormSubmitted,\n\t isRequired: this.isRequired,\n\t showRequired: this.showRequired,\n\t showError: this.showError,\n\t isValidValue: this.isValidValue\n\t }, this.props));\n\t }\n\t });\n\t};\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ },\n/* 6 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tvar _isExisty = function _isExisty(value) {\n\t return value !== null && value !== undefined;\n\t};\n\t\n\tvar isEmpty = function isEmpty(value) {\n\t return value === '';\n\t};\n\t\n\tvar validations = {\n\t isDefaultRequiredValue: function isDefaultRequiredValue(values, value) {\n\t return value === undefined || value === '';\n\t },\n\t isExisty: function isExisty(values, value) {\n\t return _isExisty(value);\n\t },\n\t matchRegexp: function matchRegexp(values, value, regexp) {\n\t return !_isExisty(value) || isEmpty(value) || regexp.test(value);\n\t },\n\t isUndefined: function isUndefined(values, value) {\n\t return value === undefined;\n\t },\n\t isEmptyString: function isEmptyString(values, value) {\n\t return isEmpty(value);\n\t },\n\t isEmail: function isEmail(values, value) {\n\t return validations.matchRegexp(values, value, /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i);\n\t },\n\t isUrl: function isUrl(values, value) {\n\t return validations.matchRegexp(values, value, /^(https?|s?ftp):\\/\\/(((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:)*@)?(((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]))|((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?)(:\\d*)?)(\\/((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)+(\\/(([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)*)*)?)?(\\?((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)|[\\uE000-\\uF8FF]|\\/|\\?)*)?(#((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$/i);\n\t },\n\t isTrue: function isTrue(values, value) {\n\t return value === true;\n\t },\n\t isFalse: function isFalse(values, value) {\n\t return value === false;\n\t },\n\t isNumeric: function isNumeric(values, value) {\n\t if (typeof value === 'number') {\n\t return true;\n\t }\n\t return validations.matchRegexp(values, value, /^[-+]?(?:\\d*[.])?\\d+$/);\n\t },\n\t isAlpha: function isAlpha(values, value) {\n\t return validations.matchRegexp(values, value, /^[A-Z]+$/i);\n\t },\n\t isAlphanumeric: function isAlphanumeric(values, value) {\n\t return validations.matchRegexp(values, value, /^[0-9A-Z]+$/i);\n\t },\n\t isInt: function isInt(values, value) {\n\t return validations.matchRegexp(values, value, /^(?:[-+]?(?:0|[1-9]\\d*))$/);\n\t },\n\t isFloat: function isFloat(values, value) {\n\t return validations.matchRegexp(values, value, /^(?:[-+]?(?:\\d+))?(?:\\.\\d*)?(?:[eE][\\+\\-]?(?:\\d+))?$/);\n\t },\n\t isWords: function isWords(values, value) {\n\t return validations.matchRegexp(values, value, /^[A-Z\\s]+$/i);\n\t },\n\t isSpecialWords: function isSpecialWords(values, value) {\n\t return validations.matchRegexp(values, value, /^[A-Z\\s\\u00C0-\\u017F]+$/i);\n\t },\n\t isLength: function isLength(values, value, length) {\n\t return !_isExisty(value) || isEmpty(value) || value.length === length;\n\t },\n\t equals: function equals(values, value, eql) {\n\t return !_isExisty(value) || isEmpty(value) || value == eql;\n\t },\n\t equalsField: function equalsField(values, value, field) {\n\t return value == values[field];\n\t },\n\t maxLength: function maxLength(values, value, length) {\n\t return !_isExisty(value) || value.length <= length;\n\t },\n\t minLength: function minLength(values, value, length) {\n\t return !_isExisty(value) || isEmpty(value) || value.length >= length;\n\t }\n\t};\n\t\n\tmodule.exports = validations;\n\n/***/ },\n/* 7 */\n/***/ function(module, exports) {\n\n\tmodule.exports = function (source) {\n\t\n\t\n\t // \"foo[0]\"\n\t return Object.keys(source).reduce(function (output, key) {\n\t\n\t var parentKey = key.match(/[^\\[]*/i);\n\t var paths = key.match(/\\[.*?\\]/g) || [];\n\t paths = [parentKey[0]].concat(paths).map(function (key) {\n\t return key.replace(/\\[|\\]/g, '');\n\t });\n\t\n\t var currentPath = output;\n\t while (paths.length) {\n\t\n\t var pathKey = paths.shift();\n\t\n\t if (pathKey in currentPath) {\n\t currentPath = currentPath[pathKey];\n\t } else {\n\t currentPath[pathKey] = paths.length ? isNaN(paths[0]) ? {} : [] : source[key];\n\t currentPath = currentPath[pathKey];\n\t }\n\t\n\t }\n\t\n\t return output;\n\t\n\t }, {});\n\t\n\t};\n\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** formsy-react.js\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\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\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.loaded = 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// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap efaed3dbac2b1cdb31ec\n **/","var React = global.React || require('react');\nvar Formsy = {};\nvar validationRules = require('./validationRules.js');\nvar formDataToObject = require('form-data-to-object');\nvar utils = require('./utils.js');\nvar Mixin = require('./Mixin.js');\nvar HOC = require('./HOC.js');\nvar Decorator = require('./Decorator.js');\nvar options = {};\nvar emptyArray = [];\n\nFormsy.Mixin = Mixin;\nFormsy.HOC = HOC;\nFormsy.Decorator = Decorator;\n\nFormsy.defaults = function (passedOptions) {\n options = passedOptions;\n};\n\nFormsy.addValidationRule = function (name, func) {\n validationRules[name] = func;\n};\n\nFormsy.Form = React.createClass({\n displayName: 'Formsy',\n getInitialState: function () {\n return {\n isValid: true,\n isSubmitting: false,\n canChange: false\n };\n },\n getDefaultProps: function () {\n return {\n onSuccess: function () {},\n onError: function () {},\n onSubmit: function () {},\n onValidSubmit: function () {},\n onInvalidSubmit: function () {},\n onSubmitted: function () {},\n onValid: function () {},\n onInvalid: function () {},\n onChange: function () {},\n validationErrors: null,\n preventExternalInvalidation: false\n };\n },\n\n childContextTypes: {\n formsy: React.PropTypes.object\n },\n getChildContext: function () {\n return {\n formsy: {\n attachToForm: this.attachToForm,\n detachFromForm: this.detachFromForm,\n validate: this.validate,\n isFormDisabled: this.isFormDisabled,\n isValidValue: (component, value) => {\n return this.runValidation(component, value).isValid;\n }\n }\n }\n },\n\n // Add a map to store the inputs of the form, a model to store\n // the values of the form and register child inputs\n componentWillMount: function () {\n this.inputs = [];\n },\n\n componentDidMount: function () {\n this.validateForm();\n },\n\n componentWillUpdate: function () {\n // Keep a reference to input names before form updates,\n // to check if inputs has changed after render\n this.prevInputNames = this.inputs.map(component => component.props.name);\n },\n\n componentDidUpdate: function () {\n\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(component => component.props.name);\n if (utils.arraysDiffer(this.prevInputNames, newInputNames)) {\n this.validateForm();\n }\n\n },\n\n // Allow resetting to specified data\n reset: function (data) {\n this.setFormPristine(true);\n this.resetModel(data);\n },\n\n // Update model, submit to url prop and send the model\n submit: function (event) {\n\n event && event.preventDefault();\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 this.state.isValid ? this.props.onValidSubmit(model, this.resetModel, this.updateInputsWithError) : this.props.onInvalidSubmit(model, this.resetModel, this.updateInputsWithError);\n\n },\n\n mapModel: function (model) {\n\n if (this.props.mapping) {\n return this.props.mapping(model)\n } else {\n return formDataToObject(Object.keys(model).reduce((mappedModel, key) => {\n\n var keyArray = key.split('.');\n var base = mappedModel;\n while (keyArray.length) {\n var currentKey = keyArray.shift();\n base = (base[currentKey] = keyArray.length ? base[currentKey] || {} : model[key]);\n }\n\n return mappedModel;\n\n }, {}));\n }\n },\n\n getModel: function () {\n var currentValues = this.getCurrentValues();\n return this.mapModel(currentValues);\n },\n\n // Reset each key in the model to the original / initial / specified value\n resetModel: function (data) {\n this.inputs.forEach(component => {\n var name = component.props.name;\n if (data && data[name]) {\n component.setValue(data[name]);\n } else {\n component.resetValue();\n }\n });\n this.validateForm();\n },\n\n setInputValidationErrors: function (errors) {\n this.inputs.forEach(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 // Checks if the values have changed from their initial value\n isChanged: function() {\n return !utils.isSame(this.getPristineValues(), this.getCurrentValues());\n },\n\n getPristineValues: function() {\n return this.inputs.reduce((data, component) => {\n var name = component.props.name;\n data[name] = component.props.value;\n return data;\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: function (errors) {\n Object.keys(errors).forEach((name, index) => {\n var component = utils.find(this.inputs, component => component.props.name === name);\n if (!component) {\n throw new Error('You are trying to update an input that does not exist. ' +\n 'Verify errors object with input names. ' + JSON.stringify(errors));\n }\n var args = [{\n _isValid: this.props.preventExternalInvalidation || false,\n _externalError: typeof errors[name] === 'string' ? [errors[name]] : errors[name]\n }];\n component.setState.apply(component, args);\n });\n },\n\n isFormDisabled: function () {\n return this.props.disabled;\n },\n\n getCurrentValues: function () {\n return this.inputs.reduce((data, component) => {\n var name = component.props.name;\n data[name] = component.state._value;\n return data;\n }, {});\n },\n\n setFormPristine: function (isPristine) {\n this.setState({\n _formSubmitted: !isPristine\n });\n\n // Iterate through each component and set it as pristine\n // or \"dirty\".\n this.inputs.forEach((component, index) => {\n component.setState({\n _formSubmitted: !isPristine,\n _isPristine: isPristine\n });\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: function (component) {\n\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\n // Checks validation on current value or a passed value\n runValidation: function (component, value) {\n\n var currentValues = this.getCurrentValues();\n var validationErrors = component.props.validationErrors;\n var validationError = component.props.validationError;\n value = arguments.length === 2 ? value : component.state._value;\n\n var validationResults = this.runRules(value, currentValues, component._validations);\n var requiredResults = this.runRules(value, currentValues, component._requiredValidations);\n\n // the component defines an explicit validate function\n if (typeof component.validate === \"function\") {\n validationResults.failed = component.validate() ? [] : ['failed'];\n }\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\n if (isValid && !isRequired) {\n return emptyArray;\n }\n\n if (validationResults.errors.length) {\n return validationResults.errors;\n }\n\n if (this.props.validationErrors && this.props.validationErrors[component.props.name]) {\n return typeof this.props.validationErrors[component.props.name] === 'string' ? [this.props.validationErrors[component.props.name]] : this.props.validationErrors[component.props.name];\n }\n\n if (isRequired) {\n var error = validationErrors[requiredResults.success[0]];\n return error ? [error] : null;\n }\n\n if (validationResults.failed.length) {\n return validationResults.failed.map(function(failed) {\n return validationErrors[failed] ? validationErrors[failed] : validationError;\n }).filter(function(x, pos, arr) {\n // Remove duplicates\n return arr.indexOf(x) === pos;\n });\n }\n\n }.call(this))\n };\n\n },\n\n runRules: function (value, currentValues, validations) {\n\n var results = {\n errors: [],\n failed: [],\n success: []\n };\n if (Object.keys(validations).length) {\n Object.keys(validations).forEach(function (validationMethod) {\n\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\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\n return results.success.push(validationMethod);\n\n });\n }\n\n return results;\n\n },\n\n // Validate the form by going through all child input components\n // and check their state\n validateForm: function () {\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 () {\n var allIsValid = this.inputs.every(component => {\n return component.state._isValid;\n });\n\n this.setState({\n isValid: allIsValid\n });\n\n if (allIsValid) {\n this.props.onValid();\n } else {\n this.props.onInvalid();\n }\n\n // Tell the form that it can start to trigger change events\n this.setState({\n canChange: true\n });\n\n }.bind(this);\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 var validation = this.runValidation(component);\n if (validation.isValid && component.state._externalError) {\n validation.isValid = false;\n }\n component.setState({\n _isValid: validation.isValid,\n _isRequired: validation.isRequired,\n _validationError: validation.error,\n _externalError: !validation.isValid && component.state._externalError ? component.state._externalError : null\n }, index === this.inputs.length - 1 ? onValidationComplete : null);\n });\n\n // If there are no inputs, set state where form is ready to trigger\n // change event. New inputs might be added later\n if (!this.inputs.length && this.isMounted()) {\n this.setState({\n canChange: true\n });\n }\n },\n\n // Method put on each input component to register\n // itself to the form\n attachToForm: function (component) {\n\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: function (component) {\n var componentPos = this.inputs.indexOf(component);\n\n if (componentPos !== -1) {\n this.inputs = this.inputs.slice(0, componentPos)\n .concat(this.inputs.slice(componentPos + 1));\n }\n\n this.validateForm();\n },\n render: function () {\n\n return (\n
\n {this.props.children}\n
\n );\n\n }\n});\n\nif (!global.exports && !global.module && (!global.define || !global.define.amd)) {\n global.Formsy = Formsy;\n}\n\nmodule.exports = Formsy;\n\n\n\n/** WEBPACK FOOTER **\n ** D:/Dev/git/React/formsy-react/src/main.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"react\"\n ** module id = 1\n ** module chunks = 0\n **/","var utils = require('./utils.js');\r\nvar React = global.React || require('react');\r\n\r\nvar convertValidationsToObject = function (validations) {\r\n\r\n if (typeof validations === 'string') {\r\n\r\n return validations.split(/\\,(?![^{\\[]*[}\\]])/g).reduce(function (validations, validation) {\r\n var args = validation.split(':');\r\n var validateMethod = args.shift();\r\n\r\n args = args.map(function (arg) {\r\n try {\r\n return JSON.parse(arg);\r\n } catch (e) {\r\n return arg; // It is a string if it can not parse it\r\n }\r\n });\r\n\r\n if (args.length > 1) {\r\n throw new Error('Formsy does not support multiple args on string validations. Use object format of validations instead.');\r\n }\r\n\r\n validations[validateMethod] = args.length ? args[0] : true;\r\n return validations;\r\n }, {});\r\n\r\n }\r\n\r\n return validations || {};\r\n};\r\n\r\nmodule.exports = {\r\n getInitialState: function () {\r\n return {\r\n _value: this.props.value,\r\n _isRequired: false,\r\n _isValid: true,\r\n _isPristine: true,\r\n _pristineValue: this.props.value,\r\n _validationError: [],\r\n _externalError: null,\r\n _formSubmitted: false\r\n };\r\n },\r\n contextTypes: {\r\n formsy: React.PropTypes.object // What about required?\r\n },\r\n getDefaultProps: function () {\r\n return {\r\n validationError: '',\r\n validationErrors: {}\r\n };\r\n },\r\n\r\n componentWillMount: function () {\r\n var configure = function () {\r\n this.setValidations(this.props.validations, this.props.required);\r\n\r\n // Pass a function instead?\r\n this.context.formsy.attachToForm(this);\r\n //this.props._attachToForm(this);\r\n }.bind(this);\r\n\r\n if (!this.props.name) {\r\n throw new Error('Form Input requires a name property when used');\r\n }\r\n\r\n /*\r\n if (!this.props._attachToForm) {\r\n return setTimeout(function () {\r\n if (!this.isMounted()) return;\r\n if (!this.props._attachToForm) {\r\n throw new Error('Form Mixin requires component to be nested in a Form');\r\n }\r\n configure();\r\n }.bind(this), 0);\r\n }\r\n */\r\n configure();\r\n },\r\n\r\n // We have to make the validate method is kept when new props are added\r\n componentWillReceiveProps: function (nextProps) {\r\n this.setValidations(nextProps.validations, nextProps.required);\r\n\r\n },\r\n\r\n componentDidUpdate: function (prevProps) {\r\n\r\n // If the value passed has changed, set it. If value is not passed it will\r\n // internally update, and this will never run\r\n if (!utils.isSame(this.props.value, prevProps.value)) {\r\n this.setValue(this.props.value);\r\n }\r\n\r\n // If validations or required is changed, run a new validation\r\n if (!utils.isSame(this.props.validations, prevProps.validations) || !utils.isSame(this.props.required, prevProps.required)) {\r\n this.context.formsy.validate(this);\r\n }\r\n },\r\n\r\n // Detach it when component unmounts\r\n componentWillUnmount: function () {\r\n this.context.formsy.detachFromForm(this);\r\n //this.props._detachFromForm(this);\r\n },\r\n\r\n setValidations: function (validations, required) {\r\n\r\n // Add validations to the store itself as the props object can not be modified\r\n this._validations = convertValidationsToObject(validations) || {};\r\n this._requiredValidations = required === true ? {isDefaultRequiredValue: true} : convertValidationsToObject(required);\r\n\r\n },\r\n\r\n // We validate after the value has been set\r\n setValue: function (value) {\r\n this.setState({\r\n _value: value,\r\n _isPristine: false\r\n }, function () {\r\n this.context.formsy.validate(this);\r\n //this.props._validate(this);\r\n }.bind(this));\r\n },\r\n resetValue: function () {\r\n this.setState({\r\n _value: this.state._pristineValue,\r\n _isPristine: true\r\n }, function () {\r\n this.context.formsy.validate(this);\r\n //this.props._validate(this);\r\n });\r\n },\r\n getValue: function () {\r\n return this.state._value;\r\n },\r\n hasValue: function () {\r\n return this.state._value !== '';\r\n },\r\n getErrorMessage: function () {\r\n var messages = this.getErrorMessages();\r\n return messages.length ? messages[0] : null;\r\n },\r\n getErrorMessages: function () {\r\n return !this.isValid() || this.showRequired() ? (this.state._externalError || this.state._validationError || []) : [];\r\n },\r\n isFormDisabled: function () {\r\n return this.context.formsy.isFormDisabled();\r\n //return this.props._isFormDisabled();\r\n },\r\n isValid: function () {\r\n return this.state._isValid;\r\n },\r\n isPristine: function () {\r\n return this.state._isPristine;\r\n },\r\n isFormSubmitted: function () {\r\n return this.state._formSubmitted;\r\n },\r\n isRequired: function () {\r\n return !!this.props.required;\r\n },\r\n showRequired: function () {\r\n return this.state._isRequired;\r\n },\r\n showError: function () {\r\n return !this.showRequired() && !this.isValid();\r\n },\r\n isValidValue: function (value) {\r\n return this.context.formsy.isValidValue.call(null, this, value);\r\n //return this.props._isValidValue.call(null, this, value);\r\n }\r\n};\r\n\n\n\n/** WEBPACK FOOTER **\n ** D:/Dev/git/React/formsy-react/src/Mixin.js\n **/","module.exports = {\r\n arraysDiffer: function (a, b) {\r\n var isDifferent = false;\r\n if (a.length !== b.length) {\r\n isDifferent = true;\r\n } else {\r\n a.forEach(function (item, index) {\r\n if (!this.isSame(item, b[index])) {\r\n isDifferent = true;\r\n }\r\n }, this);\r\n }\r\n return isDifferent;\r\n },\r\n\r\n objectsDiffer: function (a, b) {\r\n var isDifferent = false;\r\n if (Object.keys(a).length !== Object.keys(b).length) {\r\n isDifferent = true;\r\n } else {\r\n Object.keys(a).forEach(function (key) {\r\n if (!this.isSame(a[key], b[key])) {\r\n isDifferent = true;\r\n }\r\n }, this);\r\n }\r\n return isDifferent;\r\n },\r\n\r\n isSame: function (a, b) {\r\n if (typeof a !== typeof b) {\r\n return false;\r\n } else if (Array.isArray(a)) {\r\n return !this.arraysDiffer(a, b);\r\n } else if (typeof a === 'object' && a !== null && b !== null) {\r\n return !this.objectsDiffer(a, b);\r\n }\r\n\r\n return a === b;\r\n },\r\n\r\n find: function (collection, fn) {\r\n for (var i = 0, l = collection.length; i < l; i++) {\r\n var item = collection[i];\r\n if (fn(item)) {\r\n return item;\r\n }\r\n }\r\n return null;\r\n }\r\n};\r\n\n\n\n/** WEBPACK FOOTER **\n ** D:/Dev/git/React/formsy-react/src/utils.js\n **/","var React = global.React || require('react');\r\nvar Mixin = require('./Mixin.js');\r\nmodule.exports = function () {\r\n return function (Component) {\r\n return React.createClass({\r\n mixins: [Mixin],\r\n render: function () {\r\n return React.createElement(Component, {\r\n setValidations: this.setValidations,\r\n setValue: this.setValue,\r\n resetValue: this.resetValue,\r\n getValue: this.getValue,\r\n hasValue: this.hasValue,\r\n getErrorMessage: this.getErrorMessage,\r\n getErrorMessages: this.getErrorMessages,\r\n isFormDisabled: this.isFormDisabled,\r\n isValid: this.isValid,\r\n isPristine: this.isPristine,\r\n isFormSubmitted: this.isFormSubmitted,\r\n isRequired: this.isRequired,\r\n showRequired: this.showRequired,\r\n showError: this.showError,\r\n isValidValue: this.isValidValue,\r\n ...this.props\r\n });\r\n }\r\n });\r\n };\r\n};\r\n\n\n\n/** WEBPACK FOOTER **\n ** D:/Dev/git/React/formsy-react/src/Decorator.js\n **/","var React = global.React || require('react');\r\nvar Mixin = require('./Mixin.js');\r\nmodule.exports = function (Component) {\r\n return React.createClass({\r\n mixins: [Mixin],\r\n render: function () {\r\n return React.createElement(Component, {\r\n setValidations: this.setValidations,\r\n setValue: this.setValue,\r\n resetValue: this.resetValue,\r\n getValue: this.getValue,\r\n hasValue: this.hasValue,\r\n getErrorMessage: this.getErrorMessage,\r\n getErrorMessages: this.getErrorMessages,\r\n isFormDisabled: this.isFormDisabled,\r\n isValid: this.isValid,\r\n isPristine: this.isPristine,\r\n isFormSubmitted: this.isFormSubmitted,\r\n isRequired: this.isRequired,\r\n showRequired: this.showRequired,\r\n showError: this.showError,\r\n isValidValue: this.isValidValue,\r\n ...this.props\r\n });\r\n }\r\n });\r\n};\r\n\n\n\n/** WEBPACK FOOTER **\n ** D:/Dev/git/React/formsy-react/src/HOC.js\n **/","var isExisty = function (value) {\r\n return value !== null && value !== undefined;\r\n};\r\n\r\nvar isEmpty = function (value) {\r\n return value === '';\r\n};\r\n\r\nvar validations = {\r\n isDefaultRequiredValue: function (values, value) {\r\n return value === undefined || value === '';\r\n },\r\n isExisty: function (values, value) {\r\n return isExisty(value);\r\n },\r\n matchRegexp: function (values, value, regexp) {\r\n return !isExisty(value) || isEmpty(value) || regexp.test(value);\r\n },\r\n isUndefined: function (values, value) {\r\n return value === undefined;\r\n },\r\n isEmptyString: function (values, value) {\r\n return isEmpty(value);\r\n },\r\n isEmail: function (values, value) {\r\n return validations.matchRegexp(values, value, /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i);\r\n },\r\n isUrl: function (values, value) {\r\n return validations.matchRegexp(values, value, /^(https?|s?ftp):\\/\\/(((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:)*@)?(((\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\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$/i);\r\n },\r\n isTrue: function (values, value) {\r\n return value === true;\r\n },\r\n isFalse: function (values, value) {\r\n return value === false;\r\n },\r\n isNumeric: function (values, value) {\r\n if (typeof value === 'number') {\r\n return true;\r\n }\r\n return validations.matchRegexp(values, value, /^[-+]?(?:\\d*[.])?\\d+$/);\r\n },\r\n isAlpha: function (values, value) {\r\n return validations.matchRegexp(values, value, /^[A-Z]+$/i);\r\n },\r\n isAlphanumeric: function (values, value) {\r\n return validations.matchRegexp(values, value, /^[0-9A-Z]+$/i);\r\n },\r\n isInt: function (values, value) {\r\n return validations.matchRegexp(values, value, /^(?:[-+]?(?:0|[1-9]\\d*))$/);\r\n },\r\n isFloat: function (values, value) {\r\n return validations.matchRegexp(values, value, /^(?:[-+]?(?:\\d+))?(?:\\.\\d*)?(?:[eE][\\+\\-]?(?:\\d+))?$/);\r\n },\r\n isWords: function (values, value) {\r\n return validations.matchRegexp(values, value, /^[A-Z\\s]+$/i);\r\n },\r\n isSpecialWords: function (values, value) {\r\n return validations.matchRegexp(values, value, /^[A-Z\\s\\u00C0-\\u017F]+$/i);\r\n },\r\n isLength: function (values, value, length) {\r\n return !isExisty(value) || isEmpty(value) || value.length === length;\r\n },\r\n equals: function (values, value, eql) {\r\n return !isExisty(value) || isEmpty(value) || value == eql;\r\n },\r\n equalsField: function (values, value, field) {\r\n return value == values[field];\r\n },\r\n maxLength: function (values, value, length) {\r\n return !isExisty(value) || value.length <= length;\r\n },\r\n minLength: function (values, value, length) {\r\n return !isExisty(value) || isEmpty(value) || value.length >= length;\r\n }\r\n};\r\n\r\nmodule.exports = validations;\r\n\n\n\n/** WEBPACK FOOTER **\n ** D:/Dev/git/React/formsy-react/src/validationRules.js\n **/","module.exports = function (source) {\n\n\n // \"foo[0]\"\n return Object.keys(source).reduce(function (output, key) {\n\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\n var currentPath = output;\n while (paths.length) {\n\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\n return output;\n\n }, {});\n\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/form-data-to-object/index.js\n ** module id = 7\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///formsy-react.js","webpack:///webpack/bootstrap b5d73becd02b9d9904bb","webpack:///./src/main.js","webpack:///external \"react\"","webpack:///./src/Mixin.js","webpack:///./src/utils.js","webpack:///./src/Decorator.js","webpack:///./src/HOC.js","webpack:///./src/validationRules.js","webpack:///./~/form-data-to-object/index.js"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_1__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","global","_objectWithoutProperties","obj","keys","target","i","indexOf","Object","prototype","hasOwnProperty","_extends","assign","arguments","length","source","key","_typeof","Symbol","iterator","constructor","React","Formsy","validationRules","formDataToObject","utils","Mixin","HOC","Decorator","options","emptyArray","defaults","passedOptions","addValidationRule","name","func","Form","createClass","displayName","getInitialState","isValid","isSubmitting","canChange","getDefaultProps","onSuccess","onError","onSubmit","onValidSubmit","onInvalidSubmit","onSubmitted","onValid","onInvalid","onChange","validationErrors","preventExternalInvalidation","childContextTypes","formsy","PropTypes","object","getChildContext","_this","attachToForm","detachFromForm","validate","isFormDisabled","isValidValue","component","value","runValidation","componentWillMount","inputs","componentDidMount","validateForm","componentWillUpdate","prevInputNames","map","props","componentDidUpdate","setInputValidationErrors","newInputNames","arraysDiffer","reset","data","setFormPristine","resetModel","submit","event","preventDefault","model","getModel","updateInputsWithError","state","mapModel","mapping","toObj","reduce","mappedModel","keyArray","split","base","currentKey","shift","currentValues","getCurrentValues","forEach","setValue","resetValue","errors","args","_isValid","_validationError","setState","apply","isChanged","isSame","getPristineValues","_this2","index","find","Error","JSON","stringify","_externalError","disabled","_value","isPristine","_formSubmitted","_isPristine","validation","_isRequired","isRequired","error","validationError","validationResults","runRules","_validations","requiredResults","_requiredValidations","failed","success","filter","x","pos","arr","validations","results","validationMethod","push","_this3","onValidationComplete","allIsValid","every","bind","isMounted","componentPos","slice","concat","render","_props","nonFormsyProps","createElement","children","convertValidationsToObject","validateMethod","arg","parse","e","_pristineValue","contextTypes","configure","setValidations","required","context","componentWillReceiveProps","nextProps","prevProps","componentWillUnmount","isDefaultRequiredValue","getValue","hasValue","getErrorMessage","messages","getErrorMessages","showRequired","isFormSubmitted","showError","a","b","isDifferent","item","objectsDiffer","Array","isArray","collection","fn","l","Component","mixins","_isExisty","undefined","isEmpty","values","isExisty","matchRegexp","regexp","test","isUndefined","isEmptyString","isEmail","isUrl","isTrue","isFalse","isNumeric","isAlpha","isAlphanumeric","isInt","isFloat","isWords","isSpecialWords","isLength","equals","eql","equalsField","field","maxLength","minLength","output","parentKey","match","paths","replace","currentPath","pathKey","isNaN","fromObj","recur","newObj","propName","currVal","toString","v"],"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,IACAT,WACAW,GAAAF,EACAG,QAAA,EAUA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G,GAAA/E,GACA,MAAAP,QAAAJ,KAAAW,GAAAgF,OAAA,SAAAmI,EAAAlN,GACA,GAAAmN,GAAAnN,EAAAoN,MAAA,WACAC,EAAArN,EAAAoN,MAAA,eACAC,IAAAF,EAAA,IAAAvE,OAAAyE,GAAA1J,IAAA,SAAA3D,GACA,MAAAA,GAAAsN,QAAA,cAGA,KADA,GAAAC,GAAAL,EACAG,EAAAvN,QAAA,CACA,GAAA0N,GAAAH,EAAAhI,OAEAmI,KAAAD,GACAA,IAAAC,IAEAD,EAAAC,GAAAH,EAAAvN,OAAA2N,MAAAJ,EAAA,UAAkEtN,EAAAC,GAClEuN,IAAAC,IAIA,MAAAN,QAIA,QAAAQ,GAAAvO,GACA,QAAAwO,GAAAC,EAAAC,EAAAC,GACA,MAAA/C,OAAAC,QAAA8C,IAAA,oBAAAtO,OAAAC,UAAAsO,SAAAlP,KAAAiP,IACAtO,OAAAJ,KAAA0O,GAAAtI,QAAA,SAAAwI,GACAL,EAAAC,EAAAC,EAAA,IAAAG,EAAA,IAAAF,EAAAE,MAEAJ,IAGAA,EAAAC,GAAAC,EACAF,GAGA,GAAAxO,GAAAI,OAAAJ,KAAAD,EACA,OAAAC,GAAA2F,OAAA,SAAA6I,EAAAC,GACA,MAAAF,GAAAC,EAAAC,EAAA1O,EAAA0O,SAIA5P,EAAAD,SACA0P,UACA5I","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\n **/","(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/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\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.loaded = 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// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {'use strict';\n\t\n\tvar _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\t\n\tvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\t\n\tfunction _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\t\n\tvar React = global.React || __webpack_require__(1);\n\tvar Formsy = {};\n\tvar validationRules = __webpack_require__(6);\n\tvar formDataToObject = __webpack_require__(7);\n\tvar utils = __webpack_require__(3);\n\tvar Mixin = __webpack_require__(2);\n\tvar HOC = __webpack_require__(5);\n\tvar Decorator = __webpack_require__(4);\n\tvar options = {};\n\tvar emptyArray = [];\n\t\n\tFormsy.Mixin = Mixin;\n\tFormsy.HOC = HOC;\n\tFormsy.Decorator = Decorator;\n\t\n\tFormsy.defaults = function (passedOptions) {\n\t options = passedOptions;\n\t};\n\t\n\tFormsy.addValidationRule = function (name, func) {\n\t validationRules[name] = func;\n\t};\n\t\n\tFormsy.Form = React.createClass({\n\t displayName: 'Formsy',\n\t getInitialState: function getInitialState() {\n\t return {\n\t isValid: true,\n\t isSubmitting: false,\n\t canChange: false\n\t };\n\t },\n\t getDefaultProps: function getDefaultProps() {\n\t return {\n\t onSuccess: function onSuccess() {},\n\t onError: function onError() {},\n\t onSubmit: function onSubmit() {},\n\t onValidSubmit: function onValidSubmit() {},\n\t onInvalidSubmit: function onInvalidSubmit() {},\n\t onSubmitted: function onSubmitted() {},\n\t onValid: function onValid() {},\n\t onInvalid: function onInvalid() {},\n\t onChange: function onChange() {},\n\t validationErrors: null,\n\t preventExternalInvalidation: false\n\t };\n\t },\n\t\n\t childContextTypes: {\n\t formsy: React.PropTypes.object\n\t },\n\t getChildContext: function getChildContext() {\n\t var _this = this;\n\t\n\t return {\n\t formsy: {\n\t attachToForm: this.attachToForm,\n\t detachFromForm: this.detachFromForm,\n\t validate: this.validate,\n\t isFormDisabled: this.isFormDisabled,\n\t isValidValue: function isValidValue(component, value) {\n\t return _this.runValidation(component, value).isValid;\n\t }\n\t }\n\t };\n\t },\n\t\n\t // Add a map to store the inputs of the form, a model to store\n\t // the values of the form and register child inputs\n\t componentWillMount: function componentWillMount() {\n\t this.inputs = [];\n\t },\n\t\n\t componentDidMount: function componentDidMount() {\n\t this.validateForm();\n\t },\n\t\n\t componentWillUpdate: function componentWillUpdate() {\n\t // Keep a reference to input names before form updates,\n\t // to check if inputs has changed after render\n\t this.prevInputNames = this.inputs.map(function (component) {\n\t return component.props.name;\n\t });\n\t },\n\t\n\t componentDidUpdate: function componentDidUpdate() {\n\t\n\t if (this.props.validationErrors && _typeof(this.props.validationErrors) === 'object' && Object.keys(this.props.validationErrors).length > 0) {\n\t this.setInputValidationErrors(this.props.validationErrors);\n\t }\n\t\n\t var newInputNames = this.inputs.map(function (component) {\n\t return component.props.name;\n\t });\n\t if (utils.arraysDiffer(this.prevInputNames, newInputNames)) {\n\t this.validateForm();\n\t }\n\t },\n\t\n\t // Allow resetting to specified data\n\t reset: function reset(data) {\n\t this.setFormPristine(true);\n\t this.resetModel(data);\n\t },\n\t\n\t // Update model, submit to url prop and send the model\n\t submit: function submit(event) {\n\t\n\t event && event.preventDefault();\n\t\n\t // Trigger form as not pristine.\n\t // If any inputs have not been touched yet this will make them dirty\n\t // so validation becomes visible (if based on isPristine)\n\t this.setFormPristine(false);\n\t var model = this.getModel();\n\t this.props.onSubmit(model, this.resetModel, this.updateInputsWithError);\n\t this.state.isValid ? this.props.onValidSubmit(model, this.resetModel, this.updateInputsWithError) : this.props.onInvalidSubmit(model, this.resetModel, this.updateInputsWithError);\n\t },\n\t\n\t mapModel: function mapModel(model) {\n\t\n\t if (this.props.mapping) {\n\t return this.props.mapping(model);\n\t } else {\n\t return formDataToObject.toObj(Object.keys(model).reduce(function (mappedModel, key) {\n\t\n\t var keyArray = key.split('.');\n\t var base = mappedModel;\n\t while (keyArray.length) {\n\t var currentKey = keyArray.shift();\n\t base = base[currentKey] = keyArray.length ? base[currentKey] || {} : model[key];\n\t }\n\t\n\t return mappedModel;\n\t }, {}));\n\t }\n\t },\n\t\n\t getModel: function getModel() {\n\t var currentValues = this.getCurrentValues();\n\t return this.mapModel(currentValues);\n\t },\n\t\n\t // Reset each key in the model to the original / initial / specified value\n\t resetModel: function resetModel(data) {\n\t this.inputs.forEach(function (component) {\n\t var name = component.props.name;\n\t if (data && data[name]) {\n\t component.setValue(data[name]);\n\t } else {\n\t component.resetValue();\n\t }\n\t });\n\t this.validateForm();\n\t },\n\t\n\t setInputValidationErrors: function setInputValidationErrors(errors) {\n\t this.inputs.forEach(function (component) {\n\t var name = component.props.name;\n\t var args = [{\n\t _isValid: !(name in errors),\n\t _validationError: typeof errors[name] === 'string' ? [errors[name]] : errors[name]\n\t }];\n\t component.setState.apply(component, args);\n\t });\n\t },\n\t\n\t // Checks if the values have changed from their initial value\n\t isChanged: function isChanged() {\n\t return !utils.isSame(this.getPristineValues(), this.getCurrentValues());\n\t },\n\t\n\t getPristineValues: function getPristineValues() {\n\t return this.inputs.reduce(function (data, component) {\n\t var name = component.props.name;\n\t data[name] = component.props.value;\n\t return data;\n\t }, {});\n\t },\n\t\n\t // Go through errors from server and grab the components\n\t // stored in the inputs map. Change their state to invalid\n\t // and set the serverError message\n\t updateInputsWithError: function updateInputsWithError(errors) {\n\t var _this2 = this;\n\t\n\t Object.keys(errors).forEach(function (name, index) {\n\t var component = utils.find(_this2.inputs, function (component) {\n\t return component.props.name === name;\n\t });\n\t if (!component) {\n\t throw new Error('You are trying to update an input that does not exist. ' + 'Verify errors object with input names. ' + JSON.stringify(errors));\n\t }\n\t var args = [{\n\t _isValid: _this2.props.preventExternalInvalidation || false,\n\t _externalError: typeof errors[name] === 'string' ? [errors[name]] : errors[name]\n\t }];\n\t component.setState.apply(component, args);\n\t });\n\t },\n\t\n\t isFormDisabled: function isFormDisabled() {\n\t return this.props.disabled;\n\t },\n\t\n\t getCurrentValues: function getCurrentValues() {\n\t return this.inputs.reduce(function (data, component) {\n\t var name = component.props.name;\n\t data[name] = component.state._value;\n\t return data;\n\t }, {});\n\t },\n\t\n\t setFormPristine: function setFormPristine(isPristine) {\n\t this.setState({\n\t _formSubmitted: !isPristine\n\t });\n\t\n\t // Iterate through each component and set it as pristine\n\t // or \"dirty\".\n\t this.inputs.forEach(function (component, index) {\n\t component.setState({\n\t _formSubmitted: !isPristine,\n\t _isPristine: isPristine\n\t });\n\t });\n\t },\n\t\n\t // Use the binded values and the actual input value to\n\t // validate the input and set its state. Then check the\n\t // state of the form itself\n\t validate: function validate(component) {\n\t\n\t // Trigger onChange\n\t if (this.state.canChange) {\n\t this.props.onChange(this.getCurrentValues(), this.isChanged());\n\t }\n\t\n\t var validation = this.runValidation(component);\n\t // Run through the validations, split them up and call\n\t // the validator IF there is a value or it is required\n\t component.setState({\n\t _isValid: validation.isValid,\n\t _isRequired: validation.isRequired,\n\t _validationError: validation.error,\n\t _externalError: null\n\t }, this.validateForm);\n\t },\n\t\n\t // Checks validation on current value or a passed value\n\t runValidation: function runValidation(component, value) {\n\t\n\t var currentValues = this.getCurrentValues();\n\t var validationErrors = component.props.validationErrors;\n\t var validationError = component.props.validationError;\n\t value = arguments.length === 2 ? value : component.state._value;\n\t\n\t var validationResults = this.runRules(value, currentValues, component._validations);\n\t var requiredResults = this.runRules(value, currentValues, component._requiredValidations);\n\t\n\t // the component defines an explicit validate function\n\t if (typeof component.validate === \"function\") {\n\t validationResults.failed = component.validate() ? [] : ['failed'];\n\t }\n\t\n\t var isRequired = Object.keys(component._requiredValidations).length ? !!requiredResults.success.length : false;\n\t var isValid = !validationResults.failed.length && !(this.props.validationErrors && this.props.validationErrors[component.props.name]);\n\t\n\t return {\n\t isRequired: isRequired,\n\t isValid: isRequired ? false : isValid,\n\t error: function () {\n\t\n\t if (isValid && !isRequired) {\n\t return emptyArray;\n\t }\n\t\n\t if (validationResults.errors.length) {\n\t return validationResults.errors;\n\t }\n\t\n\t if (this.props.validationErrors && this.props.validationErrors[component.props.name]) {\n\t return typeof this.props.validationErrors[component.props.name] === 'string' ? [this.props.validationErrors[component.props.name]] : this.props.validationErrors[component.props.name];\n\t }\n\t\n\t if (isRequired) {\n\t var error = validationErrors[requiredResults.success[0]];\n\t return error ? [error] : null;\n\t }\n\t\n\t if (validationResults.failed.length) {\n\t return validationResults.failed.map(function (failed) {\n\t return validationErrors[failed] ? validationErrors[failed] : validationError;\n\t }).filter(function (x, pos, arr) {\n\t // Remove duplicates\n\t return arr.indexOf(x) === pos;\n\t });\n\t }\n\t }.call(this)\n\t };\n\t },\n\t\n\t runRules: function runRules(value, currentValues, validations) {\n\t\n\t var results = {\n\t errors: [],\n\t failed: [],\n\t success: []\n\t };\n\t if (Object.keys(validations).length) {\n\t Object.keys(validations).forEach(function (validationMethod) {\n\t\n\t if (validationRules[validationMethod] && typeof validations[validationMethod] === 'function') {\n\t throw new Error('Formsy does not allow you to override default validations: ' + validationMethod);\n\t }\n\t\n\t if (!validationRules[validationMethod] && typeof validations[validationMethod] !== 'function') {\n\t throw new Error('Formsy does not have the validation rule: ' + validationMethod);\n\t }\n\t\n\t if (typeof validations[validationMethod] === 'function') {\n\t var validation = validations[validationMethod](currentValues, value);\n\t if (typeof validation === 'string') {\n\t results.errors.push(validation);\n\t results.failed.push(validationMethod);\n\t } else if (!validation) {\n\t results.failed.push(validationMethod);\n\t }\n\t return;\n\t } else if (typeof validations[validationMethod] !== 'function') {\n\t var validation = validationRules[validationMethod](currentValues, value, validations[validationMethod]);\n\t if (typeof validation === 'string') {\n\t results.errors.push(validation);\n\t results.failed.push(validationMethod);\n\t } else if (!validation) {\n\t results.failed.push(validationMethod);\n\t } else {\n\t results.success.push(validationMethod);\n\t }\n\t return;\n\t }\n\t\n\t return results.success.push(validationMethod);\n\t });\n\t }\n\t\n\t return results;\n\t },\n\t\n\t // Validate the form by going through all child input components\n\t // and check their state\n\t validateForm: function validateForm() {\n\t var _this3 = this;\n\t\n\t // We need a callback as we are validating all inputs again. This will\n\t // run when the last component has set its state\n\t var onValidationComplete = function () {\n\t var allIsValid = this.inputs.every(function (component) {\n\t return component.state._isValid;\n\t });\n\t\n\t this.setState({\n\t isValid: allIsValid\n\t });\n\t\n\t if (allIsValid) {\n\t this.props.onValid();\n\t } else {\n\t this.props.onInvalid();\n\t }\n\t\n\t // Tell the form that it can start to trigger change events\n\t this.setState({\n\t canChange: true\n\t });\n\t }.bind(this);\n\t\n\t // Run validation again in case affected by other inputs. The\n\t // last component validated will run the onValidationComplete callback\n\t this.inputs.forEach(function (component, index) {\n\t var validation = _this3.runValidation(component);\n\t if (validation.isValid && component.state._externalError) {\n\t validation.isValid = false;\n\t }\n\t component.setState({\n\t _isValid: validation.isValid,\n\t _isRequired: validation.isRequired,\n\t _validationError: validation.error,\n\t _externalError: !validation.isValid && component.state._externalError ? component.state._externalError : null\n\t }, index === _this3.inputs.length - 1 ? onValidationComplete : null);\n\t });\n\t\n\t // If there are no inputs, set state where form is ready to trigger\n\t // change event. New inputs might be added later\n\t if (!this.inputs.length && this.isMounted()) {\n\t this.setState({\n\t canChange: true\n\t });\n\t }\n\t },\n\t\n\t // Method put on each input component to register\n\t // itself to the form\n\t attachToForm: function attachToForm(component) {\n\t\n\t if (this.inputs.indexOf(component) === -1) {\n\t this.inputs.push(component);\n\t }\n\t\n\t this.validate(component);\n\t },\n\t\n\t // Method put on each input component to unregister\n\t // itself from the form\n\t detachFromForm: function detachFromForm(component) {\n\t var componentPos = this.inputs.indexOf(component);\n\t\n\t if (componentPos !== -1) {\n\t this.inputs = this.inputs.slice(0, componentPos).concat(this.inputs.slice(componentPos + 1));\n\t }\n\t\n\t this.validateForm();\n\t },\n\t render: function render() {\n\t var _props = this.props;\n\t var mapping = _props.mapping;\n\t var validationErrors = _props.validationErrors;\n\t var onSubmit = _props.onSubmit;\n\t var onValid = _props.onValid;\n\t var onInvalid = _props.onInvalid;\n\t var onInvalidSubmit = _props.onInvalidSubmit;\n\t var onChange = _props.onChange;\n\t var reset = _props.reset;\n\t var preventExternalInvalidation = _props.preventExternalInvalidation;\n\t var onSuccess = _props.onSuccess;\n\t var onError = _props.onError;\n\t\n\t var nonFormsyProps = _objectWithoutProperties(_props, ['mapping', 'validationErrors', 'onSubmit', 'onValid', 'onInvalid', 'onInvalidSubmit', 'onChange', 'reset', 'preventExternalInvalidation', 'onSuccess', 'onError']);\n\t\n\t return React.createElement(\n\t 'form',\n\t _extends({}, nonFormsyProps, { onSubmit: this.submit }),\n\t this.props.children\n\t );\n\t }\n\t});\n\t\n\tif (!global.exports && !global.module && (!global.define || !global.define.amd)) {\n\t global.Formsy = Formsy;\n\t}\n\t\n\tmodule.exports = Formsy;\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {'use strict';\n\t\n\tvar utils = __webpack_require__(3);\n\tvar React = global.React || __webpack_require__(1);\n\t\n\tvar convertValidationsToObject = function convertValidationsToObject(validations) {\n\t\n\t if (typeof validations === 'string') {\n\t\n\t return validations.split(/\\,(?![^{\\[]*[}\\]])/g).reduce(function (validations, validation) {\n\t var args = validation.split(':');\n\t var validateMethod = args.shift();\n\t\n\t args = args.map(function (arg) {\n\t try {\n\t return JSON.parse(arg);\n\t } catch (e) {\n\t return arg; // It is a string if it can not parse it\n\t }\n\t });\n\t\n\t if (args.length > 1) {\n\t throw new Error('Formsy does not support multiple args on string validations. Use object format of validations instead.');\n\t }\n\t\n\t validations[validateMethod] = args.length ? args[0] : true;\n\t return validations;\n\t }, {});\n\t }\n\t\n\t return validations || {};\n\t};\n\t\n\tmodule.exports = {\n\t getInitialState: function getInitialState() {\n\t return {\n\t _value: this.props.value,\n\t _isRequired: false,\n\t _isValid: true,\n\t _isPristine: true,\n\t _pristineValue: this.props.value,\n\t _validationError: [],\n\t _externalError: null,\n\t _formSubmitted: false\n\t };\n\t },\n\t contextTypes: {\n\t formsy: React.PropTypes.object // What about required?\n\t },\n\t getDefaultProps: function getDefaultProps() {\n\t return {\n\t validationError: '',\n\t validationErrors: {}\n\t };\n\t },\n\t\n\t componentWillMount: function componentWillMount() {\n\t var configure = function () {\n\t this.setValidations(this.props.validations, this.props.required);\n\t\n\t // Pass a function instead?\n\t this.context.formsy.attachToForm(this);\n\t //this.props._attachToForm(this);\n\t }.bind(this);\n\t\n\t if (!this.props.name) {\n\t throw new Error('Form Input requires a name property when used');\n\t }\n\t\n\t /*\n\t if (!this.props._attachToForm) {\n\t return setTimeout(function () {\n\t if (!this.isMounted()) return;\n\t if (!this.props._attachToForm) {\n\t throw new Error('Form Mixin requires component to be nested in a Form');\n\t }\n\t configure();\n\t }.bind(this), 0);\n\t }\n\t */\n\t configure();\n\t },\n\t\n\t // We have to make the validate method is kept when new props are added\n\t componentWillReceiveProps: function componentWillReceiveProps(nextProps) {\n\t this.setValidations(nextProps.validations, nextProps.required);\n\t },\n\t\n\t componentDidUpdate: function componentDidUpdate(prevProps) {\n\t\n\t // If the value passed has changed, set it. If value is not passed it will\n\t // internally update, and this will never run\n\t if (!utils.isSame(this.props.value, prevProps.value)) {\n\t this.setValue(this.props.value);\n\t }\n\t\n\t // If validations or required is changed, run a new validation\n\t if (!utils.isSame(this.props.validations, prevProps.validations) || !utils.isSame(this.props.required, prevProps.required)) {\n\t this.context.formsy.validate(this);\n\t }\n\t },\n\t\n\t // Detach it when component unmounts\n\t componentWillUnmount: function componentWillUnmount() {\n\t this.context.formsy.detachFromForm(this);\n\t //this.props._detachFromForm(this);\n\t },\n\t\n\t setValidations: function setValidations(validations, required) {\n\t\n\t // Add validations to the store itself as the props object can not be modified\n\t this._validations = convertValidationsToObject(validations) || {};\n\t this._requiredValidations = required === true ? { isDefaultRequiredValue: true } : convertValidationsToObject(required);\n\t },\n\t\n\t // We validate after the value has been set\n\t setValue: function setValue(value) {\n\t this.setState({\n\t _value: value,\n\t _isPristine: false\n\t }, function () {\n\t this.context.formsy.validate(this);\n\t //this.props._validate(this);\n\t }.bind(this));\n\t },\n\t resetValue: function resetValue() {\n\t this.setState({\n\t _value: this.state._pristineValue,\n\t _isPristine: true\n\t }, function () {\n\t this.context.formsy.validate(this);\n\t //this.props._validate(this);\n\t });\n\t },\n\t getValue: function getValue() {\n\t return this.state._value;\n\t },\n\t hasValue: function hasValue() {\n\t return this.state._value !== '';\n\t },\n\t getErrorMessage: function getErrorMessage() {\n\t var messages = this.getErrorMessages();\n\t return messages.length ? messages[0] : null;\n\t },\n\t getErrorMessages: function getErrorMessages() {\n\t return !this.isValid() || this.showRequired() ? this.state._externalError || this.state._validationError || [] : [];\n\t },\n\t isFormDisabled: function isFormDisabled() {\n\t return this.context.formsy.isFormDisabled();\n\t //return this.props._isFormDisabled();\n\t },\n\t isValid: function isValid() {\n\t return this.state._isValid;\n\t },\n\t isPristine: function isPristine() {\n\t return this.state._isPristine;\n\t },\n\t isFormSubmitted: function isFormSubmitted() {\n\t return this.state._formSubmitted;\n\t },\n\t isRequired: function isRequired() {\n\t return !!this.props.required;\n\t },\n\t showRequired: function showRequired() {\n\t return this.state._isRequired;\n\t },\n\t showError: function showError() {\n\t return !this.showRequired() && !this.isValid();\n\t },\n\t isValidValue: function isValidValue(value) {\n\t return this.context.formsy.isValidValue.call(null, this, value);\n\t //return this.props._isValidValue.call(null, this, value);\n\t }\n\t};\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\t\n\tmodule.exports = {\n\t arraysDiffer: function arraysDiffer(a, b) {\n\t var isDifferent = false;\n\t if (a.length !== b.length) {\n\t isDifferent = true;\n\t } else {\n\t a.forEach(function (item, index) {\n\t if (!this.isSame(item, b[index])) {\n\t isDifferent = true;\n\t }\n\t }, this);\n\t }\n\t return isDifferent;\n\t },\n\t\n\t objectsDiffer: function objectsDiffer(a, b) {\n\t var isDifferent = false;\n\t if (Object.keys(a).length !== Object.keys(b).length) {\n\t isDifferent = true;\n\t } else {\n\t Object.keys(a).forEach(function (key) {\n\t if (!this.isSame(a[key], b[key])) {\n\t isDifferent = true;\n\t }\n\t }, this);\n\t }\n\t return isDifferent;\n\t },\n\t\n\t isSame: function isSame(a, b) {\n\t if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) !== (typeof b === 'undefined' ? 'undefined' : _typeof(b))) {\n\t return false;\n\t } else if (Array.isArray(a)) {\n\t return !this.arraysDiffer(a, b);\n\t } else if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) === 'object' && a !== null && b !== null) {\n\t return !this.objectsDiffer(a, b);\n\t }\n\t\n\t return a === b;\n\t },\n\t\n\t find: function find(collection, fn) {\n\t for (var i = 0, l = collection.length; i < l; i++) {\n\t var item = collection[i];\n\t if (fn(item)) {\n\t return item;\n\t }\n\t }\n\t return null;\n\t }\n\t};\n\n/***/ },\n/* 4 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {'use strict';\n\t\n\tvar _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\t\n\tvar React = global.React || __webpack_require__(1);\n\tvar Mixin = __webpack_require__(2);\n\tmodule.exports = function () {\n\t return function (Component) {\n\t return React.createClass({\n\t mixins: [Mixin],\n\t render: function render() {\n\t return React.createElement(Component, _extends({\n\t setValidations: this.setValidations,\n\t setValue: this.setValue,\n\t resetValue: this.resetValue,\n\t getValue: this.getValue,\n\t hasValue: this.hasValue,\n\t getErrorMessage: this.getErrorMessage,\n\t getErrorMessages: this.getErrorMessages,\n\t isFormDisabled: this.isFormDisabled,\n\t isValid: this.isValid,\n\t isPristine: this.isPristine,\n\t isFormSubmitted: this.isFormSubmitted,\n\t isRequired: this.isRequired,\n\t showRequired: this.showRequired,\n\t showError: this.showError,\n\t isValidValue: this.isValidValue\n\t }, this.props));\n\t }\n\t });\n\t };\n\t};\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ },\n/* 5 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {'use strict';\n\t\n\tvar _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\t\n\tvar React = global.React || __webpack_require__(1);\n\tvar Mixin = __webpack_require__(2);\n\tmodule.exports = function (Component) {\n\t return React.createClass({\n\t mixins: [Mixin],\n\t render: function render() {\n\t return React.createElement(Component, _extends({\n\t setValidations: this.setValidations,\n\t setValue: this.setValue,\n\t resetValue: this.resetValue,\n\t getValue: this.getValue,\n\t hasValue: this.hasValue,\n\t getErrorMessage: this.getErrorMessage,\n\t getErrorMessages: this.getErrorMessages,\n\t isFormDisabled: this.isFormDisabled,\n\t isValid: this.isValid,\n\t isPristine: this.isPristine,\n\t isFormSubmitted: this.isFormSubmitted,\n\t isRequired: this.isRequired,\n\t showRequired: this.showRequired,\n\t showError: this.showError,\n\t isValidValue: this.isValidValue\n\t }, this.props));\n\t }\n\t });\n\t};\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ },\n/* 6 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tvar _isExisty = function _isExisty(value) {\n\t return value !== null && value !== undefined;\n\t};\n\t\n\tvar isEmpty = function isEmpty(value) {\n\t return value === '';\n\t};\n\t\n\tvar validations = {\n\t isDefaultRequiredValue: function isDefaultRequiredValue(values, value) {\n\t return value === undefined || value === '';\n\t },\n\t isExisty: function isExisty(values, value) {\n\t return _isExisty(value);\n\t },\n\t matchRegexp: function matchRegexp(values, value, regexp) {\n\t return !_isExisty(value) || isEmpty(value) || regexp.test(value);\n\t },\n\t isUndefined: function isUndefined(values, value) {\n\t return value === undefined;\n\t },\n\t isEmptyString: function isEmptyString(values, value) {\n\t return isEmpty(value);\n\t },\n\t isEmail: function isEmail(values, value) {\n\t return validations.matchRegexp(values, value, /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i);\n\t },\n\t isUrl: function isUrl(values, value) {\n\t return validations.matchRegexp(values, value, /^(https?|s?ftp):\\/\\/(((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:)*@)?(((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]))|((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?)(:\\d*)?)(\\/((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)+(\\/(([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)*)*)?)?(\\?((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)|[\\uE000-\\uF8FF]|\\/|\\?)*)?(#((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$/i);\n\t },\n\t isTrue: function isTrue(values, value) {\n\t return value === true;\n\t },\n\t isFalse: function isFalse(values, value) {\n\t return value === false;\n\t },\n\t isNumeric: function isNumeric(values, value) {\n\t if (typeof value === 'number') {\n\t return true;\n\t }\n\t return validations.matchRegexp(values, value, /^[-+]?(?:\\d*[.])?\\d+$/);\n\t },\n\t isAlpha: function isAlpha(values, value) {\n\t return validations.matchRegexp(values, value, /^[A-Z]+$/i);\n\t },\n\t isAlphanumeric: function isAlphanumeric(values, value) {\n\t return validations.matchRegexp(values, value, /^[0-9A-Z]+$/i);\n\t },\n\t isInt: function isInt(values, value) {\n\t return validations.matchRegexp(values, value, /^(?:[-+]?(?:0|[1-9]\\d*))$/);\n\t },\n\t isFloat: function isFloat(values, value) {\n\t return validations.matchRegexp(values, value, /^(?:[-+]?(?:\\d+))?(?:\\.\\d*)?(?:[eE][\\+\\-]?(?:\\d+))?$/);\n\t },\n\t isWords: function isWords(values, value) {\n\t return validations.matchRegexp(values, value, /^[A-Z\\s]+$/i);\n\t },\n\t isSpecialWords: function isSpecialWords(values, value) {\n\t return validations.matchRegexp(values, value, /^[A-Z\\s\\u00C0-\\u017F]+$/i);\n\t },\n\t isLength: function isLength(values, value, length) {\n\t return !_isExisty(value) || isEmpty(value) || value.length === length;\n\t },\n\t equals: function equals(values, value, eql) {\n\t return !_isExisty(value) || isEmpty(value) || value == eql;\n\t },\n\t equalsField: function equalsField(values, value, field) {\n\t return value == values[field];\n\t },\n\t maxLength: function maxLength(values, value, length) {\n\t return !_isExisty(value) || value.length <= length;\n\t },\n\t minLength: function minLength(values, value, length) {\n\t return !_isExisty(value) || isEmpty(value) || value.length >= length;\n\t }\n\t};\n\t\n\tmodule.exports = validations;\n\n/***/ },\n/* 7 */\n/***/ function(module, exports) {\n\n\tfunction toObj(source) {\n\t return Object.keys(source).reduce(function (output, key) {\n\t var parentKey = key.match(/[^\\[]*/i);\n\t var paths = key.match(/\\[.*?\\]/g) || [];\n\t paths = [parentKey[0]].concat(paths).map(function (key) {\n\t return key.replace(/\\[|\\]/g, '');\n\t });\n\t var currentPath = output;\n\t while (paths.length) {\n\t var pathKey = paths.shift();\n\t\n\t if (pathKey in currentPath) {\n\t currentPath = currentPath[pathKey];\n\t } else {\n\t currentPath[pathKey] = paths.length ? isNaN(paths[0]) ? {} : [] : source[key];\n\t currentPath = currentPath[pathKey];\n\t }\n\t }\n\t\n\t return output;\n\t }, {});\n\t}\n\t\n\tfunction fromObj(obj) {\n\t function recur(newObj, propName, currVal) {\n\t if (Array.isArray(currVal) || Object.prototype.toString.call(currVal) === '[object Object]') {\n\t Object.keys(currVal).forEach(function(v) {\n\t recur(newObj, propName + \"[\" + v + \"]\", currVal[v]);\n\t });\n\t return newObj;\n\t }\n\t\n\t newObj[propName] = currVal;\n\t return newObj;\n\t }\n\t\n\t var keys = Object.keys(obj);\n\t return keys.reduce(function(newObj, propName) {\n\t return recur(newObj, propName, obj[propName]);\n\t }, {});\n\t}\n\t\n\tmodule.exports = {\n\t fromObj: fromObj,\n\t toObj: toObj\n\t}\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** formsy-react.js\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\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\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.loaded = 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// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap b5d73becd02b9d9904bb\n **/","var React = global.React || require('react');\nvar Formsy = {};\nvar validationRules = require('./validationRules.js');\nvar formDataToObject = require('form-data-to-object');\nvar utils = require('./utils.js');\nvar Mixin = require('./Mixin.js');\nvar HOC = require('./HOC.js');\nvar Decorator = require('./Decorator.js');\nvar options = {};\nvar emptyArray = [];\n\nFormsy.Mixin = Mixin;\nFormsy.HOC = HOC;\nFormsy.Decorator = Decorator;\n\nFormsy.defaults = function (passedOptions) {\n options = passedOptions;\n};\n\nFormsy.addValidationRule = function (name, func) {\n validationRules[name] = func;\n};\n\nFormsy.Form = React.createClass({\n displayName: 'Formsy',\n getInitialState: function () {\n return {\n isValid: true,\n isSubmitting: false,\n canChange: false\n };\n },\n getDefaultProps: function () {\n return {\n onSuccess: function () {},\n onError: function () {},\n onSubmit: function () {},\n onValidSubmit: function () {},\n onInvalidSubmit: function () {},\n onSubmitted: function () {},\n onValid: function () {},\n onInvalid: function () {},\n onChange: function () {},\n validationErrors: null,\n preventExternalInvalidation: false\n };\n },\n\n childContextTypes: {\n formsy: React.PropTypes.object\n },\n getChildContext: function () {\n return {\n formsy: {\n attachToForm: this.attachToForm,\n detachFromForm: this.detachFromForm,\n validate: this.validate,\n isFormDisabled: this.isFormDisabled,\n isValidValue: (component, value) => {\n return this.runValidation(component, value).isValid;\n }\n }\n }\n },\n\n // Add a map to store the inputs of the form, a model to store\n // the values of the form and register child inputs\n componentWillMount: function () {\n this.inputs = [];\n },\n\n componentDidMount: function () {\n this.validateForm();\n },\n\n componentWillUpdate: function () {\n // Keep a reference to input names before form updates,\n // to check if inputs has changed after render\n this.prevInputNames = this.inputs.map(component => component.props.name);\n },\n\n componentDidUpdate: function () {\n\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(component => component.props.name);\n if (utils.arraysDiffer(this.prevInputNames, newInputNames)) {\n this.validateForm();\n }\n\n },\n\n // Allow resetting to specified data\n reset: function (data) {\n this.setFormPristine(true);\n this.resetModel(data);\n },\n\n // Update model, submit to url prop and send the model\n submit: function (event) {\n\n event && event.preventDefault();\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 this.state.isValid ? this.props.onValidSubmit(model, this.resetModel, this.updateInputsWithError) : this.props.onInvalidSubmit(model, this.resetModel, this.updateInputsWithError);\n\n },\n\n mapModel: function (model) {\n\n if (this.props.mapping) {\n return this.props.mapping(model)\n } else {\n return formDataToObject.toObj(Object.keys(model).reduce((mappedModel, key) => {\n\n var keyArray = key.split('.');\n var base = mappedModel;\n while (keyArray.length) {\n var currentKey = keyArray.shift();\n base = (base[currentKey] = keyArray.length ? base[currentKey] || {} : model[key]);\n }\n\n return mappedModel;\n\n }, {}));\n }\n },\n\n getModel: function () {\n var currentValues = this.getCurrentValues();\n return this.mapModel(currentValues);\n },\n\n // Reset each key in the model to the original / initial / specified value\n resetModel: function (data) {\n this.inputs.forEach(component => {\n var name = component.props.name;\n if (data && data[name]) {\n component.setValue(data[name]);\n } else {\n component.resetValue();\n }\n });\n this.validateForm();\n },\n\n setInputValidationErrors: function (errors) {\n this.inputs.forEach(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 // Checks if the values have changed from their initial value\n isChanged: function() {\n return !utils.isSame(this.getPristineValues(), this.getCurrentValues());\n },\n\n getPristineValues: function() {\n return this.inputs.reduce((data, component) => {\n var name = component.props.name;\n data[name] = component.props.value;\n return data;\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: function (errors) {\n Object.keys(errors).forEach((name, index) => {\n var component = utils.find(this.inputs, component => component.props.name === name);\n if (!component) {\n throw new Error('You are trying to update an input that does not exist. ' +\n 'Verify errors object with input names. ' + JSON.stringify(errors));\n }\n var args = [{\n _isValid: this.props.preventExternalInvalidation || false,\n _externalError: typeof errors[name] === 'string' ? [errors[name]] : errors[name]\n }];\n component.setState.apply(component, args);\n });\n },\n\n isFormDisabled: function () {\n return this.props.disabled;\n },\n\n getCurrentValues: function () {\n return this.inputs.reduce((data, component) => {\n var name = component.props.name;\n data[name] = component.state._value;\n return data;\n }, {});\n },\n\n setFormPristine: function (isPristine) {\n this.setState({\n _formSubmitted: !isPristine\n });\n\n // Iterate through each component and set it as pristine\n // or \"dirty\".\n this.inputs.forEach((component, index) => {\n component.setState({\n _formSubmitted: !isPristine,\n _isPristine: isPristine\n });\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: function (component) {\n\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\n // Checks validation on current value or a passed value\n runValidation: function (component, value) {\n\n var currentValues = this.getCurrentValues();\n var validationErrors = component.props.validationErrors;\n var validationError = component.props.validationError;\n value = arguments.length === 2 ? value : component.state._value;\n\n var validationResults = this.runRules(value, currentValues, component._validations);\n var requiredResults = this.runRules(value, currentValues, component._requiredValidations);\n\n // the component defines an explicit validate function\n if (typeof component.validate === \"function\") {\n validationResults.failed = component.validate() ? [] : ['failed'];\n }\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\n if (isValid && !isRequired) {\n return emptyArray;\n }\n\n if (validationResults.errors.length) {\n return validationResults.errors;\n }\n\n if (this.props.validationErrors && this.props.validationErrors[component.props.name]) {\n return typeof this.props.validationErrors[component.props.name] === 'string' ? [this.props.validationErrors[component.props.name]] : this.props.validationErrors[component.props.name];\n }\n\n if (isRequired) {\n var error = validationErrors[requiredResults.success[0]];\n return error ? [error] : null;\n }\n\n if (validationResults.failed.length) {\n return validationResults.failed.map(function(failed) {\n return validationErrors[failed] ? validationErrors[failed] : validationError;\n }).filter(function(x, pos, arr) {\n // Remove duplicates\n return arr.indexOf(x) === pos;\n });\n }\n\n }.call(this))\n };\n\n },\n\n runRules: function (value, currentValues, validations) {\n\n var results = {\n errors: [],\n failed: [],\n success: []\n };\n if (Object.keys(validations).length) {\n Object.keys(validations).forEach(function (validationMethod) {\n\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\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\n return results.success.push(validationMethod);\n\n });\n }\n\n return results;\n\n },\n\n // Validate the form by going through all child input components\n // and check their state\n validateForm: function () {\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 () {\n var allIsValid = this.inputs.every(component => {\n return component.state._isValid;\n });\n\n this.setState({\n isValid: allIsValid\n });\n\n if (allIsValid) {\n this.props.onValid();\n } else {\n this.props.onInvalid();\n }\n\n // Tell the form that it can start to trigger change events\n this.setState({\n canChange: true\n });\n\n }.bind(this);\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 var validation = this.runValidation(component);\n if (validation.isValid && component.state._externalError) {\n validation.isValid = false;\n }\n component.setState({\n _isValid: validation.isValid,\n _isRequired: validation.isRequired,\n _validationError: validation.error,\n _externalError: !validation.isValid && component.state._externalError ? component.state._externalError : null\n }, index === this.inputs.length - 1 ? onValidationComplete : null);\n });\n\n // If there are no inputs, set state where form is ready to trigger\n // change event. New inputs might be added later\n if (!this.inputs.length && this.isMounted()) {\n this.setState({\n canChange: true\n });\n }\n },\n\n // Method put on each input component to register\n // itself to the form\n attachToForm: function (component) {\n\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: function (component) {\n var componentPos = this.inputs.indexOf(component);\n\n if (componentPos !== -1) {\n this.inputs = this.inputs.slice(0, componentPos)\n .concat(this.inputs.slice(componentPos + 1));\n }\n\n this.validateForm();\n },\n render: function () {\n var {\n mapping,\n validationErrors,\n onSubmit,\n onValid,\n onInvalid,\n onInvalidSubmit,\n onChange,\n reset,\n preventExternalInvalidation,\n onSuccess,\n onError,\n ...nonFormsyProps\n } = this.props;\n\n return (\n
\n {this.props.children}\n
\n );\n\n }\n});\n\nif (!global.exports && !global.module && (!global.define || !global.define.amd)) {\n global.Formsy = Formsy;\n}\n\nmodule.exports = Formsy;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/main.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"react\"\n ** module id = 1\n ** module chunks = 0\n **/","var utils = require('./utils.js');\nvar React = global.React || require('react');\n\nvar convertValidationsToObject = function (validations) {\n\n if (typeof validations === 'string') {\n\n return validations.split(/\\,(?![^{\\[]*[}\\]])/g).reduce(function (validations, 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 validations[validateMethod] = args.length ? args[0] : true;\n return validations;\n }, {});\n\n }\n\n return validations || {};\n};\n\nmodule.exports = {\n getInitialState: function () {\n return {\n _value: this.props.value,\n _isRequired: false,\n _isValid: true,\n _isPristine: true,\n _pristineValue: this.props.value,\n _validationError: [],\n _externalError: null,\n _formSubmitted: false\n };\n },\n contextTypes: {\n formsy: React.PropTypes.object // What about required?\n },\n getDefaultProps: function () {\n return {\n validationError: '',\n validationErrors: {}\n };\n },\n\n componentWillMount: function () {\n var configure = function () {\n this.setValidations(this.props.validations, this.props.required);\n\n // Pass a function instead?\n this.context.formsy.attachToForm(this);\n //this.props._attachToForm(this);\n }.bind(this);\n\n if (!this.props.name) {\n throw new Error('Form Input requires a name property when used');\n }\n\n /*\n if (!this.props._attachToForm) {\n return setTimeout(function () {\n if (!this.isMounted()) return;\n if (!this.props._attachToForm) {\n throw new Error('Form Mixin requires component to be nested in a Form');\n }\n configure();\n }.bind(this), 0);\n }\n */\n configure();\n },\n\n // We have to make the validate method is kept when new props are added\n componentWillReceiveProps: function (nextProps) {\n this.setValidations(nextProps.validations, nextProps.required);\n\n },\n\n componentDidUpdate: function (prevProps) {\n\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) || !utils.isSame(this.props.required, prevProps.required)) {\n this.context.formsy.validate(this);\n }\n },\n\n // Detach it when component unmounts\n componentWillUnmount: function () {\n this.context.formsy.detachFromForm(this);\n //this.props._detachFromForm(this);\n },\n\n setValidations: function (validations, required) {\n\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\n // We validate after the value has been set\n setValue: function (value) {\n this.setState({\n _value: value,\n _isPristine: false\n }, function () {\n this.context.formsy.validate(this);\n //this.props._validate(this);\n }.bind(this));\n },\n resetValue: function () {\n this.setState({\n _value: this.state._pristineValue,\n _isPristine: true\n }, function () {\n this.context.formsy.validate(this);\n //this.props._validate(this);\n });\n },\n getValue: function () {\n return this.state._value;\n },\n hasValue: function () {\n return this.state._value !== '';\n },\n getErrorMessage: function () {\n var messages = this.getErrorMessages();\n return messages.length ? messages[0] : null;\n },\n getErrorMessages: function () {\n return !this.isValid() || this.showRequired() ? (this.state._externalError || this.state._validationError || []) : [];\n },\n isFormDisabled: function () {\n return this.context.formsy.isFormDisabled();\n //return this.props._isFormDisabled();\n },\n isValid: function () {\n return this.state._isValid;\n },\n isPristine: function () {\n return this.state._isPristine;\n },\n isFormSubmitted: function () {\n return this.state._formSubmitted;\n },\n isRequired: function () {\n return !!this.props.required;\n },\n showRequired: function () {\n return this.state._isRequired;\n },\n showError: function () {\n return !this.showRequired() && !this.isValid();\n },\n isValidValue: function (value) {\n return this.context.formsy.isValidValue.call(null, this, value);\n //return this.props._isValidValue.call(null, this, value);\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/Mixin.js\n **/","module.exports = {\n arraysDiffer: function (a, b) {\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\n objectsDiffer: function (a, b) {\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 (!this.isSame(a[key], b[key])) {\n isDifferent = true;\n }\n }, this);\n }\n return isDifferent;\n },\n\n isSame: function (a, b) {\n if (typeof a !== typeof b) {\n return false;\n } else if (Array.isArray(a)) {\n return !this.arraysDiffer(a, b);\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: function (collection, fn) {\n for (var i = 0, l = collection.length; i < l; i++) {\n var item = collection[i];\n if (fn(item)) {\n return item;\n }\n }\n return null;\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utils.js\n **/","var React = global.React || require('react');\r\nvar Mixin = require('./Mixin.js');\r\nmodule.exports = function () {\r\n return function (Component) {\r\n return React.createClass({\r\n mixins: [Mixin],\r\n render: function () {\r\n return React.createElement(Component, {\r\n setValidations: this.setValidations,\r\n setValue: this.setValue,\r\n resetValue: this.resetValue,\r\n getValue: this.getValue,\r\n hasValue: this.hasValue,\r\n getErrorMessage: this.getErrorMessage,\r\n getErrorMessages: this.getErrorMessages,\r\n isFormDisabled: this.isFormDisabled,\r\n isValid: this.isValid,\r\n isPristine: this.isPristine,\r\n isFormSubmitted: this.isFormSubmitted,\r\n isRequired: this.isRequired,\r\n showRequired: this.showRequired,\r\n showError: this.showError,\r\n isValidValue: this.isValidValue,\r\n ...this.props\r\n });\r\n }\r\n });\r\n };\r\n};\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/Decorator.js\n **/","var React = global.React || require('react');\r\nvar Mixin = require('./Mixin.js');\r\nmodule.exports = function (Component) {\r\n return React.createClass({\r\n mixins: [Mixin],\r\n render: function () {\r\n return React.createElement(Component, {\r\n setValidations: this.setValidations,\r\n setValue: this.setValue,\r\n resetValue: this.resetValue,\r\n getValue: this.getValue,\r\n hasValue: this.hasValue,\r\n getErrorMessage: this.getErrorMessage,\r\n getErrorMessages: this.getErrorMessages,\r\n isFormDisabled: this.isFormDisabled,\r\n isValid: this.isValid,\r\n isPristine: this.isPristine,\r\n isFormSubmitted: this.isFormSubmitted,\r\n isRequired: this.isRequired,\r\n showRequired: this.showRequired,\r\n showError: this.showError,\r\n isValidValue: this.isValidValue,\r\n ...this.props\r\n });\r\n }\r\n });\r\n};\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/HOC.js\n **/","var isExisty = function (value) {\n return value !== null && value !== undefined;\n};\n\nvar isEmpty = function (value) {\n return value === '';\n};\n\nvar validations = {\n isDefaultRequiredValue: function (values, value) {\n return value === undefined || value === '';\n },\n isExisty: function (values, value) {\n return isExisty(value);\n },\n matchRegexp: function (values, value, regexp) {\n return !isExisty(value) || isEmpty(value) || regexp.test(value);\n },\n isUndefined: function (values, value) {\n return value === undefined;\n },\n isEmptyString: function (values, value) {\n return isEmpty(value);\n },\n isEmail: function (values, value) {\n return validations.matchRegexp(values, value, /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i);\n },\n isUrl: function (values, value) {\n return validations.matchRegexp(values, value, /^(https?|s?ftp):\\/\\/(((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:)*@)?(((\\d|[1-9]\\d|1\\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uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$/i);\n },\n isTrue: function (values, value) {\n return value === true;\n },\n isFalse: function (values, value) {\n return value === false;\n },\n isNumeric: function (values, value) {\n if (typeof value === 'number') {\n return true;\n }\n return validations.matchRegexp(values, value, /^[-+]?(?:\\d*[.])?\\d+$/);\n },\n isAlpha: function (values, value) {\n return validations.matchRegexp(values, value, /^[A-Z]+$/i);\n },\n isAlphanumeric: function (values, value) {\n return validations.matchRegexp(values, value, /^[0-9A-Z]+$/i);\n },\n isInt: function (values, value) {\n return validations.matchRegexp(values, value, /^(?:[-+]?(?:0|[1-9]\\d*))$/);\n },\n isFloat: function (values, value) {\n return validations.matchRegexp(values, value, /^(?:[-+]?(?:\\d+))?(?:\\.\\d*)?(?:[eE][\\+\\-]?(?:\\d+))?$/);\n },\n isWords: function (values, value) {\n return validations.matchRegexp(values, value, /^[A-Z\\s]+$/i);\n },\n isSpecialWords: function (values, value) {\n return validations.matchRegexp(values, value, /^[A-Z\\s\\u00C0-\\u017F]+$/i);\n },\n isLength: function (values, value, length) {\n return !isExisty(value) || isEmpty(value) || value.length === length;\n },\n equals: function (values, value, eql) {\n return !isExisty(value) || isEmpty(value) || value == eql;\n },\n equalsField: function (values, value, field) {\n return value == values[field];\n },\n maxLength: function (values, value, length) {\n return !isExisty(value) || value.length <= length;\n },\n minLength: function (values, value, length) {\n return !isExisty(value) || isEmpty(value) || value.length >= length;\n }\n};\n\nmodule.exports = validations;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/validationRules.js\n **/","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 ** ./~/form-data-to-object/index.js\n ** module id = 7\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/release/formsy-react.min.js b/release/formsy-react.min.js deleted file mode 100644 index 26f2276..0000000 --- a/release/formsy-react.min.js +++ /dev/null @@ -1 +0,0 @@ -!function t(i,e,r){function n(o,u){if(!e[o]){if(!i[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var d=e[o]={exports:{}};i[o][0].call(d.exports,function(t){var e=i[o][1][t];return n(e?e:t)},d,d.exports,t,i,e,r)}return e[o].exports}for(var s="function"==typeof require&&require,o=0;o1)throw new Error("Formsy does not support multiple args on string validations. Use object format of validations instead.");return t[r]=e.length?e[0]:!0,t},{}):t||{}};i.exports={getInitialState:function(){return{_value:this.props.value,_isRequired:!1,_isValid:!0,_isPristine:!0,_pristineValue:this.props.value,_validationError:"",_externalError:null,_formSubmitted:!1}},getDefaultProps:function(){return{validationError:"",validationErrors:{}}},componentWillMount:function(){var t=function(){this.setValidations(this.props.validations,this.props.required),this.props._attachToForm(this)}.bind(this);if(!this.props.name)throw new Error("Form Input requires a name property when used");return this.props._attachToForm?(t(),void 0):setTimeout(function(){if(this.isMounted()){if(!this.props._attachToForm)throw new Error("Form Mixin requires component to be nested in a Form");t()}}.bind(this),0)},componentWillReceiveProps:function(t){this.setValidations(t.validations,t.required)},componentDidUpdate:function(t){var i=function(){return!e.isSame(this.props.value,t.value)&&e.isSame(this.state._value,t.value)}.bind(this);i()&&this.setValue(this.props.value)},componentWillUnmount:function(){this.props._detachFromForm(this)},setValidations:function(t,i){this._validations=r(t)||{},this._requiredValidations=i===!0?{isDefaultRequiredValue:!0}:r(i)},setValue:function(t){this.setState({_value:t,_isPristine:!1},function(){this.props._validate(this)}.bind(this))},resetValue:function(){this.setState({_value:this.state._pristineValue,_isPristine:!0},function(){this.props._validate(this)})},getValue:function(){return this.state._value},hasValue:function(){return""!==this.state._value},getErrorMessage:function(){return!this.isValid()||this.showRequired()?this.state._externalError||this.state._validationError:null},isFormDisabled:function(){return this.props._isFormDisabled()},isValid:function(){return this.state._isValid},isPristine:function(){return this.state._isPristine},isFormSubmitted:function(){return this.state._formSubmitted},isRequired:function(){return!!this.props.required},showRequired:function(){return this.state._isRequired},showError:function(){return!this.showRequired()&&!this.isValid()},isValidValue:function(t){return this.props._isValidValue.call(null,this,t)}}},{"./utils.js":3}],3:[function(t,i){i.exports={arraysDiffer:function(t,i){var e=!1;return t.length!==i.length?e=!0:t.forEach(function(t,r){this.isSame(t,i[r])||(e=!0)},this),e},objectsDiffer:function(t,i){var e=!1;return Object.keys(t).length!==Object.keys(i).length?e=!0:Object.keys(t).forEach(function(r){this.isSame(t[r],i[r])||(e=!0)},this),e},isSame:function(t,i){return t!==i?!1:Array.isArray(t)?!this.arraysDiffer(t,i):"object"==typeof t&&null!==t?!this.objectsDiffer(t,i):!0}}},{}],4:[function(t,i){var e=function(t){return null!==t&&void 0!==t},r={isDefaultRequiredValue:function(t,i){return void 0===i||""===i},hasValue:function(t,i){return!!i},matchRegexp:function(t,i,r){return e(i)&&r.test(i)},isUndefined:function(t,i){return void 0===i},isEmptyString:function(t,i){return""===i},isEmail:function(t,i){return r.matchRegexp(t,i,/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i)},isTrue:function(t,i){return i===!0},isFalse:function(t,i){return i===!1},isNumeric:function(t,i){if(!e(i))return!1;if("number"==typeof i)return!0;var r=i.match(/[-+]?(\d*[.])?\d+/);return r?r[0]==i:!1},isAlpha:function(t,i){return i&&/^[a-zA-Z]+$/.test(i)},isWords:function(t,i){return i&&/^[a-zA-Z\s]+$/.test(i)},isSpecialWords:function(t,i){return!i||/^[a-zA-Z\s\u00C0-\u017F]+$/.test(i)},isLength:function(t,i,r){return e(i)&&i.length===r},equals:function(t,i,e){return i==e},equalsField:function(t,i,e){return i==t[e]},maxLength:function(t,i,r){return e(i)&&i.length<=r},minLength:function(t,i,r){return e(i)&&i.length>=r}};i.exports=r},{}]},{},[1]); \ No newline at end of file diff --git a/src/main.js b/src/main.js index c2eaa43..c72358a 100644 --- a/src/main.js +++ b/src/main.js @@ -118,7 +118,7 @@ Formsy.Form = React.createClass({ if (this.props.mapping) { return this.props.mapping(model) } else { - return formDataToObject(Object.keys(model).reduce((mappedModel, key) => { + return formDataToObject.toObj(Object.keys(model).reduce((mappedModel, key) => { var keyArray = key.split('.'); var base = mappedModel; diff --git a/tests/Rules-minLength-spec.js b/tests/Rules-minLength-spec.js index 6c85d27..4dd7bd6 100644 --- a/tests/Rules-minLength-spec.js +++ b/tests/Rules-minLength-spec.js @@ -42,6 +42,15 @@ export default { }, + 'should fail when a string\'s length is smaller': function (test) { + + const form = TestUtils.renderIntoDocument(); + const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput); + test.equal(inputComponent.isValid(), false); + test.done(); + + }, + 'should pass with empty string': function (test) { const form = TestUtils.renderIntoDocument(); diff --git a/tests/utils/TestInput.js b/tests/utils/TestInput.js index e72a1f4..d9a57ec 100644 --- a/tests/utils/TestInput.js +++ b/tests/utils/TestInput.js @@ -1,6 +1,5 @@ import React from 'react'; import Formsy from './../..'; -import assign from 'react/lib/Object.assign'; const defaultProps = { mixins: [Formsy.Mixin], @@ -16,7 +15,7 @@ const defaultProps = { }; export function InputFactory(props) { - return React.createClass(assign(defaultProps, props)); + return React.createClass(Object.assign(defaultProps, props)); } export default React.createClass(defaultProps); diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index dba29d5..0000000 --- a/webpack.config.js +++ /dev/null @@ -1,21 +0,0 @@ -var path = require('path'); - -module.exports = { - - devtool: 'inline-source-map', - - entry: path.resolve(__dirname, 'build', 'test.js'), - - output: { - path: path.resolve(__dirname, 'build'), - filename: 'build.js' - }, - - module: { - loaders: [ - { test: /\.js$/, exclude: /node_modules/, loader: 'babel' }, - { test: /\.json$/, loader: 'json' } - ] - } - -};