New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

informed

Package Overview
Dependencies
Maintainers
1
Versions
402
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

informed - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

10

CHANGELOG.md

@@ -0,1 +1,11 @@

## 1.1.1 ( June 18, 2018 )
### Fixed
- Bug where i did not do null check on event within on submit
## 1.0.1 ( June 15, 2018 )
### Added
- Notify prop to inputs that allows you to notify other fields when your error state changes ( see docs )
## 1.0.0 (June 12, 2018)

@@ -2,0 +12,0 @@ ### Added

2

dist/index.js

@@ -1,1 +0,1 @@

!function(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()}(window,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=22)}([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,o=r(0),i=(n=o)&&n.__esModule?n:{default:n};var u=i.default.createContext(),a=i.default.createContext(),l=i.default.createContext(),f=i.default.createContext();t.FormContext=u,t.FieldContext=a,t.GroupContext=l,t.SelectContext=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=u(r(0)),i=u(r(6));function u(e){return e&&e.__esModule?e:{default:e}}t.default=function(e){return o.default.forwardRef(function(t,r){return o.default.createElement(i.default,n({component:e,forwardedRef:r},t))})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,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=(n=i)&&n.__esModule?n:{default:n},a=r(1);t.default=function(e){return u.default.forwardRef(function(t,r){return u.default.createElement(a.FormContext.Consumer,null,function(n){var i=n.formApi;return u.default.createElement(e,o({formApi:i,ref:r},t))})})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,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=(n=i)&&n.__esModule?n:{default:n},a=r(1);t.default=function(e){return u.default.forwardRef(function(t,r){return u.default.createElement(a.GroupContext.Consumer,null,function(n){var i=n.radioGroupApi,a=n.radioGroupState;return u.default.createElement(e,o({radioGroupApi:i,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 e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),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=f(r(0)),u=f(r(3)),a=f(r(7)),l=f(r(16));function f(e){return e&&e.__esModule?e:{default:e}}function c(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 s=function(e,t){return{getValue:function(){return e.getValue(t)},setValue:function(r){return e.setValue(t,r)},getTouched:function(){return e.getTouched(t)},setTouched:function(r){return e.setTouched(t,r)},getError:function(){return e.getError(t)},setError:function(r){return e.setError(t,r)}}},d=function(e,t){return{value:e.getValue(t),touched:e.getTouched(t),error:e.getError(t)}};t.withFieldApi=function(e){return function(t){return(0,u.default)(function(r){var n=r.formApi,u=c(r,["formApi"]);return i.default.createElement(t,o({fieldApi:s(n,e)},u))})}},t.withFieldState=function(e){return function(t){return(0,u.default)(function(r){var n=r.formApi,u=c(r,["formApi"]);return i.default.createElement(t,o({fieldState:d(n,e)},u))})}},t.bindToField=function(e){return(0,a.default)((0,u.default)(function(t){function r(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r);var t=function(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,(r.__proto__||Object.getPrototypeOf(r)).call(this,e)),n=e.formApi,o=e.controller,i=e.field,u=e.validate,a=e.validateOnBlur,f=e.validateOnChange,c=e.initialValue,p=e.notify;t.state=d(n,i),t.fieldApi=s(n,i);var h=function(e){e===n.getFullField(i)&&t.setState(d(n,i))},v=function(){t.setState(d(n,i))};return t.register=function(){o.on("field",h),o.on("update",v),o.register(n.getFullField(i),new l.default(n.getFullField(i),t.fieldApi,{validateOnBlur:a,validateOnChange:f,validate:u,initialValue:c,notify:p}))},t.deregister=function(){o.removeListener("field",h),o.removeListener("update",v),o.deregister(n.getFullField(i))},t.register=t.register.bind(t),t.deregister=t.deregister.bind(t),t}return function(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)}(r,i.default.PureComponent),n(r,[{key:"render",value:function(){var t=this.props,r=(t.formApi,t.formState,t.controller,t.validate,t.validateOnBlur,t.validateOnChange,c(t,["formApi","formState","controller","validate","validateOnBlur","validateOnChange"]));return i.default.createElement(e,o({register:this.register,deregister:this.deregister,fieldApi:this.fieldApi,fieldState:this.state},r))}}]),r}()))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,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=function(){function e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r(0),a=(n=u)&&n.__esModule?n:{default:n},l=r(5);var f=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.me=a.default.createRef(),r}return function(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)}(t,u.PureComponent),i(t,[{key:"componentDidMount",value:function(){this.props.register()}},{key:"componentWillUnmount",value:function(){this.props.deregister()}},{key:"componentDidUpdate",value:function(){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(){var e=this.props,t=e.fieldApi,r=e.fieldState,n=e.children,i=e.component,u=e.render,l=(e.field,e.register,e.deregister,e.forwardedRef),f=e.debug,c=function(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"]),s=o({fieldApi:t,fieldState:r,forwardedRef:f?this.me:l},c);return i?a.default.createElement(i,s,n):u?u(s):"function"==typeof n?n(s):n}}]),t}();t.default=(0,l.bindToField)(f)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,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=(n=i)&&n.__esModule?n:{default:n},a=r(1);t.default=function(e){return u.default.forwardRef(function(t,r){return u.default.createElement(a.FormContext.Consumer,null,function(n){var i=n.controller;return u.default.createElement(e,o({controller:i,ref:r},t))})})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,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=(n=i)&&n.__esModule?n:{default:n},a=r(1);t.default=function(e){return u.default.forwardRef(function(t,r){return u.default.createElement(a.FormContext.Consumer,null,function(n){var i=n.formState;return u.default.createElement(e,o({formState:i,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 e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),u=f(i),a=r(1),l=f(r(2));function f(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(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,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(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)}(t,i.Component),o(t,[{key:"render",value:function(){return u.default.createElement(a.GroupContext.Provider,{value:this.groupContext},this.props.children)}},{key:"groupContext",get:function(){return{radioGroupApi:n({},this.props.fieldApi,{onChange:this.props.onChange,onBlur:this.props.onBlur}),radioGroupState:this.props.fieldState}}}]),t}();t.default=(0,l.default)(c)},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=u(r(0)),i=u(r(2));function u(e){return e&&e.__esModule?e:{default:e}}function a(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(e){var t=e.fieldApi,r=e.fieldState,i=a(e,["fieldApi","fieldState"]),u=r.value,l=t.setValue,f=t.setTouched,c=i.onChange,s=i.onBlur,d=i.forwardedRef,p=a(i,["onChange","onBlur","forwardedRef"]);return o.default.createElement("input",n({},p,{ref:d,checked:!!u,onChange:function(e){l(e.target.checked),c&&c(e)},onBlur:function(e){f(),s&&s(e)},type:"checkbox"}))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,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=(n=i)&&n.__esModule?n:{default:n};t.default=function(e){var t=e.value,r=e.forwardedRef,n=e.children,i=function(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 u.default.createElement("option",o({ref:r,value:t,key:t},i),n)}},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 e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=a(r(0)),u=a(r(2));function a(e){return e&&e.__esModule?e:{default:e}}function l(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(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.handleChange=r.handleChange.bind(r),r}return function(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)}(t,i.default.Component),o(t,[{key:"handleChange",value:function(e){var t=[].concat(function(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(){var e=this.props,t=e.fieldApi,r=e.fieldState,o=l(e,["fieldApi","fieldState"]),u=r.value,a=(t.setValue,t.setTouched),f=(o.onChange,o.onBlur),c=(o.forwardedRef,o.children),s=o.multiple,d=l(o,["onChange","onBlur","forwardedRef","children","multiple"]);return i.default.createElement("select",n({},d,{multiple:s,ref:"select",value:u||(s?[]:""),onChange:this.handleChange,onBlur:function(e){a(),f&&f(e)}}),c)}}]),t}();t.default=(0,u.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=u(r(0)),i=u(r(2));function u(e){return e&&e.__esModule?e:{default:e}}function a(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(e){var t=e.fieldApi,r=e.fieldState,i=a(e,["fieldApi","fieldState"]),u=r.value,l=t.setValue,f=t.setTouched,c=i.onChange,s=i.onBlur,d=i.forwardedRef,p=a(i,["onChange","onBlur","forwardedRef"]);return o.default.createElement("textarea",n({},p,{ref:d,value:u||"",onChange:function(e){l(e.target.value),c&&c(e)},onBlur:function(e){f(),s&&s(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=u(r(0)),i=u(r(4));function u(e){return e&&e.__esModule?e:{default:e}}function a(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(e){var t=e.radioGroupApi,r=e.radioGroupState,i=a(e,["radioGroupApi","radioGroupState"]),u=r.value,l=t.setValue,f=t.setTouched,c=t.onChange,s=t.onBlur,d=i.value,p=i.onChange,h=i.onBlur,v=i.forwardedRef,y=a(i,["value","onChange","onBlur","forwardedRef"]);return o.default.createElement("input",n({},y,{ref:v,value:d,checked:u===d,onChange:function(e){e.target.checked&&(l(d),p&&p(e),c&&c(e))},onBlur:function(e){f(),h&&h(e),s&&s(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=u(r(0)),i=u(r(2));function u(e){return e&&e.__esModule?e:{default:e}}function a(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(e){var t=e.fieldApi,r=e.fieldState,i=a(e,["fieldApi","fieldState"]),u=r.value,l=t.setValue,f=t.setTouched,c=i.onChange,s=i.onBlur,d=i.forwardedRef,p=a(i,["onChange","onBlur","forwardedRef"]);return o.default.createElement("input",n({},p,{ref:d,value:u||0===u?u:"",onChange:function(e){l(e.target.value),c&&c(e)},onBlur:function(e){f(),s&&s(e)}}))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=function(){function e(t,r,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.field=t,this.config=n,this.api=r}return n(e,[{key:"validate",value:function(e){if(this.config.validate)return this.config.validate(this.api.getValue(),e)}}]),e}();t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),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=s(i),a=r(1),l=s(r(3)),f=s(r(8)),c=s(r(7));function s(e){return e&&e.__esModule?e:{default:e}}var d=function(e,t,r,n){return{formApi:o({},t,{getValue:function(r){return t.getValue(e+"."+r)},setValue:function(r,n){return t.setValue(e+"."+r,n)},getTouched:function(r){return t.getTouched(e+"."+r)},setTouched:function(r,n){return t.setTouched(e+"."+r,n)},getError:function(r){return t.getError(e+"."+r)},setError:function(r,n){return t.setError(e+"."+r,n)},getFullField:function(t){return e+"."+t}}),formState:r,controller:n}},p=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),n=e.scope,o=e.formApi,i=e.formState,u=e.controller;return r.formContext=d(n,o,i,u),r}return function(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)}(t,i.Component),n(t,[{key:"render",value:function(){var e=this.props.children;return u.default.createElement(a.FormContext.Provider,{value:this.formContext},e)}}]),t}();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});var n=function(){function e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),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};var i=function(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 u(e){return Array.isArray(e)}function a(e){return!Array.isArray(e)&&"object"===(void 0===e?"undefined":o(e))&&null!==e}var l=function e(t){if(a(t)){var r=new Map;return Object.keys(t).forEach(function(n){var o=e(t[n]);null!=o&&r.set(n,o)}),r}if(u(t)){var n=new Map;return t.forEach(function(t,r){var o=e(t);null!=o&&n.set(r,o)}),n}return t},f=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.object=JSON.parse(JSON.stringify(t)),this.map=l(this.object)}return n(e,[{key:"empty",value:function(){return 0===this.map.size}},{key:"rebuild",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.object=JSON.parse(JSON.stringify(e)),this.map=l(this.object)}},{key:"get",value:function(e){var t=i(e),r=function e(r,n,o,i){if(null!=r)return null==o?r[n]:e(r[n],t[i+1],t[i+2],i+1)};return r(this.object,t[0],t[1],0)}},{key:"set",value:function(e,t){var r=i(e),n=function e(n,o,i,l,f){if(null!=n)if(null!=l){null!=t&&("number"!=typeof l||u(n[i])||(n[i]=[],o.set(i,new Map)),"number"==typeof l||a(n[i])||(n[i]={},o.set(i,new Map)));var c=a(n[i])||u(n[i])?o.get(i):o;e(n[i],c,r[f+1],r[f+2],f+1),0===c.size&&(delete n[i],o.delete(i))}else null==t?(delete n[i],o.delete(i)):(n[i]=t,o.set(i,t))};n(this.object,this.map,r[0],r[1],0)}},{key:"delete",value:function(e){this.set(e,null)}}]),e}();t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(19),u=(n=i)&&n.__esModule?n:{default:n};var a=r(18).EventEmitter,l=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(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,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.valid=function(){return n.errors.empty()},n.getFormState=function(){return n.state},n.setFormState=function(e){n.values.rebuild(e.values),n.touched.rebuild(e.touched),n.errors.rebuild(e.errors),n.emit("change",n.state),n.emit("values",n.state.values),n.emit("update",n.state)},n.setValues=function(e){n.values.rebuild(e),n.emit("change",n.state),n.emit("values",n.state.values),n.emit("update",n.state)},n.setValue=function(e,t){n.values.set(e,t);var r=n.fields.get(e);r.config.validateOnChange&&(n.errors.set(e,r.validate(n.state.values)),n.notify(r.config.notify)),n.emit("change",n.state),n.emit("values",n.state.values),n.emit("field",e)},n.setTouched=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];n.touched.set(e,t);var r=n.fields.get(e);r.config.validateOnBlur&&(n.errors.set(e,r.validate(n.state.values)),n.notify(r.config.notify)),n.emit("change",n.state),n.emit("field",e)},n.setError=function(e,t){n.errors.set(e,t),n.emit("change",n.state),n.emit("field",e);var r=n.fields.get(e);n.notify(r.config.notify)},n.getValue=function(e){return n.values.get(e)},n.getTouched=function(e){return n.touched.get(e)},n.getError=function(e){return n.errors.get(e)},n.getFullField=function(e){return e},n.register=function(e,t){n.fields.set(e,t),t.config.initialValue&&n.values.set(e,t.config.initialValue)},n.remove=function(e){n.fields.delete(e),n.values.delete(e),n.touched.delete(e),n.errors.delete(e),n.emit("change",n.state)},n.deregister=function(e){n.remove(e)},n.reset=function(){n.values.rebuild(n.config.initialValues),n.touched.rebuild(),n.errors.rebuild(),n.fields.forEach(function(e){e.config.initialValue&&n.values.set(e.field,e.config.initialValue)}),n.emit("change",n.state),n.emit("update",n.state)},n.notify=function(e){e&&(e.forEach(function(e){var t=n.fields.get(e);if(!t)throw new Error("Cant notify field "+e+" as it does not exist!");n.errors.set(e,t.validate(n.state.values)),n.emit("field",e)}),n.emit("change",n.state))},n.submitForm=function(e){e&&!n.config.dontPreventDefault&&e.preventDefault(e),n.fields.forEach(function(e){var t=e.field;n.touched.set(t,!0),n.errors.set(t,e.validate(n.state.values))}),n.emit("change",n.state),n.emit("update",n.state),n.valid()?(n.hooks.preSubmit&&(n.values.rebuild(n.hooks.preSubmit(n.state.values)),n.emit("change",n.state),n.emit("update",n.state)),n.hooks.onSubmit&&n.hooks.onSubmit(n.state.values)):n.hooks.onSubmitFailure&&n.hooks.onSubmitFailure(n.state.errors)},n.hooks=e,n.config=r,n.values=new u.default(r.initialValues),n.touched=new u.default,n.errors=new u.default,n.api={setValue:n.setValue,getValue:n.getValue,setTouched:n.setTouched,getTouched:n.getTouched,setError:n.setError,getError:n.getError,getFullField:n.getFullField,submitForm:n.submitForm,getState:n.getFormState,setState:n.setFormState,setValues:n.setValues,reset:n.reset,notify:n.notify},n.fields=new Map,e.getApi&&e.getApi(n.api),n}return function(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)}(t,a),o(t,[{key:"state",get:function(){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(){return this.touched.empty()&&this.values.empty()}},{key:"dirty",get:function(){return!this.pristine}},{key:"invalid",get:function(){return!this.errors.empty()}}]),t}();t.default=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(){function e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),u=f(i),a=r(1),l=f(r(20));function f(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),n=e.onSubmit,o=e.preSubmit,i=e.getApi,u=e.dontPreventDefault,a=e.onSubmitFailure,f=e.initialValues;return r.controller=new l.default({onSubmit:n,getApi:i,preSubmit:o,onSubmitFailure:a},{dontPreventDefault:u,initialValues:f}),r.controller.on("change",function(){return r.forceUpdate()}),r.controller.on("change",function(t){e.onChange&&e.onChange(t)}),r.controller.on("values",function(t){e.onValueChange&&e.onValueChange(t)}),r}return function(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)}(t,i.Component),o(t,[{key:"render",value:function(){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,function(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"]));return u.default.createElement(a.FormContext.Provider,{value:this.formContext},u.default.createElement("form",n({},t,{onSubmit:this.formContext.formApi.submitForm}),this.content))}},{key:"formContext",get:function(){return{formApi:this.controller.api,formState:this.controller.state,controller:this.controller}}},{key:"content",get:function(){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}}]),t}();t.default=c},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.withRadioGroup=t.withFieldState=t.withFieldApi=t.withFormState=t.withFormApi=t.Field=t.Scope=t.Form=void 0;var n=b(r(21)),o=b(r(17)),i=b(r(6)),u=b(r(3)),a=b(r(8)),l=r(5),f=b(r(4)),c=b(r(15)),s=b(r(14)),d=b(r(13)),p=b(r(12)),h=b(r(11)),v=b(r(10)),y=b(r(9));function b(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.Text=c.default,t.Radio=s.default,t.TextArea=d.default,t.Select=p.default,t.Option=h.default,t.Checkbox=v.default,t.RadioGroup=y.default}])});
!function(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()}(window,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=22)}([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,o=r(0),i=(n=o)&&n.__esModule?n:{default:n};var u=i.default.createContext(),a=i.default.createContext(),l=i.default.createContext(),f=i.default.createContext();t.FormContext=u,t.FieldContext=a,t.GroupContext=l,t.SelectContext=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=u(r(0)),i=u(r(6));function u(e){return e&&e.__esModule?e:{default:e}}t.default=function(e){return o.default.forwardRef(function(t,r){return o.default.createElement(i.default,n({component:e,forwardedRef:r},t))})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,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=(n=i)&&n.__esModule?n:{default:n},a=r(1);t.default=function(e){return u.default.forwardRef(function(t,r){return u.default.createElement(a.FormContext.Consumer,null,function(n){var i=n.formApi;return u.default.createElement(e,o({formApi:i,ref:r},t))})})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,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=(n=i)&&n.__esModule?n:{default:n},a=r(1);t.default=function(e){return u.default.forwardRef(function(t,r){return u.default.createElement(a.GroupContext.Consumer,null,function(n){var i=n.radioGroupApi,a=n.radioGroupState;return u.default.createElement(e,o({radioGroupApi:i,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 e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),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=f(r(0)),u=f(r(3)),a=f(r(7)),l=f(r(16));function f(e){return e&&e.__esModule?e:{default:e}}function c(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 s=function(e,t){return{getValue:function(){return e.getValue(t)},setValue:function(r){return e.setValue(t,r)},getTouched:function(){return e.getTouched(t)},setTouched:function(r){return e.setTouched(t,r)},getError:function(){return e.getError(t)},setError:function(r){return e.setError(t,r)}}},d=function(e,t){return{value:e.getValue(t),touched:e.getTouched(t),error:e.getError(t)}};t.withFieldApi=function(e){return function(t){return(0,u.default)(function(r){var n=r.formApi,u=c(r,["formApi"]);return i.default.createElement(t,o({fieldApi:s(n,e)},u))})}},t.withFieldState=function(e){return function(t){return(0,u.default)(function(r){var n=r.formApi,u=c(r,["formApi"]);return i.default.createElement(t,o({fieldState:d(n,e)},u))})}},t.bindToField=function(e){return(0,a.default)((0,u.default)(function(t){function r(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r);var t=function(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,(r.__proto__||Object.getPrototypeOf(r)).call(this,e)),n=e.formApi,o=e.controller,i=e.field,u=e.validate,a=e.validateOnBlur,f=e.validateOnChange,c=e.initialValue,p=e.notify;t.state=d(n,i),t.fieldApi=s(n,i);var h=function(e){e===n.getFullField(i)&&t.setState(d(n,i))},v=function(){t.setState(d(n,i))};return t.register=function(){o.on("field",h),o.on("update",v),o.register(n.getFullField(i),new l.default(n.getFullField(i),t.fieldApi,{validateOnBlur:a,validateOnChange:f,validate:u,initialValue:c,notify:p}))},t.deregister=function(){o.removeListener("field",h),o.removeListener("update",v),o.deregister(n.getFullField(i))},t.register=t.register.bind(t),t.deregister=t.deregister.bind(t),t}return function(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)}(r,i.default.PureComponent),n(r,[{key:"render",value:function(){var t=this.props,r=(t.formApi,t.formState,t.controller,t.validate,t.validateOnBlur,t.validateOnChange,c(t,["formApi","formState","controller","validate","validateOnBlur","validateOnChange"]));return i.default.createElement(e,o({register:this.register,deregister:this.deregister,fieldApi:this.fieldApi,fieldState:this.state},r))}}]),r}()))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,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=function(){function e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r(0),a=(n=u)&&n.__esModule?n:{default:n},l=r(5);var f=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.me=a.default.createRef(),r}return function(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)}(t,u.PureComponent),i(t,[{key:"componentDidMount",value:function(){this.props.register()}},{key:"componentWillUnmount",value:function(){this.props.deregister()}},{key:"componentDidUpdate",value:function(){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(){var e=this.props,t=e.fieldApi,r=e.fieldState,n=e.children,i=e.component,u=e.render,l=(e.field,e.register,e.deregister,e.forwardedRef),f=e.debug,c=function(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"]),s=o({fieldApi:t,fieldState:r,forwardedRef:f?this.me:l},c);return i?a.default.createElement(i,s,n):u?u(s):"function"==typeof n?n(s):n}}]),t}();t.default=(0,l.bindToField)(f)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,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=(n=i)&&n.__esModule?n:{default:n},a=r(1);t.default=function(e){return u.default.forwardRef(function(t,r){return u.default.createElement(a.FormContext.Consumer,null,function(n){var i=n.controller;return u.default.createElement(e,o({controller:i,ref:r},t))})})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,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=(n=i)&&n.__esModule?n:{default:n},a=r(1);t.default=function(e){return u.default.forwardRef(function(t,r){return u.default.createElement(a.FormContext.Consumer,null,function(n){var i=n.formState;return u.default.createElement(e,o({formState:i,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 e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),u=f(i),a=r(1),l=f(r(2));function f(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(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,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(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)}(t,i.Component),o(t,[{key:"render",value:function(){return u.default.createElement(a.GroupContext.Provider,{value:this.groupContext},this.props.children)}},{key:"groupContext",get:function(){return{radioGroupApi:n({},this.props.fieldApi,{onChange:this.props.onChange,onBlur:this.props.onBlur}),radioGroupState:this.props.fieldState}}}]),t}();t.default=(0,l.default)(c)},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=u(r(0)),i=u(r(2));function u(e){return e&&e.__esModule?e:{default:e}}function a(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(e){var t=e.fieldApi,r=e.fieldState,i=a(e,["fieldApi","fieldState"]),u=r.value,l=t.setValue,f=t.setTouched,c=i.onChange,s=i.onBlur,d=i.forwardedRef,p=a(i,["onChange","onBlur","forwardedRef"]);return o.default.createElement("input",n({},p,{ref:d,checked:!!u,onChange:function(e){l(e.target.checked),c&&c(e)},onBlur:function(e){f(),s&&s(e)},type:"checkbox"}))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,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=(n=i)&&n.__esModule?n:{default:n};t.default=function(e){var t=e.value,r=e.forwardedRef,n=e.children,i=function(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 u.default.createElement("option",o({ref:r,value:t,key:t},i),n)}},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 e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=a(r(0)),u=a(r(2));function a(e){return e&&e.__esModule?e:{default:e}}function l(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(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.handleChange=r.handleChange.bind(r),r}return function(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)}(t,i.default.Component),o(t,[{key:"handleChange",value:function(e){var t=[].concat(function(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(){var e=this.props,t=e.fieldApi,r=e.fieldState,o=l(e,["fieldApi","fieldState"]),u=r.value,a=(t.setValue,t.setTouched),f=(o.onChange,o.onBlur),c=(o.forwardedRef,o.children),s=o.multiple,d=l(o,["onChange","onBlur","forwardedRef","children","multiple"]);return i.default.createElement("select",n({},d,{multiple:s,ref:"select",value:u||(s?[]:""),onChange:this.handleChange,onBlur:function(e){a(),f&&f(e)}}),c)}}]),t}();t.default=(0,u.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=u(r(0)),i=u(r(2));function u(e){return e&&e.__esModule?e:{default:e}}function a(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(e){var t=e.fieldApi,r=e.fieldState,i=a(e,["fieldApi","fieldState"]),u=r.value,l=t.setValue,f=t.setTouched,c=i.onChange,s=i.onBlur,d=i.forwardedRef,p=a(i,["onChange","onBlur","forwardedRef"]);return o.default.createElement("textarea",n({},p,{ref:d,value:u||"",onChange:function(e){l(e.target.value),c&&c(e)},onBlur:function(e){f(),s&&s(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=u(r(0)),i=u(r(4));function u(e){return e&&e.__esModule?e:{default:e}}function a(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(e){var t=e.radioGroupApi,r=e.radioGroupState,i=a(e,["radioGroupApi","radioGroupState"]),u=r.value,l=t.setValue,f=t.setTouched,c=t.onChange,s=t.onBlur,d=i.value,p=i.onChange,h=i.onBlur,v=i.forwardedRef,y=a(i,["value","onChange","onBlur","forwardedRef"]);return o.default.createElement("input",n({},y,{ref:v,value:d,checked:u===d,onChange:function(e){e.target.checked&&(l(d),p&&p(e),c&&c(e))},onBlur:function(e){f(),h&&h(e),s&&s(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=u(r(0)),i=u(r(2));function u(e){return e&&e.__esModule?e:{default:e}}function a(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(e){var t=e.fieldApi,r=e.fieldState,i=a(e,["fieldApi","fieldState"]),u=r.value,l=t.setValue,f=t.setTouched,c=i.onChange,s=i.onBlur,d=i.forwardedRef,p=a(i,["onChange","onBlur","forwardedRef"]);return o.default.createElement("input",n({},p,{ref:d,value:u||0===u?u:"",onChange:function(e){l(e.target.value),c&&c(e)},onBlur:function(e){f(),s&&s(e)}}))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=function(){function e(t,r,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.field=t,this.config=n,this.api=r}return n(e,[{key:"validate",value:function(e){if(this.config.validate)return this.config.validate(this.api.getValue(),e)}}]),e}();t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),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=s(i),a=r(1),l=s(r(3)),f=s(r(8)),c=s(r(7));function s(e){return e&&e.__esModule?e:{default:e}}var d=function(e,t,r,n){return{formApi:o({},t,{getValue:function(r){return t.getValue(e+"."+r)},setValue:function(r,n){return t.setValue(e+"."+r,n)},getTouched:function(r){return t.getTouched(e+"."+r)},setTouched:function(r,n){return t.setTouched(e+"."+r,n)},getError:function(r){return t.getError(e+"."+r)},setError:function(r,n){return t.setError(e+"."+r,n)},getFullField:function(t){return e+"."+t}}),formState:r,controller:n}},p=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),n=e.scope,o=e.formApi,i=e.formState,u=e.controller;return r.formContext=d(n,o,i,u),r}return function(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)}(t,i.Component),n(t,[{key:"render",value:function(){var e=this.props.children;return u.default.createElement(a.FormContext.Provider,{value:this.formContext},e)}}]),t}();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});var n=function(){function e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),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};var i=function(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 u(e){return Array.isArray(e)}function a(e){return!Array.isArray(e)&&"object"===(void 0===e?"undefined":o(e))&&null!==e}var l=function e(t){if(a(t)){var r=new Map;return Object.keys(t).forEach(function(n){var o=e(t[n]);null!=o&&r.set(n,o)}),r}if(u(t)){var n=new Map;return t.forEach(function(t,r){var o=e(t);null!=o&&n.set(r,o)}),n}return t},f=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.object=JSON.parse(JSON.stringify(t)),this.map=l(this.object)}return n(e,[{key:"empty",value:function(){return 0===this.map.size}},{key:"rebuild",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.object=JSON.parse(JSON.stringify(e)),this.map=l(this.object)}},{key:"get",value:function(e){var t=i(e),r=function e(r,n,o,i){if(null!=r)return null==o?r[n]:e(r[n],t[i+1],t[i+2],i+1)};return r(this.object,t[0],t[1],0)}},{key:"set",value:function(e,t){var r=i(e),n=function e(n,o,i,l,f){if(null!=n)if(null!=l){null!=t&&("number"!=typeof l||u(n[i])||(n[i]=[],o.set(i,new Map)),"number"==typeof l||a(n[i])||(n[i]={},o.set(i,new Map)));var c=a(n[i])||u(n[i])?o.get(i):o;e(n[i],c,r[f+1],r[f+2],f+1),0===c.size&&(delete n[i],o.delete(i))}else null==t?(delete n[i],o.delete(i)):(n[i]=t,o.set(i,t))};n(this.object,this.map,r[0],r[1],0)}},{key:"delete",value:function(e){this.set(e,null)}}]),e}();t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(19),u=(n=i)&&n.__esModule?n:{default:n};var a=r(18).EventEmitter,l=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(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,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.valid=function(){return n.errors.empty()},n.getFormState=function(){return n.state},n.setFormState=function(e){n.values.rebuild(e.values),n.touched.rebuild(e.touched),n.errors.rebuild(e.errors),n.emit("change",n.state),n.emit("values",n.state.values),n.emit("update",n.state)},n.setValues=function(e){n.values.rebuild(e),n.emit("change",n.state),n.emit("values",n.state.values),n.emit("update",n.state)},n.setValue=function(e,t){n.values.set(e,t);var r=n.fields.get(e);r.config.validateOnChange&&(n.errors.set(e,r.validate(n.state.values)),n.notify(r.config.notify)),n.emit("change",n.state),n.emit("values",n.state.values),n.emit("field",e)},n.setTouched=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];n.touched.set(e,t);var r=n.fields.get(e);r.config.validateOnBlur&&(n.errors.set(e,r.validate(n.state.values)),n.notify(r.config.notify)),n.emit("change",n.state),n.emit("field",e)},n.setError=function(e,t){n.errors.set(e,t),n.emit("change",n.state),n.emit("field",e);var r=n.fields.get(e);n.notify(r.config.notify)},n.getValue=function(e){return n.values.get(e)},n.getTouched=function(e){return n.touched.get(e)},n.getError=function(e){return n.errors.get(e)},n.getFullField=function(e){return e},n.register=function(e,t){n.fields.set(e,t),t.config.initialValue&&n.values.set(e,t.config.initialValue)},n.remove=function(e){n.fields.delete(e),n.values.delete(e),n.touched.delete(e),n.errors.delete(e),n.emit("change",n.state)},n.deregister=function(e){n.remove(e)},n.reset=function(){n.values.rebuild(n.config.initialValues),n.touched.rebuild(),n.errors.rebuild(),n.fields.forEach(function(e){e.config.initialValue&&n.values.set(e.field,e.config.initialValue)}),n.emit("change",n.state),n.emit("update",n.state)},n.notify=function(e){e&&(e.forEach(function(e){var t=n.fields.get(e);if(!t)throw new Error("Cant notify field "+e+" as it does not exist!");n.errors.set(e,t.validate(n.state.values)),n.emit("field",e)}),n.emit("change",n.state))},n.submitForm=function(e){e&&!n.config.dontPreventDefault&&e.preventDefault(e),n.fields.forEach(function(e){var t=e.field;n.touched.set(t,!0),n.errors.set(t,e.validate(n.state.values))}),n.emit("change",n.state),n.emit("update",n.state),n.valid()?(n.hooks.preSubmit&&(n.values.rebuild(n.hooks.preSubmit(n.state.values)),n.emit("change",n.state),n.emit("update",n.state)),n.hooks.onSubmit&&n.hooks.onSubmit(n.state.values)):n.hooks.onSubmitFailure&&n.hooks.onSubmitFailure(n.state.errors)},n.hooks=e,n.config=r,n.values=new u.default(r.initialValues),n.touched=new u.default,n.errors=new u.default,n.api={setValue:n.setValue,getValue:n.getValue,setTouched:n.setTouched,getTouched:n.getTouched,setError:n.setError,getError:n.getError,getFullField:n.getFullField,submitForm:n.submitForm,getState:n.getFormState,setState:n.setFormState,setValues:n.setValues,reset:n.reset,notify:n.notify},n.fields=new Map,e.getApi&&e.getApi(n.api),n}return function(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)}(t,a),o(t,[{key:"state",get:function(){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(){return this.touched.empty()&&this.values.empty()}},{key:"dirty",get:function(){return!this.pristine}},{key:"invalid",get:function(){return!this.errors.empty()}}]),t}();t.default=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(){function e(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(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),u=f(i),a=r(1),l=f(r(20));function f(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),n=e.onSubmit,o=e.preSubmit,i=e.getApi,u=e.dontPreventDefault,a=e.onSubmitFailure,f=e.initialValues;return r.controller=new l.default({onSubmit:n,getApi:i,preSubmit:o,onSubmitFailure:a},{dontPreventDefault:u,initialValues:f}),r.controller.on("change",function(){return r.forceUpdate()}),r.controller.on("change",function(t){e.onChange&&e.onChange(t)}),r.controller.on("values",function(t){e.onValueChange&&e.onValueChange(t)}),r}return function(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)}(t,i.Component),o(t,[{key:"render",value:function(){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,function(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"]));return u.default.createElement(a.FormContext.Provider,{value:this.formContext},u.default.createElement("form",n({},t,{onSubmit:this.formContext.formApi.submitForm}),this.content))}},{key:"formContext",get:function(){return{formApi:this.controller.api,formState:this.controller.state,controller:this.controller}}},{key:"content",get:function(){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}}]),t}();t.default=c},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=g(r(21)),o=g(r(17)),i=g(r(6)),u=g(r(3)),a=g(r(8)),l=r(5),f=g(r(4)),c=g(r(2)),s=g(r(15)),d=g(r(14)),p=g(r(13)),h=g(r(12)),v=g(r(11)),y=g(r(10)),b=g(r(9));function g(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=d.default,t.TextArea=p.default,t.Select=h.default,t.Option=v.default,t.Checkbox=y.default,t.RadioGroup=b.default}])});
{
"name": "informed",
"version": "1.1.1",
"version": "1.1.2",
"description": "A lightweight framework and utility for building powerful forms in React applications",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc