@goodie-forms/react 1.0.0-alpha

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.
@@ -0,0 +1,22 @@
1
+ import { Field, FormField } from '../../../core/src';
2
+ import { ChangeEvent, FocusEvent, ReactNode, Ref } from 'react';
3
+ import { UseForm } from '../hooks/useForm';
4
+ export interface RenderParams<TShape extends object, TPath extends Field.Paths<TShape>> {
5
+ ref: Ref<any | null>;
6
+ value: Field.GetValue<TShape, TPath> | undefined;
7
+ handlers: {
8
+ onChange: (event: ChangeEvent<EventTarget>) => void;
9
+ onFocus: (event: FocusEvent) => void;
10
+ onBlur: (event: FocusEvent) => void;
11
+ };
12
+ field: FormField<TShape, TPath>;
13
+ }
14
+ export interface FieldRendererProps<TShape extends object, TPath extends Field.Paths<TShape>> {
15
+ form: UseForm<TShape>;
16
+ path: TPath;
17
+ resetOnUnmount?: boolean;
18
+ defaultValue?: Field.GetValue<TShape, TPath>;
19
+ render: (params: RenderParams<TShape, TPath>) => ReactNode;
20
+ }
21
+ export declare function FieldRenderer<TShape extends object, TPath extends Field.Paths<TShape>>(props: FieldRendererProps<TShape, TPath>): import("react/jsx-runtime").JSX.Element;
22
+ //# sourceMappingURL=FieldRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldRenderer.d.ts","sourceRoot":"","sources":["../../src/components/FieldRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,WAAW,EACX,UAAU,EACV,SAAS,EACT,GAAG,EAGJ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,MAAM,WAAW,YAAY,CAC3B,MAAM,SAAS,MAAM,EACrB,KAAK,SAAS,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;IAEjC,GAAG,EAAE,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;IAErB,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC;IAEjD,QAAQ,EAAE;QACR,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;QACpD,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;QACrC,MAAM,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;KACrC,CAAC;IAEF,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,kBAAkB,CACjC,MAAM,SAAS,MAAM,EACrB,KAAK,SAAS,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;IAEjC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACtB,IAAI,EAAE,KAAK,CAAC;IACZ,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC7C,MAAM,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,SAAS,CAAC;CAC5D;AAED,wBAAgB,aAAa,CAC3B,MAAM,SAAS,MAAM,EACrB,KAAK,SAAS,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,EACjC,KAAK,EAAE,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,2CA8DzC"}
@@ -0,0 +1,22 @@
1
+ import { FormController, Form } from '../../../core/src';
2
+ export declare function useForm<TShape extends object>(formConfigs: Form.FormConfigs<TShape>, hookConfigs?: {
3
+ validateMode?: "onChange" | "onBlur" | "onSubmit";
4
+ revalidateMode?: "onChange" | "onBlur" | "onSubmit";
5
+ watchIssues?: boolean;
6
+ watchValues?: boolean;
7
+ }): {
8
+ formConfigs: {
9
+ initialData?: import('packages/core/src/types/DeepPartial').DeepPartial<TShape> | undefined;
10
+ validationSchema?: import('@standard-schema/spec').StandardSchemaV1<TShape, TShape> | undefined;
11
+ equalityComparators?: Record<any, (a: any, b: any) => boolean>;
12
+ };
13
+ hookConfigs: {
14
+ validateMode?: "onChange" | "onBlur" | "onSubmit";
15
+ revalidateMode?: "onChange" | "onBlur" | "onSubmit";
16
+ watchIssues?: boolean;
17
+ watchValues?: boolean;
18
+ } | undefined;
19
+ controller: FormController<TShape>;
20
+ };
21
+ export type UseForm<TShape extends object> = ReturnType<typeof useForm<TShape>>;
22
+ //# sourceMappingURL=useForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../src/hooks/useForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAK/D,wBAAgB,OAAO,CAAC,MAAM,SAAS,MAAM,EAC3C,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EACrC,WAAW,CAAC,EAAE;IACZ,YAAY,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;IAClD,cAAc,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;IACpD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;;;;;;;uBAJgB,UAAU,GAAG,QAAQ,GAAG,UAAU;yBAChC,UAAU,GAAG,QAAQ,GAAG,UAAU;sBACrC,OAAO;sBACP,OAAO;;;EAqCxB;AAED,MAAM,MAAM,OAAO,CAAC,MAAM,SAAS,MAAM,IAAI,UAAU,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Field } from '../../../core/src';
2
+ import { UseForm } from './useForm';
3
+ export declare function useFormErrorObserver<TShape extends object>(form: UseForm<TShape>, options?: {
4
+ include?: Field.Paths<TShape>[];
5
+ }): Record<Field.Paths<TShape>, import("@standard-schema/spec").StandardSchemaV1.Issue[]>;
6
+ //# sourceMappingURL=useFormErrorObserver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormErrorObserver.d.ts","sourceRoot":"","sources":["../../src/hooks/useFormErrorObserver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAIhD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,wBAAgB,oBAAoB,CAAC,MAAM,SAAS,MAAM,EACxD,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,EACrB,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;CACjC,yFA0BF"}
@@ -0,0 +1,4 @@
1
+ import { Field } from '../../../core/src';
2
+ import { UseForm } from '../hooks/useForm';
3
+ export declare function useFormField<TShape extends object, TPath extends Field.Paths<TShape>>(form: UseForm<TShape>, path: TPath, defaultValue?: Field.GetValue<TShape, TPath>): import('../../../core/src').FormField<TShape, TPath>;
4
+ //# sourceMappingURL=useFormField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormField.d.ts","sourceRoot":"","sources":["../../src/hooks/useFormField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,wBAAgB,YAAY,CAC1B,MAAM,SAAS,MAAM,EACrB,KAAK,SAAS,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,EAEjC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,EACrB,IAAI,EAAE,KAAK,EACX,YAAY,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,yDAiC7C"}
@@ -0,0 +1,6 @@
1
+ import { Field } from '../../../core/src';
2
+ import { UseForm } from './useForm';
3
+ export declare function useFormValuesObserver<TShape extends object>(form: UseForm<TShape>, options?: {
4
+ include?: Field.Paths<TShape>[];
5
+ }): import('packages/core/src/types/DeepPartial').DeepPartial<TShape>;
6
+ //# sourceMappingURL=useFormValuesObserver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormValuesObserver.d.ts","sourceRoot":"","sources":["../../src/hooks/useFormValuesObserver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,wBAAgB,qBAAqB,CAAC,MAAM,SAAS,MAAM,EACzD,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,EACrB,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;CACjC,qEAuBF"}
@@ -0,0 +1,5 @@
1
+ export declare function useRenderControl(): {
2
+ renderCount: number;
3
+ forceRerender: () => void;
4
+ };
5
+ //# sourceMappingURL=useRenderControl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRenderControl.d.ts","sourceRoot":"","sources":["../../src/hooks/useRenderControl.tsx"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB;;;EAS/B"}
@@ -0,0 +1,7 @@
1
+ export * from './hooks/useForm';
2
+ export * from './hooks/useFormField';
3
+ export * from './hooks/useFormValuesObserver';
4
+ export * from './hooks/useFormErrorObserver';
5
+ export * from './hooks/useRenderControl';
6
+ export * from './components/FieldRenderer';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,4BAA4B,CAAC"}