@jcoreio/zod-forms 1.0.3 → 1.0.4
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/package.json +1 -1
- package/src/useFormContext.ts +4 -1
- package/src/useFormDispatch.ts +4 -1
- package/src/useInitialize.ts +6 -1
- package/useFormContext.d.ts +1 -1
- package/useFormContext.d.ts.map +1 -1
- package/useFormContext.js.map +1 -1
- package/useFormContext.mjs.map +1 -1
- package/useFormDispatch.d.ts +1 -1
- package/useFormDispatch.d.ts.map +1 -1
- package/useFormDispatch.js.map +1 -1
- package/useFormDispatch.mjs.map +1 -1
- package/useInitialize.d.ts +1 -1
- package/useInitialize.d.ts.map +1 -1
- package/useInitialize.js.map +1 -1
- package/useInitialize.mjs.map +1 -1
package/package.json
CHANGED
package/src/useFormContext.ts
CHANGED
|
@@ -3,7 +3,10 @@ import React from 'react'
|
|
|
3
3
|
import { FormContext, FormContextProps } from './FormContext'
|
|
4
4
|
|
|
5
5
|
export function useFormContext<
|
|
6
|
-
T extends z.ZodTypeAny = z.
|
|
6
|
+
T extends z.ZodTypeAny = z.ZodBranded<
|
|
7
|
+
z.ZodNever,
|
|
8
|
+
'you must pass a schema type'
|
|
9
|
+
>
|
|
7
10
|
>(): FormContextProps<T> {
|
|
8
11
|
const props: FormContextProps<T> = React.useContext(FormContext) as any
|
|
9
12
|
if (!props) {
|
package/src/useFormDispatch.ts
CHANGED
|
@@ -9,5 +9,8 @@ export const useFormDispatch = createDispatchHook(
|
|
|
9
9
|
) as typeof useFormDispatchType
|
|
10
10
|
|
|
11
11
|
declare function useFormDispatchType<
|
|
12
|
-
T extends z.ZodTypeAny = z.
|
|
12
|
+
T extends z.ZodTypeAny = z.ZodBranded<
|
|
13
|
+
z.ZodNever,
|
|
14
|
+
'you must pass a schema type'
|
|
15
|
+
>
|
|
13
16
|
>(): Dispatch<FormAction<T>>
|
package/src/useInitialize.ts
CHANGED
|
@@ -3,7 +3,12 @@ import React, { DependencyList } from 'react'
|
|
|
3
3
|
import { useFormContext } from './useFormContext'
|
|
4
4
|
import { InitializeAction } from './actions/initialize'
|
|
5
5
|
|
|
6
|
-
export function useInitialize<
|
|
6
|
+
export function useInitialize<
|
|
7
|
+
T extends z.ZodTypeAny = z.ZodBranded<
|
|
8
|
+
z.ZodNever,
|
|
9
|
+
'you must pass a schema type'
|
|
10
|
+
>
|
|
11
|
+
>(
|
|
7
12
|
options: Omit<InitializeAction<T>, 'type'>,
|
|
8
13
|
deps: DependencyList = [options.values, options.rawValues]
|
|
9
14
|
) {
|
package/useFormContext.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
import { FormContextProps } from './FormContext';
|
|
3
|
-
export declare function useFormContext<T extends z.ZodTypeAny = z.
|
|
3
|
+
export declare function useFormContext<T extends z.ZodTypeAny = z.ZodBranded<z.ZodNever, 'you must pass a schema type'>>(): FormContextProps<T>;
|
|
4
4
|
//# sourceMappingURL=useFormContext.d.ts.map
|
package/useFormContext.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormContext.d.ts","sourceRoot":"","sources":["src/useFormContext.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,OAAO,EAAe,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAE7D,wBAAgB,cAAc,CAC5B,CAAC,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"useFormContext.d.ts","sourceRoot":"","sources":["src/useFormContext.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,OAAO,EAAe,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAE7D,wBAAgB,cAAc,CAC5B,CAAC,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CACnC,CAAC,CAAC,QAAQ,EACV,6BAA6B,CAC9B,KACE,gBAAgB,CAAC,CAAC,CAAC,CAMvB"}
|
package/useFormContext.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormContext.js","names":["_react","_interopRequireDefault","require","_FormContext","useFormContext","props","React","useContext","FormContext","Error"],"sources":["src/useFormContext.ts"],"sourcesContent":["import z from 'zod'\nimport React from 'react'\nimport { FormContext, FormContextProps } from './FormContext'\n\nexport function useFormContext<\n T extends z.ZodTypeAny = z.
|
|
1
|
+
{"version":3,"file":"useFormContext.js","names":["_react","_interopRequireDefault","require","_FormContext","useFormContext","props","React","useContext","FormContext","Error"],"sources":["src/useFormContext.ts"],"sourcesContent":["import z from 'zod'\nimport React from 'react'\nimport { FormContext, FormContextProps } from './FormContext'\n\nexport function useFormContext<\n T extends z.ZodTypeAny = z.ZodBranded<\n z.ZodNever,\n 'you must pass a schema type'\n >\n>(): FormContextProps<T> {\n const props: FormContextProps<T> = React.useContext(FormContext) as any\n if (!props) {\n throw new Error(`must be used inside a <FormProvider>`)\n }\n return props\n}\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEO,SAASE,cAAcA,CAAA,EAKL;EACvB,IAAMC,KAA0B,GAAGC,iBAAK,CAACC,UAAU,CAACC,wBAAW,CAAQ;EACvE,IAAI,CAACH,KAAK,EAAE;IACV,MAAM,IAAII,KAAK,uCAAuC,CAAC;EACzD;EACA,OAAOJ,KAAK;AACd","ignoreList":[]}
|
package/useFormContext.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormContext.mjs","names":["React","FormContext","useFormContext","props","useContext","Error"],"sources":["src/useFormContext.ts"],"sourcesContent":["import z from 'zod'\nimport React from 'react'\nimport { FormContext, FormContextProps } from './FormContext'\n\nexport function useFormContext<\n T extends z.ZodTypeAny = z.
|
|
1
|
+
{"version":3,"file":"useFormContext.mjs","names":["React","FormContext","useFormContext","props","useContext","Error"],"sources":["src/useFormContext.ts"],"sourcesContent":["import z from 'zod'\nimport React from 'react'\nimport { FormContext, FormContextProps } from './FormContext'\n\nexport function useFormContext<\n T extends z.ZodTypeAny = z.ZodBranded<\n z.ZodNever,\n 'you must pass a schema type'\n >\n>(): FormContextProps<T> {\n const props: FormContextProps<T> = React.useContext(FormContext) as any\n if (!props) {\n throw new Error(`must be used inside a <FormProvider>`)\n }\n return props\n}\n"],"mappings":"AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW;AAEpB,OAAO,SAASC,cAAcA,CAAA,EAKL;EACvB,MAAMC,KAA0B,GAAGH,KAAK,CAACI,UAAU,CAACH,WAAW,CAAQ;EACvE,IAAI,CAACE,KAAK,EAAE;IACV,MAAM,IAAIE,KAAK,CAAC,sCAAsC,CAAC;EACzD;EACA,OAAOF,KAAK;AACd","ignoreList":[]}
|
package/useFormDispatch.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import z from 'zod';
|
|
|
2
2
|
import { FormAction } from './FormAction';
|
|
3
3
|
import { Dispatch } from 'redux';
|
|
4
4
|
export declare const useFormDispatch: typeof useFormDispatchType;
|
|
5
|
-
declare function useFormDispatchType<T extends z.ZodTypeAny = z.ZodNever
|
|
5
|
+
declare function useFormDispatchType<T extends z.ZodTypeAny = z.ZodBranded<z.ZodNever, 'you must pass a schema type'>>(): Dispatch<FormAction<T>>;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=useFormDispatch.d.ts.map
|
package/useFormDispatch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormDispatch.d.ts","sourceRoot":"","sources":["src/useFormDispatch.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,KAAK,CAAA;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,eAAO,MAAM,eAAe,EAEvB,OAAO,mBAAmB,CAAA;AAE/B,OAAO,UAAU,mBAAmB,CAClC,CAAC,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"useFormDispatch.d.ts","sourceRoot":"","sources":["src/useFormDispatch.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,KAAK,CAAA;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,eAAO,MAAM,eAAe,EAEvB,OAAO,mBAAmB,CAAA;AAE/B,OAAO,UAAU,mBAAmB,CAClC,CAAC,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CACnC,CAAC,CAAC,QAAQ,EACV,6BAA6B,CAC9B,KACE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA"}
|
package/useFormDispatch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormDispatch.js","names":["_reactRedux","require","_FormStateContext","useFormDispatch","exports","createDispatchHook","FormStateContext"],"sources":["src/useFormDispatch.ts"],"sourcesContent":["import { createDispatchHook } from 'react-redux'\nimport { FormStateContext } from './FormStateContext'\nimport z from 'zod'\nimport { FormAction } from './FormAction'\nimport { Dispatch } from 'redux'\n\nexport const useFormDispatch = createDispatchHook(\n FormStateContext\n) as typeof useFormDispatchType\n\ndeclare function useFormDispatchType<\n T extends z.ZodTypeAny = z.ZodNever\n>(): Dispatch<FormAction<T>>\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAKO,IAAME,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,IAAAE,8BAAkB,EAC/CC,kCACF,CAA+B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"useFormDispatch.js","names":["_reactRedux","require","_FormStateContext","useFormDispatch","exports","createDispatchHook","FormStateContext"],"sources":["src/useFormDispatch.ts"],"sourcesContent":["import { createDispatchHook } from 'react-redux'\nimport { FormStateContext } from './FormStateContext'\nimport z from 'zod'\nimport { FormAction } from './FormAction'\nimport { Dispatch } from 'redux'\n\nexport const useFormDispatch = createDispatchHook(\n FormStateContext\n) as typeof useFormDispatchType\n\ndeclare function useFormDispatchType<\n T extends z.ZodTypeAny = z.ZodBranded<\n z.ZodNever,\n 'you must pass a schema type'\n >\n>(): Dispatch<FormAction<T>>\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAKO,IAAME,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,IAAAE,8BAAkB,EAC/CC,kCACF,CAA+B","ignoreList":[]}
|
package/useFormDispatch.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormDispatch.mjs","names":["createDispatchHook","FormStateContext","useFormDispatch"],"sources":["src/useFormDispatch.ts"],"sourcesContent":["import { createDispatchHook } from 'react-redux'\nimport { FormStateContext } from './FormStateContext'\nimport z from 'zod'\nimport { FormAction } from './FormAction'\nimport { Dispatch } from 'redux'\n\nexport const useFormDispatch = createDispatchHook(\n FormStateContext\n) as typeof useFormDispatchType\n\ndeclare function useFormDispatchType<\n T extends z.ZodTypeAny = z.ZodNever\n>(): Dispatch<FormAction<T>>\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,aAAa;AAChD,SAASC,gBAAgB;AAKzB,OAAO,MAAMC,eAAe,GAAGF,kBAAkB,CAC/CC,gBACF,CAA+B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"useFormDispatch.mjs","names":["createDispatchHook","FormStateContext","useFormDispatch"],"sources":["src/useFormDispatch.ts"],"sourcesContent":["import { createDispatchHook } from 'react-redux'\nimport { FormStateContext } from './FormStateContext'\nimport z from 'zod'\nimport { FormAction } from './FormAction'\nimport { Dispatch } from 'redux'\n\nexport const useFormDispatch = createDispatchHook(\n FormStateContext\n) as typeof useFormDispatchType\n\ndeclare function useFormDispatchType<\n T extends z.ZodTypeAny = z.ZodBranded<\n z.ZodNever,\n 'you must pass a schema type'\n >\n>(): Dispatch<FormAction<T>>\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,aAAa;AAChD,SAASC,gBAAgB;AAKzB,OAAO,MAAMC,eAAe,GAAGF,kBAAkB,CAC/CC,gBACF,CAA+B","ignoreList":[]}
|
package/useInitialize.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
import { DependencyList } from 'react';
|
|
3
3
|
import { InitializeAction } from './actions/initialize';
|
|
4
|
-
export declare function useInitialize<T extends z.ZodTypeAny = z.ZodNever
|
|
4
|
+
export declare function useInitialize<T extends z.ZodTypeAny = z.ZodBranded<z.ZodNever, 'you must pass a schema type'>>(options: Omit<InitializeAction<T>, 'type'>, deps?: DependencyList): void;
|
|
5
5
|
//# sourceMappingURL=useInitialize.d.ts.map
|
package/useInitialize.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInitialize.d.ts","sourceRoot":"","sources":["src/useInitialize.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AACnB,OAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,wBAAgB,aAAa,
|
|
1
|
+
{"version":3,"file":"useInitialize.d.ts","sourceRoot":"","sources":["src/useInitialize.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AACnB,OAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,wBAAgB,aAAa,CAC3B,CAAC,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CACnC,CAAC,CAAC,QAAQ,EACV,6BAA6B,CAC9B,EAED,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAC1C,IAAI,GAAE,cAAoD,QAM3D"}
|
package/useInitialize.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInitialize.js","names":["_react","_interopRequireDefault","require","_useFormContext2","useInitialize","options","deps","arguments","length","undefined","values","rawValues","_useFormContext","useFormContext","initialize","React","useEffect"],"sources":["src/useInitialize.ts"],"sourcesContent":["import z from 'zod'\nimport React, { DependencyList } from 'react'\nimport { useFormContext } from './useFormContext'\nimport { InitializeAction } from './actions/initialize'\n\nexport function useInitialize
|
|
1
|
+
{"version":3,"file":"useInitialize.js","names":["_react","_interopRequireDefault","require","_useFormContext2","useInitialize","options","deps","arguments","length","undefined","values","rawValues","_useFormContext","useFormContext","initialize","React","useEffect"],"sources":["src/useInitialize.ts"],"sourcesContent":["import z from 'zod'\nimport React, { DependencyList } from 'react'\nimport { useFormContext } from './useFormContext'\nimport { InitializeAction } from './actions/initialize'\n\nexport function useInitialize<\n T extends z.ZodTypeAny = z.ZodBranded<\n z.ZodNever,\n 'you must pass a schema type'\n >\n>(\n options: Omit<InitializeAction<T>, 'type'>,\n deps: DependencyList = [options.values, options.rawValues]\n) {\n const { initialize } = useFormContext<T>()\n React.useEffect(() => {\n initialize(options)\n }, deps)\n}\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAGO,SAASE,aAAaA,CAM3BC,OAA0C,EAE1C;EAAA,IADAC,IAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAACF,OAAO,CAACK,MAAM,EAAEL,OAAO,CAACM,SAAS,CAAC;EAE1D,IAAAC,eAAA,GAAuB,IAAAC,+BAAc,EAAI,CAAC;IAAlCC,UAAU,GAAAF,eAAA,CAAVE,UAAU;EAClBC,iBAAK,CAACC,SAAS,CAAC,YAAM;IACpBF,UAAU,CAACT,OAAO,CAAC;EACrB,CAAC,EAAEC,IAAI,CAAC;AACV","ignoreList":[]}
|
package/useInitialize.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInitialize.mjs","names":["React","useFormContext","useInitialize","options","deps","values","rawValues","initialize","useEffect"],"sources":["src/useInitialize.ts"],"sourcesContent":["import z from 'zod'\nimport React, { DependencyList } from 'react'\nimport { useFormContext } from './useFormContext'\nimport { InitializeAction } from './actions/initialize'\n\nexport function useInitialize
|
|
1
|
+
{"version":3,"file":"useInitialize.mjs","names":["React","useFormContext","useInitialize","options","deps","values","rawValues","initialize","useEffect"],"sources":["src/useInitialize.ts"],"sourcesContent":["import z from 'zod'\nimport React, { DependencyList } from 'react'\nimport { useFormContext } from './useFormContext'\nimport { InitializeAction } from './actions/initialize'\n\nexport function useInitialize<\n T extends z.ZodTypeAny = z.ZodBranded<\n z.ZodNever,\n 'you must pass a schema type'\n >\n>(\n options: Omit<InitializeAction<T>, 'type'>,\n deps: DependencyList = [options.values, options.rawValues]\n) {\n const { initialize } = useFormContext<T>()\n React.useEffect(() => {\n initialize(options)\n }, deps)\n}\n"],"mappings":"AACA,OAAOA,KAAK,MAA0B,OAAO;AAC7C,SAASC,cAAc;AAGvB,OAAO,SAASC,aAAaA,CAM3BC,OAA0C,EAC1CC,IAAoB,GAAG,CAACD,OAAO,CAACE,MAAM,EAAEF,OAAO,CAACG,SAAS,CAAC,EAC1D;EACA,MAAM;IAAEC;EAAW,CAAC,GAAGN,cAAc,CAAI,CAAC;EAC1CD,KAAK,CAACQ,SAAS,CAAC,MAAM;IACpBD,UAAU,CAACJ,OAAO,CAAC;EACrB,CAAC,EAAEC,IAAI,CAAC;AACV","ignoreList":[]}
|