formula-one
Advanced tools
Comparing version 0.9.0-alpha.2 to 0.9.0-alpha.3
@@ -26,2 +26,4 @@ # Changelog | ||
- Fix flow types for ErrorHelper. | ||
### v0.8.2 | ||
@@ -28,0 +30,0 @@ |
@@ -7,2 +7,4 @@ "use strict"; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; // strict | ||
var _react = require("react"); | ||
@@ -12,16 +14,8 @@ | ||
require("./Form"); | ||
var _Form = require("./Form"); | ||
var _withFormContext = require("./withFormContext"); | ||
var _withFormContext2 = _interopRequireDefault(_withFormContext); | ||
var _formState = require("./formState"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
// strict | ||
function flattenErrors(errors) { | ||
@@ -53,2 +47,14 @@ var flatErrors = []; | ||
exports.default = (0, _withFormContext2.default)(ErrorsHelper); | ||
// Using a HOC here is not possible due to a Flow bug: https://github.com/facebook/flow/issues/6903 | ||
function wrap(props) { | ||
return React.createElement( | ||
_Form.FormContext.Consumer, | ||
null, | ||
function (formContext) { | ||
return React.createElement(ErrorsHelper, _extends({}, props, { formContext: formContext })); | ||
} | ||
); | ||
} | ||
wrap.defaultProps = ErrorsHelper.defaultProps; | ||
exports.default = wrap; |
{ | ||
"name": "formula-one", | ||
"version": "0.9.0-alpha.2", | ||
"version": "0.9.0-alpha.3", | ||
"description": "Strongly-typed React form state management", | ||
@@ -5,0 +5,0 @@ "author": "Zach Gotsch", |
@@ -5,4 +5,3 @@ // @flow strict | ||
import type {FieldLink, ClientErrors, ServerErrors, Err} from "./types"; | ||
import {type FormContextPayload} from "./Form"; | ||
import withFormContext from "./withFormContext"; | ||
import {FormContext, type FormContextPayload} from "./Form"; | ||
import {getExtras} from "./formState"; | ||
@@ -43,2 +42,12 @@ | ||
export default withFormContext(ErrorsHelper); | ||
// Using a HOC here is not possible due to a Flow bug: https://github.com/facebook/flow/issues/6903 | ||
function wrap<E>(props: $Diff<Props<E>, {+formContext: FormContextPayload}>) { | ||
return ( | ||
<FormContext.Consumer> | ||
{formContext => <ErrorsHelper {...props} formContext={formContext} />} | ||
</FormContext.Consumer> | ||
); | ||
} | ||
wrap.defaultProps = ErrorsHelper.defaultProps; | ||
export default wrap; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
308419
7766