@saas-ui/forms 2.0.0-next.9 → 2.0.0-rc.23

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -1,36 +1,13 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default from 'react';
3
- import * as _chakra_ui_system_dist_system_types from '@chakra-ui/system/dist/system.types';
4
- import { ButtonProps, NumberInputProps as NumberInputProps$1, InputProps, RadioProps, RadioGroupProps, SystemProps, StackDirection, MenuProps, MenuListProps, MenuItemOptionProps, SelectProps as SelectProps$1, TextareaProps, SwitchProps, CheckboxProps, UsePinInputProps, FormControlProps, SimpleGridProps, ResponsiveValue, FormLabelProps, HTMLChakraProps, ThemingProps } from '@chakra-ui/react';
5
- import { FocusableElement } from '@chakra-ui/utils';
6
3
  import * as react_hook_form from 'react-hook-form';
7
4
  import { FieldValues, FieldPath, RegisterOptions, UseFormReturn as UseFormReturn$1, UseFieldArrayReturn, UseFormProps, WatchObserver, SubmitHandler, SubmitErrorHandler, ResolverOptions, ResolverResult, FormProviderProps as FormProviderProps$1 } from 'react-hook-form';
8
5
  export { BatchFieldArrayUpdate, ChangeHandler, Control, Controller, ControllerFieldState, ControllerProps, ControllerRenderProps, CriteriaMode, CustomElement, DeepMap, DeepPartial, DeepPartialSkipArrayKey, DefaultValues, DelayCallback, EmptyObject, ErrorOption, EventType, FieldArray, FieldArrayMethodProps, FieldArrayWithId, Field as FieldDef, FieldElement, FieldError, FieldErrors, FieldName, FieldNamesMarkedBoolean, FieldRefs, FieldValue, FieldValues, FormProviderProps, FormState, FormStateProxy, FormStateSubjectRef, GetIsDirty, InternalFieldErrors, InternalFieldName, InternalNameSet, IsAny, IsFlatObject, KeepStateOptions, LiteralUnion, Message, Mode, MultipleFieldErrors, Names, NativeFieldValue, NestedValue, NonUndefined, Noop, Primitive, ReadFormState, Ref, RefCallBack, RegisterOptions, Resolver, ResolverError, ResolverOptions, ResolverResult, ResolverSuccess, SetFieldValue, SetValueConfig, Subjects, SubmitErrorHandler, SubmitHandler, TriggerConfig, UnpackNestedValue, UseControllerProps, UseControllerReturn, UseFieldArrayProps, UseFieldArrayReturn, UseFormClearErrors, UseFormGetValues, UseFormHandleSubmit, UseFormProps, UseFormRegister, UseFormRegisterReturn, UseFormReset, UseFormResetField, UseFormReturn, UseFormSetError, UseFormSetFocus, UseFormSetValue, UseFormStateProps, UseFormStateReturn, UseFormTrigger, UseFormUnregister, UseFormWatch, UseWatchProps, Validate, ValidateResult, ValidationMode, ValidationRule, ValidationValue, ValidationValueMessage, WatchInternal, WatchObserver, appendErrors, useController, useFieldArray, useForm, useFormState, useWatch } from 'react-hook-form';
9
6
  import { MaybeRenderProp } from '@chakra-ui/react-utils';
10
- import { UseStepperReturn, UseStepperProps, StepperStepsProps } from '@saas-ui/core';
11
-
12
- interface SubmitButtonProps extends ButtonProps {
13
- /**
14
- * Disable the submit button if the form is untouched.
15
- *
16
- * Change the default behavior by updating
17
- * `SubmitButton.defaultProps.disableIfUntouched`
18
- */
19
- disableIfUntouched?: boolean;
20
- /**
21
- * Disable the submit button if the form is invalid.
22
- *
23
- * Change the default behavior by updating
24
- * `SubmitButton.defaultProps.disableIfInvalid`
25
- */
26
- disableIfInvalid?: boolean;
27
- }
28
- /**
29
- * A button with type submit and default color scheme primary and isLoading state when the form is submitting.
30
- *
31
- * @see Docs https://saas-ui.dev/docs/components/forms/form
32
- */
33
- declare const SubmitButton: _chakra_ui_system_dist_system_types.ComponentWithAs<"button", SubmitButtonProps>;
7
+ import { StepsProps, StepsItemProps, UseStepperReturn, UseStepperProps } from '@saas-ui/core';
8
+ import { NumberInputProps as NumberInputProps$1, InputProps, RadioProps, RadioGroupProps, SystemProps, StackDirection, MenuProps, ButtonProps, MenuListProps, MenuItemOptionProps, SelectProps as SelectProps$1, TextareaProps, SwitchProps, CheckboxProps, UsePinInputProps, FormControlProps, SimpleGridProps, ResponsiveValue, FormLabelProps, HTMLChakraProps, ThemingProps } from '@chakra-ui/react';
9
+ import { FocusableElement } from '@chakra-ui/utils';
10
+ import * as _chakra_ui_system_dist_system_types from '@chakra-ui/system/dist/system.types';
34
11
 
35
12
  interface NumberInputOptions {
36
13
  /**
@@ -197,6 +174,29 @@ declare const defaultFieldTypes: {
197
174
  };
198
175
  type DefaultFields = typeof defaultFieldTypes;
199
176
 
177
+ interface SubmitButtonProps extends ButtonProps {
178
+ /**
179
+ * Disable the submit button if the form is untouched.
180
+ *
181
+ * Change the default behavior by updating
182
+ * `SubmitButton.defaultProps.disableIfUntouched`
183
+ */
184
+ disableIfUntouched?: boolean;
185
+ /**
186
+ * Disable the submit button if the form is invalid.
187
+ *
188
+ * Change the default behavior by updating
189
+ * `SubmitButton.defaultProps.disableIfInvalid`
190
+ */
191
+ disableIfInvalid?: boolean;
192
+ }
193
+ /**
194
+ * A button with type submit and default color scheme primary and isLoading state when the form is submitting.
195
+ *
196
+ * @see Docs https://saas-ui.dev/docs/components/forms/form
197
+ */
198
+ declare const SubmitButton: _chakra_ui_system_dist_system_types.ComponentWithAs<"button", SubmitButtonProps>;
199
+
200
200
  type FieldOption = {
201
201
  label?: string;
202
202
  value: string;
@@ -256,11 +256,11 @@ type DefaultFieldOverrides = {
256
256
  type FieldOverrides<FieldDefs, TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {
257
257
  [K in FieldPathWithArray<TFieldValues, TName>]?: Omit<MergeFieldProps<FieldDefs extends never ? DefaultFields : ShallowMerge<DefaultFields, FieldDefs>, TFieldValues>, 'name'>;
258
258
  };
259
- type WithFields<TFormProps extends FormProps<any, any, any, any>, FieldDefs> = TFormProps extends FormProps<infer TFieldValues, infer TContext> ? Omit<TFormProps, 'children' | 'fields'> & {
259
+ type WithFields<TFormProps extends FormProps<any, any, any, any>, FieldDefs, ExtraOverrides = object> = TFormProps extends FormProps<infer TSchema, infer TFieldValues, infer TContext> ? Omit<TFormProps, 'children' | 'fields'> & {
260
260
  children?: FormChildren<FieldDefs, TFieldValues, TContext>;
261
261
  fields?: FieldOverrides<FieldDefs, TFieldValues> & {
262
262
  submit?: SubmitButtonProps;
263
- };
263
+ } & ExtraOverrides;
264
264
  } : never;
265
265
 
266
266
  type FieldResolver = {
@@ -289,7 +289,7 @@ interface DisplayIfProps<TFieldValues extends FieldValues = FieldValues, TName e
289
289
  * @see Docs https://saas-ui.dev/docs/components/forms/form
290
290
  */
291
291
  declare const DisplayIf: {
292
- <TFieldValues extends FieldValues = FieldValues, TName extends react_hook_form.Path<TFieldValues> = react_hook_form.Path<TFieldValues>>({ children, name, defaultValue, isDisabled, isExact, condition, }: DisplayIfProps<TFieldValues, TName>): React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>> | null;
292
+ <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ children, name, defaultValue, isDisabled, isExact, condition, }: DisplayIfProps<TFieldValues, TName>): React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>> | null;
293
293
  displayName: string;
294
294
  };
295
295
 
@@ -522,7 +522,7 @@ interface FormRenderContext<TFieldValues extends FieldValues = FieldValues, TCon
522
522
  ArrayField: React$1.FC<ArrayFieldProps<TFieldValues> & React$1.RefAttributes<UseArrayFieldReturn>>;
523
523
  ObjectField: React$1.FC<ObjectFieldProps<TFieldValues>>;
524
524
  }
525
- interface FormOptions<TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TSchema = any, TFieldTypes = FieldProps<TFieldValues>> {
525
+ interface FormOptions<TSchema = unknown, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues>> {
526
526
  /**
527
527
  * The form schema.
528
528
  */
@@ -556,66 +556,84 @@ interface FormOptions<TFieldValues extends FieldValues = FieldValues, TContext e
556
556
  */
557
557
  fields?: DefaultFieldOverrides;
558
558
  }
559
- interface FormProps<TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TSchema = any, TFieldTypes = FieldProps<TFieldValues>> extends UseFormProps<TFieldValues, TContext>, Omit<HTMLChakraProps<'form'>, 'children' | 'onChange' | 'onSubmit' | 'onError'>, FormOptions<TFieldValues, TContext, TSchema, TFieldTypes> {
559
+ interface FormProps<TSchema = unknown, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues>> extends UseFormProps<TFieldValues, TContext>, Omit<HTMLChakraProps<'form'>, 'children' | 'onChange' | 'onSubmit' | 'onError'>, FormOptions<TSchema, TFieldValues, TContext, TFieldTypes> {
560
560
  }
561
561
  /**
562
562
  * The wrapper component provides context, state, and focus management.
563
563
  *
564
564
  * @see Docs https://saas-ui.dev/docs/components/forms/form
565
565
  */
566
- declare const Form$1: (<TFieldValues extends FieldValues, TContext extends object = object, TSchema = any, TFieldTypes = FieldProps<TFieldValues>>(props: FormProps<TFieldValues, TContext, TSchema, TFieldTypes> & {
567
- ref?: React$1.ForwardedRef<HTMLFormElement> | undefined;
566
+ declare const Form$1: FormComponent;
567
+ type FormComponent = (<TSchema = unknown, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues>>(props: FormProps<TSchema, TFieldValues, TContext, TFieldTypes> & {
568
+ ref?: React$1.ForwardedRef<HTMLFormElement>;
568
569
  }) => React$1.ReactElement) & {
569
- displayName?: string | undefined;
570
+ displayName?: string;
570
571
  };
571
- type GetResolver = <TFieldValues extends FieldValues, TContext extends object>(schema: any) => (values: TFieldValues, context: TContext | undefined, options: ResolverOptions<TFieldValues>) => Promise<ResolverResult<TFieldValues>>;
572
+ type GetResolver = <TFieldValues extends FieldValues, TContext extends object>(schema: unknown) => (values: TFieldValues, context: TContext | undefined, options: ResolverOptions<TFieldValues>) => Promise<ResolverResult<TFieldValues>>;
572
573
 
573
- interface DisplayFieldProps extends FormControlProps, Omit<FieldProps, 'type' | 'label'> {
574
+ type StepsOptions<TSchema, TName extends string = string> = {
575
+ /**
576
+ * The step name
577
+ */
578
+ name: TName;
579
+ /**
580
+ * Schema
581
+ */
582
+ schema?: TSchema;
583
+ }[];
584
+ interface StepFormProps<TSteps extends StepsOptions<any> = StepsOptions<any>, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues>> extends UseStepFormProps<TSteps, TFieldValues, TContext, TFieldTypes> {
585
+ }
586
+ interface FormStepOptions<TName extends string = string> {
587
+ /**
588
+ * The step name
589
+ */
590
+ name: TName;
591
+ /**
592
+ * Schema
593
+ */
594
+ schema?: any;
595
+ /**
596
+ * Hook Form Resolver
597
+ */
598
+ resolver?: any;
599
+ }
600
+ interface FormStepperProps extends StepsProps, ThemingProps<'Stepper'> {
601
+ render?: StepsItemProps['render'];
574
602
  }
575
603
  /**
604
+ * Renders a stepper that displays progress above the form.
576
605
  *
577
- *
578
- * @see Docs https://saas-ui.dev/
606
+ * @see Docs https://saas-ui.dev/docs/components/forms/step-form
579
607
  */
580
- declare const DisplayField: React$1.FC<DisplayFieldProps>;
581
- declare const FormValue: React$1.FC<{
582
- name: string;
583
- }>;
584
-
585
- interface Option {
586
- value: string;
587
- label?: string;
588
- [key: string]: unknown;
608
+ declare const FormStepper: React$1.FC<FormStepperProps>;
609
+ interface FormStepProps<TName extends string = string> extends FormStepOptions<TName>, Omit<HTMLChakraProps<'div'>, 'onSubmit'> {
610
+ onSubmit?: FormStepSubmitHandler;
589
611
  }
590
- type FieldRules = Pick<RegisterOptions, 'required' | 'min' | 'max' | 'maxLength' | 'minLength' | 'pattern'>;
591
612
  /**
592
- * Form field component.
593
- *
594
- * Build-in types:
595
- * text, number, password, textarea, select, native-select, checkbox, radio, switch, pin
613
+ * The form step containing fields for a specific step.
596
614
  *
597
- * Will default to a text field if there is no matching type.
598
-
599
- * @see Docs https://saas-ui.dev/docs/components/forms/field
615
+ * @see Docs https://saas-ui.dev/docs/components/forms/step-form
600
616
  */
601
- declare const Field: (<TFieldValues extends FieldValues>(props: FieldProps<TFieldValues> & {
602
- ref?: React$1.ForwardedRef<FocusableElement> | undefined;
603
- }) => React$1.ReactElement) & {
604
- displayName?: string | undefined;
617
+ declare const FormStep: {
618
+ <TName extends string = string>(props: FormStepProps<TName>): JSX.Element | null;
619
+ displayName: string;
605
620
  };
606
-
607
- interface FieldsProps<TSchema = any> {
608
- schema?: TSchema;
609
- fieldResolver?: FieldResolver;
610
- focusFirstField?: boolean;
621
+ /**
622
+ * A button that this opens the previous step when clicked. Disabled on the first step.
623
+ *
624
+ * @see Docs https://saas-ui.dev/docs/components/forms/step-form
625
+ */
626
+ declare const PrevButton: React$1.FC<ButtonProps>;
627
+ interface NextButtonProps extends Omit<ButtonProps, 'children'> {
628
+ submitLabel?: string;
629
+ label?: string;
611
630
  }
612
- declare const AutoFields: React$1.FC<FieldsProps>;
613
-
614
- declare const FieldsProvider: React__default.FC<{
615
- value: Record<string, React__default.FC<any>>;
616
- children: React__default.ReactNode;
617
- }>;
618
- declare const useField: (type: string) => React__default.FC<any>;
631
+ /**
632
+ * A button that submits the active step.
633
+ *
634
+ * @see Docs https://saas-ui.dev/docs/components/forms/step-form
635
+ */
636
+ declare const NextButton: React$1.FC<NextButtonProps>;
619
637
 
620
638
  interface StepState {
621
639
  name: string;
@@ -633,8 +651,21 @@ interface StepFormContext extends UseStepperReturn {
633
651
  declare const StepFormProvider: React$1.Provider<StepFormContext>;
634
652
  declare const useStepFormContext: () => StepFormContext;
635
653
 
636
- interface UseStepFormProps<TFieldValues extends FieldValues = FieldValues> extends Omit<UseStepperProps, 'onChange'>, Omit<FormProps<TFieldValues>, 'children'> {
637
- children: MaybeRenderProp<UseStepFormReturn<TFieldValues>>;
654
+ type StepName<T extends {
655
+ [k: number]: {
656
+ readonly name: string;
657
+ };
658
+ }> = T[number]['name'];
659
+ interface StepFormRenderContext<TSteps extends StepsOptions<any> = StepsOptions<any>, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues>> extends UseStepFormReturn<TFieldValues> {
660
+ Field: React$1.FC<TFieldTypes & React$1.RefAttributes<FocusableElement>>;
661
+ FormStep: React$1.FC<FormStepProps<StepName<TSteps>>>;
662
+ DisplayIf: React$1.FC<DisplayIfProps<TFieldValues>>;
663
+ ArrayField: React$1.FC<ArrayFieldProps<TFieldValues> & React$1.RefAttributes<UseArrayFieldReturn>>;
664
+ ObjectField: React$1.FC<ObjectFieldProps<TFieldValues>>;
665
+ }
666
+ interface UseStepFormProps<TSteps extends StepsOptions<any> = StepsOptions<any>, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues>> extends Omit<UseStepperProps, 'onChange'>, Omit<FormProps<any, TFieldValues, TContext, TFieldTypes>, 'children'> {
667
+ steps?: TSteps;
668
+ children: MaybeRenderProp<StepFormRenderContext<TSteps, TFieldValues, TContext, TFieldTypes>>;
638
669
  }
639
670
  interface UseStepFormReturn<TFieldValues extends FieldValues = FieldValues> extends UseStepperReturn {
640
671
  getFormProps(): {
@@ -645,7 +676,7 @@ interface UseStepFormReturn<TFieldValues extends FieldValues = FieldValues> exte
645
676
  updateStep(step: any): void;
646
677
  steps: Record<string, any>;
647
678
  }
648
- declare function useStepForm<TFieldValues extends FieldValues = FieldValues>(props: UseStepFormProps<TFieldValues>): UseStepFormReturn<TFieldValues>;
679
+ declare function useStepForm<TSteps extends StepsOptions<any> = StepsOptions<any>, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues>>(props: UseStepFormProps<TSteps, TFieldValues, TContext, TFieldTypes>): UseStepFormReturn<TFieldValues>;
649
680
  interface UseFormStepProps {
650
681
  name: string;
651
682
  schema?: any;
@@ -654,63 +685,65 @@ interface UseFormStepProps {
654
685
  }
655
686
  declare function useFormStep(props: UseFormStepProps): StepState;
656
687
 
657
- interface StepFormProps<TFieldValues extends FieldValues = FieldValues, TContext extends object = object> extends UseStepFormProps<TFieldValues> {
658
- }
659
- /**
660
- * The wrapper component provides context, state, and focus management.
661
- *
662
- * @see Docs https://saas-ui.dev/docs/components/forms/step-form
663
- */
664
- declare const StepForm: <TFieldValues extends FieldValues>(props: StepFormProps<TFieldValues, object> & {
665
- ref?: React$1.ForwardedRef<HTMLFormElement> | undefined;
666
- }) => React$1.ReactElement;
667
- interface FormStepOptions {
668
- /**
669
- * The step name
670
- */
671
- name: string;
672
- /**
673
- * Schema
674
- */
675
- schema?: any;
676
- /**
677
- * Hook Form Resolver
678
- */
679
- resolver?: any;
680
- }
681
- interface FormStepperProps extends StepperStepsProps, ThemingProps<'Stepper'> {
688
+ interface CreateFormProps$1<FieldDefs> {
689
+ resolver?: GetResolver;
690
+ fieldResolver?: GetFieldResolver;
691
+ fields?: FieldDefs extends Record<string, React__default.FC<any>> ? FieldDefs : never;
682
692
  }
683
- /**
684
- * Renders a stepper that displays progress above the form.
685
- *
686
- * @see Docs https://saas-ui.dev/docs/components/forms/step-form
687
- */
688
- declare const FormStepper: React$1.FC<FormStepperProps>;
689
- interface FormStepProps extends FormStepOptions, Omit<HTMLChakraProps<'div'>, 'onSubmit'> {
690
- onSubmit?: FormStepSubmitHandler;
693
+ type FormType<FieldDefs, ExtraProps = object, ExtraOverrides = object> = (<TSchema = unknown, TFieldValues extends FieldValues = FieldValues, TContext extends object = object>(props: WithFields<FormProps<TSchema, TFieldValues, TContext>, FieldDefs, ExtraOverrides> & {
694
+ ref?: React__default.ForwardedRef<HTMLFormElement>;
695
+ } & ExtraProps) => React__default.ReactElement) & {
696
+ displayName?: string;
697
+ id?: string;
698
+ };
699
+ declare function createForm<FieldDefs>({ resolver, fieldResolver, fields, }?: CreateFormProps$1<FieldDefs>): FormType<FieldDefs, object, object>;
700
+
701
+ interface DisplayFieldProps extends FormControlProps, Omit<FieldProps, 'type' | 'label'> {
691
702
  }
692
703
  /**
693
- * The form step containing fields for a specific step.
694
704
  *
695
- * @see Docs https://saas-ui.dev/docs/components/forms/step-form
696
- */
697
- declare const FormStep: React$1.FC<FormStepProps>;
698
- /**
699
- * A button that this opens the previous step when clicked. Disabled on the first step.
700
705
  *
701
- * @see Docs https://saas-ui.dev/docs/components/forms/step-form
706
+ * @see Docs https://saas-ui.dev/
702
707
  */
703
- declare const PrevButton: React$1.FC<ButtonProps>;
704
- interface NextButtonProps extends Omit<ButtonProps, 'children'> {
705
- submitLabel?: string;
708
+ declare const DisplayField: React$1.FC<DisplayFieldProps>;
709
+ declare const FormValue: React$1.FC<{
710
+ name: string;
711
+ }>;
712
+
713
+ interface Option {
714
+ value: string;
706
715
  label?: string;
716
+ [key: string]: unknown;
707
717
  }
718
+ type FieldRules = Pick<RegisterOptions, 'required' | 'min' | 'max' | 'maxLength' | 'minLength' | 'pattern'>;
708
719
  /**
709
- * A button that submits the active step.
720
+ * Form field component.
710
721
  *
711
- * @see Docs https://saas-ui.dev/docs/components/forms/step-form
722
+ * Build-in types:
723
+ * text, number, password, textarea, select, native-select, checkbox, radio, switch, pin
724
+ *
725
+ * Will default to a text field if there is no matching type.
726
+
727
+ * @see Docs https://saas-ui.dev/docs/components/forms/field
712
728
  */
713
- declare const NextButton: React$1.FC<NextButtonProps>;
729
+ declare const Field: (<TFieldValues extends FieldValues>(props: FieldProps<TFieldValues> & {
730
+ ref?: React$1.ForwardedRef<FocusableElement> | undefined;
731
+ }) => React$1.ReactElement) & {
732
+ displayName?: string | undefined;
733
+ };
734
+
735
+ interface FieldsProps<TSchema = any> {
736
+ schema?: TSchema;
737
+ fieldResolver?: FieldResolver;
738
+ focusFirstField?: boolean;
739
+ }
740
+ declare const AutoFields: React$1.FC<FieldsProps>;
741
+
742
+ declare const FieldsProvider: React__default.FC<{
743
+ value: Record<string, React__default.FC<any>>;
744
+ children: React__default.ReactNode;
745
+ }>;
746
+ declare const useField: (type: string) => React__default.FC<any>;
714
747
 
715
748
  type FormProviderProps<TFieldValues extends FieldValues = FieldValues, TContext = any, TSchema = any> = FormProviderProps$1<TFieldValues, TContext> & {
716
749
  fieldResolver?: FieldResolver;
@@ -762,22 +795,6 @@ declare const InputRightButton: _chakra_ui_system_dist_system_types.ComponentWit
762
795
  */
763
796
  declare const BaseField: React$1.FC<BaseFieldProps>;
764
797
 
765
- interface CreateFormProps<FieldDefs> {
766
- resolver?: GetResolver;
767
- fieldResolver?: GetFieldResolver;
768
- fields?: FieldDefs extends Record<string, React__default.FC<any>> ? FieldDefs : never;
769
- }
770
- declare function createForm<FieldDefs, Schema = any>({ resolver, fieldResolver, fields, }?: CreateFormProps<FieldDefs>): (<TFieldValues extends FieldValues, TContext extends object = object, TSchema extends Schema = Schema>(props: Omit<FormProps<TFieldValues, TContext, TSchema, FieldProps<TFieldValues>>, "children" | "fields"> & {
771
- children?: FormChildren<FieldDefs, TFieldValues, TContext>;
772
- fields?: (FieldOverrides<FieldDefs, TFieldValues, react_hook_form.Path<TFieldValues>> & {
773
- submit?: SubmitButtonProps | undefined;
774
- }) | undefined;
775
- } & {
776
- ref?: React__default.ForwardedRef<HTMLFormElement> | undefined;
777
- }) => React__default.ReactElement) & {
778
- displayName?: string | undefined;
779
- };
780
-
781
798
  interface CreateFieldOptions {
782
799
  isControlled?: boolean;
783
800
  hideLabel?: boolean;
@@ -793,15 +810,36 @@ interface CreateFieldOptions {
793
810
  */
794
811
  declare const createField: <TProps extends object>(component: React$1.FC<TProps>, options?: CreateFieldOptions) => React$1.FC<TProps & BaseFieldProps<react_hook_form.FieldValues, string>>;
795
812
 
796
- declare const Form: (<TFieldValues extends react_hook_form.FieldValues, TContext extends object = object, TSchema extends any = any>(props: Omit<FormProps<TFieldValues, TContext, TSchema, FieldProps<TFieldValues>>, "children" | "fields"> & {
797
- children?: FormChildren<unknown, TFieldValues, TContext>;
798
- fields?: (FieldOverrides<unknown, TFieldValues, react_hook_form.Path<TFieldValues>> & {
799
- submit?: SubmitButtonProps | undefined;
800
- }) | undefined;
801
- } & {
813
+ type StepFormType<FieldDefs, ExtraProps = object, ExtraOverrides = object> = (<TSteps extends StepsOptions<any> = StepsOptions<any>, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues>>(props: UseStepFormProps<TSteps, TFieldValues, TContext, TFieldTypes> & {
814
+ ref?: React__default.ForwardedRef<HTMLFormElement>;
815
+ }) => React__default.ReactElement) & {
816
+ displayName?: string;
817
+ id?: string;
818
+ };
819
+ interface CreateFormProps<FieldDefs> {
820
+ resolver?: GetResolver;
821
+ fieldResolver?: GetFieldResolver;
822
+ fields?: FieldDefs extends Record<string, React__default.FC<any>> ? FieldDefs : never;
823
+ }
824
+ declare function createStepForm<FieldDefs = any, ExtraProps = object, ExtraOverrides = object>({ fields, resolver, fieldResolver }?: CreateFormProps<FieldDefs>): StepFormType<FieldDefs, ExtraProps, ExtraOverrides>;
825
+
826
+ /**
827
+ * Form component.
828
+ *
829
+ * @see Docs https://saas-ui.dev/docs/components/forms/form
830
+ */
831
+ declare const Form: FormType<unknown, object, object>;
832
+
833
+ /**
834
+ * Multi-step form component.
835
+ *
836
+ * @see Docs https://saas-ui.dev/docs/components/forms/step-form
837
+ */
838
+ declare const StepForm: (<TSteps extends StepsOptions<any> = StepsOptions<any>, TFieldValues extends react_hook_form.FieldValues = react_hook_form.FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues>>(props: UseStepFormProps<TSteps, TFieldValues, TContext, TFieldTypes> & {
802
839
  ref?: React$1.ForwardedRef<HTMLFormElement> | undefined;
803
840
  }) => React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>>) & {
804
841
  displayName?: string | undefined;
842
+ id?: string | undefined;
805
843
  };
806
844
 
807
- export { ArrayField, ArrayFieldAddButton, ArrayFieldButtonProps, ArrayFieldContainer, ArrayFieldContainerProps, ArrayFieldOptions, ArrayFieldProps, ArrayFieldProvider, ArrayFieldRemoveButton, ArrayFieldRow, ArrayFieldRowContainer, ArrayFieldRowFields, ArrayFieldRowFieldsProps, ArrayFieldRowProvider, ArrayFieldRows, ArrayFieldRowsProps, AutoFields, BaseField, BaseFieldProps, Form$1 as BaseForm, CheckboxField, CreateFieldOptions, CreateFormProps, DefaultFields, DisplayField, DisplayFieldProps, DisplayIf, DisplayIfProps, Field, FieldOptions, FieldProps, FieldResolver, FieldRules, FieldsProps, FieldsProvider, Form, FormLayout, FormLayoutProps, FormLegend, FormProps, FormProvider, FormRenderContext, FormStep, FormStepOptions, FormStepProps, FormStepSubmitHandler, FormStepper, FormStepperProps, FormValue, GetFieldResolver, InputField, InputFieldProps, InputRightButton, InputRightButtonProps, NativeSelect, NativeSelectField, NativeSelectProps, NextButton, NextButtonProps, NumberInputField, NumberInputFieldProps, ObjectField, ObjectFieldProps, ObjectSchema, Option, PasswordInput, PasswordInputField, PasswordInputProps, PinField, PinFieldProps, PrevButton, RadioField, RadioInput, RadioInputProps, RadioOption, RadioOptions, Select, SelectButton, SelectButtonProps, SelectField, SelectList, SelectListProps, SelectOption, SelectProps, StepForm, StepFormContext, StepFormProps, StepFormProvider, StepState, SubmitButton, SubmitButtonProps, SwitchField, TextareaField, UseArrayFieldReturn, UseArrayFieldRowProps, UseArrayFieldRowReturn, UseFormStepProps, UseStepFormProps, UseStepFormReturn, WatchField, WatchFieldProps, WithFields, createField, createForm, defaultFieldTypes, objectFieldResolver, useArrayField, useArrayFieldAddButton, useArrayFieldContext, useArrayFieldRemoveButton, useArrayFieldRow, useArrayFieldRowContext, useField, useFormContext, useFormStep, useStepForm, useStepFormContext };
845
+ export { ArrayField, ArrayFieldAddButton, ArrayFieldButtonProps, ArrayFieldContainer, ArrayFieldContainerProps, ArrayFieldOptions, ArrayFieldProps, ArrayFieldProvider, ArrayFieldRemoveButton, ArrayFieldRow, ArrayFieldRowContainer, ArrayFieldRowFields, ArrayFieldRowFieldsProps, ArrayFieldRowProvider, ArrayFieldRows, ArrayFieldRowsProps, AutoFields, BaseField, BaseFieldProps, Form$1 as BaseForm, CheckboxField, CreateFieldOptions, CreateFormProps$1 as CreateFormProps, DefaultFieldOverrides, DefaultFields, DisplayField, DisplayFieldProps, DisplayIf, DisplayIfProps, Field, FieldOptions, FieldProps, FieldResolver, FieldRules, FieldsProps, FieldsProvider, Form, FormComponent, FormLayout, FormLayoutProps, FormLegend, FormProps, FormProvider, FormRenderContext, FormStep, FormStepOptions, FormStepProps, FormStepSubmitHandler, FormStepper, FormStepperProps, FormType, FormValue, GetFieldResolver, InputField, InputFieldProps, InputRightButton, InputRightButtonProps, NativeSelect, NativeSelectField, NativeSelectProps, NextButton, NextButtonProps, NumberInputField, NumberInputFieldProps, ObjectField, ObjectFieldProps, ObjectSchema, Option, PasswordInput, PasswordInputField, PasswordInputProps, PinField, PinFieldProps, PrevButton, RadioField, RadioInput, RadioInputProps, RadioOption, RadioOptions, Select, SelectButton, SelectButtonProps, SelectField, SelectList, SelectListProps, SelectOption, SelectProps, StepForm, StepFormContext, StepFormProps, StepFormProvider, StepState, StepsOptions, SubmitButton, SubmitButtonProps, SwitchField, TextareaField, UseArrayFieldReturn, UseArrayFieldRowProps, UseArrayFieldRowReturn, UseFormStepProps, UseStepFormProps, UseStepFormReturn, WatchField, WatchFieldProps, WithFields, createField, createForm, createStepForm, defaultFieldTypes, objectFieldResolver, useArrayField, useArrayFieldAddButton, useArrayFieldContext, useArrayFieldRemoveButton, useArrayFieldRow, useArrayFieldRowContext, useField, useFormContext, useFormStep, useStepForm, useStepFormContext };