formula-one
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.TestUtils = exports.makeField = exports.ErrorsHelper = exports.ArrayField = exports.ObjectField = exports.Form = undefined; | ||
exports.TestUtils = exports.Field = exports.ErrorsHelper = exports.ArrayField = exports.ObjectField = exports.Form = undefined; | ||
@@ -45,8 +45,8 @@ var _Form = require("./Form"); | ||
var _makeField = require("./makeField"); | ||
var _Field = require("./Field"); | ||
Object.defineProperty(exports, "makeField", { | ||
Object.defineProperty(exports, "Field", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_makeField).default; | ||
return _interopRequireDefault(_Field).default; | ||
} | ||
@@ -53,0 +53,0 @@ }); |
@@ -14,5 +14,5 @@ "use strict"; | ||
var _makeField = require("../makeField"); | ||
var _Field = require("../Field"); | ||
var _makeField2 = _interopRequireDefault(_makeField); | ||
var _Field2 = _interopRequireDefault(_Field); | ||
@@ -58,2 +58,37 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = (0, _makeField2.default)(TestInput); | ||
var TestField = function (_React$Component2) { | ||
_inherits(TestField, _React$Component2); | ||
function TestField() { | ||
_classCallCheck(this, TestField); | ||
return _possibleConstructorReturn(this, (TestField.__proto__ || Object.getPrototypeOf(TestField)).apply(this, arguments)); | ||
} | ||
_createClass(TestField, [{ | ||
key: "render", | ||
value: function render() { | ||
return React.createElement( | ||
_Field2.default, | ||
{ link: this.props.link, validation: this.props.validation }, | ||
function (value, errors, onChange, onBlur) { | ||
return React.createElement(TestInput, { | ||
value: value, | ||
errors: errors, | ||
onChange: onChange, | ||
onBlur: onBlur | ||
}); | ||
} | ||
); | ||
} | ||
}]); | ||
return TestField; | ||
}(React.Component); | ||
TestField.defaultProps = { | ||
validation: function validation() { | ||
return []; | ||
} | ||
}; | ||
exports.default = TestField; |
{ | ||
"name": "formula-one", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Strongly-typed React form state management", | ||
@@ -5,0 +5,0 @@ "author": "Zach Gotsch", |
@@ -8,3 +8,3 @@ // @flow strict | ||
export {default as ErrorsHelper} from "./ErrorsHelper"; | ||
export {default as makeField} from "./makeField"; | ||
export {default as Field} from "./Field"; | ||
@@ -11,0 +11,0 @@ export type {FeedbackStrategy} from "./Form"; |
import * as React from "react"; | ||
import makeField from "../makeField"; | ||
import Field from "../Field"; | ||
@@ -22,2 +22,26 @@ export class TestInput extends React.Component<{| | ||
export default makeField(TestInput); | ||
type Props = {| | ||
link: FieldLink<T>, | ||
validation: Validation<T>, | ||
|}; | ||
export default class TestField extends React.Component<Props> { | ||
static defaultProps = { | ||
validation: () => [], | ||
}; | ||
render() { | ||
return ( | ||
<Field link={this.props.link} validation={this.props.validation}> | ||
{(value, errors, onChange, onBlur) => ( | ||
<TestInput | ||
value={value} | ||
errors={errors} | ||
onChange={onChange} | ||
onBlur={onBlur} | ||
/> | ||
)} | ||
</Field> | ||
); | ||
} | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
201958
5025
0