Comparing version 1.3.9 to 1.3.10
@@ -0,1 +1,6 @@ | ||
## 1.3.10 ( July 5, 2018 ) | ||
### Fixed | ||
- issue where you could not pass initialValue=false to checkbox | ||
## 1.3.9 ( July 5, 2018 ) | ||
@@ -2,0 +7,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("informed",[],t):"object"==typeof exports?exports.informed=t():e.informed=t()}(this,function(){return function(e){var t={};function __webpack_require__(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,__webpack_require__),n.l=!0,n.exports}return __webpack_require__.m=e,__webpack_require__.c=t,__webpack_require__.d=function(e,t,r){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},__webpack_require__.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.n=function(e){var t=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=23)}([function(e,t){e.exports=require("react")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SelectContext=t.GroupContext=t.FieldContext=t.FormContext=void 0;var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(0));var o=n.default.createContext(),i=n.default.createContext(),u=n.default.createContext(),a=n.default.createContext();t.FormContext=o,t.FieldContext=i,t.GroupContext=u,t.SelectContext=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=_interopRequireDefault(r(0)),i=_interopRequireDefault(r(6));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}t.default=function asField(e){var t=function getDisplayName(e){return e.displayName||e.name||"Component"}(e);e.displayName="Wrapper";var r=function AsField(t){return o.default.createElement(i.default,n({component:e},t))};return r.displayName=t,r}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(0)),i=r(1);t.default=function withFormApi(e){return o.default.forwardRef(function(t,r){return o.default.createElement(i.FormContext.Consumer,null,function(i){var u=i.formApi;return o.default.createElement(e,n({formApi:u,ref:r},t))})})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(0)),i=r(1);t.default=function withRadioGroup(e){return o.default.forwardRef(function(t,r){return o.default.createElement(i.GroupContext.Consumer,null,function(i){var u=i.radioGroupApi,a=i.radioGroupState;return o.default.createElement(e,n({radioGroupApi:u,radioGroupState:a,ref:r},t))})})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bindToField=t.withFieldState=t.withFieldApi=void 0;var n=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=_interopRequireDefault(r(0)),u=_interopRequireDefault(r(3)),a=_interopRequireDefault(r(7)),l=_interopRequireDefault(r(16));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}var f=function buildFieldApi(e,t){return{getValue:function getValue(){return e.getValue(t)},setValue:function setValue(r){return e.setValue(t,r)},getTouched:function getTouched(){return e.getTouched(t)},setTouched:function setTouched(r){return e.setTouched(t,r)},getError:function getError(){return e.getError(t)},setError:function setError(r){return e.setError(t,r)}}},c=function buildFieldState(e,t){return{value:e.getValue(t),touched:e.getTouched(t),error:e.getError(t)}};t.withFieldApi=function withFieldApi(e){return function(t){return(0,u.default)(function(r){var n=r.formApi,u=_objectWithoutProperties(r,["formApi"]);return i.default.createElement(t,o({fieldApi:f(n,e)},u))})}},t.withFieldState=function withFieldState(e){return function(t){return(0,u.default)(function(r){var n=r.formApi,u=_objectWithoutProperties(r,["formApi"]);return i.default.createElement(t,o({fieldState:c(n,e)},u))})}},t.bindToField=function bindToField(e){return(0,a.default)((0,u.default)(function(t){function _class(e){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,_class);var t=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(_class.__proto__||Object.getPrototypeOf(_class)).call(this,e)),r=e.formApi,n=e.controller,o=e.field,i=e.mask,u=e.validate,a=e.validateOnBlur,s=e.validateOnChange,p=e.initialValue,d=e.validateOnMount,h=e.notify;t.state=c(r,o),t.fieldApi=f(r,o);var _=function updateMe(e){e===r.getFullField(o)&&t.setState(c(r,o))},v=function update(){t.setState(c(r,o))};return t.register=function(){n.on("field",_),n.on("update",v),n.register(r.getFullField(o),new l.default(r.getFullField(o),t.fieldApi,{validateOnBlur:a,validateOnChange:s,validate:u,initialValue:p,validateOnMount:d,notify:h,mask:i}))},t.deregister=function(){n.removeListener("field",_),n.removeListener("update",v),n.deregister(r.getFullField(o))},t.register=t.register.bind(t),t.deregister=t.deregister.bind(t),t}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(_class,i.default.PureComponent),n(_class,[{key:"render",value:function render(){var t=this.props,r=(t.mask,t.field,t.formApi,t.formState,t.controller,t.validate,t.initialValue,t.validateOnBlur,t.validateOnMount,t.validateOnChange,_objectWithoutProperties(t,["mask","field","formApi","formState","controller","validate","initialValue","validateOnBlur","validateOnMount","validateOnChange"]));return i.default.createElement(e,o({register:this.register,deregister:this.deregister,fieldApi:this.fieldApi,fieldState:this.state},r))}}]),_class}()))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),i=r(0),u=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(i),a=r(5);var l=function(e){function Field(e){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Field);var t=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(Field.__proto__||Object.getPrototypeOf(Field)).call(this,e));return t.me=u.default.createRef(),t}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(Field,i.PureComponent),o(Field,[{key:"componentDidMount",value:function componentDidMount(){this.props.register()}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.props.deregister()}},{key:"componentDidUpdate",value:function componentDidUpdate(){var e=this;this.props.debug&&this.me&&(this.me.current.style.backgroundColor="red",setTimeout(function(){e.me.current.style.backgroundColor="white"},500))}},{key:"render",value:function render(){var e=this.props,t=e.fieldApi,r=e.fieldState,o=e.children,i=e.component,render=e.render,a=(e.field,e.register,e.deregister,e.forwardedRef),l=e.debug,f=function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(e,["fieldApi","fieldState","children","component","render","field","register","deregister","forwardedRef","debug"]),c=n({fieldApi:t,fieldState:r,forwardedRef:l?this.me:a},f);return i?u.default.createElement(i,c,o):render?render(c):"function"==typeof o?o(c):o}}]),Field}();t.default=(0,a.bindToField)(l)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(0)),i=r(1);t.default=function withController(e){return o.default.forwardRef(function(t,r){return o.default.createElement(i.FormContext.Consumer,null,function(i){var u=i.controller;return o.default.createElement(e,n({controller:u,ref:r},t))})})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(0)),i=r(1);t.default=function withFormApi(e){return o.default.forwardRef(function(t,r){return o.default.createElement(i.FormContext.Consumer,null,function(i){var u=i.formState;return o.default.createElement(e,n({formState:u,ref:r},t))})})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),i=r(0),u=_interopRequireDefault(i),a=r(1),l=_interopRequireDefault(r(2));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var f=function(e){function RadioGroup(){return function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,RadioGroup),function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(RadioGroup.__proto__||Object.getPrototypeOf(RadioGroup)).apply(this,arguments))}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(RadioGroup,i.Component),o(RadioGroup,[{key:"render",value:function render(){return u.default.createElement(a.GroupContext.Provider,{value:this.groupContext},this.props.children)}},{key:"groupContext",get:function get(){return{radioGroupApi:n({},this.props.fieldApi,{onChange:this.props.onChange,onBlur:this.props.onBlur}),radioGroupState:this.props.fieldState}}}]),RadioGroup}();t.default=(0,l.default)(f)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=_interopRequireDefault(r(0)),i=_interopRequireDefault(r(2));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}t.default=(0,i.default)(function Checkbox(e){var t=e.fieldApi,r=e.fieldState,i=_objectWithoutProperties(e,["fieldApi","fieldState"]),u=r.value,a=t.setValue,l=t.setTouched,f=i.onChange,c=i.onBlur,s=i.forwardedRef,p=_objectWithoutProperties(i,["onChange","onBlur","forwardedRef"]);return o.default.createElement("input",n({},p,{ref:s,checked:!!u,onChange:function onChange(e){a(e.target.checked),f&&f(e)},onBlur:function onBlur(e){l(),c&&c(e)},type:"checkbox"}))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(0));t.default=function Option(e){var t=e.value,r=e.forwardedRef,i=e.children,u=function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(e,["value","forwardedRef","children"]);return o.default.createElement("option",n({ref:r,value:t,key:t},u),i)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),i=_interopRequireDefault(r(0)),u=_interopRequireDefault(r(2));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}var a=function(e){function Select(e){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Select);var t=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(Select.__proto__||Object.getPrototypeOf(Select)).call(this,e));return t.handleChange=t.handleChange.bind(t),t}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(Select,i.default.Component),o(Select,[{key:"handleChange",value:function handleChange(e){var t=[].concat(function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}(this.refs.select)).filter(function(e){return e.selected}).map(function(e){return e.value});this.props.fieldApi.setValue(this.props.multiple?t:t[0]||""),this.props.onChange&&this.props.onChange(e)}},{key:"render",value:function render(){var e=this.props,t=e.fieldApi,r=e.fieldState,o=_objectWithoutProperties(e,["fieldApi","fieldState"]),u=r.value,a=(t.setValue,t.setTouched),l=(o.onChange,o.onBlur),f=(o.forwardedRef,o.children),c=o.multiple,s=_objectWithoutProperties(o,["onChange","onBlur","forwardedRef","children","multiple"]);return i.default.createElement("select",n({},s,{multiple:c,ref:"select",value:u||(c?[]:""),onChange:this.handleChange,onBlur:function onBlur(e){a(),l&&l(e)}}),f)}}]),Select}();t.default=(0,u.default)(a)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=_interopRequireDefault(r(0)),i=_interopRequireDefault(r(2));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}t.default=(0,i.default)(function TextArea(e){var t=e.fieldApi,r=e.fieldState,i=_objectWithoutProperties(e,["fieldApi","fieldState"]),u=r.value,a=t.setValue,l=t.setTouched,f=i.onChange,c=i.onBlur,s=i.forwardedRef,p=_objectWithoutProperties(i,["onChange","onBlur","forwardedRef"]);return o.default.createElement("textarea",n({},p,{ref:s,value:u||"",onChange:function onChange(e){a(e.target.value),f&&f(e)},onBlur:function onBlur(e){l(),c&&c(e)}}))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=_interopRequireDefault(r(0)),i=_interopRequireDefault(r(4));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}t.default=(0,i.default)(function Radio(e){var t=e.radioGroupApi,r=e.radioGroupState,i=_objectWithoutProperties(e,["radioGroupApi","radioGroupState"]),u=r.value,a=t.setValue,l=t.setTouched,f=t.onChange,c=t.onBlur,s=i.value,p=i.onChange,d=i.onBlur,h=i.forwardedRef,_=_objectWithoutProperties(i,["value","onChange","onBlur","forwardedRef"]);return o.default.createElement("input",n({},_,{ref:h,value:s,checked:u===s,onChange:function onChange(e){e.target.checked&&(a(s),p&&p(e),f&&f(e))},onBlur:function onBlur(e){l(),d&&d(e),c&&c(e)},type:"radio"}))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=_interopRequireDefault(r(0)),i=_interopRequireDefault(r(2));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}t.default=(0,i.default)(function Text(e){var t=e.fieldApi,r=e.fieldState,i=_objectWithoutProperties(e,["fieldApi","fieldState"]),u=r.value,a=t.setValue,l=t.setTouched,f=i.onChange,c=i.onBlur,s=i.forwardedRef,p=_objectWithoutProperties(i,["onChange","onBlur","forwardedRef"]);return o.default.createElement("input",n({},p,{ref:s,value:u||0===u?u:"",onChange:function onChange(e){a(e.target.value),f&&f(e)},onBlur:function onBlur(e){l(),c&&c(e)}}))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}();var o=function(){function FieldController(e,t,r){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FieldController),this.field=e,this.config=r,this.api=t}return n(FieldController,[{key:"validate",value:function validate(e){if(this.config.validate)return this.config.validate(this.api.getValue(),e)}}]),FieldController}();t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(0),u=_interopRequireDefault(i),a=r(1),l=_interopRequireDefault(r(3)),f=_interopRequireDefault(r(8)),c=_interopRequireDefault(r(7));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var s=function buildScopedContext(e,t,r,n){return{formApi:o({},t,{getValue:function getValue(r){return t.getValue(e+"."+r)},setValue:function setValue(r,n){return t.setValue(e+"."+r,n)},getTouched:function getTouched(r){return t.getTouched(e+"."+r)},setTouched:function setTouched(r,n){return t.setTouched(e+"."+r,n)},getError:function getError(r){return t.getError(e+"."+r)},setError:function setError(r,n){return t.setError(e+"."+r,n)},getFullField:function getFullField(t){return e+"."+t}}),formState:r,controller:n}},p=function(e){function Scope(e){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Scope);var t=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(Scope.__proto__||Object.getPrototypeOf(Scope)).call(this,e)),r=e.scope,n=e.formApi,o=e.formState,i=e.controller;return t.formContext=s(r,n,o,i),t}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(Scope,i.Component),n(Scope,[{key:"render",value:function render(){var e=this.props.children;return u.default.createElement(a.FormContext.Provider,{value:this.formContext},e)}}]),Scope}();t.default=(0,f.default)((0,c.default)((0,l.default)(p)))},function(e,t){e.exports=require("events")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function makePathArray(e){return e.replace(/\[(\d+)]/g,".__int__$1").replace(/\['([^.]+)']/g,".$1").split(".").map(function(e){return 0===e.indexOf("__int__")?parseInt(e.substring(7),10):e})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(19));function isArray(e){return Array.isArray(e)}function isObject(e){return!Array.isArray(e)&&"object"===(void 0===e?"undefined":o(e))&&null!==e}var u=function buildMap(e){if(isObject(e)){var t=new Map;return Object.keys(e).forEach(function(r){var n=buildMap(e[r]);null!=n&&t.set(r,n)}),t}if(isArray(e)){var r=new Map;return e.forEach(function(e,t){var n=buildMap(e);null!=n&&r.set(t,n)}),r}return e},a=function(){function ObjectMap(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ObjectMap),this.object=JSON.parse(JSON.stringify(e)),this.map=u(this.object),this.paths=new Map}return n(ObjectMap,[{key:"empty",value:function empty(){return 0===this.map.size}},{key:"rebuild",value:function rebuild(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.object=JSON.parse(JSON.stringify(e)),this.map=u(this.object)}},{key:"get",value:function get(e){var t=this.paths.get(e);t||(t=(0,i.default)(e),this.paths.set(e,t));var get=function get(e,r,n,o){if(null!=e)return null==n?e[r]:get(e[r],t[o+1],t[o+2],o+1)};return get(this.object,t[0],t[1],0)}},{key:"set",value:function set(e,t){var r=this.paths.get(e);r||(r=(0,i.default)(e),this.paths.set(e,r));var set=function set(e,n,o,i,u){if(null!=e)if(null!=i){null!=t&&("number"!=typeof i||isArray(e[o])||(e[o]=[],n.set(o,new Map)),"number"==typeof i||isObject(e[o])||(e[o]={},n.set(o,new Map)));var a=isObject(e[o])||isArray(e[o])?n.get(o):n;set(e[o],a,r[u+1],r[u+2],u+1),0===a.size&&(delete e[o],n.delete(o))}else null==t?(delete e[o],n.delete(o)):(e[o]=t,n.set(o,t))};set(this.object,this.map,r[0],r[1],0)}},{key:"delete",value:function _delete(e){this.set(e,null),this.paths.delete(e)}}]),ObjectMap}();t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(20));var i=r(18).EventEmitter,u=function(e){function FormController(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FormController);var r=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(FormController.__proto__||Object.getPrototypeOf(FormController)).call(this));return r.valid=function(){return r.errors.empty()},r.getFormState=function(){return JSON.parse(JSON.stringify(r.state))},r.setFormState=function(e){r.values.rebuild(e.values),r.touched.rebuild(e.touched),r.errors.rebuild(e.errors),r.emit("change",r.state),r.emit("values",r.state.values),r.emit("update",r.state)},r.setValues=function(e){r.values.rebuild(e),r.emit("change",r.state),r.emit("values",r.state.values),r.emit("update",r.state)},r.setValue=function(e,t){var n=r.fields.get(e);r.values.set(e,n.config.mask?n.config.mask(t):t),n.config.validateOnChange&&(r.errors.set(e,n.validate(r.state.values)),r.notify(n.config.notify)),r.emit("change",r.state),r.emit("values",r.state.values),r.emit("field",e)},r.setTouched=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];r.touched.set(e,t);var n=r.fields.get(e);n.config.validateOnBlur&&(r.errors.set(e,n.validate(r.state.values)),r.notify(n.config.notify)),r.emit("change",r.state),r.emit("field",e)},r.setError=function(e,t){r.errors.set(e,t),r.emit("change",r.state),r.emit("field",e);var n=r.fields.get(e);r.notify(n.config.notify)},r.getValue=function(e){return r.values.get(e)},r.getTouched=function(e){return r.touched.get(e)},r.getError=function(e){return r.errors.get(e)},r.getFullField=function(e){return e},r.register=function(e,t){r.fields.set(e,t),t.config.initialValue&&r.values.set(e,t.config.initialValue),t.config.validateOnMount&&r.errors.set(e,t.validate(r.state.values)),r.emit("change",r.state),r.emit("field",e)},r.remove=function(e){r.fields.delete(e),r.values.delete(e),r.touched.delete(e),r.errors.delete(e),r.emit("change",r.state)},r.deregister=function(e){r.remove(e),r.emit("change",r.state),r.emit("field",e)},r.reset=function(){r.values.rebuild(r.config.initialValues),r.touched.rebuild(),r.errors.rebuild(),r.fields.forEach(function(e){e.config.initialValue&&r.values.set(e.field,e.config.initialValue)}),r.emit("change",r.state),r.emit("update",r.state)},r.notify=function(e){e&&(e.forEach(function(e){var t=r.fields.get(e);if(!t)throw new Error("Cant notify field "+e+" as it does not exist!");r.errors.set(e,t.validate(r.state.values)),r.emit("field",e)}),r.emit("change",r.state))},r.submitForm=function(e){e&&!r.config.dontPreventDefault&&e.preventDefault(e),r.fields.forEach(function(e){var t=e.field;r.touched.set(t,!0),r.errors.set(t,e.validate(r.state.values))}),r.emit("change",r.state),r.emit("update",r.state),r.valid()?(r.hooks.preSubmit&&(r.values.rebuild(r.hooks.preSubmit(JSON.parse(JSON.stringify(r.state.values)))),r.emit("change",r.state),r.emit("update",r.state)),r.hooks.onSubmit&&r.hooks.onSubmit(JSON.parse(JSON.stringify(r.state.values)))):r.hooks.onSubmitFailure&&r.hooks.onSubmitFailure(JSON.parse(JSON.stringify(r.state.errors)))},r.setMaxListeners(0),r.hooks=e,r.config=t,r.values=new o.default(t.initialValues),r.touched=new o.default,r.errors=new o.default,r.api={setValue:r.setValue,getValue:r.getValue,setTouched:r.setTouched,getTouched:r.getTouched,setError:r.setError,getError:r.getError,getFullField:r.getFullField,submitForm:r.submitForm,getState:r.getFormState,setState:r.setFormState,setValues:r.setValues,reset:r.reset,notify:r.notify},r.fields=new Map,e.getApi&&e.getApi(r.api),r}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(FormController,i),n(FormController,[{key:"state",get:function get(){return{values:this.values.object,touched:this.touched.object,errors:this.errors.object,pristine:this.pristine,dirty:this.dirty,invalid:this.invalid}}},{key:"pristine",get:function get(){return this.touched.empty()&&this.values.empty()}},{key:"dirty",get:function get(){return!this.pristine}},{key:"invalid",get:function get(){return!this.errors.empty()}}]),FormController}();t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),i=r(0),u=_interopRequireDefault(i),a=r(1),l=_interopRequireDefault(r(21));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var f=function(e){function Form(e){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Form);var t=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(Form.__proto__||Object.getPrototypeOf(Form)).call(this,e)),r=e.onSubmit,n=e.preSubmit,o=e.getApi,i=e.dontPreventDefault,u=e.onSubmitFailure,a=e.initialValues;return t.controller=new l.default({onSubmit:r,getApi:o,preSubmit:n,onSubmitFailure:u},{dontPreventDefault:i,initialValues:a}),t.controller.on("change",function(){return t.forceUpdate()}),t.controller.on("change",function(t){e.onChange&&e.onChange(t)}),t.controller.on("values",function(t){e.onValueChange&&e.onValueChange(t)}),t}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(Form,i.Component),o(Form,[{key:"render",value:function render(){var e=this.props,t=(e.children,e.component,e.render,e.onSubmit,e.preSubmit,e.getApi,e.dontPreventDefault,e.onSubmitFailure,e.initialValues,e.onValueChange,e.onChange,function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(e,["children","component","render","onSubmit","preSubmit","getApi","dontPreventDefault","onSubmitFailure","initialValues","onValueChange","onChange"]));return u.default.createElement(a.FormContext.Provider,{value:this.formContext},u.default.createElement("form",n({},t,{onReset:this.formContext.formApi.reset,onSubmit:this.formContext.formApi.submitForm}),this.content))}},{key:"formContext",get:function get(){return{formApi:this.controller.api,formState:this.controller.state,controller:this.controller}}},{key:"content",get:function get(){var e=this.props,t=e.children,r=e.component,n=e.render,o=this.formContext;return r?u.default.createElement(r,o,t):n?n(o):"function"==typeof t?t(o):t}}]),Form}();t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RadioGroup=t.Checkbox=t.Option=t.Select=t.TextArea=t.Radio=t.Text=t.asField=t.withRadioGroup=t.withFieldState=t.withFieldApi=t.withFormState=t.withFormApi=t.Field=t.Scope=t.Form=void 0;var n=_interopRequireDefault(r(22)),o=_interopRequireDefault(r(17)),i=_interopRequireDefault(r(6)),u=_interopRequireDefault(r(3)),a=_interopRequireDefault(r(8)),l=r(5),f=_interopRequireDefault(r(4)),c=_interopRequireDefault(r(2)),s=_interopRequireDefault(r(15)),p=_interopRequireDefault(r(14)),d=_interopRequireDefault(r(13)),h=_interopRequireDefault(r(12)),_=_interopRequireDefault(r(11)),v=_interopRequireDefault(r(10)),b=_interopRequireDefault(r(9));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}t.Form=n.default,t.Scope=o.default,t.Field=i.default,t.withFormApi=u.default,t.withFormState=a.default,t.withFieldApi=l.withFieldApi,t.withFieldState=l.withFieldState,t.withRadioGroup=f.default,t.asField=c.default,t.Text=s.default,t.Radio=p.default,t.TextArea=d.default,t.Select=h.default,t.Option=_.default,t.Checkbox=v.default,t.RadioGroup=b.default}])}); | ||
!function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("informed",[],t):"object"==typeof exports?exports.informed=t():e.informed=t()}(this,function(){return function(e){var t={};function __webpack_require__(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,__webpack_require__),n.l=!0,n.exports}return __webpack_require__.m=e,__webpack_require__.c=t,__webpack_require__.d=function(e,t,r){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},__webpack_require__.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.n=function(e){var t=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=23)}([function(e,t){e.exports=require("react")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SelectContext=t.GroupContext=t.FieldContext=t.FormContext=void 0;var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(0));var o=n.default.createContext(),i=n.default.createContext(),u=n.default.createContext(),a=n.default.createContext();t.FormContext=o,t.FieldContext=i,t.GroupContext=u,t.SelectContext=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=_interopRequireDefault(r(0)),i=_interopRequireDefault(r(6));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}t.default=function asField(e){var t=function getDisplayName(e){return e.displayName||e.name||"Component"}(e);e.displayName="Wrapper";var r=function AsField(t){return o.default.createElement(i.default,n({component:e},t))};return r.displayName=t,r}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(0)),i=r(1);t.default=function withFormApi(e){return o.default.forwardRef(function(t,r){return o.default.createElement(i.FormContext.Consumer,null,function(i){var u=i.formApi;return o.default.createElement(e,n({formApi:u,ref:r},t))})})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(0)),i=r(1);t.default=function withRadioGroup(e){return o.default.forwardRef(function(t,r){return o.default.createElement(i.GroupContext.Consumer,null,function(i){var u=i.radioGroupApi,a=i.radioGroupState;return o.default.createElement(e,n({radioGroupApi:u,radioGroupState:a,ref:r},t))})})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bindToField=t.withFieldState=t.withFieldApi=void 0;var n=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=_interopRequireDefault(r(0)),u=_interopRequireDefault(r(3)),a=_interopRequireDefault(r(7)),l=_interopRequireDefault(r(16));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}var f=function buildFieldApi(e,t){return{getValue:function getValue(){return e.getValue(t)},setValue:function setValue(r){return e.setValue(t,r)},getTouched:function getTouched(){return e.getTouched(t)},setTouched:function setTouched(r){return e.setTouched(t,r)},getError:function getError(){return e.getError(t)},setError:function setError(r){return e.setError(t,r)}}},c=function buildFieldState(e,t){return{value:e.getValue(t),touched:e.getTouched(t),error:e.getError(t)}};t.withFieldApi=function withFieldApi(e){return function(t){return(0,u.default)(function(r){var n=r.formApi,u=_objectWithoutProperties(r,["formApi"]);return i.default.createElement(t,o({fieldApi:f(n,e)},u))})}},t.withFieldState=function withFieldState(e){return function(t){return(0,u.default)(function(r){var n=r.formApi,u=_objectWithoutProperties(r,["formApi"]);return i.default.createElement(t,o({fieldState:c(n,e)},u))})}},t.bindToField=function bindToField(e){return(0,a.default)((0,u.default)(function(t){function _class(e){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,_class);var t=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(_class.__proto__||Object.getPrototypeOf(_class)).call(this,e)),r=e.formApi,n=e.controller,o=e.field,i=e.mask,u=e.validate,a=e.validateOnBlur,s=e.validateOnChange,p=e.initialValue,d=e.validateOnMount,h=e.notify;t.state=c(r,o),t.fieldApi=f(r,o);var _=function updateMe(e){e===r.getFullField(o)&&t.setState(c(r,o))},v=function update(){t.setState(c(r,o))};return t.register=function(){n.on("field",_),n.on("update",v),n.register(r.getFullField(o),new l.default(r.getFullField(o),t.fieldApi,{validateOnBlur:a,validateOnChange:s,validate:u,initialValue:p,validateOnMount:d,notify:h,mask:i}))},t.deregister=function(){n.removeListener("field",_),n.removeListener("update",v),n.deregister(r.getFullField(o))},t.register=t.register.bind(t),t.deregister=t.deregister.bind(t),t}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(_class,i.default.PureComponent),n(_class,[{key:"render",value:function render(){var t=this.props,r=(t.mask,t.field,t.formApi,t.formState,t.controller,t.validate,t.initialValue,t.validateOnBlur,t.validateOnMount,t.validateOnChange,_objectWithoutProperties(t,["mask","field","formApi","formState","controller","validate","initialValue","validateOnBlur","validateOnMount","validateOnChange"]));return i.default.createElement(e,o({register:this.register,deregister:this.deregister,fieldApi:this.fieldApi,fieldState:this.state},r))}}]),_class}()))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),i=r(0),u=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(i),a=r(5);var l=function(e){function Field(e){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Field);var t=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(Field.__proto__||Object.getPrototypeOf(Field)).call(this,e));return t.me=u.default.createRef(),t}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(Field,i.PureComponent),o(Field,[{key:"componentDidMount",value:function componentDidMount(){this.props.register()}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.props.deregister()}},{key:"componentDidUpdate",value:function componentDidUpdate(){var e=this;this.props.debug&&this.me&&(this.me.current.style.backgroundColor="red",setTimeout(function(){e.me.current.style.backgroundColor="white"},500))}},{key:"render",value:function render(){var e=this.props,t=e.fieldApi,r=e.fieldState,o=e.children,i=e.component,render=e.render,a=(e.field,e.register,e.deregister,e.forwardedRef),l=e.debug,f=function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(e,["fieldApi","fieldState","children","component","render","field","register","deregister","forwardedRef","debug"]),c=n({fieldApi:t,fieldState:r,forwardedRef:l?this.me:a},f);return i?u.default.createElement(i,c,o):render?render(c):"function"==typeof o?o(c):o}}]),Field}();t.default=(0,a.bindToField)(l)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(0)),i=r(1);t.default=function withController(e){return o.default.forwardRef(function(t,r){return o.default.createElement(i.FormContext.Consumer,null,function(i){var u=i.controller;return o.default.createElement(e,n({controller:u,ref:r},t))})})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(0)),i=r(1);t.default=function withFormApi(e){return o.default.forwardRef(function(t,r){return o.default.createElement(i.FormContext.Consumer,null,function(i){var u=i.formState;return o.default.createElement(e,n({formState:u,ref:r},t))})})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),i=r(0),u=_interopRequireDefault(i),a=r(1),l=_interopRequireDefault(r(2));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var f=function(e){function RadioGroup(){return function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,RadioGroup),function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(RadioGroup.__proto__||Object.getPrototypeOf(RadioGroup)).apply(this,arguments))}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(RadioGroup,i.Component),o(RadioGroup,[{key:"render",value:function render(){return u.default.createElement(a.GroupContext.Provider,{value:this.groupContext},this.props.children)}},{key:"groupContext",get:function get(){return{radioGroupApi:n({},this.props.fieldApi,{onChange:this.props.onChange,onBlur:this.props.onBlur}),radioGroupState:this.props.fieldState}}}]),RadioGroup}();t.default=(0,l.default)(f)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=_interopRequireDefault(r(0)),i=_interopRequireDefault(r(2));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}t.default=(0,i.default)(function Checkbox(e){var t=e.fieldApi,r=e.fieldState,i=_objectWithoutProperties(e,["fieldApi","fieldState"]),u=r.value,a=t.setValue,l=t.setTouched,f=i.onChange,c=i.onBlur,s=i.forwardedRef,p=_objectWithoutProperties(i,["onChange","onBlur","forwardedRef"]);return o.default.createElement("input",n({},p,{ref:s,checked:!!u,onChange:function onChange(e){a(e.target.checked),f&&f(e)},onBlur:function onBlur(e){l(),c&&c(e)},type:"checkbox"}))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(0));t.default=function Option(e){var t=e.value,r=e.forwardedRef,i=e.children,u=function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(e,["value","forwardedRef","children"]);return o.default.createElement("option",n({ref:r,value:t,key:t},u),i)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),i=_interopRequireDefault(r(0)),u=_interopRequireDefault(r(2));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}var a=function(e){function Select(e){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Select);var t=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(Select.__proto__||Object.getPrototypeOf(Select)).call(this,e));return t.handleChange=t.handleChange.bind(t),t}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(Select,i.default.Component),o(Select,[{key:"handleChange",value:function handleChange(e){var t=[].concat(function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}(this.refs.select)).filter(function(e){return e.selected}).map(function(e){return e.value});this.props.fieldApi.setValue(this.props.multiple?t:t[0]||""),this.props.onChange&&this.props.onChange(e)}},{key:"render",value:function render(){var e=this.props,t=e.fieldApi,r=e.fieldState,o=_objectWithoutProperties(e,["fieldApi","fieldState"]),u=r.value,a=(t.setValue,t.setTouched),l=(o.onChange,o.onBlur),f=(o.forwardedRef,o.children),c=o.multiple,s=_objectWithoutProperties(o,["onChange","onBlur","forwardedRef","children","multiple"]);return i.default.createElement("select",n({},s,{multiple:c,ref:"select",value:u||(c?[]:""),onChange:this.handleChange,onBlur:function onBlur(e){a(),l&&l(e)}}),f)}}]),Select}();t.default=(0,u.default)(a)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=_interopRequireDefault(r(0)),i=_interopRequireDefault(r(2));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}t.default=(0,i.default)(function TextArea(e){var t=e.fieldApi,r=e.fieldState,i=_objectWithoutProperties(e,["fieldApi","fieldState"]),u=r.value,a=t.setValue,l=t.setTouched,f=i.onChange,c=i.onBlur,s=i.forwardedRef,p=_objectWithoutProperties(i,["onChange","onBlur","forwardedRef"]);return o.default.createElement("textarea",n({},p,{ref:s,value:u||"",onChange:function onChange(e){a(e.target.value),f&&f(e)},onBlur:function onBlur(e){l(),c&&c(e)}}))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=_interopRequireDefault(r(0)),i=_interopRequireDefault(r(4));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}t.default=(0,i.default)(function Radio(e){var t=e.radioGroupApi,r=e.radioGroupState,i=_objectWithoutProperties(e,["radioGroupApi","radioGroupState"]),u=r.value,a=t.setValue,l=t.setTouched,f=t.onChange,c=t.onBlur,s=i.value,p=i.onChange,d=i.onBlur,h=i.forwardedRef,_=_objectWithoutProperties(i,["value","onChange","onBlur","forwardedRef"]);return o.default.createElement("input",n({},_,{ref:h,value:s,checked:u===s,onChange:function onChange(e){e.target.checked&&(a(s),p&&p(e),f&&f(e))},onBlur:function onBlur(e){l(),d&&d(e),c&&c(e)},type:"radio"}))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=_interopRequireDefault(r(0)),i=_interopRequireDefault(r(2));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}t.default=(0,i.default)(function Text(e){var t=e.fieldApi,r=e.fieldState,i=_objectWithoutProperties(e,["fieldApi","fieldState"]),u=r.value,a=t.setValue,l=t.setTouched,f=i.onChange,c=i.onBlur,s=i.forwardedRef,p=_objectWithoutProperties(i,["onChange","onBlur","forwardedRef"]);return o.default.createElement("input",n({},p,{ref:s,value:u||0===u?u:"",onChange:function onChange(e){a(e.target.value),f&&f(e)},onBlur:function onBlur(e){l(),c&&c(e)}}))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}();var o=function(){function FieldController(e,t,r){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FieldController),this.field=e,this.config=r,this.api=t}return n(FieldController,[{key:"validate",value:function validate(e){if(this.config.validate)return this.config.validate(this.api.getValue(),e)}}]),FieldController}();t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(0),u=_interopRequireDefault(i),a=r(1),l=_interopRequireDefault(r(3)),f=_interopRequireDefault(r(8)),c=_interopRequireDefault(r(7));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var s=function buildScopedContext(e,t,r,n){return{formApi:o({},t,{getValue:function getValue(r){return t.getValue(e+"."+r)},setValue:function setValue(r,n){return t.setValue(e+"."+r,n)},getTouched:function getTouched(r){return t.getTouched(e+"."+r)},setTouched:function setTouched(r,n){return t.setTouched(e+"."+r,n)},getError:function getError(r){return t.getError(e+"."+r)},setError:function setError(r,n){return t.setError(e+"."+r,n)},getFullField:function getFullField(t){return e+"."+t}}),formState:r,controller:n}},p=function(e){function Scope(e){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Scope);var t=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(Scope.__proto__||Object.getPrototypeOf(Scope)).call(this,e)),r=e.scope,n=e.formApi,o=e.formState,i=e.controller;return t.formContext=s(r,n,o,i),t}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(Scope,i.Component),n(Scope,[{key:"render",value:function render(){var e=this.props.children;return u.default.createElement(a.FormContext.Provider,{value:this.formContext},e)}}]),Scope}();t.default=(0,f.default)((0,c.default)((0,l.default)(p)))},function(e,t){e.exports=require("events")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function makePathArray(e){return e.replace(/\[(\d+)]/g,".__int__$1").replace(/\['([^.]+)']/g,".$1").split(".").map(function(e){return 0===e.indexOf("__int__")?parseInt(e.substring(7),10):e})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(19));function isArray(e){return Array.isArray(e)}function isObject(e){return!Array.isArray(e)&&"object"===(void 0===e?"undefined":o(e))&&null!==e}var u=function buildMap(e){if(isObject(e)){var t=new Map;return Object.keys(e).forEach(function(r){var n=buildMap(e[r]);null!=n&&t.set(r,n)}),t}if(isArray(e)){var r=new Map;return e.forEach(function(e,t){var n=buildMap(e);null!=n&&r.set(t,n)}),r}return e},a=function(){function ObjectMap(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ObjectMap),this.object=JSON.parse(JSON.stringify(e)),this.map=u(this.object),this.paths=new Map}return n(ObjectMap,[{key:"empty",value:function empty(){return 0===this.map.size}},{key:"rebuild",value:function rebuild(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.object=JSON.parse(JSON.stringify(e)),this.map=u(this.object)}},{key:"get",value:function get(e){var t=this.paths.get(e);t||(t=(0,i.default)(e),this.paths.set(e,t));var get=function get(e,r,n,o){if(null!=e)return null==n?e[r]:get(e[r],t[o+1],t[o+2],o+1)};return get(this.object,t[0],t[1],0)}},{key:"set",value:function set(e,t){var r=this.paths.get(e);r||(r=(0,i.default)(e),this.paths.set(e,r));var set=function set(e,n,o,i,u){if(null!=e)if(null!=i){null!=t&&("number"!=typeof i||isArray(e[o])||(e[o]=[],n.set(o,new Map)),"number"==typeof i||isObject(e[o])||(e[o]={},n.set(o,new Map)));var a=isObject(e[o])||isArray(e[o])?n.get(o):n;set(e[o],a,r[u+1],r[u+2],u+1),0===a.size&&(delete e[o],n.delete(o))}else null==t?(delete e[o],n.delete(o)):(e[o]=t,n.set(o,t))};set(this.object,this.map,r[0],r[1],0)}},{key:"delete",value:function _delete(e){this.set(e,null),this.paths.delete(e)}}]),ObjectMap}();t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(20));var i=r(18).EventEmitter,u=function(e){function FormController(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FormController);var r=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(FormController.__proto__||Object.getPrototypeOf(FormController)).call(this));return r.valid=function(){return r.errors.empty()},r.getFormState=function(){return JSON.parse(JSON.stringify(r.state))},r.setFormState=function(e){r.values.rebuild(e.values),r.touched.rebuild(e.touched),r.errors.rebuild(e.errors),r.emit("change",r.state),r.emit("values",r.state.values),r.emit("update",r.state)},r.setValues=function(e){r.values.rebuild(e),r.emit("change",r.state),r.emit("values",r.state.values),r.emit("update",r.state)},r.setValue=function(e,t){var n=r.fields.get(e);r.values.set(e,n.config.mask?n.config.mask(t):t),n.config.validateOnChange&&(r.errors.set(e,n.validate(r.state.values)),r.notify(n.config.notify)),r.emit("change",r.state),r.emit("values",r.state.values),r.emit("field",e)},r.setTouched=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];r.touched.set(e,t);var n=r.fields.get(e);n.config.validateOnBlur&&(r.errors.set(e,n.validate(r.state.values)),r.notify(n.config.notify)),r.emit("change",r.state),r.emit("field",e)},r.setError=function(e,t){r.errors.set(e,t),r.emit("change",r.state),r.emit("field",e);var n=r.fields.get(e);r.notify(n.config.notify)},r.getValue=function(e){return r.values.get(e)},r.getTouched=function(e){return r.touched.get(e)},r.getError=function(e){return r.errors.get(e)},r.getFullField=function(e){return e},r.register=function(e,t){r.fields.set(e,t),null!=t.config.initialValue&&r.values.set(e,t.config.initialValue),t.config.validateOnMount&&r.errors.set(e,t.validate(r.state.values)),r.emit("change",r.state),r.emit("field",e)},r.remove=function(e){r.fields.delete(e),r.values.delete(e),r.touched.delete(e),r.errors.delete(e),r.emit("change",r.state)},r.deregister=function(e){r.remove(e),r.emit("change",r.state),r.emit("field",e)},r.reset=function(){r.values.rebuild(r.config.initialValues),r.touched.rebuild(),r.errors.rebuild(),r.fields.forEach(function(e){e.config.initialValue&&r.values.set(e.field,e.config.initialValue)}),r.emit("change",r.state),r.emit("update",r.state)},r.notify=function(e){e&&(e.forEach(function(e){var t=r.fields.get(e);if(!t)throw new Error("Cant notify field "+e+" as it does not exist!");r.errors.set(e,t.validate(r.state.values)),r.emit("field",e)}),r.emit("change",r.state))},r.submitForm=function(e){e&&!r.config.dontPreventDefault&&e.preventDefault(e),r.fields.forEach(function(e){var t=e.field;r.touched.set(t,!0),r.errors.set(t,e.validate(r.state.values))}),r.emit("change",r.state),r.emit("update",r.state),r.valid()?(r.hooks.preSubmit&&(r.values.rebuild(r.hooks.preSubmit(JSON.parse(JSON.stringify(r.state.values)))),r.emit("change",r.state),r.emit("update",r.state)),r.hooks.onSubmit&&r.hooks.onSubmit(JSON.parse(JSON.stringify(r.state.values)))):r.hooks.onSubmitFailure&&r.hooks.onSubmitFailure(JSON.parse(JSON.stringify(r.state.errors)))},r.setMaxListeners(0),r.hooks=e,r.config=t,r.values=new o.default(t.initialValues),r.touched=new o.default,r.errors=new o.default,r.api={setValue:r.setValue,getValue:r.getValue,setTouched:r.setTouched,getTouched:r.getTouched,setError:r.setError,getError:r.getError,getFullField:r.getFullField,submitForm:r.submitForm,getState:r.getFormState,setState:r.setFormState,setValues:r.setValues,reset:r.reset,notify:r.notify},r.fields=new Map,e.getApi&&e.getApi(r.api),r}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(FormController,i),n(FormController,[{key:"state",get:function get(){return{values:this.values.object,touched:this.touched.object,errors:this.errors.object,pristine:this.pristine,dirty:this.dirty,invalid:this.invalid}}},{key:"pristine",get:function get(){return this.touched.empty()&&this.values.empty()}},{key:"dirty",get:function get(){return!this.pristine}},{key:"invalid",get:function get(){return!this.errors.empty()}}]),FormController}();t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function(){function defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&defineProperties(e.prototype,t),r&&defineProperties(e,r),e}}(),i=r(0),u=_interopRequireDefault(i),a=r(1),l=_interopRequireDefault(r(21));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var f=function(e){function Form(e){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Form);var t=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(Form.__proto__||Object.getPrototypeOf(Form)).call(this,e)),r=e.onSubmit,n=e.preSubmit,o=e.getApi,i=e.dontPreventDefault,u=e.onSubmitFailure,a=e.initialValues;return t.controller=new l.default({onSubmit:r,getApi:o,preSubmit:n,onSubmitFailure:u},{dontPreventDefault:i,initialValues:a}),t.controller.on("change",function(){return t.forceUpdate()}),t.controller.on("change",function(t){e.onChange&&e.onChange(t)}),t.controller.on("values",function(t){e.onValueChange&&e.onValueChange(t)}),t}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(Form,i.Component),o(Form,[{key:"render",value:function render(){var e=this.props,t=(e.children,e.component,e.render,e.onSubmit,e.preSubmit,e.getApi,e.dontPreventDefault,e.onSubmitFailure,e.initialValues,e.onValueChange,e.onChange,function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(e,["children","component","render","onSubmit","preSubmit","getApi","dontPreventDefault","onSubmitFailure","initialValues","onValueChange","onChange"]));return u.default.createElement(a.FormContext.Provider,{value:this.formContext},u.default.createElement("form",n({},t,{onReset:this.formContext.formApi.reset,onSubmit:this.formContext.formApi.submitForm}),this.content))}},{key:"formContext",get:function get(){return{formApi:this.controller.api,formState:this.controller.state,controller:this.controller}}},{key:"content",get:function get(){var e=this.props,t=e.children,r=e.component,n=e.render,o=this.formContext;return r?u.default.createElement(r,o,t):n?n(o):"function"==typeof t?t(o):t}}]),Form}();t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RadioGroup=t.Checkbox=t.Option=t.Select=t.TextArea=t.Radio=t.Text=t.asField=t.withRadioGroup=t.withFieldState=t.withFieldApi=t.withFormState=t.withFormApi=t.Field=t.Scope=t.Form=void 0;var n=_interopRequireDefault(r(22)),o=_interopRequireDefault(r(17)),i=_interopRequireDefault(r(6)),u=_interopRequireDefault(r(3)),a=_interopRequireDefault(r(8)),l=r(5),f=_interopRequireDefault(r(4)),c=_interopRequireDefault(r(2)),s=_interopRequireDefault(r(15)),p=_interopRequireDefault(r(14)),d=_interopRequireDefault(r(13)),h=_interopRequireDefault(r(12)),_=_interopRequireDefault(r(11)),v=_interopRequireDefault(r(10)),b=_interopRequireDefault(r(9));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}t.Form=n.default,t.Scope=o.default,t.Field=i.default,t.withFormApi=u.default,t.withFormState=a.default,t.withFieldApi=l.withFieldApi,t.withFieldState=l.withFieldState,t.withRadioGroup=f.default,t.asField=c.default,t.Text=s.default,t.Radio=p.default,t.TextArea=d.default,t.Select=h.default,t.Option=_.default,t.Checkbox=v.default,t.RadioGroup=b.default}])}); |
{ | ||
"name": "informed", | ||
"version": "1.3.9", | ||
"version": "1.3.10", | ||
"description": "A lightweight framework and utility for building powerful forms in React applications", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
43627