Socket
Socket
Sign inDemoInstall

react-final-form

Package Overview
Dependencies
9
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.6.5 to 3.6.6

1

dist/index.d.ts

@@ -74,2 +74,3 @@ import * as React from 'react'

decorators?: Decorator[]
initialValuesEqual?: (a?: object, b?: object) => boolean
}

@@ -76,0 +77,0 @@

4

dist/react-final-form.cjs.js

@@ -519,3 +519,3 @@ 'use strict';

if (this.form) {
this.resumeValidation = !this.form.isValidationPaused();
this.resumeValidation = this.resumeValidation || !this.form.isValidationPaused();
this.form.pauseValidation();

@@ -532,3 +532,3 @@ }

}
if (this.props.initialValues && !shallowEqual(prevProps.initialValues, this.props.initialValues)) {
if (this.props.initialValues && !(this.props.initialValuesEqual || shallowEqual)(prevProps.initialValues, this.props.initialValues)) {
this.form.initialize(this.props.initialValues);

@@ -535,0 +535,0 @@ }

@@ -513,3 +513,3 @@ import { createElement, Component } from 'react';

if (this.form) {
this.resumeValidation = !this.form.isValidationPaused();
this.resumeValidation = this.resumeValidation || !this.form.isValidationPaused();
this.form.pauseValidation();

@@ -526,3 +526,3 @@ }

}
if (this.props.initialValues && !shallowEqual(prevProps.initialValues, this.props.initialValues)) {
if (this.props.initialValues && !(this.props.initialValuesEqual || shallowEqual)(prevProps.initialValues, this.props.initialValues)) {
this.form.initialize(this.props.initialValues);

@@ -529,0 +529,0 @@ }

@@ -517,3 +517,3 @@ (function (global, factory) {

if (this.form) {
this.resumeValidation = !this.form.isValidationPaused();
this.resumeValidation = this.resumeValidation || !this.form.isValidationPaused();
this.form.pauseValidation();

@@ -530,3 +530,3 @@ }

}
if (this.props.initialValues && !shallowEqual(prevProps.initialValues, this.props.initialValues)) {
if (this.props.initialValues && !(this.props.initialValuesEqual || shallowEqual)(prevProps.initialValues, this.props.initialValues)) {
this.form.initialize(this.props.initialValues);

@@ -533,0 +533,0 @@ }

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("prop-types"),require("final-form")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","final-form"],e):e(t["react-final-form"]={},t.React,t.PropTypes,t.FinalForm)}(this,function(t,h,e,u){"use strict";function a(e,n,t){return e?!n||t.some(function(t){return e[t]!==n[t]}):!!n}e=e&&e.hasOwnProperty("default")?e.default:e;var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},n=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},v=function(t,e){var n={};for(var r in t)0<=e.indexOf(r)||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},p=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e};function y(t,e){var n=t.render,r=t.children,i=t.component,o=v(t,["render","children","component"]);return i?h.createElement(i,b({},o,{children:r,render:n})):n?n(b({},o,{children:r})):"function"!=typeof r?null:r(o)}var o="undefined"!=typeof window&&window.navigator&&window.navigator.product&&"ReactNative"===window.navigator.product,s=u.fieldSubscriptionItems.reduce(function(t,e){return t[e]=!0,t},{}),r=function(i){function d(t,e){f(this,d);var n=p(this,i.call(this,t,e));l.call(n);var r=void 0;return n.context.reactFinalForm&&n.subscribe(t,function(t){r?n.notify(t):r=t}),n.state={state:r},n}return n(d,i),d.prototype.componentDidUpdate=function(t){var e=this.props,n=e.name,r=e.subscription;(t.name!==n||a(t.subscription,r,u.fieldSubscriptionItems))&&this.context.reactFinalForm&&(this.unsubscribe(),this.subscribe(this.props,this.notify))},d.prototype.componentWillUnmount=function(){this.unsubscribe()},d.prototype.render=function(){var t=this.props,e=t.allowNull,n=t.component,r=t.children,i=t.format,o=t.formatOnBlur,a=(t.parse,t.isEqual,t.name),s=(t.subscription,t.validate,t.validateFields,t.value),u=v(t,["allowNull","component","children","format","formatOnBlur","parse","isEqual","name","subscription","validate","validateFields","value"]),c=this.state.state||{},f=(c.blur,c.change,c.focus,c.value),p=(c.name,v(c,["blur","change","focus","value","name"])),l={active:p.active,data:p.data,dirty:p.dirty,dirtySinceLastSubmit:p.dirtySinceLastSubmit,error:p.error,initial:p.initial,invalid:p.invalid,pristine:p.pristine,submitError:p.submitError,submitFailed:p.submitFailed,submitSucceeded:p.submitSucceeded,touched:p.touched,valid:p.valid,visited:p.visited};o?f=d.defaultProps.format(f,a):i&&(f=i(f,a)),null!==f||e||(f="");var m=b({name:a,value:f},this.handlers);return"checkbox"===u.type?void 0===s?m.checked=!!f:(m.checked=!(!Array.isArray(f)||!~f.indexOf(s)),m.value=s):"radio"===u.type?(m.checked=f===s,m.value=s):"select"===n&&u.multiple&&(m.value=m.value||[]),"function"==typeof r?r(b({input:m,meta:l},u)):"string"==typeof n?h.createElement(n,b({},m,{children:r},u)):y(b({},{input:m,meta:l},{children:r,component:n},u))},d}(h.Component);r.contextTypes={reactFinalForm:e.object},r.defaultProps={format:function(t,e){return void 0===t?"":t},parse:function(t,e){return""===t?void 0:t}};var l=function(){var a=this;this.subscribe=function(t,e){var n=t.isEqual,r=t.name,i=t.subscription,o=t.validateFields;a.unsubscribe=a.context.reactFinalForm.registerField(r,e,i||s,{isEqual:n,getValidator:function(){return a.props.validate},validateFields:o})},this.notify=function(t){return a.setState({state:t})},this.handlers={onBlur:function(t){var e=a.state.state;if(e){var n=a.props,r=n.format,i=n.formatOnBlur;e.blur(),r&&i&&e.change(r(e.value,e.name))}},onChange:function(t){var e=a.props,n=e.parse,r=e.value,i=t&&t.target?function(t,e,n,r){if(!r&&t.nativeEvent&&void 0!==t.nativeEvent.text)return t.nativeEvent.text;if(r&&t.nativeEvent)return t.nativeEvent.text;var i=t.target,o=i.type,a=i.value,s=i.checked;switch(o){case"checkbox":if(void 0!==n){if(s)return Array.isArray(e)?e.concat(n):[n];if(!Array.isArray(e))return e;var u=e.indexOf(n);return u<0?e:e.slice(0,u).concat(e.slice(u+1))}return!!s;case"select-multiple":return function(t){var e=[];if(t)for(var n=0;n<t.length;n++){var r=t[n];r.selected&&e.push(r.value)}return e}(t.target.options);default:return a}}(t,a.state.state&&a.state.state.value,r,o):t;a.state.state&&a.state.state.change(n?n(i,a.props.name):i)},onFocus:function(t){a.state.state&&a.state.state.focus()}}},m=function(t){return!(!t||"function"!=typeof t.stopPropagation)},i="3.6.0",d={"final-form":u.version,"react-final-form":i},g=u.formSubscriptionItems.reduce(function(t,e){return t[e]=!0,t},{}),F=function(a){function s(t){f(this,s);var e=p(this,a.call(this,t));e.notify=function(t){e.mounted&&e.setState({state:t}),e.mounted=!0},e.handleSubmit=function(t){return t&&("function"==typeof t.preventDefault&&t.preventDefault(),"function"==typeof t.stopPropagation&&t.stopPropagation()),e.form.submit()};t.children,t.component,t.render;var n=t.subscription,r=t.decorators,i=v(t,["children","component","render","subscription","decorators"]);e.mounted=!1;try{e.form=u.createForm(i)}catch(t){}if(e.unsubscriptions=[],e.form){var o={};e.form.subscribe(function(t){o=t},n||g)(),e.state={state:o}}return r&&r.forEach(function(t){e.unsubscriptions.push(t(e.form))}),e}return n(s,a),s.prototype.getChildContext=function(){return{reactFinalForm:this.form}},s.prototype.componentWillMount=function(){this.form&&this.form.pauseValidation()},s.prototype.componentDidMount=function(){this.form&&(this.unsubscriptions.push(this.form.subscribe(this.notify,this.props.subscription||g)),this.form.resumeValidation())},s.prototype.componentWillUpdate=function(){this.form&&(this.resumeValidation=!this.form.isValidationPaused(),this.form.pauseValidation())},s.prototype.componentDidUpdate=function(e){var n=this;this.form&&this.resumeValidation&&this.form.resumeValidation(),this.props.initialValues&&!function(t,e){if(t===e)return!0;if("object"!==(void 0===t?"undefined":c(t))||!t||"object"!==(void 0===e?"undefined":c(e))||!e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var i=Object.prototype.hasOwnProperty.bind(e),o=0;o<n.length;o++){var a=n[o];if(!i(a)||t[a]!==e[a])return!1}return!0}(e.initialValues,this.props.initialValues)&&this.form.initialize(this.props.initialValues),u.configOptions.forEach(function(t){"initialValues"!==t&&e[t]!==n.props[t]&&n.form.setConfig(t,n.props[t])})},s.prototype.componentWillUnmount=function(){this.unsubscriptions.forEach(function(t){return t()})},s.prototype.render=function(){var n=this,t=this.props,e=(t.debug,t.initialValues,t.mutators,t.onSubmit,t.subscription,t.validate,t.validateOnBlur,v(t,["debug","initialValues","mutators","onSubmit","subscription","validate","validateOnBlur"])),r=b({},this.state?this.state.state:{},{batch:this.form&&function(t){return n.form.batch(t)},blur:this.form&&function(t){return n.form.blur(t)},change:this.form&&function(t,e){return n.form.change(t,e)},focus:this.form&&function(t){return n.form.focus(t)},form:b({},this.form,{reset:function(t){m(t)?n.form.reset():n.form.reset(t)}}),handleSubmit:this.handleSubmit,initialize:this.form&&function(t){return n.form.initialize(t)},mutators:this.form&&Object.keys(this.form.mutators).reduce(function(t,e){return t[e]=function(){var t;(t=n.form.mutators)[e].apply(t,arguments)},t},{}),reset:this.form&&function(t){return n.form.reset(t)}});return y(b({},e,r,{__versions:d}))},s}(h.Component);F.childContextTypes={reactFinalForm:e.object};var O=function(i){function o(e,t){f(this,o);var r=p(this,i.call(this,e,t));r.subscribe=function(t,e){var n=t.subscription;r.unsubscribe=r.context.reactFinalForm.subscribe(e,n||g)},r.notify=function(t){r.setState({state:t}),r.props.onChange&&r.props.onChange(t)};var n=void 0;return r.context.reactFinalForm&&r.subscribe(e,function(t){n?r.notify(t):(n=t,e.onChange&&e.onChange(t))}),n&&(r.state={state:n}),r}return n(o,i),o.prototype.componentDidUpdate=function(t){var e=this.props.subscription;a(t.subscription,e,u.formSubscriptionItems)&&this.context.reactFinalForm&&(this.unsubscribe(),this.subscribe(this.props,this.notify))},o.prototype.componentWillUnmount=function(){this.unsubscribe()},o.prototype.render=function(){var t=this.props,e=t.onChange,n=(t.subscription,v(t,["onChange","subscription"])),r=this.context.reactFinalForm,i={batch:r&&function(t){return r.batch(t)},blur:r&&function(t){return r.blur(t)},change:r&&function(t,e){return r.change(t,e)},focus:r&&function(t){return r.focus(t)},form:b({},r,{reset:function(t){m(t)?r.reset():r.reset(t)}}),initialize:r&&function(t){return r.initialize(t)},mutators:r&&Object.keys(r.mutators).reduce(function(t,e){return t[e]=function(){var t;(t=r.mutators)[e].apply(t,arguments)},t},{}),reset:r&&function(t){return r.reset(t)}};return e?null:y(b({},n,this.state?this.state.state:{},i))},o}(h.Component);O.contextTypes={reactFinalForm:e.object},t.Field=r,t.Form=F,t.version=i,t.FormSpy=O,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("prop-types"),require("final-form")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","final-form"],e):e(t["react-final-form"]={},t.React,t.PropTypes,t.FinalForm)}(this,function(t,d,e,u){"use strict";function a(e,n,t){return e?!n||t.some(function(t){return e[t]!==n[t]}):!!n}e=e&&e.hasOwnProperty("default")?e.default:e;var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},n=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},v=function(t,e){var n={};for(var r in t)0<=e.indexOf(r)||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},l=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e};function y(t,e){var n=t.render,r=t.children,i=t.component,o=v(t,["render","children","component"]);return i?d.createElement(i,b({},o,{children:r,render:n})):n?n(b({},o,{children:r})):"function"!=typeof r?null:r(o)}var o="undefined"!=typeof window&&window.navigator&&window.navigator.product&&"ReactNative"===window.navigator.product,s=u.fieldSubscriptionItems.reduce(function(t,e){return t[e]=!0,t},{}),r=function(i){function h(t,e){f(this,h);var n=l(this,i.call(this,t,e));p.call(n);var r=void 0;return n.context.reactFinalForm&&n.subscribe(t,function(t){r?n.notify(t):r=t}),n.state={state:r},n}return n(h,i),h.prototype.componentDidUpdate=function(t){var e=this.props,n=e.name,r=e.subscription;(t.name!==n||a(t.subscription,r,u.fieldSubscriptionItems))&&this.context.reactFinalForm&&(this.unsubscribe(),this.subscribe(this.props,this.notify))},h.prototype.componentWillUnmount=function(){this.unsubscribe()},h.prototype.render=function(){var t=this.props,e=t.allowNull,n=t.component,r=t.children,i=t.format,o=t.formatOnBlur,a=(t.parse,t.isEqual,t.name),s=(t.subscription,t.validate,t.validateFields,t.value),u=v(t,["allowNull","component","children","format","formatOnBlur","parse","isEqual","name","subscription","validate","validateFields","value"]),c=this.state.state||{},f=(c.blur,c.change,c.focus,c.value),l=(c.name,v(c,["blur","change","focus","value","name"])),p={active:l.active,data:l.data,dirty:l.dirty,dirtySinceLastSubmit:l.dirtySinceLastSubmit,error:l.error,initial:l.initial,invalid:l.invalid,pristine:l.pristine,submitError:l.submitError,submitFailed:l.submitFailed,submitSucceeded:l.submitSucceeded,touched:l.touched,valid:l.valid,visited:l.visited};o?f=h.defaultProps.format(f,a):i&&(f=i(f,a)),null!==f||e||(f="");var m=b({name:a,value:f},this.handlers);return"checkbox"===u.type?void 0===s?m.checked=!!f:(m.checked=!(!Array.isArray(f)||!~f.indexOf(s)),m.value=s):"radio"===u.type?(m.checked=f===s,m.value=s):"select"===n&&u.multiple&&(m.value=m.value||[]),"function"==typeof r?r(b({input:m,meta:p},u)):"string"==typeof n?d.createElement(n,b({},m,{children:r},u)):y(b({},{input:m,meta:p},{children:r,component:n},u))},h}(d.Component);r.contextTypes={reactFinalForm:e.object},r.defaultProps={format:function(t,e){return void 0===t?"":t},parse:function(t,e){return""===t?void 0:t}};var p=function(){var a=this;this.subscribe=function(t,e){var n=t.isEqual,r=t.name,i=t.subscription,o=t.validateFields;a.unsubscribe=a.context.reactFinalForm.registerField(r,e,i||s,{isEqual:n,getValidator:function(){return a.props.validate},validateFields:o})},this.notify=function(t){return a.setState({state:t})},this.handlers={onBlur:function(t){var e=a.state.state;if(e){var n=a.props,r=n.format,i=n.formatOnBlur;e.blur(),r&&i&&e.change(r(e.value,e.name))}},onChange:function(t){var e=a.props,n=e.parse,r=e.value,i=t&&t.target?function(t,e,n,r){if(!r&&t.nativeEvent&&void 0!==t.nativeEvent.text)return t.nativeEvent.text;if(r&&t.nativeEvent)return t.nativeEvent.text;var i=t.target,o=i.type,a=i.value,s=i.checked;switch(o){case"checkbox":if(void 0===n)return!!s;if(s)return Array.isArray(e)?e.concat(n):[n];if(!Array.isArray(e))return e;var u=e.indexOf(n);return u<0?e:e.slice(0,u).concat(e.slice(u+1));case"select-multiple":return function(t){var e=[];if(t)for(var n=0;n<t.length;n++){var r=t[n];r.selected&&e.push(r.value)}return e}(t.target.options);default:return a}}(t,a.state.state&&a.state.state.value,r,o):t;a.state.state&&a.state.state.change(n?n(i,a.props.name):i)},onFocus:function(t){a.state.state&&a.state.state.focus()}}},m=function(t){return!(!t||"function"!=typeof t.stopPropagation)},i="3.6.0",h={"final-form":u.version,"react-final-form":i},g=u.formSubscriptionItems.reduce(function(t,e){return t[e]=!0,t},{}),F=function(a){function s(t){f(this,s);var e=l(this,a.call(this,t));e.notify=function(t){e.mounted&&e.setState({state:t}),e.mounted=!0},e.handleSubmit=function(t){return t&&("function"==typeof t.preventDefault&&t.preventDefault(),"function"==typeof t.stopPropagation&&t.stopPropagation()),e.form.submit()};t.children,t.component,t.render;var n=t.subscription,r=t.decorators,i=v(t,["children","component","render","subscription","decorators"]);e.mounted=!1;try{e.form=u.createForm(i)}catch(t){}if(e.unsubscriptions=[],e.form){var o={};e.form.subscribe(function(t){o=t},n||g)(),e.state={state:o}}return r&&r.forEach(function(t){e.unsubscriptions.push(t(e.form))}),e}return n(s,a),s.prototype.getChildContext=function(){return{reactFinalForm:this.form}},s.prototype.componentWillMount=function(){this.form&&this.form.pauseValidation()},s.prototype.componentDidMount=function(){this.form&&(this.unsubscriptions.push(this.form.subscribe(this.notify,this.props.subscription||g)),this.form.resumeValidation())},s.prototype.componentWillUpdate=function(){this.form&&(this.resumeValidation=this.resumeValidation||!this.form.isValidationPaused(),this.form.pauseValidation())},s.prototype.componentDidUpdate=function(e){var n=this;this.form&&this.resumeValidation&&this.form.resumeValidation(),this.props.initialValues&&!(this.props.initialValuesEqual||function(t,e){if(t===e)return!0;if("object"!==(void 0===t?"undefined":c(t))||!t||"object"!==(void 0===e?"undefined":c(e))||!e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var i=Object.prototype.hasOwnProperty.bind(e),o=0;o<n.length;o++){var a=n[o];if(!i(a)||t[a]!==e[a])return!1}return!0})(e.initialValues,this.props.initialValues)&&this.form.initialize(this.props.initialValues),u.configOptions.forEach(function(t){"initialValues"!==t&&e[t]!==n.props[t]&&n.form.setConfig(t,n.props[t])})},s.prototype.componentWillUnmount=function(){this.unsubscriptions.forEach(function(t){return t()})},s.prototype.render=function(){var n=this,t=this.props,e=(t.debug,t.initialValues,t.mutators,t.onSubmit,t.subscription,t.validate,t.validateOnBlur,v(t,["debug","initialValues","mutators","onSubmit","subscription","validate","validateOnBlur"])),r=b({},this.state?this.state.state:{},{batch:this.form&&function(t){return n.form.batch(t)},blur:this.form&&function(t){return n.form.blur(t)},change:this.form&&function(t,e){return n.form.change(t,e)},focus:this.form&&function(t){return n.form.focus(t)},form:b({},this.form,{reset:function(t){m(t)?n.form.reset():n.form.reset(t)}}),handleSubmit:this.handleSubmit,initialize:this.form&&function(t){return n.form.initialize(t)},mutators:this.form&&Object.keys(this.form.mutators).reduce(function(t,e){return t[e]=function(){var t;(t=n.form.mutators)[e].apply(t,arguments)},t},{}),reset:this.form&&function(t){return n.form.reset(t)}});return y(b({},e,r,{__versions:h}))},s}(d.Component);F.childContextTypes={reactFinalForm:e.object};var O=function(i){function o(e,t){f(this,o);var r=l(this,i.call(this,e,t));r.subscribe=function(t,e){var n=t.subscription;r.unsubscribe=r.context.reactFinalForm.subscribe(e,n||g)},r.notify=function(t){r.setState({state:t}),r.props.onChange&&r.props.onChange(t)};var n=void 0;return r.context.reactFinalForm&&r.subscribe(e,function(t){n?r.notify(t):(n=t,e.onChange&&e.onChange(t))}),n&&(r.state={state:n}),r}return n(o,i),o.prototype.componentDidUpdate=function(t){var e=this.props.subscription;a(t.subscription,e,u.formSubscriptionItems)&&this.context.reactFinalForm&&(this.unsubscribe(),this.subscribe(this.props,this.notify))},o.prototype.componentWillUnmount=function(){this.unsubscribe()},o.prototype.render=function(){var t=this.props,e=t.onChange,n=(t.subscription,v(t,["onChange","subscription"])),r=this.context.reactFinalForm,i={batch:r&&function(t){return r.batch(t)},blur:r&&function(t){return r.blur(t)},change:r&&function(t,e){return r.change(t,e)},focus:r&&function(t){return r.focus(t)},form:b({},r,{reset:function(t){m(t)?r.reset():r.reset(t)}}),initialize:r&&function(t){return r.initialize(t)},mutators:r&&Object.keys(r.mutators).reduce(function(t,e){return t[e]=function(){var t;(t=r.mutators)[e].apply(t,arguments)},t},{}),reset:r&&function(t){return r.reset(t)}};return e?null:y(b({},n,this.state?this.state.state:{},i))},o}(d.Component);O.contextTypes={reactFinalForm:e.object},t.Field=r,t.Form=F,t.version=i,t.FormSpy=O,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=react-final-form.umd.min.js.map
{
"name": "react-final-form",
"version": "3.6.5",
"version": "3.6.6",
"description": "🏁 High performance subscription-based form state management for React",

@@ -18,3 +18,3 @@ "main": "dist/react-final-form.cjs.js",

"prepublish": "npm start validate",
"postinstall": "opencollective postinstall || exit 0"
"postinstall": "node ./scripts/postinstall.js || exit 0"
},

@@ -49,2 +49,3 @@ "author": "Erik Rasmussen <rasmussenerik@gmail.com> (http://github.com/erikras)",

"eslint-plugin-react": "^7.10.0",
"fast-deep-equal": "^2.0.1",
"final-form": "^4.8.3",

@@ -85,2 +86,5 @@ "flow-bin": "^0.75.0",

},
"jest": {
"testEnvironment": "jsdom"
},
"bundlesize": [

@@ -87,0 +91,0 @@ {

@@ -113,126 +113,132 @@ # 🏁 React Final Form

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
* [Examples](#examples)
* [Simple Example](#simple-example)
* [Synchronous Record-Level Validation](#synchronous-record-level-validation)
* [Synchronous Field-Level Validation](#synchronous-field-level-validation)
* [Asynchronous Field-Level Validation](#asynchronous-field-level-validation)
* [Hybrid Synchronous/Asynchronous Record-Level Validation](#hybrid-synchronousasynchronous-record-level-validation)
* [Submission Errors](#submission-errors)
* [Third Party Components](#third-party-components)
* [Material-UI 1.0](#material-ui-10)
* [💥 Performance Optimization Through Subscriptions 💥](#-performance-optimization-through-subscriptions-)
* [Independent Error Component](#independent-error-component)
* [Loading and Initializing Values](#loading-and-initializing-values)
* [Field Arrays](#field-arrays)
* [Calculated Fields](#calculated-fields)
* [Field Warnings](#field-warnings)
* [Reusable Field Groups](#reusable-field-groups)
* [External Submit](#external-submit)
* [Wizard Form](#wizard-form)
* [Parse and Format (and Normalize)](#parse-and-format-and-normalize)
* [Auto-Save with Debounce](#auto-save-with-debounce)
* [Auto-Save on Field Blur](#auto-save-on-field-blur)
* [Custom Validation Engine](#custom-validation-engine)
* [Loading, Normalizing, Saving, and Reinitializing](#loading-normalizing-saving-and-reinitializing)
* [🏎️ Downshift Type-Ahead](#-downshift-type-ahead)
* [Redux Example](#redux-example)
* [Conditional Fields](#conditional-fields)
* [Listening for External Changes](#listening-for-external-changes)
* [Focus On First Error](#focus-on-first-error)
* [Credit Card Example](#credit-card-example)
* [Async Redux Submission](#async-redux-submission)
* [Declarative Form Rules](#declarative-form-rules)
* [Format String By Pattern](#format-string-by-pattern)
* [AsyncTypeahead and Redux](#asynctypeahead-and-redux)
* [Format On Blur](#format-on-blur)
* [Styling with 🍭 Smooth-UI](#styling-with--smooth-ui)
* [Rendering](#rendering)
* [API](#api)
* [`Field : React.ComponentType<FieldProps>`](#field--reactcomponenttypefieldprops)
* [`Form : React.ComponentType<FormProps>`](#form--reactcomponenttypeformprops)
* [`FormSpy : React.ComponentType<FormSpyProps>`](#formspy--reactcomponenttypeformspyprops)
* [`version: string`](#version-string)
* [Types](#types)
* [`FieldProps`](#fieldprops)
* [`allowNull?: boolean`](#allownull-boolean)
* [`children?: ((props: FieldRenderProps) => React.Node) | React.Node`](#children-props-fieldrenderprops--reactnode--reactnode)
* [`component?: React.ComponentType<FieldRenderProps> | string`](#component-reactcomponenttypefieldrenderprops--string)
* [`format?: ((value: any, name: string) => any) | null`](#format-value-any-name-string--any--null)
* [`formatOnBlur?: boolean`](#formatonblur-boolean)
* [`isEqual?: (a: any, b: any) => boolean`](#isequal-a-any-b-any--boolean)
* [`name: string`](#name-string)
* [`parse?: ((value: any, name: string) => any) | null`](#parse-value-any-name-string--any--null)
* [`render?: (props: FieldRenderProps) => React.Node`](#render-props-fieldrenderprops--reactnode)
* [`subscription?: FieldSubscription`](#subscription-fieldsubscription)
* [`validate?: (value: ?any, allValues: Object) => ?any`](#validate-value-any-allvalues-object--any)
* [`validateFields?: string[]`](#validatefields-string)
* [`value?: any`](#value-any)
* [`FieldRenderProps`](#fieldrenderprops)
* [`input.name: string`](#inputname-string)
* [`input.onBlur: (?SyntheticFocusEvent<*>) => void`](#inputonblur-syntheticfocusevent--void)
* [`input.onChange: (SyntheticInputEvent<*> | any) => void`](#inputonchange-syntheticinputevent--any--void)
* [`input.onFocus: (?SyntheticFocusEvent<*>) => void`](#inputonfocus-syntheticfocusevent--void)
* [`input.value: any`](#inputvalue-any)
* [`meta.active?: boolean`](#metaactive-boolean)
* [`meta.data?: Object`](#metadata-object)
* [`meta.dirty?: boolean`](#metadirty-boolean)
* [`meta.error?: any`](#metaerror-any)
* [`meta.initial?: any`](#metainitial-any)
* [`meta.invalid?: boolean`](#metainvalid-boolean)
* [`meta.pristine?: boolean`](#metapristine-boolean)
* [`meta.submitError?: any`](#metasubmiterror-any)
* [`meta.submitFailed?: boolean`](#metasubmitfailed-boolean)
* [`meta.submitSucceeded?: boolean`](#metasubmitsucceeded-boolean)
* [`meta.touched?: boolean`](#metatouched-boolean)
* [`meta.valid?: boolean`](#metavalid-boolean)
* [`meta.visited?: boolean`](#metavisited-boolean)
* [`FormProps`](#formprops)
* [`children?: ((props: FormRenderProps) => React.Node) | React.Node`](#children-props-formrenderprops--reactnode--reactnode)
* [`component?: React.ComponentType<FormRenderProps>`](#component-reactcomponenttypeformrenderprops)
* [`debug?: DebugFunction`](#debug-debugfunction)
* [`decorators?: Decorator[]`](#decorators-decorator)
* [`initialValues?: Object`](#initialvalues-object)
* [`keepDirtyOnReinitialize?: boolean`](#keepdirtyonreinitialize-boolean)
* [`mutators?: { [string]: Mutator }`](#mutators--string-mutator-)
* [`onSubmit: (values: Object, form: FormApi, callback: ?(errors: ?Object) => void) => ?Object | Promise<?Object> | void`](#onsubmit-values-object-form-formapi-callback-errors-object--void--object--promiseobject--void)
* [`render?: (props: FormRenderProps) => React.Node`](#render-props-formrenderprops--reactnode)
* [`subscription?: FormSubscription`](#subscription-formsubscription)
* [`validate?: (values: Object) => Object | Promise<Object>`](#validate-values-object--object--promiseobject)
* [`validateOnBlur?: boolean`](#validateonblur-boolean)
* [`FormRenderProps`](#formrenderprops)
* [`batch: (fn: () => void) => void)`](#batch-fn---void--void)
* [`blur: (name: string) => void`](#blur-name-string--void)
* [`change: (name: string, value: any) => void`](#change-name-string-value-any--void)
* [`focus: (name: string) => void`](#focus-name-string--void)
* [`form: FormApi`](#form-formapi)
* [`handleSubmit: (?SyntheticEvent<HTMLFormElement>) => void`](#handlesubmit-syntheticeventhtmlformelement--void)
* [`initialize: (values: Object) => void`](#initialize-values-object--void)
* [`mutators?: { [string]: Function }`](#mutators--string-function-)
* [`reset: (newInitialValues?: Object) => void`](#reset-newinitialvalues-object--void)
* [`FormSpyProps`](#formspyprops)
* [`children?: ((props: FormSpyRenderProps) => React.Node) | React.Node`](#children-props-formspyrenderprops--reactnode--reactnode)
* [`component?: React.ComponentType<FormSpyRenderProps>`](#component-reactcomponenttypeformspyrenderprops)
* [`onChange?: (formState: FormState) => void`](#onchange-formstate-formstate--void)
* [`render?: (props: FormSpyRenderProps) => React.Node`](#render-props-formspyrenderprops--reactnode)
* [`subscription?: FormSubscription`](#subscription-formsubscription-1)
* [`FormSpyRenderProps`](#formspyrenderprops)
* [`batch: (fn: () => void) => void)`](#batch-fn---void--void-1)
* [`blur: (name: string) => void`](#blur-name-string--void-1)
* [`change: (name: string, value: any) => void`](#change-name-string-value-any--void-1)
* [`focus: (name: string) => void`](#focus-name-string--void-1)
* [`form: FormApi`](#form-formapi-1)
* [`initialize: (values: Object) => void`](#initialize-values-object--void-1)
* [`mutators?: { [string]: Function }`](#mutators--string-function--1)
* [`reset: (newInitialValues?: Object) => void`](#reset-newinitialvalues-object--void-1)
* [Contributors](#contributors)
* [Backers](#backers)
* [Sponsors](#sponsors)
- [Videos](#videos)
- [Examples](#examples)
- [Simple Example](#simple-example)
- [Synchronous Record-Level Validation](#synchronous-record-level-validation)
- [Synchronous Field-Level Validation](#synchronous-field-level-validation)
- [Asynchronous Field-Level Validation](#asynchronous-field-level-validation)
- [Hybrid Synchronous/Asynchronous Record-Level Validation](#hybrid-synchronousasynchronous-record-level-validation)
- [Submission Errors](#submission-errors)
- [Third Party Components](#third-party-components)
- [Material-UI 1.0](#material-ui-10)
- [💥 Performance Optimization Through Subscriptions 💥](#-performance-optimization-through-subscriptions-)
- [Independent Error Component](#independent-error-component)
- [Loading and Initializing Values](#loading-and-initializing-values)
- [Field Arrays](#field-arrays)
- [Calculated Fields](#calculated-fields)
- [Field Warnings](#field-warnings)
- [Reusable Field Groups](#reusable-field-groups)
- [External Submit](#external-submit)
- [Wizard Form](#wizard-form)
- [Parse and Format (and Normalize)](#parse-and-format-and-normalize)
- [Auto-Save with Debounce](#auto-save-with-debounce)
- [Auto-Save on Field Blur](#auto-save-on-field-blur)
- [Custom Validation Engine](#custom-validation-engine)
- [Loading, Normalizing, Saving, and Reinitializing](#loading-normalizing-saving-and-reinitializing)
- [🏎️ Downshift Type-Ahead](#-downshift-type-ahead)
- [Redux Example](#redux-example)
- [Conditional Fields](#conditional-fields)
- [Listening for External Changes](#listening-for-external-changes)
- [Focus On First Error](#focus-on-first-error)
- [Credit Card Example](#credit-card-example)
- [Async Redux Submission](#async-redux-submission)
- [Declarative Form Rules](#declarative-form-rules)
- [Format String By Pattern](#format-string-by-pattern)
- [AsyncTypeahead and Redux](#asynctypeahead-and-redux)
- [Format On Blur](#format-on-blur)
- [Styling with 🍭 Smooth-UI](#styling-with--smooth-ui)
- [Rendering](#rendering)
- [API](#api)
- [`Field : React.ComponentType<FieldProps>`](#field--reactcomponenttypefieldprops)
- [`Form : React.ComponentType<FormProps>`](#form--reactcomponenttypeformprops)
- [`FormSpy : React.ComponentType<FormSpyProps>`](#formspy--reactcomponenttypeformspyprops)
- [`version: string`](#version-string)
- [Types](#types)
- [`FieldProps`](#fieldprops)
- [`allowNull?: boolean`](#allownull-boolean)
- [`children?: ((props: FieldRenderProps) => React.Node) | React.Node`](#children-props-fieldrenderprops--reactnode--reactnode)
- [`component?: React.ComponentType<FieldRenderProps> | string`](#component-reactcomponenttypefieldrenderprops--string)
- [`format?: ((value: any, name: string) => any) | null`](#format-value-any-name-string--any--null)
- [`formatOnBlur?: boolean`](#formatonblur-boolean)
- [`isEqual?: (a: any, b: any) => boolean`](#isequal-a-any-b-any--boolean)
- [`name: string`](#name-string)
- [`parse?: ((value: any, name: string) => any) | null`](#parse-value-any-name-string--any--null)
- [`render?: (props: FieldRenderProps) => React.Node`](#render-props-fieldrenderprops--reactnode)
- [`subscription?: FieldSubscription`](#subscription-fieldsubscription)
- [`validate?: (value: ?any, allValues: Object) => ?any`](#validate-value-any-allvalues-object--any)
- [`validateFields?: string[]`](#validatefields-string)
- [`value?: any`](#value-any)
- [`FieldRenderProps`](#fieldrenderprops)
- [`input.name: string`](#inputname-string)
- [`input.onBlur: (?SyntheticFocusEvent<*>) => void`](#inputonblur-syntheticfocusevent--void)
- [`input.onChange: (SyntheticInputEvent<*> | any) => void`](#inputonchange-syntheticinputevent--any--void)
- [`input.onFocus: (?SyntheticFocusEvent<*>) => void`](#inputonfocus-syntheticfocusevent--void)
- [`input.value: any`](#inputvalue-any)
- [`meta.active?: boolean`](#metaactive-boolean)
- [`meta.data?: Object`](#metadata-object)
- [`meta.dirty?: boolean`](#metadirty-boolean)
- [`meta.error?: any`](#metaerror-any)
- [`meta.initial?: any`](#metainitial-any)
- [`meta.invalid?: boolean`](#metainvalid-boolean)
- [`meta.pristine?: boolean`](#metapristine-boolean)
- [`meta.submitError?: any`](#metasubmiterror-any)
- [`meta.submitFailed?: boolean`](#metasubmitfailed-boolean)
- [`meta.submitSucceeded?: boolean`](#metasubmitsucceeded-boolean)
- [`meta.touched?: boolean`](#metatouched-boolean)
- [`meta.valid?: boolean`](#metavalid-boolean)
- [`meta.visited?: boolean`](#metavisited-boolean)
- [`FormProps`](#formprops)
- [`children?: ((props: FormRenderProps) => React.Node) | React.Node`](#children-props-formrenderprops--reactnode--reactnode)
- [`component?: React.ComponentType<FormRenderProps>`](#component-reactcomponenttypeformrenderprops)
- [`debug?: DebugFunction`](#debug-debugfunction)
- [`decorators?: Decorator[]`](#decorators-decorator)
- [`initialValues?: Object`](#initialvalues-object)
- [`initialValuesEqual?: (?Object, ?Object) => boolean`](#initialvaluesequal-object-object--boolean)
- [`keepDirtyOnReinitialize?: boolean`](#keepdirtyonreinitialize-boolean)
- [`mutators?: { [string]: Mutator }`](#mutators--string-mutator-)
- [`onSubmit: (values: Object, form: FormApi, callback: ?(errors: ?Object) => void) => ?Object | Promise<?Object> | void`](#onsubmit-values-object-form-formapi-callback-errors-object--void--object--promiseobject--void)
- [`render?: (props: FormRenderProps) => React.Node`](#render-props-formrenderprops--reactnode)
- [`subscription?: FormSubscription`](#subscription-formsubscription)
- [`validate?: (values: Object) => Object | Promise<Object>`](#validate-values-object--object--promiseobject)
- [`validateOnBlur?: boolean`](#validateonblur-boolean)
- [`FormRenderProps`](#formrenderprops)
- [`batch: (fn: () => void) => void)`](#batch-fn---void--void)
- [`blur: (name: string) => void`](#blur-name-string--void)
- [`change: (name: string, value: any) => void`](#change-name-string-value-any--void)
- [`focus: (name: string) => void`](#focus-name-string--void)
- [`form: FormApi`](#form-formapi)
- [`handleSubmit: (?SyntheticEvent<HTMLFormElement>) => void`](#handlesubmit-syntheticeventhtmlformelement--void)
- [`initialize: (values: Object) => void`](#initialize-values-object--void)
- [`mutators?: { [string]: Function }`](#mutators--string-function-)
- [`reset: (newInitialValues?: Object) => void`](#reset-newinitialvalues-object--void)
- [`FormSpyProps`](#formspyprops)
- [`children?: ((props: FormSpyRenderProps) => React.Node) | React.Node`](#children-props-formspyrenderprops--reactnode--reactnode)
- [`component?: React.ComponentType<FormSpyRenderProps>`](#component-reactcomponenttypeformspyrenderprops)
- [`onChange?: (formState: FormState) => void`](#onchange-formstate-formstate--void)
- [`render?: (props: FormSpyRenderProps) => React.Node`](#render-props-formspyrenderprops--reactnode)
- [`subscription?: FormSubscription`](#subscription-formsubscription-1)
- [`FormSpyRenderProps`](#formspyrenderprops)
- [`batch: (fn: () => void) => void)`](#batch-fn---void--void-1)
- [`blur: (name: string) => void`](#blur-name-string--void-1)
- [`change: (name: string, value: any) => void`](#change-name-string-value-any--void-1)
- [`focus: (name: string) => void`](#focus-name-string--void-1)
- [`form: FormApi`](#form-formapi-1)
- [`initialize: (values: Object) => void`](#initialize-values-object--void-1)
- [`mutators?: { [string]: Function }`](#mutators--string-function--1)
- [`reset: (newInitialValues?: Object) => void`](#reset-newinitialvalues-object--void-1)
- [Contributors](#contributors)
- [Backers](#backers)
- [Sponsors](#sponsors)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Videos
| [![Next Generation Forms with 🏁 React Final Form – React Alicante 2018](docs/ReactAlicante2018.gif)](https://youtu.be/WoSzy-4mviQ) |
| :---------------------------------------------------------------------------------------------------------------------------------: |
| **Next Generation Forms with 🏁 React Final Form – React Alicante 2018** |
## Examples

@@ -286,3 +292,3 @@

Demonstrates how, by restricting which parts of form state the form component
needs to render, it reduce the number of times the whole form has to rerender.
needs to render, it reduces the number of times the whole form has to rerender.
Yet, if some part of form state is needed inside of it, the

@@ -513,8 +519,8 @@ [`FormSpy`](#formspy--reactcomponenttypeformspyprops) component can be used to

**This is only used for checkboxes radio buttons!**
**This is only used for checkboxes and radio buttons!**
* Radio Buttons: The value of the radio button. The radio button will render as `checked` if and only if the value given here `===` the value for the field in the form.
* Checkboxes:
* `value` is specified: the checkbox will be `checked` if the value given in `value` is contained in the array that is the value for the field for the form. Checking the box will add the value to the array, and unchecking the checkbox will remove the value from the array.
* no `value` is specified: the checkbox will be `checked` if the value is truthy. Checking the box will set the value to `true`, and unchecking the checkbox will set the value to `false`.
- Radio Buttons: The value of the radio button. The radio button will render as `checked` if and only if the value given here `===` the value for the field in the form.
- Checkboxes:
- `value` is specified: the checkbox will be `checked` if the value given in `value` is contained in the array that is the value for the field for the form. Checking the box will add the value to the array, and unchecking the checkbox will remove the value from the array.
- no `value` is specified: the checkbox will be `checked` if the value is truthy. Checking the box will set the value to `true`, and unchecking the checkbox will set the value to `false`.

@@ -639,2 +645,6 @@ ### `FieldRenderProps`

#### `initialValuesEqual?: (?Object, ?Object) => boolean`
A predicate to determine whether or not the `initialValues` prop has changed. Useful for passing in a "deep equals" function if you need to. Defaults to "shallow equals".
#### `keepDirtyOnReinitialize?: boolean`

@@ -641,0 +651,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc