@zod-to-form/react 0.2.3 → 0.2.5

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.
Files changed (62) hide show
  1. package/README.md +142 -0
  2. package/dist/FieldRenderer.d.ts +11 -2
  3. package/dist/FieldRenderer.d.ts.map +1 -1
  4. package/dist/FieldRenderer.js +131 -27
  5. package/dist/FieldRenderer.js.map +1 -1
  6. package/dist/ZodForm.d.ts +7 -3
  7. package/dist/ZodForm.d.ts.map +1 -1
  8. package/dist/ZodForm.js +8 -4
  9. package/dist/ZodForm.js.map +1 -1
  10. package/dist/components/Checkbox.d.ts +1 -1
  11. package/dist/components/Checkbox.d.ts.map +1 -1
  12. package/dist/components/Checkbox.js +3 -2
  13. package/dist/components/Checkbox.js.map +1 -1
  14. package/dist/components/Combobox.d.ts +1 -1
  15. package/dist/components/Combobox.d.ts.map +1 -1
  16. package/dist/components/Combobox.js +3 -2
  17. package/dist/components/Combobox.js.map +1 -1
  18. package/dist/components/DatePicker.d.ts +1 -1
  19. package/dist/components/DatePicker.d.ts.map +1 -1
  20. package/dist/components/DatePicker.js +3 -2
  21. package/dist/components/DatePicker.js.map +1 -1
  22. package/dist/components/FileInput.d.ts +1 -1
  23. package/dist/components/FileInput.d.ts.map +1 -1
  24. package/dist/components/FileInput.js +3 -2
  25. package/dist/components/FileInput.js.map +1 -1
  26. package/dist/components/Input.d.ts +1 -1
  27. package/dist/components/Input.d.ts.map +1 -1
  28. package/dist/components/Input.js +3 -2
  29. package/dist/components/Input.js.map +1 -1
  30. package/dist/components/RadioGroup.d.ts +1 -1
  31. package/dist/components/RadioGroup.d.ts.map +1 -1
  32. package/dist/components/RadioGroup.js +3 -2
  33. package/dist/components/RadioGroup.js.map +1 -1
  34. package/dist/components/Select.d.ts +1 -1
  35. package/dist/components/Select.d.ts.map +1 -1
  36. package/dist/components/Select.js +3 -2
  37. package/dist/components/Select.js.map +1 -1
  38. package/dist/components/Switch.d.ts +1 -1
  39. package/dist/components/Switch.d.ts.map +1 -1
  40. package/dist/components/Switch.js +3 -2
  41. package/dist/components/Switch.js.map +1 -1
  42. package/dist/components/Textarea.d.ts +1 -1
  43. package/dist/components/Textarea.d.ts.map +1 -1
  44. package/dist/components/Textarea.js +3 -2
  45. package/dist/components/Textarea.js.map +1 -1
  46. package/dist/components/index.d.ts +24 -26
  47. package/dist/components/index.d.ts.map +1 -1
  48. package/dist/components/index.js +8 -8
  49. package/dist/components/index.js.map +1 -1
  50. package/dist/index.d.ts +2 -1
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +1 -1
  53. package/dist/index.js.map +1 -1
  54. package/dist/shadcn/index.d.ts +22 -17
  55. package/dist/shadcn/index.d.ts.map +1 -1
  56. package/dist/shadcn/index.js +16 -16
  57. package/dist/shadcn/index.js.map +1 -1
  58. package/dist/useZodForm.d.ts +5 -3
  59. package/dist/useZodForm.d.ts.map +1 -1
  60. package/dist/useZodForm.js +21 -3
  61. package/dist/useZodForm.js.map +1 -1
  62. package/package.json +4 -4
@@ -1,3 +1,3 @@
1
1
  import type { InputHTMLAttributes } from 'react';
2
- export declare function Input(props: InputHTMLAttributes<HTMLInputElement>): import("react/jsx-runtime").JSX.Element;
2
+ export declare const Input: import("react").MemoExoticComponent<(props: InputHTMLAttributes<HTMLInputElement>) => import("react/jsx-runtime").JSX.Element>;
3
3
  //# sourceMappingURL=Input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAEjD,wBAAgB,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,2CAEjE"}
1
+ {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAEjD,eAAO,MAAM,KAAK,gIAEhB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- export function Input(props) {
2
+ import { memo } from 'react';
3
+ export const Input = memo(function Input(props) {
3
4
  return _jsx("input", { ...props });
4
- }
5
+ });
5
6
  //# sourceMappingURL=Input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":";AAEA,MAAM,UAAU,KAAK,CAAC,KAA4C,EAAE;IAClE,OAAO,mBAAW,KAAK,GAAI,CAAC;AAAA,CAC7B"}
1
+ {"version":3,"file":"Input.js","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAG7B,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,KAAK,CAAC,KAA4C,EAAE;IACrF,OAAO,mBAAW,KAAK,GAAI,CAAC;AAAA,CAC7B,CAAC,CAAC"}
@@ -4,6 +4,6 @@ type RadioGroupProps = InputHTMLAttributes<HTMLInputElement> & {
4
4
  name: string;
5
5
  options?: FormFieldOption[];
6
6
  };
7
- export declare function RadioGroup({ options, name, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare const RadioGroup: import("react").MemoExoticComponent<({ options, name, ...props }: RadioGroupProps) => import("react/jsx-runtime").JSX.Element>;
8
8
  export {};
9
9
  //# sourceMappingURL=RadioGroup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../src/components/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,KAAK,eAAe,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC;AAEF,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAiBtE"}
1
+ {"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../src/components/RadioGroup.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,KAAK,eAAe,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,UAAU,gIAiBrB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export function RadioGroup({ options, name, ...props }) {
2
+ import { memo } from 'react';
3
+ export const RadioGroup = memo(function RadioGroup({ options, name, ...props }) {
3
4
  return (_jsx("fieldset", { children: options?.map((option) => (_jsxs("label", { children: [
4
5
  _jsx("input", { ...props, type: "radio", name: name, value: option.value, disabled: option.disabled }), option.label] }, `${option.value}`))) }));
5
- }
6
+ });
6
7
  //# sourceMappingURL=RadioGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../../src/components/RadioGroup.tsx"],"names":[],"mappings":";AAQA,MAAM,UAAU,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,EAAmB,EAAE;IACvE,OAAO,CACL,6BACG,OAAO,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACxB;gBACE,mBACM,KAAK,EACT,IAAI,EAAC,OAAO,EACZ,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ,GACzB,EACD,MAAM,CAAC,KAAK,KARH,GAAG,MAAM,CAAC,KAAK,EAAE,CASrB,CACT,CAAC,GACO,CACZ,CAAC;AAAA,CACH"}
1
+ {"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../../src/components/RadioGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAS7B,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,EAAmB,EAAE;IAC/F,OAAO,CACL,6BACG,OAAO,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACxB;gBACE,mBACM,KAAK,EACT,IAAI,EAAC,OAAO,EACZ,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ,GACzB,EACD,MAAM,CAAC,KAAK,KARH,GAAG,MAAM,CAAC,KAAK,EAAE,CASrB,CACT,CAAC,GACO,CACZ,CAAC;AAAA,CACH,CAAC,CAAC"}
@@ -3,6 +3,6 @@ import type { FormFieldOption } from '@zod-to-form/core';
3
3
  type SelectProps = SelectHTMLAttributes<HTMLSelectElement> & {
4
4
  options?: FormFieldOption[];
5
5
  };
6
- export declare function Select({ options, ...props }: SelectProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare const Select: import("react").MemoExoticComponent<({ options, ...props }: SelectProps) => import("react/jsx-runtime").JSX.Element>;
7
7
  export {};
8
8
  //# sourceMappingURL=Select.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/components/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,KAAK,WAAW,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAC3D,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC;AAEF,wBAAgB,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,2CAUxD"}
1
+ {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/components/Select.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,KAAK,WAAW,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAC3D,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,MAAM,sHAUjB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- export function Select({ options, ...props }) {
2
+ import { memo } from 'react';
3
+ export const Select = memo(function Select({ options, ...props }) {
3
4
  return (_jsx("select", { ...props, children: options?.map((option) => (_jsx("option", { value: option.value, disabled: option.disabled, children: option.label }, `${option.value}`))) }));
4
- }
5
+ });
5
6
  //# sourceMappingURL=Select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","sourceRoot":"","sources":["../../src/components/Select.tsx"],"names":[],"mappings":";AAOA,MAAM,UAAU,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAe,EAAE;IACzD,OAAO,CACL,oBAAY,KAAK,YACd,OAAO,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACxB,iBAAgC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,YAC3E,MAAM,CAAC,KAAK,IADF,GAAG,MAAM,CAAC,KAAK,EAAE,CAErB,CACV,CAAC,GACK,CACV,CAAC;AAAA,CACH"}
1
+ {"version":3,"file":"Select.js","sourceRoot":"","sources":["../../src/components/Select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAQ7B,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAe,EAAE;IAC7E,OAAO,CACL,oBAAY,KAAK,YACd,OAAO,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACxB,iBAAgC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,YAC3E,MAAM,CAAC,KAAK,IADF,GAAG,MAAM,CAAC,KAAK,EAAE,CAErB,CACV,CAAC,GACK,CACV,CAAC;AAAA,CACH,CAAC,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { InputHTMLAttributes } from 'react';
2
- export declare function Switch(props: InputHTMLAttributes<HTMLInputElement>): import("react/jsx-runtime").JSX.Element;
2
+ export declare const Switch: import("react").MemoExoticComponent<(props: InputHTMLAttributes<HTMLInputElement>) => import("react/jsx-runtime").JSX.Element>;
3
3
  //# sourceMappingURL=Switch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/components/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAEjD,wBAAgB,MAAM,CAAC,KAAK,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,2CAElE"}
1
+ {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/components/Switch.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAEjD,eAAO,MAAM,MAAM,gIAEjB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- export function Switch(props) {
2
+ import { memo } from 'react';
3
+ export const Switch = memo(function Switch(props) {
3
4
  return _jsx("input", { type: "checkbox", role: "switch", ...props });
4
- }
5
+ });
5
6
  //# sourceMappingURL=Switch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../src/components/Switch.tsx"],"names":[],"mappings":";AAEA,MAAM,UAAU,MAAM,CAAC,KAA4C,EAAE;IACnE,OAAO,gBAAO,IAAI,EAAC,UAAU,EAAC,IAAI,EAAC,QAAQ,KAAK,KAAK,GAAI,CAAC;AAAA,CAC3D"}
1
+ {"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../src/components/Switch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAG7B,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,MAAM,CAAC,KAA4C,EAAE;IACvF,OAAO,gBAAO,IAAI,EAAC,UAAU,EAAC,IAAI,EAAC,QAAQ,KAAK,KAAK,GAAI,CAAC;AAAA,CAC3D,CAAC,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { TextareaHTMLAttributes } from 'react';
2
- export declare function Textarea(props: TextareaHTMLAttributes<HTMLTextAreaElement>): import("react/jsx-runtime").JSX.Element;
2
+ export declare const Textarea: import("react").MemoExoticComponent<(props: TextareaHTMLAttributes<HTMLTextAreaElement>) => import("react/jsx-runtime").JSX.Element>;
3
3
  //# sourceMappingURL=Textarea.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAEpD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC,mBAAmB,CAAC,2CAE1E"}
1
+ {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAEpD,eAAO,MAAM,QAAQ,sIAEnB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- export function Textarea(props) {
2
+ import { memo } from 'react';
3
+ export const Textarea = memo(function Textarea(props) {
3
4
  return _jsx("textarea", { ...props });
4
- }
5
+ });
5
6
  //# sourceMappingURL=Textarea.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":";AAEA,MAAM,UAAU,QAAQ,CAAC,KAAkD,EAAE;IAC3E,OAAO,sBAAc,KAAK,GAAI,CAAC;AAAA,CAChC"}
1
+ {"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAG7B,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,QAAQ,CAAC,KAAkD,EAAE;IACjG,OAAO,sBAAc,KAAK,GAAI,CAAC;AAAA,CAChC,CAAC,CAAC"}
@@ -1,31 +1,29 @@
1
1
  import type { HTMLAttributes, LabelHTMLAttributes } from 'react';
2
- import { Checkbox } from './Checkbox.js';
3
- import { ComboboxFallback } from './Combobox.js';
4
- import { DatePicker } from './DatePicker.js';
5
- import { FileInput } from './FileInput.js';
6
- import { Input } from './Input.js';
7
- import { RadioGroup } from './RadioGroup.js';
8
- import { Select } from './Select.js';
9
- import { Switch } from './Switch.js';
10
- import { Textarea } from './Textarea.js';
11
- declare function FormField(props: HTMLAttributes<HTMLDivElement>): import("react").DetailedReactHTMLElement<HTMLAttributes<HTMLDivElement>, HTMLElement>;
12
- declare function FormLabel(props: LabelHTMLAttributes<HTMLLabelElement>): import("react").DetailedReactHTMLElement<LabelHTMLAttributes<HTMLLabelElement>, HTMLElement>;
13
- declare function FormDescription(props: HTMLAttributes<HTMLParagraphElement>): import("react").DetailedReactHTMLElement<HTMLAttributes<HTMLParagraphElement>, HTMLElement>;
14
- declare function FormMessage(props: HTMLAttributes<HTMLParagraphElement>): import("react").DetailedReactHTMLElement<HTMLAttributes<HTMLParagraphElement>, HTMLElement>;
2
+ declare function Field(props: HTMLAttributes<HTMLDivElement>): import("react").DetailedReactHTMLElement<HTMLAttributes<HTMLDivElement>, HTMLElement>;
3
+ declare function FieldLabel(props: LabelHTMLAttributes<HTMLLabelElement>): import("react").DetailedReactHTMLElement<LabelHTMLAttributes<HTMLLabelElement>, HTMLElement>;
4
+ declare function FieldDescription(props: HTMLAttributes<HTMLParagraphElement>): import("react").DetailedReactHTMLElement<HTMLAttributes<HTMLParagraphElement>, HTMLElement>;
5
+ declare function FieldMessage(props: HTMLAttributes<HTMLParagraphElement>): import("react").DetailedReactHTMLElement<HTMLAttributes<HTMLParagraphElement>, HTMLElement>;
15
6
  export declare const defaultComponentMap: {
16
- Input: typeof Input;
17
- Textarea: typeof Textarea;
18
- Checkbox: typeof Checkbox;
19
- Combobox: typeof ComboboxFallback;
20
- Switch: typeof Switch;
21
- Select: typeof Select;
22
- DatePicker: typeof DatePicker;
23
- FileInput: typeof FileInput;
24
- RadioGroup: typeof RadioGroup;
25
- FormField: typeof FormField;
26
- FormLabel: typeof FormLabel;
27
- FormDescription: typeof FormDescription;
28
- FormMessage: typeof FormMessage;
7
+ Input: import("react").MemoExoticComponent<(props: import("react").InputHTMLAttributes<HTMLInputElement>) => import("react/jsx-runtime").JSX.Element>;
8
+ Textarea: import("react").MemoExoticComponent<(props: import("react").TextareaHTMLAttributes<HTMLTextAreaElement>) => import("react/jsx-runtime").JSX.Element>;
9
+ Checkbox: import("react").MemoExoticComponent<(props: import("react").InputHTMLAttributes<HTMLInputElement>) => import("react/jsx-runtime").JSX.Element>;
10
+ Combobox: import("react").MemoExoticComponent<({ options, id, ...props }: Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "list"> & {
11
+ options?: import("@zod-to-form/core").FormFieldOption[] | undefined;
12
+ }) => import("react/jsx-runtime").JSX.Element>;
13
+ Switch: import("react").MemoExoticComponent<(props: import("react").InputHTMLAttributes<HTMLInputElement>) => import("react/jsx-runtime").JSX.Element>;
14
+ Select: import("react").MemoExoticComponent<({ options, ...props }: import("react").SelectHTMLAttributes<HTMLSelectElement> & {
15
+ options?: import("@zod-to-form/core").FormFieldOption[] | undefined;
16
+ }) => import("react/jsx-runtime").JSX.Element>;
17
+ DatePicker: import("react").MemoExoticComponent<(props: import("react").InputHTMLAttributes<HTMLInputElement>) => import("react/jsx-runtime").JSX.Element>;
18
+ FileInput: import("react").MemoExoticComponent<(props: import("react").InputHTMLAttributes<HTMLInputElement>) => import("react/jsx-runtime").JSX.Element>;
19
+ RadioGroup: import("react").MemoExoticComponent<({ options, name, ...props }: import("react").InputHTMLAttributes<HTMLInputElement> & {
20
+ name: string;
21
+ options?: import("@zod-to-form/core").FormFieldOption[] | undefined;
22
+ }) => import("react/jsx-runtime").JSX.Element>;
23
+ Field: typeof Field;
24
+ FieldLabel: typeof FieldLabel;
25
+ FieldDescription: typeof FieldDescription;
26
+ FieldMessage: typeof FieldMessage;
29
27
  };
30
28
  export {};
31
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,iBAAS,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,yFAEvD;AAED,iBAAS,SAAS,CAAC,KAAK,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,gGAE9D;AAED,iBAAS,eAAe,CAAC,KAAK,EAAE,cAAc,CAAC,oBAAoB,CAAC,+FAEnE;AAED,iBAAS,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,oBAAoB,CAAC,+FAE/D;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;CAc/B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAWjE,iBAAS,KAAK,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,yFAEnD;AAED,iBAAS,UAAU,CAAC,KAAK,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,gGAE/D;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,oBAAoB,CAAC,+FAEpE;AAED,iBAAS,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,oBAAoB,CAAC,+FAEhE;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;CAc/B,CAAC"}
@@ -8,16 +8,16 @@ import { RadioGroup } from './RadioGroup.js';
8
8
  import { Select } from './Select.js';
9
9
  import { Switch } from './Switch.js';
10
10
  import { Textarea } from './Textarea.js';
11
- function FormField(props) {
11
+ function Field(props) {
12
12
  return createElement('div', props);
13
13
  }
14
- function FormLabel(props) {
14
+ function FieldLabel(props) {
15
15
  return createElement('label', props);
16
16
  }
17
- function FormDescription(props) {
17
+ function FieldDescription(props) {
18
18
  return createElement('p', props);
19
19
  }
20
- function FormMessage(props) {
20
+ function FieldMessage(props) {
21
21
  return createElement('p', props);
22
22
  }
23
23
  export const defaultComponentMap = {
@@ -30,9 +30,9 @@ export const defaultComponentMap = {
30
30
  DatePicker,
31
31
  FileInput,
32
32
  RadioGroup,
33
- FormField,
34
- FormLabel,
35
- FormDescription,
36
- FormMessage
33
+ Field,
34
+ FieldLabel,
35
+ FieldDescription,
36
+ FieldMessage
37
37
  };
38
38
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,SAAS,SAAS,CAAC,KAAqC,EAAE;IACxD,OAAO,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAAA,CACpC;AAED,SAAS,SAAS,CAAC,KAA4C,EAAE;IAC/D,OAAO,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAAA,CACtC;AAED,SAAS,eAAe,CAAC,KAA2C,EAAE;IACpE,OAAO,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAAA,CAClC;AAED,SAAS,WAAW,C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,GAAG,EAAE,KAAK,CAAC,CAAC;AAAA,CAClC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,QAAQ,EAAE,gBAAgB;IAC1B,MAAM;IACN,MAAM;IACN,UAAU;IACV,SAAS;IACT,UAAU;IACV,KAAK;IACL,UAAU;IACV,gBAAgB;IAChB,YAAY;CACb,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- export type { FormField, FormFieldOption, FormFieldConstraints, FormMeta, WalkOptions } from '@zod-to-form/core';
1
+ export type { FormField, FormFieldOption, FormFieldConstraints, FormMeta, FieldConfig, WalkOptions } from '@zod-to-form/core';
2
2
  export { ZodForm } from './ZodForm.js';
3
3
  export { useZodForm } from './useZodForm.js';
4
4
  export { defaultComponentMap } from './components/index.js';
5
5
  export { shadcnComponentMap } from './shadcn/index.js';
6
+ export type { RuntimeComponentConfig, RuntimeComponentEntry, RuntimeFieldOverride } from './FieldRenderer.js';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @zod-to-form/react — Public API
2
- // Runtime renderer — stubs until Phase 3 implementation
2
+ // Runtime renderer
3
3
  export { ZodForm } from './ZodForm.js';
4
4
  export { useZodForm } from './useZodForm.js';
5
5
  export { defaultComponentMap } from './components/index.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAWlC,wDAAwD;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAYlC,mBAAmB;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -17,9 +17,9 @@
17
17
  * } from '@/components/ui/select';
18
18
  * import { Button } from '@/components/ui/button';
19
19
  * import {
20
- * FormItem, FormLabel, FormControl,
21
- * FormDescription, FormMessage
22
- * } from '@/components/ui/form';
20
+ * Field, FieldLabel,
21
+ * FieldDescription, FieldMessage
22
+ * } from '@/components/ui/field';
23
23
  *
24
24
  * Then pass the map to <ZodForm>:
25
25
  * <ZodForm schema={schema} onSubmit={...} components={shadcnComponentMap} />
@@ -613,7 +613,7 @@ declare function ShadcnSelect(props: SelectHTMLAttributes<HTMLSelectElement>): i
613
613
  onChange?: import("react").ChangeEventHandler<HTMLSelectElement, HTMLSelectElement> | undefined;
614
614
  className: string;
615
615
  }, HTMLElement>;
616
- declare function ShadcnFormField(props: HTMLAttributes<HTMLDivElement>): import("react").DetailedReactHTMLElement<{
616
+ declare function ShadcnField(props: HTMLAttributes<HTMLDivElement>): import("react").DetailedReactHTMLElement<{
617
617
  children?: import("react").ReactNode;
618
618
  dangerouslySetInnerHTML?: {
619
619
  __html: string | TrustedHTML;
@@ -895,7 +895,7 @@ declare function ShadcnFormField(props: HTMLAttributes<HTMLDivElement>): import(
895
895
  part?: string | undefined;
896
896
  className: string;
897
897
  }, HTMLElement>;
898
- declare function ShadcnFormLabel(props: LabelHTMLAttributes<HTMLLabelElement>): import("react").DetailedReactHTMLElement<{
898
+ declare function ShadcnFieldLabel(props: LabelHTMLAttributes<HTMLLabelElement>): import("react").DetailedReactHTMLElement<{
899
899
  children?: import("react").ReactNode;
900
900
  dangerouslySetInnerHTML?: {
901
901
  __html: string | TrustedHTML;
@@ -1179,7 +1179,7 @@ declare function ShadcnFormLabel(props: LabelHTMLAttributes<HTMLLabelElement>):
1179
1179
  htmlFor?: string | undefined;
1180
1180
  className: string;
1181
1181
  }, HTMLElement>;
1182
- declare function ShadcnFormDescription(props: HTMLAttributes<HTMLParagraphElement>): import("react").DetailedReactHTMLElement<{
1182
+ declare function ShadcnFieldDescription(props: HTMLAttributes<HTMLParagraphElement>): import("react").DetailedReactHTMLElement<{
1183
1183
  children?: import("react").ReactNode;
1184
1184
  dangerouslySetInnerHTML?: {
1185
1185
  __html: string | TrustedHTML;
@@ -1461,7 +1461,7 @@ declare function ShadcnFormDescription(props: HTMLAttributes<HTMLParagraphElemen
1461
1461
  part?: string | undefined;
1462
1462
  className: string;
1463
1463
  }, HTMLElement>;
1464
- declare function ShadcnFormMessage(props: HTMLAttributes<HTMLParagraphElement>): import("react").DetailedReactHTMLElement<{
1464
+ declare function ShadcnFieldMessage(props: HTMLAttributes<HTMLParagraphElement>): import("react").DetailedReactHTMLElement<{
1465
1465
  children?: import("react").ReactNode;
1466
1466
  dangerouslySetInnerHTML?: {
1467
1467
  __html: string | TrustedHTML;
@@ -1744,19 +1744,24 @@ declare function ShadcnFormMessage(props: HTMLAttributes<HTMLParagraphElement>):
1744
1744
  className: string;
1745
1745
  }, HTMLElement>;
1746
1746
  export declare const shadcnComponentMap: {
1747
- Checkbox: typeof import("../components/Checkbox.js").Checkbox;
1748
- Combobox: typeof import("../components/Combobox.js").ComboboxFallback;
1749
- Switch: typeof import("../components/Switch.js").Switch;
1750
- DatePicker: typeof import("../components/DatePicker.js").DatePicker;
1751
- FileInput: typeof import("../components/FileInput.js").FileInput;
1752
- RadioGroup: typeof import("../components/RadioGroup.js").RadioGroup;
1747
+ Checkbox: import("react").MemoExoticComponent<(props: InputHTMLAttributes<HTMLInputElement>) => import("react/jsx-runtime").JSX.Element>;
1748
+ Combobox: import("react").MemoExoticComponent<({ options, id, ...props }: Omit<InputHTMLAttributes<HTMLInputElement>, "list"> & {
1749
+ options?: import("@zod-to-form/core").FormFieldOption[] | undefined;
1750
+ }) => import("react/jsx-runtime").JSX.Element>;
1751
+ Switch: import("react").MemoExoticComponent<(props: InputHTMLAttributes<HTMLInputElement>) => import("react/jsx-runtime").JSX.Element>;
1752
+ DatePicker: import("react").MemoExoticComponent<(props: InputHTMLAttributes<HTMLInputElement>) => import("react/jsx-runtime").JSX.Element>;
1753
+ FileInput: import("react").MemoExoticComponent<(props: InputHTMLAttributes<HTMLInputElement>) => import("react/jsx-runtime").JSX.Element>;
1754
+ RadioGroup: import("react").MemoExoticComponent<({ options, name, ...props }: InputHTMLAttributes<HTMLInputElement> & {
1755
+ name: string;
1756
+ options?: import("@zod-to-form/core").FormFieldOption[] | undefined;
1757
+ }) => import("react/jsx-runtime").JSX.Element>;
1753
1758
  Input: typeof ShadcnInput;
1754
1759
  Textarea: typeof ShadcnTextarea;
1755
1760
  Select: typeof ShadcnSelect;
1756
- FormField: typeof ShadcnFormField;
1757
- FormLabel: typeof ShadcnFormLabel;
1758
- FormDescription: typeof ShadcnFormDescription;
1759
- FormMessage: typeof ShadcnFormMessage;
1761
+ Field: typeof ShadcnField;
1762
+ FieldLabel: typeof ShadcnFieldLabel;
1763
+ FieldDescription: typeof ShadcnFieldDescription;
1764
+ FieldMessage: typeof ShadcnFieldMessage;
1760
1765
  };
1761
1766
  export {};
1762
1767
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shadcn/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AACrF,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAK/F,iBAAS,WAAW,CAAC,KAAK,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,qGAahE;AAID,iBAAS,cAAc,CAAC,KAAK,EAAE,sBAAsB,CAAC,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAKtE;AAQD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;CAS9B,CAAC"}
@@ -17,9 +17,9 @@
17
17
  * } from '@/components/ui/select';
18
18
  * import { Button } from '@/components/ui/button';
19
19
  * import {
20
- * FormItem, FormLabel, FormControl,
21
- * FormDescription, FormMessage
22
- * } from '@/components/ui/form';
20
+ * Field, FieldLabel,
21
+ * FieldDescription, FieldMessage
22
+ * } from '@/components/ui/field';
23
23
  *
24
24
  * Then pass the map to <ZodForm>:
25
25
  * <ZodForm schema={schema} onSubmit={...} components={shadcnComponentMap} />
@@ -71,15 +71,15 @@ function ShadcnSelect(props) {
71
71
  .trim()
72
72
  });
73
73
  }
74
- // ─── Shadcn-style FormField wrapper ──────────────────────────────────────────
75
- function ShadcnFormField(props) {
74
+ // ─── Shadcn-style Field wrapper ──────────────────────────────────────────────
75
+ function ShadcnField(props) {
76
76
  return createElement('div', {
77
77
  ...props,
78
78
  className: ['space-y-2', props.className ?? ''].join(' ').trim()
79
79
  });
80
80
  }
81
- // ─── Shadcn-style FormLabel stub ─────────────────────────────────────────────
82
- function ShadcnFormLabel(props) {
81
+ // ─── Shadcn-style FieldLabel stub ────────────────────────────────────────────
82
+ function ShadcnFieldLabel(props) {
83
83
  return createElement('label', {
84
84
  ...props,
85
85
  className: [
@@ -90,15 +90,15 @@ function ShadcnFormLabel(props) {
90
90
  .trim()
91
91
  });
92
92
  }
93
- // ─── Shadcn-style FormDescription stub ───────────────────────────────────────
94
- function ShadcnFormDescription(props) {
93
+ // ─── Shadcn-style FieldDescription stub ──────────────────────────────────────
94
+ function ShadcnFieldDescription(props) {
95
95
  return createElement('p', {
96
96
  ...props,
97
97
  className: ['text-sm text-muted-foreground', props.className ?? ''].join(' ').trim()
98
98
  });
99
99
  }
100
- // ─── Shadcn-style FormMessage stub ───────────────────────────────────────────
101
- function ShadcnFormMessage(props) {
100
+ // ─── Shadcn-style FieldMessage stub ──────────────────────────────────────────
101
+ function ShadcnFieldMessage(props) {
102
102
  return createElement('p', {
103
103
  ...props,
104
104
  className: ['text-sm font-medium text-destructive', props.className ?? ''].join(' ').trim()
@@ -107,16 +107,16 @@ function ShadcnFormMessage(props) {
107
107
  // ─── Assembled shadcn component map ──────────────────────────────────────────
108
108
  //
109
109
  // Inherits Checkbox, Switch, DatePicker, FileInput, RadioGroup, Combobox from
110
- // defaultComponentMap; overrides Input, Textarea, Select and all Form wrapper
110
+ // defaultComponentMap; overrides Input, Textarea, Select and all Field wrapper
111
111
  // components with shadcn/ui-styled stubs.
112
112
  export const shadcnComponentMap = {
113
113
  ...defaultComponentMap,
114
114
  Input: ShadcnInput,
115
115
  Textarea: ShadcnTextarea,
116
116
  Select: ShadcnSelect,
117
- FormField: ShadcnFormField,
118
- FormLabel: ShadcnFormLabel,
119
- FormDescription: ShadcnFormDescription,
120
- FormMessage: ShadcnFormMessage
117
+ Field: ShadcnField,
118
+ FieldLabel: ShadcnFieldLabel,
119
+ FieldDescription: ShadcnFieldDescription,
120
+ FieldMessage: ShadcnFieldMessage
121
121
  };
122
122
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shadcn/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,aAAa,EAAiD,MAAM,OAAO,CAAC;AAErF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,iFAAiF;AAEjF,SAAS,WAAW,CAAC,KAA4C,EAAE;IACjE,OAAO,aAAa,CAAC,OAAO,EAAE;QAC5B,GAAG,KAAK;QACR,SAAS,EAAE;YACT,yEAAyE;YACzE,uEAAuE;YACvE,yEAAyE;YACzE,iDAAiD;YACjD,KAAK,CAAC,SAAS,IAAI,EAAE;SACtB;aACE,IAAI,CAAC,GAAG,CAAC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AAa,CAAC,GAAG,EAAE;QACxB,GAAG,KAAK;QACR,SAAS,EAAE,CAAC,+BAA+B,EAAE,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE;KACrF,CAAC,CAAC;AAAA,CACJ;AAED,gFAAgF;AAEhF,SAAS,kBAAkB,CAAC,KAA2C,EAAE;IACvE,OAAO,aAAa,CAAC,GAAG,EAAE;QACxB,GAAG,KAAK;QACR,SAAS,EAAE,CAAC,sCAAsC,EAAE,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE;KAC5F,CAAC,CAAC;AAAA,CACJ;AAED,gFAAgF;AAChF,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,0CAA0C;AAE1C,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,GAAG,mBAAmB;IACtB,KAAK,EAAE,WAAW;IAClB,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,WAAW;IAClB,UAAU,EAAE,gBAAgB;IAC5B,gBAAgB,EAAE,sBAAsB;IACxC,YAAY,EAAE,kBAAkB;CACjC,CAAC"}
@@ -1,12 +1,14 @@
1
- import type { ZodObject } from 'zod';
1
+ import type { output, ZodObject } from 'zod';
2
2
  import type { FormProcessor, ZodFormRegistry } from '@zod-to-form/core';
3
3
  type UseZodFormOptions<TSchema extends ZodObject> = {
4
- defaultValues?: Partial<TSchema['_zod']['output']>;
4
+ defaultValues?: Partial<output<TSchema>>;
5
5
  formRegistry?: ZodFormRegistry;
6
6
  processors?: Record<string, FormProcessor>;
7
+ mode?: 'onSubmit' | 'onChange' | 'onBlur';
8
+ onValueChange?: (values: output<TSchema>) => void;
7
9
  };
8
10
  export declare function useZodForm<TSchema extends ZodObject>(schema: TSchema, options?: UseZodFormOptions<TSchema>): {
9
- form: import("react-hook-form").UseFormReturn<TSchema["_zod"]["output"], any, TSchema["_zod"]["output"]>;
11
+ form: import("react-hook-form").UseFormReturn<output<TSchema>, any, output<TSchema>>;
10
12
  fields: import("@zod-to-form/core").FormField[];
11
13
  };
12
14
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"useZodForm.d.ts","sourceRoot":"","sources":["../src/useZodForm.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAExE,KAAK,iBAAiB,CAAC,OAAO,SAAS,SAAS,IAAI;IAClD,aAAa,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IACnD,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAC5C,CAAC;AA4CF,wBAAgB,UAAU,CAAC,OAAO,SAAS,SAAS,EAClD,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC;;;EA2BrC"}
1
+ {"version":3,"file":"useZodForm.d.ts","sourceRoot":"","sources":["../src/useZodForm.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAExE,KAAK,iBAAiB,CAAC,OAAO,SAAS,SAAS,IAAI;IAClD,aAAa,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC3C,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC1C,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;CACnD,CAAC;AA4CF,wBAAgB,UAAU,CAAC,OAAO,SAAS,SAAS,EAClD,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC;;;EAiDrC"}
@@ -1,4 +1,4 @@
1
- import { useMemo } from 'react';
1
+ import { useEffect, useMemo } from 'react';
2
2
  import { zodResolver } from '@hookform/resolvers/zod';
3
3
  import { walkSchema } from '@zod-to-form/core';
4
4
  import { useForm } from 'react-hook-form';
@@ -32,15 +32,33 @@ function isFileListLike(value) {
32
32
  return typeof candidate.length === 'number' && typeof candidate.item === 'function';
33
33
  }
34
34
  export function useZodForm(schema, options) {
35
- const baseResolver = zodResolver(schema);
35
+ const baseResolver = useMemo(() => zodResolver(schema), [schema]);
36
36
  const fields = useMemo(() => walkSchema(schema, {
37
37
  formRegistry: options?.formRegistry,
38
38
  processors: options?.processors
39
39
  }), [schema, options?.formRegistry, options?.processors]);
40
40
  const form = useForm({
41
41
  resolver: ((values, context, resolverOptions) => baseResolver(normalizeFileLists(values), context, resolverOptions)),
42
- defaultValues: options?.defaultValues
42
+ defaultValues: options?.defaultValues,
43
+ mode: options?.mode
43
44
  });
45
+ useEffect(() => {
46
+ if (!options?.onValueChange) {
47
+ return undefined;
48
+ }
49
+ const subscription = form.watch((values, info) => {
50
+ if (!info?.name) {
51
+ return;
52
+ }
53
+ const parsed = schema.safeParse(normalizeFileLists(values));
54
+ if (parsed.success) {
55
+ options.onValueChange?.(parsed.data);
56
+ }
57
+ });
58
+ return () => {
59
+ subscription.unsubscribe();
60
+ };
61
+ }, [options?.onValueChange, schema]);
44
62
  return {
45
63
  form,
46
64
  fields
@@ -1 +1 @@
1
- {"version":3,"file":"useZodForm.js","sourceRoot":"","sources":["../src/useZodForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM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CAAC;QAAA,CACF,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE,CAAC;YACX,YAAY,CAAC,WAAW,EAAE,CAAC;QAAA,CAC5B,CAAC;IAAA,CACH,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;IAErC,OAAO;QACL,IAAI;QACJ,MAAM;KACP,CAAC;AAAA,CACH"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@zod-to-form/react",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Runtime <ZodForm> renderer for Zod v4 schemas",
5
5
  "license": "MIT",
6
- "homepage": "https://github.com/pradeepmouli/zodforms#readme",
6
+ "homepage": "https://github.com/pradeepmouli/zod-to-form#readme",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/pradeepmouli/zodforms.git",
9
+ "url": "https://github.com/pradeepmouli/zod-to-form.git",
10
10
  "directory": "packages/react"
11
11
  },
12
12
  "keywords": [
@@ -52,7 +52,7 @@
52
52
  "zod": "^4.3.6"
53
53
  },
54
54
  "dependencies": {
55
- "@zod-to-form/core": "0.2.3"
55
+ "@zod-to-form/core": "0.2.5"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsgo -p tsconfig.build.json",