Socket
Socket
Sign inDemoInstall

react-final-form

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-final-form - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

2

dist/react-final-form.cjs.js

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

}
return renderComponent(_extends({ input: input, meta: meta, children: children }, rest), 'Field(' + name + ')');
return renderComponent(_extends({ input: input, meta: meta, children: children, component: component }, rest), 'Field(' + name + ')');
}

@@ -404,0 +404,0 @@ }]);

@@ -395,3 +395,3 @@ import { PureComponent, createElement } from 'react';

}
return renderComponent(_extends({ input: input, meta: meta, children: children }, rest), 'Field(' + name + ')');
return renderComponent(_extends({ input: input, meta: meta, children: children, component: component }, rest), 'Field(' + name + ')');
}

@@ -398,0 +398,0 @@ }]);

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

}
return renderComponent(_extends({ input: input, meta: meta, children: children }, rest), 'Field(' + name + ')');
return renderComponent(_extends({ input: input, meta: meta, children: children, component: component }, rest), 'Field(' + name + ')');
}

@@ -401,0 +401,0 @@ }]);

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("final-form")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","final-form"],t):t(e["react-final-form"]={},e.React,e.PropTypes,e.FinalForm)}(this,function(e,t,n,r){"use strict";function i(e,n){var r=e.render,i=e.children,o=e.component,a=l(e,["render","children","component"]);return o?t.createElement(o,c({},a,{children:i})):r?r(c({},a,{children:i})):"function"!=typeof i?null:i(a)}n=n&&n.hasOwnProperty("default")?n.default:n;var o=function(e,t){},a=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=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)},l=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},f=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},p=r.formSubscriptionItems.reduce(function(e,t){return e[t]=!0,e},{}),d=function(e){function t(e){a(this,t);var n=f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));n.notify=function(e){return n.setState({state:e})},n.handleSubmit=function(e){e.preventDefault(),n.form.submit()};e.children,e.component;var i=e.debug,u=e.initialValues,c=e.onSubmit,s=(e.render,e.validate),l=e.subscription,d={debug:i,initialValues:u,onSubmit:c,validate:s};try{n.form=r.createForm(d)}catch(e){o(!1,e.message)}var h=void 0;return n.unsubscribe=n.form&&n.form.subscribe(function(e){h?n.notify(e):h=e},l||p),n.state={state:h},n}return s(t,e),u(t,[{key:"getChildContext",value:function(){return{reactFinalForm:{registerField:this.form&&this.form.registerField}}}},{key:"componentWillUnmount",value:function(){this.unsubscribe()}},{key:"render",value:function(){var e=this.props,t=(e.debug,e.initialValues,e.onSubmit,e.subscription,e.validate,l(e,["debug","initialValues","onSubmit","subscription","validate"]));return i(c({},t,this.state.state,{batch:this.form&&this.form.batch,blur:this.form&&this.form.blur,change:this.form&&this.form.change,focus:this.form&&this.form.focus,handleSubmit:this.handleSubmit,reset:this.form&&this.form.reset}))}}]),t}(t.PureComponent);d.childContextTypes={reactFinalForm:n.object},d.displayName="ReactFinalForm("+r.version+")(0.0.2)";var h="undefined"!=typeof window&&window.navigator&&window.navigator.product&&"ReactNative"===window.navigator.product,m=function(e,t){if(!t&&e.nativeEvent&&void 0!==e.nativeEvent.text)return e.nativeEvent.text;if(t&&e.nativeEvent)return e.nativeEvent.text;var n=e.target,r=n.type,i=n.value,o=n.checked;switch(r){case"checkbox":return!!o;case"select-multiple":return function(e){var t=[];if(e)for(var n=0;n<e.length;n++){var r=e[n];r.selected&&t.push(r.value)}return t}(e.target.options);default:return i}},b=r.fieldSubscriptionItems.reduce(function(e,t){return e[t]=!0,e},{}),v=function(e){function n(e,t){a(this,n);var r=f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));r.subscribe=function(e,t){var n=e.name,i=e.subscription;r.unsubscribe=r.context.reactFinalForm.registerField(n,t,i||b,r.validate)},r.validate=function(e,t){return r.props.validate&&r.props.validate(e,t)},r.notify=function(e){return r.setState(e)},r.handlers={onBlur:function(e){r.state.blur()},onChange:function(e){var t=e&&e.target?m(e,h):e;r.state.change(""===t?void 0:t)},onFocus:function(e){r.state.focus()}};var i=void 0;return o(t.reactFinalForm,"Field must be used inside of a Form component"),r.context.reactFinalForm&&r.subscribe(e,function(e){i?r.notify(e):i=e}),r.state=i||{},r}return s(n,e),u(n,[{key:"componentWillReceiveProps",value:function(e){var t=e.name,n=e.subscription;(this.props.name!==t||function(e,t,n){return e?!t||n.some(function(n){return e[n]!==t[n]}):!!t}(this.props.subscription,n,r.fieldSubscriptionItems))&&this.context.reactFinalForm&&(this.unsubscribe(),this.subscribe(e,this.notify))}},{key:"componentWillUnmount",value:function(){this.unsubscribe()}},{key:"render",value:function(){var e=this.props,n=e.name,r=e.component,o=e.children,a=e.allowNull,u=e.value,s=l(e,["name","component","children","allowNull","value"]),f=this.state,p=(f.blur,f.change,f.focus,f.value),d=l(f,["blur","change","focus","value"]);(void 0===p||null===p&&!a)&&(p="");var h=c({name:n,value:p},this.handlers);return"checkbox"===s.type?h.checked=!!p:"radio"===s.type&&(h.checked=p===u,h.value=u),"function"==typeof o?o(c({input:h,meta:d},s)):"string"==typeof r?t.createElement(r,c({},h,{children:o},s)):i(c({input:h,meta:d,children:o},s))}}]),n}(t.PureComponent);v.contextTypes={reactFinalForm:n.object},e.Form=d,e.version="0.0.2",e.Field=v,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("final-form")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","final-form"],t):t(e["react-final-form"]={},e.React,e.PropTypes,e.FinalForm)}(this,function(e,t,n,r){"use strict";function o(e,n){var r=e.render,o=e.children,i=e.component,a=l(e,["render","children","component"]);return i?t.createElement(i,c({},a,{children:o})):r?r(c({},a,{children:o})):"function"!=typeof o?null:o(a)}n=n&&n.hasOwnProperty("default")?n.default:n;var i=function(e,t){},a=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=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)},l=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},f=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},p=r.formSubscriptionItems.reduce(function(e,t){return e[t]=!0,e},{}),d=function(e){function t(e){a(this,t);var n=f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));n.notify=function(e){return n.setState({state:e})},n.handleSubmit=function(e){e.preventDefault(),n.form.submit()};e.children,e.component;var o=e.debug,u=e.initialValues,c=e.onSubmit,s=(e.render,e.validate),l=e.subscription,d={debug:o,initialValues:u,onSubmit:c,validate:s};try{n.form=r.createForm(d)}catch(e){i(!1,e.message)}var h=void 0;return n.unsubscribe=n.form&&n.form.subscribe(function(e){h?n.notify(e):h=e},l||p),n.state={state:h},n}return s(t,e),u(t,[{key:"getChildContext",value:function(){return{reactFinalForm:{registerField:this.form&&this.form.registerField}}}},{key:"componentWillUnmount",value:function(){this.unsubscribe()}},{key:"render",value:function(){var e=this.props,t=(e.debug,e.initialValues,e.onSubmit,e.subscription,e.validate,l(e,["debug","initialValues","onSubmit","subscription","validate"]));return o(c({},t,this.state.state,{batch:this.form&&this.form.batch,blur:this.form&&this.form.blur,change:this.form&&this.form.change,focus:this.form&&this.form.focus,handleSubmit:this.handleSubmit,reset:this.form&&this.form.reset}))}}]),t}(t.PureComponent);d.childContextTypes={reactFinalForm:n.object},d.displayName="ReactFinalForm("+r.version+")(0.0.2)";var h="undefined"!=typeof window&&window.navigator&&window.navigator.product&&"ReactNative"===window.navigator.product,m=function(e,t){if(!t&&e.nativeEvent&&void 0!==e.nativeEvent.text)return e.nativeEvent.text;if(t&&e.nativeEvent)return e.nativeEvent.text;var n=e.target,r=n.type,o=n.value,i=n.checked;switch(r){case"checkbox":return!!i;case"select-multiple":return function(e){var t=[];if(e)for(var n=0;n<e.length;n++){var r=e[n];r.selected&&t.push(r.value)}return t}(e.target.options);default:return o}},b=r.fieldSubscriptionItems.reduce(function(e,t){return e[t]=!0,e},{}),v=function(e){function n(e,t){a(this,n);var r=f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));r.subscribe=function(e,t){var n=e.name,o=e.subscription;r.unsubscribe=r.context.reactFinalForm.registerField(n,t,o||b,r.validate)},r.validate=function(e,t){return r.props.validate&&r.props.validate(e,t)},r.notify=function(e){return r.setState(e)},r.handlers={onBlur:function(e){r.state.blur()},onChange:function(e){var t=e&&e.target?m(e,h):e;r.state.change(""===t?void 0:t)},onFocus:function(e){r.state.focus()}};var o=void 0;return i(t.reactFinalForm,"Field must be used inside of a Form component"),r.context.reactFinalForm&&r.subscribe(e,function(e){o?r.notify(e):o=e}),r.state=o||{},r}return s(n,e),u(n,[{key:"componentWillReceiveProps",value:function(e){var t=e.name,n=e.subscription;(this.props.name!==t||function(e,t,n){return e?!t||n.some(function(n){return e[n]!==t[n]}):!!t}(this.props.subscription,n,r.fieldSubscriptionItems))&&this.context.reactFinalForm&&(this.unsubscribe(),this.subscribe(e,this.notify))}},{key:"componentWillUnmount",value:function(){this.unsubscribe()}},{key:"render",value:function(){var e=this.props,n=e.name,r=e.component,i=e.children,a=e.allowNull,u=e.value,s=l(e,["name","component","children","allowNull","value"]),f=this.state,p=(f.blur,f.change,f.focus,f.value),d=l(f,["blur","change","focus","value"]);(void 0===p||null===p&&!a)&&(p="");var h=c({name:n,value:p},this.handlers);return"checkbox"===s.type?h.checked=!!p:"radio"===s.type&&(h.checked=p===u,h.value=u),"function"==typeof i?i(c({input:h,meta:d},s)):"string"==typeof r?t.createElement(r,c({},h,{children:i},s)):o(c({input:h,meta:d,children:i,component:r},s))}}]),n}(t.PureComponent);v.contextTypes={reactFinalForm:n.object},e.Form=d,e.version="0.0.2",e.Field=v,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=react-final-form.umd.min.js.map
{
"name": "react-final-form",
"version": "0.0.4",
"version": "0.0.5",
"description":

@@ -5,0 +5,0 @@ "High performance subscription-based form state management for React",

@@ -171,2 +171,20 @@ # 🏁 React Final Form

### [Asynchronous Field-Level Validation](https://codesandbox.io/s/2k054qp40)
Demonstrates how field-level validation rules may be asynchronous (return a
`Promise`), as well as how to show a "validating" spinner during the lifetime of
the `Promise`.
### [Hybrid Synchronous/Asynchronous Record-Level Validation](https://codesandbox.io/s/kl9n295n5)
Demonstrates how you can mix synchronous and asynchronous validation patterns at
the record-level, by returning errors synchronously, and falling back to an
asynchronous call (by returning a `Promise`) if sync validation is passing.
### [Submission Errors](https://codesandbox.io/s/9y9om95lyp)
This example demonstrates how to return submission errors from failed submits.
Notice that the `Promise` should _resolve_ to the submission error (not reject).
Rejection is reserved for communications or server exceptions.
## Rendering

@@ -173,0 +191,0 @@

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