@danderson00/react-forms 0.0.39 → 0.0.41

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.
package/dist/useForm.js CHANGED
@@ -8,10 +8,17 @@ exports["default"] = void 0;
8
8
  var _react = require("react");
9
9
 
10
10
  var _default = function _default(context) {
11
- return function useFormValues() {
11
+ return function useForm() {
12
+ var _useContext = (0, _react.useContext)(context),
13
+ onSubmit = _useContext.onSubmit,
14
+ getFieldValues = _useContext.getFieldValues;
15
+
12
16
  return {
13
17
  submit: function submit(options) {
14
- return (0, _react.useContext)(context).onSubmit(undefined, options);
18
+ return onSubmit(undefined, options);
19
+ },
20
+ values: function values() {
21
+ return getFieldValues();
15
22
  }
16
23
  };
17
24
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useForm.js","names":["context","useFormValues","submit","options","useContext","onSubmit","undefined"],"sources":["../src/useForm.js"],"sourcesContent":["import { useContext } from 'react'\n\nexport default context => function useFormValues() {\n return {\n submit: options => useContext(context).onSubmit(undefined, options)\n }\n}"],"mappings":";;;;;;;AAAA;;eAEe,kBAAAA,OAAO;EAAA,OAAI,SAASC,aAAT,GAAyB;IACjD,OAAO;MACLC,MAAM,EAAE,gBAAAC,OAAO;QAAA,OAAI,IAAAC,iBAAA,EAAWJ,OAAX,EAAoBK,QAApB,CAA6BC,SAA7B,EAAwCH,OAAxC,CAAJ;MAAA;IADV,CAAP;EAGD,CAJqB;AAAA,C"}
1
+ {"version":3,"file":"useForm.js","names":["context","useForm","useContext","onSubmit","getFieldValues","submit","options","undefined","values"],"sources":["../src/useForm.js"],"sourcesContent":["import { useContext } from 'react'\n\nexport default context => function useForm() {\n const { onSubmit, getFieldValues } = useContext(context)\n\n return {\n submit: options => onSubmit(undefined, options),\n values: () => getFieldValues()\n }\n}"],"mappings":";;;;;;;AAAA;;eAEe,kBAAAA,OAAO;EAAA,OAAI,SAASC,OAAT,GAAmB;IAC3C,kBAAqC,IAAAC,iBAAA,EAAWF,OAAX,CAArC;IAAA,IAAQG,QAAR,eAAQA,QAAR;IAAA,IAAkBC,cAAlB,eAAkBA,cAAlB;;IAEA,OAAO;MACLC,MAAM,EAAE,gBAAAC,OAAO;QAAA,OAAIH,QAAQ,CAACI,SAAD,EAAYD,OAAZ,CAAZ;MAAA,CADV;MAELE,MAAM,EAAE;QAAA,OAAMJ,cAAc,EAApB;MAAA;IAFH,CAAP;EAID,CAPqB;AAAA,C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danderson00/react-forms",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "description": "Ultra simple, stateless, validated forms for use in React function components",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/index.js",
package/src/useForm.js CHANGED
@@ -1,7 +1,10 @@
1
1
  import { useContext } from 'react'
2
2
 
3
- export default context => function useFormValues() {
3
+ export default context => function useForm() {
4
+ const { onSubmit, getFieldValues } = useContext(context)
5
+
4
6
  return {
5
- submit: options => useContext(context).onSubmit(undefined, options)
7
+ submit: options => onSubmit(undefined, options),
8
+ values: () => getFieldValues()
6
9
  }
7
10
  }