@rachelallyson/hero-hook-form 2.2.1 → 2.3.0

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/index.d.ts CHANGED
@@ -123,9 +123,9 @@ interface DynamicSectionConfig<TFieldValues extends FieldValues> extends BaseFor
123
123
  condition: (formData: Partial<TFieldValues>) => boolean;
124
124
  fields: ZodFormFieldConfig<TFieldValues>[];
125
125
  }
126
- interface ContentFieldConfig<TFieldValues extends FieldValues> {
126
+ interface ContentFieldConfig<TFieldValues extends FieldValues = FieldValues> {
127
127
  type: "content";
128
- name?: Path<TFieldValues>;
128
+ name?: string;
129
129
  title?: string;
130
130
  description?: string;
131
131
  render?: (field: {
@@ -155,14 +155,6 @@ interface ZodFormConfig<TFieldValues extends FieldValues> extends UseFormProps<T
155
155
  fields: ZodFormFieldConfig<TFieldValues>[];
156
156
  onError?: (errors: FieldErrors<TFieldValues>) => void;
157
157
  errorDisplay?: "inline" | "toast" | "modal" | "none";
158
- render?: (formState: {
159
- form: UseFormReturn<TFieldValues>;
160
- isSubmitting: boolean;
161
- isSubmitted: boolean;
162
- isSuccess: boolean;
163
- errors: FieldErrors<TFieldValues>;
164
- values: TFieldValues;
165
- }) => React.ReactNode;
166
158
  }
167
159
  interface FormValidationError {
168
160
  message: string;
@@ -436,23 +428,262 @@ interface ServerActionFormProps<T extends FieldValues> {
436
428
  */
437
429
  declare function ServerActionForm<T extends FieldValues>({ action, className, clientValidationSchema, columns, defaultValues, fields, initialState, layout, onError, onSuccess, resetButtonText, showResetButton, spacing, submitButtonProps, submitButtonText, subtitle, title, }: ServerActionFormProps<T>): React$1.JSX.Element;
438
430
 
431
+ /**
432
+ * Props for the CheckboxField component.
433
+ *
434
+ * @template TFieldValues - The form data type
435
+ *
436
+ * @example
437
+ * ```tsx
438
+ * import { CheckboxField } from "@rachelallyson/hero-hook-form";
439
+ * import { useForm } from "react-hook-form";
440
+ *
441
+ * const form = useForm({
442
+ * defaultValues: { newsletter: false },
443
+ * });
444
+ *
445
+ * <CheckboxField
446
+ * control={form.control}
447
+ * name="newsletter"
448
+ * label="Subscribe to newsletter"
449
+ * description="Receive weekly updates"
450
+ * />
451
+ * ```
452
+ */
439
453
  type CheckboxFieldProps<TFieldValues extends FieldValues> = FieldBaseProps<TFieldValues, boolean> & WithControl<TFieldValues> & {
454
+ /** Additional props to pass to the underlying Checkbox component */
440
455
  checkboxProps?: Omit<React$1.ComponentProps<typeof Checkbox>, "isSelected" | "onValueChange" | "isInvalid" | "errorMessage" | "isDisabled">;
441
456
  };
457
+ /**
458
+ * A checkbox field component that integrates React Hook Form with HeroUI Checkbox.
459
+ *
460
+ * This component provides a type-safe checkbox field with validation support,
461
+ * error handling, and accessibility features. The field value is a boolean.
462
+ *
463
+ * @template TFieldValues - The form data type
464
+ *
465
+ * @param props - The checkbox field props
466
+ * @returns The rendered checkbox field component
467
+ *
468
+ * @example
469
+ * ```tsx
470
+ * import { ZodForm, FormFieldHelpers } from "@rachelallyson/hero-hook-form";
471
+ * import { z } from "zod";
472
+ *
473
+ * const schema = z.object({
474
+ * terms: z.boolean().refine((val) => val === true, {
475
+ * message: "You must accept the terms",
476
+ * }),
477
+ * newsletter: z.boolean().optional(),
478
+ * });
479
+ *
480
+ * function MyForm() {
481
+ * return (
482
+ * <ZodForm
483
+ * config={{
484
+ * schema,
485
+ * fields: [
486
+ * FormFieldHelpers.checkbox("terms", "I accept the terms and conditions"),
487
+ * FormFieldHelpers.checkbox("newsletter", "Subscribe to newsletter"),
488
+ * ],
489
+ * }}
490
+ * onSubmit={(data) => console.log(data)}
491
+ * />
492
+ * );
493
+ * }
494
+ * ```
495
+ *
496
+ * @example
497
+ * ```tsx
498
+ * // With custom styling
499
+ * <CheckboxField
500
+ * control={form.control}
501
+ * name="newsletter"
502
+ * label="Subscribe"
503
+ * checkboxProps={{
504
+ * color: "primary",
505
+ * size: "lg",
506
+ * }}
507
+ * />
508
+ * ```
509
+ */
442
510
  declare function CheckboxField<TFieldValues extends FieldValues>(props: CheckboxFieldProps<TFieldValues>): React$1.JSX.Element;
443
511
 
512
+ /**
513
+ * Props for the DateField component.
514
+ *
515
+ * @template TFieldValues - The form data type
516
+ *
517
+ * @example
518
+ * ```tsx
519
+ * import { DateField } from "@rachelallyson/hero-hook-form";
520
+ * import { useForm } from "react-hook-form";
521
+ * import { CalendarDate } from "@internationalized/date";
522
+ *
523
+ * const form = useForm({
524
+ * defaultValues: { birthDate: null as CalendarDate | null },
525
+ * });
526
+ *
527
+ * <DateField
528
+ * control={form.control}
529
+ * name="birthDate"
530
+ * label="Birth Date"
531
+ * description="Select your date of birth"
532
+ * />
533
+ * ```
534
+ */
444
535
  type DateFieldProps<TFieldValues extends FieldValues> = FieldBaseProps<TFieldValues, CalendarDate | null> & WithControl<TFieldValues> & {
536
+ /** Additional props to pass to the underlying DateInput component */
445
537
  dateProps?: Omit<React$1.ComponentProps<typeof DateInput>, "value" | "onChange" | "label" | "isInvalid" | "errorMessage" | "isDisabled">;
538
+ /** Transform function to modify the date value before it's set */
446
539
  transform?: (value: CalendarDate | null) => CalendarDate | null;
447
540
  };
541
+ /**
542
+ * A date input field component that integrates React Hook Form with HeroUI DateInput.
543
+ *
544
+ * This component provides a type-safe date field with validation support,
545
+ * error handling, and accessibility features. Uses `@internationalized/date`
546
+ * for date handling.
547
+ *
548
+ * @template TFieldValues - The form data type
549
+ *
550
+ * @param props - The date field props
551
+ * @returns The rendered date field component
552
+ *
553
+ * @example
554
+ * ```tsx
555
+ * import { ZodForm, FormFieldHelpers } from "@rachelallyson/hero-hook-form";
556
+ * import { z } from "zod";
557
+ * import { CalendarDate } from "@internationalized/date";
558
+ *
559
+ * const schema = z.object({
560
+ * birthDate: z.instanceof(CalendarDate).nullable(),
561
+ * eventDate: z.instanceof(CalendarDate),
562
+ * });
563
+ *
564
+ * function MyForm() {
565
+ * return (
566
+ * <ZodForm
567
+ * config={{
568
+ * schema,
569
+ * fields: [
570
+ * FormFieldHelpers.date("birthDate", "Birth Date"),
571
+ * FormFieldHelpers.date("eventDate", "Event Date"),
572
+ * ],
573
+ * }}
574
+ * onSubmit={(data) => console.log(data)}
575
+ * />
576
+ * );
577
+ * }
578
+ * ```
579
+ *
580
+ * @example
581
+ * ```tsx
582
+ * // With custom date format and min/max dates
583
+ * <DateField
584
+ * control={form.control}
585
+ * name="eventDate"
586
+ * label="Event Date"
587
+ * dateProps={{
588
+ * minValue: new CalendarDate(2024, 1, 1),
589
+ * maxValue: new CalendarDate(2024, 12, 31),
590
+ * }}
591
+ * />
592
+ * ```
593
+ */
448
594
  declare function DateField<TFieldValues extends FieldValues>(props: DateFieldProps<TFieldValues>): React$1.JSX.Element;
449
595
 
596
+ /**
597
+ * Props for the FileField component.
598
+ *
599
+ * @template TFieldValues - The form data type
600
+ *
601
+ * @example
602
+ * ```tsx
603
+ * import { FileField } from "@rachelallyson/hero-hook-form";
604
+ * import { useForm } from "react-hook-form";
605
+ *
606
+ * const form = useForm({
607
+ * defaultValues: { avatar: null as FileList | null },
608
+ * });
609
+ *
610
+ * <FileField
611
+ * control={form.control}
612
+ * name="avatar"
613
+ * label="Upload Avatar"
614
+ * accept="image/*"
615
+ * description="Select an image file"
616
+ * />
617
+ * ```
618
+ */
450
619
  type FileFieldProps<TFieldValues extends FieldValues> = FieldBaseProps<TFieldValues, FileList | null> & WithControl<TFieldValues> & {
620
+ /** Additional props to pass to the underlying Input component */
451
621
  fileProps?: Omit<React$1.ComponentProps<typeof Input>, "value" | "onValueChange" | "label" | "isInvalid" | "errorMessage" | "isDisabled" | "type">;
622
+ /** Transform function to modify the file list before it's set */
452
623
  transform?: (value: FileList | null) => FileList | null;
624
+ /** Whether multiple files can be selected */
453
625
  multiple?: boolean;
626
+ /** Accepted file types (e.g., "image/*", ".pdf,.doc") */
454
627
  accept?: string;
455
628
  };
629
+ /**
630
+ * A file input field component that integrates React Hook Form with HeroUI Input.
631
+ *
632
+ * This component provides a type-safe file upload field with validation support,
633
+ * error handling, and accessibility features. The field value is a `FileList` or `null`.
634
+ *
635
+ * @template TFieldValues - The form data type
636
+ *
637
+ * @param props - The file field props
638
+ * @returns The rendered file field component
639
+ *
640
+ * @example
641
+ * ```tsx
642
+ * import { ZodForm, FormFieldHelpers } from "@rachelallyson/hero-hook-form";
643
+ * import { z } from "zod";
644
+ *
645
+ * const schema = z.object({
646
+ * avatar: z.instanceof(FileList).nullable(),
647
+ * documents: z.instanceof(FileList).optional(),
648
+ * });
649
+ *
650
+ * function MyForm() {
651
+ * return (
652
+ * <ZodForm
653
+ * config={{
654
+ * schema,
655
+ * fields: [
656
+ * FormFieldHelpers.file("avatar", "Upload Avatar", { accept: "image/*" }),
657
+ * FormFieldHelpers.file("documents", "Upload Documents", {
658
+ * multiple: true,
659
+ * accept: ".pdf,.doc,.docx",
660
+ * }),
661
+ * ],
662
+ * }}
663
+ * onSubmit={(data) => console.log(data)}
664
+ * />
665
+ * );
666
+ * }
667
+ * ```
668
+ *
669
+ * @example
670
+ * ```tsx
671
+ * // With file size validation
672
+ * <FileField
673
+ * control={form.control}
674
+ * name="avatar"
675
+ * label="Upload Avatar"
676
+ * accept="image/*"
677
+ * transform={(files) => {
678
+ * if (files && files[0] && files[0].size > 5 * 1024 * 1024) {
679
+ * // File too large
680
+ * return null;
681
+ * }
682
+ * return files;
683
+ * }}
684
+ * />
685
+ * ```
686
+ */
456
687
  declare function FileField<TFieldValues extends FieldValues>(props: FileFieldProps<TFieldValues>): React$1.JSX.Element;
457
688
 
458
689
  interface FontPickerProps {
@@ -525,45 +756,473 @@ type InputFieldProps<TFieldValues extends FieldValues> = FieldBaseProps<TFieldVa
525
756
  */
526
757
  declare const InputField: <TFieldValues extends FieldValues>(props: InputFieldProps<TFieldValues>) => React$1.JSX.Element;
527
758
 
759
+ /**
760
+ * Configuration for a radio option.
761
+ *
762
+ * @template TValue - The value type for the option
763
+ */
528
764
  interface RadioOption<TValue extends string | number> {
765
+ /** Display label for the option */
529
766
  label: string;
767
+ /** Value of the option */
530
768
  value: TValue;
769
+ /** Optional description text */
531
770
  description?: string;
771
+ /** Whether the option is disabled */
532
772
  disabled?: boolean;
533
773
  }
774
+ /**
775
+ * Props for the RadioGroupField component.
776
+ *
777
+ * @template TFieldValues - The form data type
778
+ * @template TValue - The value type for the radio group (string or number)
779
+ *
780
+ * @example
781
+ * ```tsx
782
+ * import { RadioGroupField } from "@rachelallyson/hero-hook-form";
783
+ * import { useForm } from "react-hook-form";
784
+ *
785
+ * const form = useForm({
786
+ * defaultValues: { plan: "" },
787
+ * });
788
+ *
789
+ * const options = [
790
+ * { label: "Basic", value: "basic" },
791
+ * { label: "Pro", value: "pro" },
792
+ * { label: "Enterprise", value: "enterprise" },
793
+ * ];
794
+ *
795
+ * <RadioGroupField
796
+ * control={form.control}
797
+ * name="plan"
798
+ * label="Select Plan"
799
+ * options={options}
800
+ * />
801
+ * ```
802
+ */
534
803
  type RadioGroupFieldProps<TFieldValues extends FieldValues, TValue extends string | number = string> = FieldBaseProps<TFieldValues, TValue> & WithControl<TFieldValues> & {
804
+ /** Array of radio options */
535
805
  options: readonly RadioOption<TValue>[];
806
+ /** Additional props to pass to the underlying RadioGroup component */
536
807
  radioGroupProps?: Omit<React$1.ComponentProps<typeof RadioGroup>, "value" | "onValueChange" | "label">;
537
808
  };
809
+ /**
810
+ * A radio group field component that integrates React Hook Form with HeroUI RadioGroup.
811
+ *
812
+ * This component provides a type-safe radio group field with validation support,
813
+ * error handling, and accessibility features. Only one option can be selected at a time.
814
+ *
815
+ * @template TFieldValues - The form data type
816
+ * @template TValue - The value type for the radio group (string or number)
817
+ *
818
+ * @param props - The radio group field props
819
+ * @returns The rendered radio group field component
820
+ *
821
+ * @example
822
+ * ```tsx
823
+ * import { ZodForm, FormFieldHelpers } from "@rachelallyson/hero-hook-form";
824
+ * import { z } from "zod";
825
+ *
826
+ * const schema = z.object({
827
+ * plan: z.enum(["basic", "pro", "enterprise"], {
828
+ * required_error: "Please select a plan",
829
+ * }),
830
+ * });
831
+ *
832
+ * const options = [
833
+ * { label: "Basic - $9/month", value: "basic" },
834
+ * { label: "Pro - $29/month", value: "pro" },
835
+ * { label: "Enterprise - $99/month", value: "enterprise" },
836
+ * ];
837
+ *
838
+ * function MyForm() {
839
+ * return (
840
+ * <ZodForm
841
+ * config={{
842
+ * schema,
843
+ * fields: [
844
+ * FormFieldHelpers.radioGroup("plan", "Select Plan", options),
845
+ * ],
846
+ * }}
847
+ * onSubmit={(data) => console.log(data)}
848
+ * />
849
+ * );
850
+ * }
851
+ * ```
852
+ *
853
+ * @example
854
+ * ```tsx
855
+ * // With custom styling
856
+ * <RadioGroupField
857
+ * control={form.control}
858
+ * name="plan"
859
+ * label="Select Plan"
860
+ * options={options}
861
+ * radioGroupProps={{
862
+ * orientation: "horizontal",
863
+ * color: "primary",
864
+ * }}
865
+ * />
866
+ * ```
867
+ */
538
868
  declare function RadioGroupField<TFieldValues extends FieldValues, TValue extends string | number = string>(props: RadioGroupFieldProps<TFieldValues, TValue>): React$1.JSX.Element;
539
869
 
870
+ /**
871
+ * Configuration for a select option.
872
+ *
873
+ * @template TValue - The value type for the option
874
+ */
540
875
  interface SelectOption<TValue extends string | number> {
876
+ /** Display label for the option */
541
877
  label: string;
878
+ /** Value of the option */
542
879
  value: TValue;
880
+ /** Optional description text */
543
881
  description?: string;
882
+ /** Whether the option is disabled */
544
883
  disabled?: boolean;
545
884
  }
885
+ /**
886
+ * Props for the SelectField component.
887
+ *
888
+ * @template TFieldValues - The form data type
889
+ * @template TValue - The value type for the select field (string or number)
890
+ *
891
+ * @example
892
+ * ```tsx
893
+ * import { SelectField } from "@rachelallyson/hero-hook-form";
894
+ * import { useForm } from "react-hook-form";
895
+ *
896
+ * const form = useForm({
897
+ * defaultValues: { country: "" },
898
+ * });
899
+ *
900
+ * const options = [
901
+ * { label: "United States", value: "us" },
902
+ * { label: "Canada", value: "ca" },
903
+ * { label: "Mexico", value: "mx" },
904
+ * ];
905
+ *
906
+ * <SelectField
907
+ * control={form.control}
908
+ * name="country"
909
+ * label="Country"
910
+ * options={options}
911
+ * placeholder="Select a country"
912
+ * />
913
+ * ```
914
+ */
546
915
  type SelectFieldProps<TFieldValues extends FieldValues, TValue extends string | number = string> = FieldBaseProps<TFieldValues, TValue> & WithControl<TFieldValues> & {
916
+ /** Array of select options */
547
917
  options: readonly SelectOption<TValue>[];
918
+ /** Placeholder text when no option is selected */
548
919
  placeholder?: string;
920
+ /** Additional props to pass to the underlying Select component */
549
921
  selectProps?: Omit<React$1.ComponentProps<typeof Select>, "selectedKeys" | "onSelectionChange" | "label" | "isInvalid" | "errorMessage" | "isDisabled">;
550
922
  };
923
+ /**
924
+ * A select dropdown field component that integrates React Hook Form with HeroUI Select.
925
+ *
926
+ * This component provides a type-safe select field with validation support,
927
+ * error handling, and accessibility features.
928
+ *
929
+ * @template TFieldValues - The form data type
930
+ * @template TValue - The value type for the select field (string or number)
931
+ *
932
+ * @param props - The select field props
933
+ * @returns The rendered select field component
934
+ *
935
+ * @example
936
+ * ```tsx
937
+ * import { ZodForm, FormFieldHelpers } from "@rachelallyson/hero-hook-form";
938
+ * import { z } from "zod";
939
+ *
940
+ * const schema = z.object({
941
+ * country: z.string().min(1, "Please select a country"),
942
+ * });
943
+ *
944
+ * const options = [
945
+ * { label: "United States", value: "us" },
946
+ * { label: "Canada", value: "ca" },
947
+ * ];
948
+ *
949
+ * function MyForm() {
950
+ * return (
951
+ * <ZodForm
952
+ * config={{
953
+ * schema,
954
+ * fields: [
955
+ * FormFieldHelpers.select("country", "Country", options, "Select a country"),
956
+ * ],
957
+ * }}
958
+ * onSubmit={(data) => console.log(data)}
959
+ * />
960
+ * );
961
+ * }
962
+ * ```
963
+ *
964
+ * @example
965
+ * ```tsx
966
+ * // With custom styling
967
+ * <SelectField
968
+ * control={form.control}
969
+ * name="country"
970
+ * label="Country"
971
+ * options={options}
972
+ * selectProps={{
973
+ * variant: "bordered",
974
+ * size: "lg",
975
+ * }}
976
+ * />
977
+ * ```
978
+ */
551
979
  declare function SelectField<TFieldValues extends FieldValues, TValue extends string | number = string>(props: SelectFieldProps<TFieldValues, TValue>): React$1.JSX.Element;
552
980
 
981
+ /**
982
+ * Props for the SliderField component.
983
+ *
984
+ * @template TFieldValues - The form data type
985
+ *
986
+ * @example
987
+ * ```tsx
988
+ * import { SliderField } from "@rachelallyson/hero-hook-form";
989
+ * import { useForm } from "react-hook-form";
990
+ *
991
+ * const form = useForm({
992
+ * defaultValues: { volume: 50 },
993
+ * });
994
+ *
995
+ * <SliderField
996
+ * control={form.control}
997
+ * name="volume"
998
+ * label="Volume"
999
+ * description="Adjust the volume level"
1000
+ * />
1001
+ * ```
1002
+ */
553
1003
  type SliderFieldProps<TFieldValues extends FieldValues> = FieldBaseProps<TFieldValues, number> & WithControl<TFieldValues> & {
1004
+ /** Additional props to pass to the underlying Slider component */
554
1005
  sliderProps?: Omit<React$1.ComponentProps<typeof Slider>, "value" | "onValueChange" | "label" | "isInvalid" | "errorMessage" | "isDisabled">;
1006
+ /** Transform function to modify the slider value before it's set */
555
1007
  transform?: (value: number) => number;
556
1008
  };
1009
+ /**
1010
+ * A slider field component that integrates React Hook Form with HeroUI Slider.
1011
+ *
1012
+ * This component provides a type-safe slider field with validation support,
1013
+ * error handling, and accessibility features. The field value is a number.
1014
+ *
1015
+ * @template TFieldValues - The form data type
1016
+ *
1017
+ * @param props - The slider field props
1018
+ * @returns The rendered slider field component
1019
+ *
1020
+ * @example
1021
+ * ```tsx
1022
+ * import { ZodForm, FormFieldHelpers } from "@rachelallyson/hero-hook-form";
1023
+ * import { z } from "zod";
1024
+ *
1025
+ * const schema = z.object({
1026
+ * volume: z.number().min(0).max(100),
1027
+ * brightness: z.number().min(0).max(100),
1028
+ * });
1029
+ *
1030
+ * function MyForm() {
1031
+ * return (
1032
+ * <ZodForm
1033
+ * config={{
1034
+ * schema,
1035
+ * fields: [
1036
+ * FormFieldHelpers.slider("volume", "Volume", { min: 0, max: 100 }),
1037
+ * FormFieldHelpers.slider("brightness", "Brightness", { min: 0, max: 100 }),
1038
+ * ],
1039
+ * }}
1040
+ * onSubmit={(data) => console.log(data)}
1041
+ * />
1042
+ * );
1043
+ * }
1044
+ * ```
1045
+ *
1046
+ * @example
1047
+ * ```tsx
1048
+ * // With custom step and marks
1049
+ * <SliderField
1050
+ * control={form.control}
1051
+ * name="volume"
1052
+ * label="Volume"
1053
+ * sliderProps={{
1054
+ * minValue: 0,
1055
+ * maxValue: 100,
1056
+ * step: 10,
1057
+ * marks: [
1058
+ * { value: 0, label: "0" },
1059
+ * { value: 50, label: "50" },
1060
+ * { value: 100, label: "100" },
1061
+ * ],
1062
+ * }}
1063
+ * />
1064
+ * ```
1065
+ */
557
1066
  declare function SliderField<TFieldValues extends FieldValues>(props: SliderFieldProps<TFieldValues>): React$1.JSX.Element;
558
1067
 
1068
+ /**
1069
+ * Props for the SwitchField component.
1070
+ *
1071
+ * @template TFieldValues - The form data type
1072
+ *
1073
+ * @example
1074
+ * ```tsx
1075
+ * import { SwitchField } from "@rachelallyson/hero-hook-form";
1076
+ * import { useForm } from "react-hook-form";
1077
+ *
1078
+ * const form = useForm({
1079
+ * defaultValues: { notifications: false },
1080
+ * });
1081
+ *
1082
+ * <SwitchField
1083
+ * control={form.control}
1084
+ * name="notifications"
1085
+ * label="Enable notifications"
1086
+ * description="Receive email notifications"
1087
+ * />
1088
+ * ```
1089
+ */
559
1090
  type SwitchFieldProps<TFieldValues extends FieldValues> = FieldBaseProps<TFieldValues, boolean> & WithControl<TFieldValues> & {
1091
+ /** Additional props to pass to the underlying Switch component */
560
1092
  switchProps?: Omit<React$1.ComponentProps<typeof Switch>, "isSelected" | "onValueChange" | "isInvalid" | "isDisabled">;
561
1093
  };
1094
+ /**
1095
+ * A switch/toggle field component that integrates React Hook Form with HeroUI Switch.
1096
+ *
1097
+ * This component provides a type-safe switch field with validation support,
1098
+ * error handling, and accessibility features. The field value is a boolean.
1099
+ *
1100
+ * @template TFieldValues - The form data type
1101
+ *
1102
+ * @param props - The switch field props
1103
+ * @returns The rendered switch field component
1104
+ *
1105
+ * @example
1106
+ * ```tsx
1107
+ * import { ZodForm, FormFieldHelpers } from "@rachelallyson/hero-hook-form";
1108
+ * import { z } from "zod";
1109
+ *
1110
+ * const schema = z.object({
1111
+ * notifications: z.boolean(),
1112
+ * darkMode: z.boolean().default(false),
1113
+ * });
1114
+ *
1115
+ * function MyForm() {
1116
+ * return (
1117
+ * <ZodForm
1118
+ * config={{
1119
+ * schema,
1120
+ * fields: [
1121
+ * FormFieldHelpers.switch("notifications", "Enable notifications"),
1122
+ * FormFieldHelpers.switch("darkMode", "Dark mode"),
1123
+ * ],
1124
+ * }}
1125
+ * onSubmit={(data) => console.log(data)}
1126
+ * />
1127
+ * );
1128
+ * }
1129
+ * ```
1130
+ *
1131
+ * @example
1132
+ * ```tsx
1133
+ * // With custom styling
1134
+ * <SwitchField
1135
+ * control={form.control}
1136
+ * name="notifications"
1137
+ * label="Enable notifications"
1138
+ * switchProps={{
1139
+ * color: "success",
1140
+ * size: "lg",
1141
+ * }}
1142
+ * />
1143
+ * ```
1144
+ */
562
1145
  declare function SwitchField<TFieldValues extends FieldValues>(props: SwitchFieldProps<TFieldValues>): React$1.JSX.Element;
563
1146
 
1147
+ /**
1148
+ * Props for the TextareaField component.
1149
+ *
1150
+ * @template TFieldValues - The form data type
1151
+ *
1152
+ * @example
1153
+ * ```tsx
1154
+ * import { TextareaField } from "@rachelallyson/hero-hook-form";
1155
+ * import { useForm } from "react-hook-form";
1156
+ *
1157
+ * const form = useForm({
1158
+ * defaultValues: { message: "" },
1159
+ * });
1160
+ *
1161
+ * <TextareaField
1162
+ * control={form.control}
1163
+ * name="message"
1164
+ * label="Message"
1165
+ * description="Enter your message here"
1166
+ * placeholder="Type your message..."
1167
+ * />
1168
+ * ```
1169
+ */
564
1170
  type TextareaFieldProps<TFieldValues extends FieldValues> = FieldBaseProps<TFieldValues, string> & WithControl<TFieldValues> & {
1171
+ /** Additional props to pass to the underlying Textarea component */
565
1172
  textareaProps?: Omit<React$1.ComponentProps<typeof Textarea>, "value" | "onValueChange" | "label" | "isInvalid" | "errorMessage" | "isDisabled">;
566
1173
  };
1174
+ /**
1175
+ * A textarea field component that integrates React Hook Form with HeroUI Textarea.
1176
+ *
1177
+ * This component provides a type-safe textarea field with validation support,
1178
+ * error handling, and accessibility features. Use this for multi-line text input.
1179
+ *
1180
+ * @template TFieldValues - The form data type
1181
+ *
1182
+ * @param props - The textarea field props
1183
+ * @returns The rendered textarea field component
1184
+ *
1185
+ * @example
1186
+ * ```tsx
1187
+ * import { ZodForm, FormFieldHelpers } from "@rachelallyson/hero-hook-form";
1188
+ * import { z } from "zod";
1189
+ *
1190
+ * const schema = z.object({
1191
+ * message: z.string().min(10, "Message must be at least 10 characters"),
1192
+ * feedback: z.string().max(500, "Feedback must be less than 500 characters"),
1193
+ * });
1194
+ *
1195
+ * function MyForm() {
1196
+ * return (
1197
+ * <ZodForm
1198
+ * config={{
1199
+ * schema,
1200
+ * fields: [
1201
+ * FormFieldHelpers.textarea("message", "Message", "Enter your message"),
1202
+ * FormFieldHelpers.textarea("feedback", "Feedback"),
1203
+ * ],
1204
+ * }}
1205
+ * onSubmit={(data) => console.log(data)}
1206
+ * />
1207
+ * );
1208
+ * }
1209
+ * ```
1210
+ *
1211
+ * @example
1212
+ * ```tsx
1213
+ * // With custom styling and min/max rows
1214
+ * <TextareaField
1215
+ * control={form.control}
1216
+ * name="message"
1217
+ * label="Message"
1218
+ * textareaProps={{
1219
+ * minRows: 3,
1220
+ * maxRows: 10,
1221
+ * variant: "bordered",
1222
+ * }}
1223
+ * />
1224
+ * ```
1225
+ */
567
1226
  declare function TextareaField<TFieldValues extends FieldValues>(props: TextareaFieldProps<TFieldValues>): React$1.JSX.Element;
568
1227
 
569
1228
  /**
@@ -1164,14 +1823,6 @@ interface ZodFormProps<T extends FieldValues> {
1164
1823
  submitButtonText?: string;
1165
1824
  subtitle?: string;
1166
1825
  title?: string;
1167
- render?: (formState: {
1168
- form: UseFormReturn<T>;
1169
- isSubmitting: boolean;
1170
- isSubmitted: boolean;
1171
- isSuccess: boolean;
1172
- errors: FieldErrors<T>;
1173
- values: T;
1174
- }) => React$1.ReactNode;
1175
1826
  }
1176
1827
  /**
1177
1828
  * ZodForm component for building type-safe forms with Zod validation.
@@ -1197,7 +1848,6 @@ interface ZodFormProps<T extends FieldValues> {
1197
1848
  * @param {string} [props.resetButtonText="Reset"] - Text for the reset button
1198
1849
  * @param {(error: FormValidationError) => void} [props.onError] - Error callback for validation errors
1199
1850
  * @param {(data: T) => void} [props.onSuccess] - Success callback called after successful submission
1200
- * @param {(formState: {...}) => React.ReactNode} [props.render] - Custom render function for advanced use cases
1201
1851
  *
1202
1852
  * @returns {JSX.Element} The rendered form component with validation and error handling
1203
1853
  *
@@ -1247,28 +1897,12 @@ interface ZodFormProps<T extends FieldValues> {
1247
1897
  * />
1248
1898
  * ```
1249
1899
  *
1250
- * @example
1251
- * Custom render function for advanced control:
1252
- * ```tsx
1253
- * <ZodForm
1254
- * config={{ schema, fields }}
1255
- * onSubmit={handleSubmit}
1256
- * render={({ form, isSubmitting, errors, values }) => (
1257
- * <div>
1258
- * <button disabled={isSubmitting}>
1259
- * {isSubmitting ? "Submitting..." : "Submit"}
1260
- * </button>
1261
- * </div>
1262
- * )}
1263
- * />
1264
- * ```
1265
- *
1266
1900
  * @see {@link Form} for the base form component without Zod
1267
1901
  * @see {@link FormFieldHelpers} for field creation helpers
1268
1902
  * @see {@link createBasicFormBuilder} for builder pattern alternative
1269
1903
  * @category Components
1270
1904
  */
1271
- declare function ZodForm<T extends FieldValues>({ className, columns, config, layout, onError, onSubmit, onSuccess, render, resetButtonText, showResetButton, spacing, submitButtonProps, submitButtonText, subtitle, title, }: ZodFormProps<T>): React$1.JSX.Element;
1905
+ declare function ZodForm<T extends FieldValues>({ className, columns, config, layout, onError, onSubmit, onSuccess, resetButtonText, showResetButton, spacing, submitButtonProps, submitButtonText, subtitle, title, }: ZodFormProps<T>): React$1.JSX.Element;
1272
1906
 
1273
1907
  /**
1274
1908
  * Hook for using Zod validation with React Hook Form
@@ -1434,15 +2068,15 @@ declare const FormFieldHelpers: {
1434
2068
  * })
1435
2069
  * ```
1436
2070
  */
1437
- content: <T extends FieldValues>(title?: string | null, description?: string | null, options?: {
2071
+ content: <T extends FieldValues = FieldValues>(title?: string | null, description?: string | null, options?: {
1438
2072
  render?: (field: {
1439
- form: any;
1440
- errors: any;
2073
+ form: UseFormReturn<T>;
2074
+ errors: FieldErrors<T>;
1441
2075
  isSubmitting: boolean;
1442
2076
  }) => React$1.ReactNode;
1443
2077
  className?: string;
1444
- name?: Path<T>;
1445
- }) => ContentFieldConfig<T>;
2078
+ name?: string;
2079
+ }) => ZodFormFieldConfig<T>;
1446
2080
  /**
1447
2081
  * Create a date field
1448
2082
  */