@reactables/react-forms 0.7.0-alpha.0 → 0.7.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  export { Form } from './Form';
2
- export { Field } from './Field';
3
- export { FormArray } from './FormArray';
2
+ export { Field, WrappedFieldInputProps, WrappedFieldProps, FieldProps } from './Field';
3
+ export { FormArray, FormArrayChildrenProps, FormArrayProps } from './FormArray';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './Components';
2
- export * from './Hooks';
3
2
  export * from '@reactables/forms';
package/dist/index.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var forms = require('@reactables/forms');
7
- var reactHelpers = require('@reactables/react-helpers');
8
7
 
9
8
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
9
 
@@ -63,6 +62,9 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
63
62
  var Field = function (_a) {
64
63
  var Component = _a.component, _b = _a.name, name = _b === void 0 ? 'root' : _b, props = __rest(_a, ["component", "name"]);
65
64
  var _c = React.useContext(FormContext), state = _c[0], _d = _c[1], markControlAsTouched = _d.markControlAsTouched, updateValues = _d.updateValues;
65
+ if (!state[name]) {
66
+ throw "Control '".concat(name, "' can not be found");
67
+ }
66
68
  var _e = state[name], controlRef = _e.controlRef, touched = _e.touched, value = _e.value;
67
69
  var inputProps = {
68
70
  name: name,
@@ -111,16 +113,9 @@ var FormArray = function (_a) {
111
113
  return React__default["default"].createElement("div", null, children && children(formArrayChildrenProps));
112
114
  };
113
115
 
114
- var useForm = function (config) {
115
- var form = React.useMemo(function () { return forms.build(config); }, []);
116
- var rxForm = reactHelpers.useReactable(form);
117
- return rxForm;
118
- };
119
-
120
116
  exports.Field = Field;
121
117
  exports.Form = Form;
122
118
  exports.FormArray = FormArray;
123
- exports.useForm = useForm;
124
119
  Object.keys(forms).forEach(function (k) {
125
120
  if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
126
121
  enumerable: true,
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "license": "ISC",
18
18
  "dependencies": {
19
19
  "@reactables/core": "*",
20
- "@reactables/forms": "^0.7.0-alpha.0",
20
+ "@reactables/forms": "^0.7.0-alpha.10",
21
21
  "@reactables/react-helpers": "*"
22
22
  },
23
23
  "peerDependencies": {
@@ -25,5 +25,5 @@
25
25
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
26
26
  "rxjs": "^6.0.0 || ^7.0.0"
27
27
  },
28
- "version": "0.7.0-alpha.0"
28
+ "version": "0.7.0-alpha.10"
29
29
  }
@@ -1 +0,0 @@
1
- export { useForm } from './useForm';
@@ -1,3 +0,0 @@
1
- import { AbstractControlConfig } from '@reactables/forms';
2
- import { HookedRxForm } from '../Components/Form';
3
- export declare const useForm: (config: AbstractControlConfig) => HookedRxForm;