@saas-ui/forms 3.0.0-alpha.1 → 3.0.0-alpha.10

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,85 @@
1
1
  # @saas-ui/forms
2
2
 
3
+ ## 3.0.0-alpha.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [212a7e6]
8
+ - Updated dependencies [942e9a0]
9
+ - Updated dependencies [212a7e6]
10
+ - Updated dependencies [65fac53]
11
+ - @saas-ui/react@3.0.0-alpha.10
12
+
13
+ ## 3.0.0-alpha.9
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [f0f5ab0]
18
+ - @saas-ui/react@3.0.0-alpha.9
19
+
20
+ ## 3.0.0-alpha.8
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [64e680e]
25
+ - Updated dependencies [64e680e]
26
+ - @saas-ui/react@3.0.0-alpha.8
27
+
28
+ ## 3.0.0-alpha.7
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies [8e760c5]
33
+ - @saas-ui/react@3.0.0-alpha.7
34
+
35
+ ## 3.0.0-alpha.6
36
+
37
+ ### Minor Changes
38
+
39
+ - 95c8652: Update to Chakra UI 3.2.1
40
+
41
+ ### Patch Changes
42
+
43
+ - Updated dependencies [95c8652]
44
+ - @saas-ui/react@3.0.0-alpha.6
45
+ - @saas-ui/core@3.0.0-alpha.4
46
+
47
+ ## 3.0.0-alpha.5
48
+
49
+ ### Patch Changes
50
+
51
+ - Updated dependencies [e9fec88]
52
+ - Updated dependencies [f62c3d6]
53
+ - @saas-ui/react@3.0.0-alpha.5
54
+
55
+ ## 3.0.0-alpha.4
56
+
57
+ ### Patch Changes
58
+
59
+ - Updated dependencies [7808a76]
60
+ - @saas-ui/react@3.0.0-alpha.4
61
+
62
+ ## 3.0.0-alpha.3
63
+
64
+ ### Patch Changes
65
+
66
+ - cee2e9c: Removed chakra ui dependency of core package
67
+ - Updated dependencies [cee2e9c]
68
+ - @saas-ui/core@3.0.0-alpha.3
69
+ - @saas-ui/react@3.0.0-alpha.3
70
+
71
+ ## 3.0.0-alpha.2
72
+
73
+ ### Minor Changes
74
+
75
+ - 6459de4: Removed src exports and files from packages
76
+
77
+ ### Patch Changes
78
+
79
+ - Updated dependencies [6459de4]
80
+ - @saas-ui/react@3.0.0-alpha.2
81
+ - @saas-ui/core@3.0.0-alpha.2
82
+
3
83
  ## 3.0.0-alpha.1
4
84
 
5
85
  ### Major Changes
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/create-form.tsx","../src/default-fields.tsx","../src/create-field.tsx","../src/base-field.tsx","../src/form-context.tsx","../src/fields-context.tsx","../src/field-resolver.ts","../src/form.tsx","../src/array-field.tsx","../src/form-layout.tsx","../src/use-array-field.tsx","../src/utils.ts","../src/display-if.tsx","../src/field.tsx","../src/fields.tsx","../src/object-field.tsx","../src/submit-button.tsx","../src/display-field.tsx","../src/watch-field.tsx"],"sourcesContent":["// Import and export Form and StepForm\nimport { createForm } from './create-form'\n\n// import { createStepForm } from './create-step-form'\n\n// Exporting from './display-field'\nexport { DisplayField } from './display-field'\nexport type { DisplayFieldProps } from './display-field'\nexport { FormValue } from './display-field'\n\n// Exporting from './field'\nexport { Field } from './field'\nexport type { FieldRules } from './field'\n\n// Exporting from './fields'\nexport { AutoFields } from './fields'\nexport type { FieldsProps } from './fields'\n\n// Exporting from './fields-context'\nexport { FieldsProvider, useField } from './fields-context'\n\n// Exporting from './layout'\nexport { FormLayout } from './form-layout'\nexport type { FormLayoutProps } from './form-layout'\n\n// Exporting from './submit-button'\nexport { SubmitButton } from './submit-button'\nexport type { SubmitButtonProps } from './submit-button'\n\n// Exporting from './array-field'\nexport {\n ArrayField,\n ArrayFieldAddButton,\n ArrayFieldContainer,\n ArrayFieldRemoveButton,\n ArrayFieldRow,\n ArrayFieldRowContainer,\n ArrayFieldRowFields,\n ArrayFieldRows,\n} from './array-field'\n\nexport type {\n ArrayFieldButtonProps,\n ArrayFieldContainerProps,\n ArrayFieldProps,\n ArrayFieldRowFieldsProps,\n ArrayFieldRowsProps,\n} from './array-field'\n\n// Exporting from './use-array-field'\nexport {\n ArrayFieldProvider,\n ArrayFieldRowProvider,\n useArrayField,\n useArrayFieldAddButton,\n useArrayFieldContext,\n useArrayFieldRemoveButton,\n useArrayFieldRow,\n useArrayFieldRowContext,\n} from './use-array-field'\n\nexport type {\n ArrayFieldOptions,\n UseArrayFieldReturn,\n UseArrayFieldRowProps,\n UseArrayFieldRowReturn,\n} from './use-array-field'\n\n// Exporting from './object-field'\nexport { FormLegend, ObjectField } from './object-field'\nexport type { ObjectFieldProps } from './object-field'\n\n// Exporting from './display-if'\nexport { DisplayIf } from './display-if'\nexport type { DisplayIfProps } from './display-if'\n\n// Exporting from './step-form'\n// export { FormStep, FormStepper, NextButton, PrevButton } from './step-form'\n\n// export type {\n// FormStepOptions,\n// FormStepProps,\n// FormStepperProps,\n// NextButtonProps,\n// StepFormProps,\n// StepsOptions,\n// } from './step-form'\n\n// Exporting from './use-step-form'\n// export {\n// StepFormProvider,\n// useFormStep,\n// useStepForm,\n// useStepFormContext,\n// } from './use-step-form'\n\n// export type {\n// FormStepSubmitHandler,\n// StepFormContext,\n// StepFormRenderContext,\n// StepState,\n// UseFormStepProps,\n// UseStepFormProps,\n// UseStepFormReturn,\n// } from './use-step-form'\n\n// Exporting from './field-resolver'\nexport { objectFieldResolver } from './field-resolver'\nexport type {\n FieldResolver,\n GetFieldResolver,\n ObjectSchema,\n} from './field-resolver'\n\n// Exporting from './watch-field'\nexport { WatchField } from './watch-field'\nexport type { WatchFieldProps } from './watch-field'\n\n// Exporting BaseField from './base-field'\nexport { BaseField, useBaseField } from './base-field'\n\n// Exporting from './default-fields'\nexport {\n // CheckboxField,\n InputField,\n // NativeSelectField,\n // NumberInputField,\n // PasswordInputField,\n // PinField,\n // RadioField,\n // SelectField,\n // SwitchField,\n TextareaField,\n defaultFieldTypes,\n} from './default-fields'\n\nexport type {\n DefaultFields,\n InputFieldProps,\n // NumberInputFieldProps,\n // PinFieldProps,\n // SelectFieldProps,\n // SwitchFieldProps,\n TextareaFieldProps,\n // CheckboxFieldProps,\n // NativeSelectFieldProps,\n // RadioFieldProps,\n} from './default-fields'\n\n// Exporting types from './types'\nexport type {\n FieldProps,\n WithFields,\n BaseFieldProps,\n FieldOptions,\n DefaultFieldOverrides,\n // WithStepFields,\n GetBaseField,\n} from './types'\n\n// Exporting from './create-form'\nexport { createForm } from './create-form'\nexport type { CreateFormProps, FormType } from './create-form'\n\n// Exporting from './create-field'\nexport { createField } from './create-field'\nexport type { CreateFieldOptions } from './create-field'\n\n// Exporting from './form'\nexport { Form as BaseForm } from './form'\nexport type { FormProps, FormRenderContext, FormComponent } from './form'\n\n// Exporting from './form-context'\nexport { FormProvider, useFormContext } from './form-context'\n\n// export { createStepForm } from './create-step-form'\n// export type { CreateStepFormProps } from './create-step-form'\n\n/**\n * Form component.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const Form = createForm()\n\n/**\n * Multi-step form component.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/step-form\n */\n// export const StepForm = createStepForm()\n\nexport type {\n BatchFieldArrayUpdate,\n ChangeHandler,\n Control,\n ControllerFieldState,\n ControllerProps,\n ControllerRenderProps,\n CriteriaMode,\n CustomElement,\n DeepMap,\n DeepPartial,\n DeepPartialSkipArrayKey,\n DefaultValues,\n DelayCallback,\n EmptyObject,\n ErrorOption,\n EventType,\n Field as FieldDef,\n FieldArray,\n FieldArrayMethodProps,\n FieldArrayWithId,\n FieldElement,\n FieldError,\n FieldErrors,\n FieldName,\n FieldNamesMarkedBoolean,\n FieldRefs,\n FieldValue,\n FieldValues,\n FormProviderProps,\n FormState,\n FormStateProxy,\n FormStateSubjectRef,\n GetIsDirty,\n InternalFieldErrors,\n InternalFieldName,\n InternalNameSet,\n IsAny,\n IsFlatObject,\n KeepStateOptions,\n LiteralUnion,\n Message,\n Mode,\n MultipleFieldErrors,\n Names,\n NativeFieldValue,\n NestedValue,\n NonUndefined,\n Noop,\n Primitive,\n ReadFormState,\n Ref,\n RefCallBack,\n RegisterOptions,\n Resolver,\n ResolverError,\n ResolverOptions,\n ResolverResult,\n ResolverSuccess,\n SetFieldValue,\n SetValueConfig,\n Subjects,\n SubmitErrorHandler,\n SubmitHandler,\n TriggerConfig,\n UnpackNestedValue,\n UseControllerProps,\n UseControllerReturn,\n UseFieldArrayProps,\n UseFieldArrayReturn,\n UseFormClearErrors,\n UseFormGetValues,\n UseFormHandleSubmit,\n UseFormProps,\n UseFormRegister,\n UseFormRegisterReturn,\n UseFormReset,\n UseFormResetField,\n UseFormReturn,\n UseFormSetError,\n UseFormSetFocus,\n UseFormSetValue,\n UseFormStateProps,\n UseFormStateReturn,\n UseFormTrigger,\n UseFormUnregister,\n UseFormWatch,\n UseWatchProps,\n Validate,\n ValidateResult,\n ValidationMode,\n ValidationRule,\n ValidationValue,\n ValidationValueMessage,\n WatchInternal,\n WatchObserver,\n ArrayPath,\n BrowserNativeObject,\n DeepRequired,\n ExtractObjects,\n FieldArrayPath,\n FieldArrayPathValue,\n FieldErrorsImpl,\n FieldPath,\n FieldPathByValue,\n FieldPathValue,\n FieldPathValues,\n} from 'react-hook-form'\n\nexport {\n appendErrors,\n useController,\n useFieldArray,\n useForm,\n useFormState,\n useWatch,\n Controller,\n} from 'react-hook-form'\n","import React, { ForwardedRef, forwardRef, useMemo } from 'react'\n\nimport { defaultFieldTypes } from './default-fields'\nimport { objectFieldResolver } from './field-resolver'\nimport { GetFieldResolver } from './field-resolver'\nimport { FieldsProvider } from './fields-context'\nimport { FieldValues, Form, FormProps, GetResolver } from './form'\nimport { GetBaseField, WithFields } from './types'\n\nexport interface CreateFormProps<\n FieldDefs,\n TGetBaseField extends GetBaseField = GetBaseField,\n> {\n resolver?: GetResolver\n fieldResolver?: GetFieldResolver\n fields?: FieldDefs extends Record<string, React.FC<any>> ? FieldDefs : never\n getBaseField?: TGetBaseField\n}\n\nexport type FormType<\n FieldDefs,\n ExtraProps = object,\n ExtraFieldProps extends object = object,\n ExtraOverrides = object,\n> = (<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n>(\n props: WithFields<\n FormProps<TSchema, TFieldValues, TContext, ExtraFieldProps>,\n FieldDefs,\n ExtraOverrides\n > & {\n ref?: React.ForwardedRef<HTMLFormElement>\n } & ExtraProps,\n) => React.ReactElement) & {\n displayName?: string\n id?: string\n}\n\nexport function createForm<\n FieldDefs,\n TGetBaseField extends GetBaseField<any> = GetBaseField<any>,\n>({\n resolver,\n fieldResolver = objectFieldResolver,\n fields,\n getBaseField,\n}: CreateFormProps<FieldDefs, TGetBaseField> = {}) {\n type ExtraFieldProps =\n TGetBaseField extends GetBaseField<infer ExtraFieldProps>\n ? ExtraFieldProps\n : object\n\n const DefaultForm = forwardRef(\n <\n TSchema = any,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n >(\n props: WithFields<\n FormProps<TSchema, TFieldValues, TContext, ExtraFieldProps>,\n FieldDefs\n >,\n ref: ForwardedRef<HTMLFormElement>,\n ) => {\n const {\n schema,\n resolver: resolverProp,\n fieldResolver: fieldResolverProp,\n ...rest\n } = props\n\n const fieldsContext = useMemo(\n () => ({\n fields: { ...defaultFieldTypes, ...fields },\n getBaseField,\n }),\n [fields, getBaseField],\n )\n\n return (\n <FieldsProvider value={fieldsContext}>\n <Form\n ref={ref}\n resolver={resolverProp ?? resolver?.(props.schema)}\n fieldResolver={fieldResolverProp ?? fieldResolver?.(schema)}\n {...rest}\n />\n </FieldsProvider>\n )\n },\n ) as FormType<FieldDefs, object, ExtraFieldProps>\n\n DefaultForm.displayName = 'Form'\n DefaultForm.id = 'Form'\n\n return DefaultForm\n}\n","import React from 'react'\n\nimport {\n Input,\n InputProps,\n Stack,\n type SystemStyleObject,\n Textarea,\n TextareaProps,\n createListCollection,\n} from '@chakra-ui/react'\nimport { Checkbox, type CheckboxProps } from '@saas-ui/react/checkbox'\nimport { InputGroup } from '@saas-ui/react/input-group'\nimport { NumberInput, type NumberInputProps } from '@saas-ui/react/number-input'\nimport {\n PasswordInput,\n type PasswordInputProps,\n} from '@saas-ui/react/password-input'\nimport { PinInput, type PinInputProps } from '@saas-ui/react/pin-input'\nimport { Radio, RadioGroup, type RadioGroupProps } from '@saas-ui/react/radio'\nimport { Select } from '@saas-ui/react/select'\nimport { Switch, type SwitchProps } from '@saas-ui/react/switch'\n\nimport { createField } from './create-field.tsx'\nimport type { FieldOption, FieldOptions } from './types.ts'\n\nexport interface InputFieldProps extends InputProps {\n type?: string\n startElement?: React.ReactNode\n endElement?: React.ReactNode\n}\n\nexport const InputField = createField<HTMLInputElement, InputFieldProps>(\n ({ type = 'text', startElement, endElement, size, ...rest }, ref) => {\n return (\n <InputGroup startElement={startElement} endElement={endElement}>\n <Input type={type} size={size} {...rest} ref={ref} />\n </InputGroup>\n )\n },\n)\n\nexport interface NumberInputFieldProps extends NumberInputProps {\n type: 'number'\n}\n\nexport const NumberInputField = createField<\n HTMLInputElement,\n NumberInputFieldProps\n>((props, ref) => <NumberInput {...props} ref={ref} />, {\n isControlled: true,\n})\n\nexport const PasswordInputField = createField<\n HTMLInputElement,\n PasswordInputProps\n>(({ type = 'password', ...props }, ref) => (\n <PasswordInput ref={ref} {...props} />\n))\n\nexport interface TextareaFieldProps extends TextareaProps {}\n\nexport const TextareaField = createField<\n HTMLTextAreaElement,\n TextareaFieldProps\n>((props, ref) => <Textarea {...props} ref={ref} />)\n\nexport interface SwitchFieldProps extends SwitchProps {\n type: 'switch'\n}\n\nexport const SwitchField = createField<HTMLInputElement, SwitchFieldProps>(\n ({ type, value, ...rest }, ref) => {\n return <Switch checked={!!value} {...rest} ref={ref} />\n },\n {\n isControlled: true,\n },\n)\n\nexport interface SelectFieldProps\n extends Omit<Select.RootProps<FieldOption>, 'collection'> {\n options: FieldOptions\n placeholder?: string\n triggerProps?: Select.TriggerProps\n contentProps?: Select.ContentProps\n}\n\nexport const SelectField = createField<HTMLDivElement, SelectFieldProps>(\n (props, ref) => {\n const {\n triggerProps,\n contentProps,\n options,\n placeholder,\n onChange,\n onValueChange,\n onBlur,\n ...rest\n } = props\n\n const collection = createListCollection({\n items: options,\n })\n\n return (\n <Select.Root\n ref={ref}\n collection={collection}\n onValueChange={(details) => {\n onChange(details.value)\n }}\n onInteractOutside={() => onBlur()}\n {...rest}\n >\n <Select.Trigger {...triggerProps}>\n <Select.ValueText placeholder={placeholder} />\n </Select.Trigger>\n <Select.Content {...contentProps}>\n {collection.items.map((option) => (\n <Select.Item key={option.value} item={option}>\n {option.label || option.value}\n </Select.Item>\n ))}\n </Select.Content>\n </Select.Root>\n )\n },\n {\n isControlled: true,\n },\n)\n\nexport interface CheckboxFieldProps extends CheckboxProps {\n type: 'checkbox'\n label?: string\n}\n\nexport const CheckboxField = createField<HTMLInputElement, CheckboxFieldProps>(\n ({ label, type, ...props }, ref) => {\n return (\n <Checkbox ref={ref} {...props}>\n {label}\n </Checkbox>\n )\n },\n {\n hideLabel: true,\n },\n)\n\nexport interface RadioFieldProps extends RadioGroupProps {\n type: 'radio'\n options: FieldOptions\n flexDirection?: SystemStyleObject['flexDirection']\n gap?: SystemStyleObject['gap']\n}\n\nexport const RadioField = createField<HTMLInputElement, RadioFieldProps>(\n (props, ref) => {\n const { options, onChange, flexDirection = 'column', gap, ...rest } = props\n return (\n <RadioGroup\n ref={ref}\n onValueChange={({ value }) => {\n onChange?.(value)\n }}\n {...rest}\n >\n <Stack flexDirection={flexDirection} gap={gap}>\n {options.map((option) => (\n <Radio key={option.value} value={option.value}>\n {option.label || option.value}\n </Radio>\n ))}\n </Stack>\n </RadioGroup>\n )\n },\n {\n isControlled: true,\n },\n)\n\nexport interface PinFieldProps\n extends Omit<PinInputProps, 'type' | 'value' | 'onChange'> {\n type: 'pin'\n pinLength?: number\n pinType?: PinInputProps['type']\n value?: string\n onChange?: (value: string) => void\n}\n\nexport const PinField = createField<HTMLInputElement, PinFieldProps>(\n (props, ref) => {\n const { pinType, value: valueProp, onChange, ...inputProps } = props\n\n const value = valueProp?.split('') || []\n\n return (\n <PinInput\n ref={ref}\n {...inputProps}\n value={value}\n onValueChange={(details) => {\n onChange(details.valueAsString)\n }}\n type={pinType}\n />\n )\n },\n {\n isControlled: true,\n },\n)\n\nexport const defaultFieldTypes = {\n text: InputField,\n email: InputField,\n url: InputField,\n phone: InputField,\n time: InputField,\n number: NumberInputField,\n pin: PinField,\n checkbox: CheckboxField,\n radio: RadioField,\n password: PasswordInputField,\n select: SelectField,\n switch: SwitchField,\n textarea: TextareaField,\n}\n\nexport type DefaultFields = typeof defaultFieldTypes\n","import React, {\n type ForwardRefRenderFunction,\n type PropsWithoutRef,\n forwardRef,\n} from 'react'\n\nimport { callAll, mergeRefs, splitProps } from '@saas-ui/core/utils'\nimport { Controller, type RegisterOptions } from 'react-hook-form'\n\nimport { BaseField } from './base-field'\nimport { useFieldsContext } from './fields-context'\nimport { useFormContext } from './form-context'\nimport { BaseFieldProps, GetBaseField } from './types'\n\ninterface CreateFieldProps<ExtraFieldProps extends object = object> {\n displayName: string\n hideLabel?: boolean\n getBaseField: GetBaseField<ExtraFieldProps>\n}\n\nconst _createField = (\n InputComponent: React.FC<any>,\n { displayName, hideLabel, getBaseField: getBaseFieldProp }: CreateFieldProps,\n) => {\n const Field = forwardRef<HTMLDivElement, any>((props, ref) => {\n const { id, name, label, isRequired, rules } = props\n\n const inputRules = {\n required: isRequired,\n ...rules,\n }\n\n const fieldContext = useFieldsContext()\n\n const getBaseField = fieldContext?.getBaseField ?? getBaseFieldProp\n\n const { extraProps, BaseField } = React.useMemo(\n () => getBaseField(),\n [getBaseField],\n )\n\n const [, inputProps] = splitProps(\n props,\n [\n 'children',\n 'name',\n 'label',\n 'required',\n 'disabled',\n 'invalid',\n 'readOnly',\n 'help',\n 'hideLabel',\n ].concat(extraProps),\n )\n\n return (\n <BaseField name={name} hideLabel={hideLabel} {...props}>\n <InputComponent\n ref={ref}\n id={id}\n name={name}\n label={hideLabel ? label : undefined} // Only pass down the label when it should be inline.\n {...inputProps}\n rules={inputRules}\n />\n </BaseField>\n )\n })\n\n Field.displayName = displayName\n\n return Field\n}\n\nconst withControlledInput = (InputComponent: React.FC<any>) => {\n return forwardRef<typeof InputComponent, ControlProps>((props, ref) => {\n const { name, rules, ...inputProps } = props\n const { control } = useFormContext()\n\n const onChange = inputProps.onChange as (...event: any[]) => void\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ field: { ref: _ref, ...field } }) => (\n <InputComponent\n {...field}\n {...inputProps}\n onChange={callAll(onChange, field.onChange)}\n onBlur={callAll(inputProps.onBlur, field.onBlur)}\n ref={mergeRefs(ref, _ref)}\n />\n )}\n />\n )\n })\n}\n\nconst withUncontrolledInput = (InputComponent: React.FC<any>) => {\n return forwardRef<typeof InputComponent, ControlProps>(\n ({ name, rules, ...inputProps }, ref) => {\n const { register } = useFormContext()\n\n const { ref: _ref, ...field } = register(name, rules)\n\n const onChange = inputProps.onChange as (...event: any[]) => void\n\n return (\n <InputComponent\n {...field}\n {...inputProps}\n onChange={callAll(onChange, field.onChange)}\n onBlur={callAll(inputProps.onBlur, field.onBlur)}\n ref={mergeRefs(ref, _ref)}\n />\n )\n },\n )\n}\n\nexport interface CreateFieldOptions {\n isControlled?: boolean\n hideLabel?: boolean\n BaseField?: React.FC<any>\n}\n\ninterface ControlProps {\n name: string\n onChange: (...event: any[]) => void\n onBlur: (...event: any[]) => void\n value: unknown\n disabled?: boolean\n rules?: RegisterOptions\n}\n\n/**\n * Register a new field type\n * @param type The name for this field in kebab-case, eg `email` or `array-field`\n * @param component The React component\n * @param options\n * @param options.isControlled Set this to true if this is a controlled field.\n * @param options.hideLabel Hide the field label, for example for the checkbox field.\n */\nexport const createField = <TType = unknown, TProps extends object = object>(\n component: ForwardRefRenderFunction<\n TType,\n PropsWithoutRef<TProps & ControlProps>\n >,\n options?: CreateFieldOptions,\n) => {\n let InputComponent\n if (options?.isControlled) {\n InputComponent = withControlledInput(forwardRef(component))\n } else {\n InputComponent = withUncontrolledInput(forwardRef(component))\n }\n\n const Field = _createField(InputComponent, {\n displayName: `${component.displayName ?? 'Custom'}Field`,\n hideLabel: options?.hideLabel,\n getBaseField: () => ({\n extraProps: [],\n BaseField,\n }),\n }) as React.FC<Omit<BaseFieldProps, keyof TProps> & TProps>\n\n return Field\n}\n","import * as React from 'react'\n\nimport { Box, Field } from '@chakra-ui/react'\nimport { splitProps } from '@saas-ui/core/utils'\nimport { FormState, get } from 'react-hook-form'\n\nimport { useFormContext } from './form-context'\nimport type { BaseFieldProps } from './types'\n\nconst getError = (name: string, formState: FormState<{ [x: string]: any }>) => {\n return get(formState.errors, name)\n}\n\nconst isTouched = (\n name: string,\n formState: FormState<{ [x: string]: any }>,\n) => {\n return get(formState.touchedFields, name)\n}\n\nexport const useBaseField = (props: BaseFieldProps) => {\n const [fieldProps] = splitProps(props, ['name', 'label', 'help', 'hideLabel'])\n\n const [controlProps] = splitProps(props, [\n // 'id',\n // 'orientation',\n // 'disabled',\n // 'invalid',\n // 'readOnly',\n // 'required',\n ])\n\n const { formState } = useFormContext()\n\n const error = getError(fieldProps.name, formState)\n const touched = isTouched(fieldProps.name, formState)\n\n return {\n ...fieldProps,\n controlProps,\n error,\n touched,\n }\n}\n\n/**\n * The default BaseField component\n * Composes the Chakra UI FormControl component, with FormLabel, FormHelperText and FormErrorMessage.\n */\nexport const BaseField: React.FC<BaseFieldProps> = (props) => {\n const { label, help, hideLabel, error } = useBaseField(props)\n\n const isInvalid = !!error //|| controlProps.\n\n return (\n <Field.Root invalid={isInvalid} {...props}>\n {label && !hideLabel ? <Field.Label>{label}</Field.Label> : null}\n <Box width=\"full\">\n {props.children}\n {help && !error?.message ? (\n <Field.HelperText>{help}</Field.HelperText>\n ) : null}\n {error?.message && <Field.ErrorText>{error?.message}</Field.ErrorText>}\n </Box>\n </Field.Root>\n )\n}\n\nBaseField.displayName = 'BaseField'\n","import * as React from 'react'\nimport {\n FormProvider as HookFormProvider,\n FormProviderProps as HookFormProviderProps,\n useFormContext as useHookFormContext,\n FieldValues,\n} from 'react-hook-form'\nimport { FieldResolver } from './field-resolver'\nimport type { BaseFieldProps } from './types'\n\nexport type FormContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n> = {\n fieldResolver?: FieldResolver\n schema?: TSchema\n fields?: {\n [key: string]: unknown\n }\n}\n\nexport type FormProviderProps<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n> = HookFormProviderProps<TFieldValues, TContext> & {\n fieldResolver?: FieldResolver\n schema?: TSchema\n fields?: {\n [key: string]: unknown\n }\n}\n\nconst FormContext = React.createContext<FormContextValue | null>(null)\n\nexport const useFormContext = <\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n>() => {\n const context = React.useContext(FormContext)\n const hookContext = useHookFormContext<TFieldValues, TContext>()\n\n return {\n ...hookContext,\n ...context,\n }\n}\n\nexport const useFieldProps = <TFieldValues extends FieldValues = FieldValues>(\n name: string\n): BaseFieldProps<TFieldValues> | undefined => {\n const parsedName = name?.replace(/\\.[0-9]/g, '.$')\n const context = useFormContext()\n return (context?.fields?.[parsedName] as any) || {}\n}\n\nexport type UseFormReturn<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n> = ReturnType<typeof useFormContext<TFieldValues, TContext, TSchema>>\n\nexport const FormProvider = <\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n>(\n props: FormProviderProps<TFieldValues, TContext, TSchema>\n) => {\n const { children, fieldResolver, schema, fields, ...rest } = props\n return (\n <HookFormProvider {...rest}>\n <FormContext.Provider value={{ fieldResolver, schema, fields }}>\n {children}\n </FormContext.Provider>\n </HookFormProvider>\n )\n}\n","import React from 'react'\n\nimport type { GetBaseField } from './types'\n\nexport interface FieldsContextValue {\n fields: Record<string, React.FC<any>>\n getBaseField?: GetBaseField<any>\n}\n\nconst FieldsContext = React.createContext<FieldsContextValue | null>(null)\n\nexport const FieldsProvider: React.FC<{\n value: FieldsContextValue\n children: React.ReactNode\n}> = (props) => {\n return (\n <FieldsContext.Provider value={props.value}>\n {props.children}\n </FieldsContext.Provider>\n )\n}\n\nexport const useFieldsContext = () => {\n return React.useContext(FieldsContext)\n}\n\nexport const useField = (\n type: string,\n fallback: React.FC<any>,\n): React.FC<any> => {\n const context = React.useContext(FieldsContext)\n return context?.fields?.[type] || fallback\n}\n","import { get } from '@saas-ui/core/utils'\n\nimport { ArrayFieldProps } from './array-field'\nimport { DefaultFields } from './default-fields'\nimport { ObjectFieldProps } from './object-field'\nimport { BaseFieldProps, ValueOf } from './types'\n\nexport type FieldResolver = {\n getFields(): BaseFieldProps[]\n getNestedFields(name: string): BaseFieldProps[]\n}\n\nexport type GetFieldResolver<TSchema = any> = (schema: TSchema) => FieldResolver\n\ntype FieldTypes<FieldDefs = DefaultFields> = ValueOf<{\n [K in keyof FieldDefs]: FieldDefs[K] extends React.FC<infer Props>\n ? { type?: K } & Omit<Props, 'name'>\n : never\n}>\n\ntype SchemaField<FieldDefs = DefaultFields> =\n | FieldTypes<FieldDefs>\n | (Omit<ObjectFieldProps, 'name' | 'children'> & {\n type: 'object'\n properties?: Record<string, SchemaField<FieldDefs>>\n })\n | (Omit<ArrayFieldProps, 'name' | 'children'> & {\n type: 'array'\n items?: SchemaField<FieldDefs>\n })\n\nexport type ObjectSchema<FieldDefs = DefaultFields> = Record<\n string,\n SchemaField<FieldDefs>\n>\n\nconst mapFields = (schema: ObjectSchema): BaseFieldProps[] =>\n schema &&\n Object.entries(schema).map(([name, props]) => {\n const { items, label, title, ...field } = props as any\n return {\n ...field,\n name,\n label: label || title || name, // json schema compatibility\n }\n })\n\nexport const objectFieldResolver: GetFieldResolver<ObjectSchema> = (schema) => {\n const getFields = (): BaseFieldProps[] => {\n return mapFields(schema)\n }\n const getNestedFields = (name: string): BaseFieldProps[] => {\n const field = get(schema, name)\n\n if (!field) return []\n\n if (field.items?.type === 'object') {\n return mapFields(field.items.properties)\n } else if (field.type === 'object') {\n return mapFields(field.properties)\n }\n return [field.items]\n }\n\n return { getFields, getNestedFields }\n}\n","import React, { forwardRef } from 'react'\n\nimport { HTMLChakraProps, chakra } from '@chakra-ui/react'\nimport { type MaybeRenderProp, cx, runIfFn } from '@saas-ui/core/utils'\nimport {\n FieldValues,\n ResolverOptions,\n ResolverResult,\n SubmitErrorHandler,\n SubmitHandler,\n UseFormProps,\n UseFormReturn,\n WatchObserver,\n useForm,\n} from 'react-hook-form'\n\nimport { ArrayField, ArrayFieldProps } from './array-field.tsx'\nimport { DisplayIf, DisplayIfProps } from './display-if.tsx'\nimport { FieldResolver } from './field-resolver.tsx'\nimport { Field as DefaultField } from './field.tsx'\nimport { AutoFields } from './fields.tsx'\nimport { FormProvider } from './form-context.tsx'\nimport { FormLayout } from './form-layout.tsx'\nimport { ObjectField, ObjectFieldProps } from './object-field.tsx'\nimport { SubmitButton } from './submit-button.tsx'\nimport {\n DefaultFieldOverrides,\n FieldProps,\n type FocusableElement,\n} from './types.ts'\nimport { UseArrayFieldReturn } from './use-array-field.tsx'\n\nexport type { UseFormReturn, FieldValues, SubmitHandler }\n\nexport interface FormRenderContext<\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TFieldTypes = FieldProps<TFieldValues>,\n> extends UseFormReturn<TFieldValues, TContext> {\n Field: React.FC<TFieldTypes & React.RefAttributes<FocusableElement>>\n DisplayIf: React.FC<DisplayIfProps<TFieldValues>>\n ArrayField: React.FC<\n ArrayFieldProps<TFieldValues> & React.RefAttributes<UseArrayFieldReturn>\n >\n ObjectField: React.FC<ObjectFieldProps<TFieldValues>>\n}\n\ninterface FormOptions<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues, TExtraFieldProps>,\n> {\n /**\n * The form schema.\n */\n schema?: TSchema\n /**\n * Triggers when any of the field change.\n */\n onChange?: WatchObserver<TFieldValues>\n /**\n * The submit handler.\n */\n onSubmit: SubmitHandler<TFieldValues>\n /**\n * Triggers when there are validation errors.\n */\n onError?: SubmitErrorHandler<TFieldValues>\n /**\n * The Hook Form state ref.\n */\n formRef?: React.Ref<UseFormReturn<TFieldValues, TContext>>\n /**\n * The form children, can be a render prop or a ReactNode.\n */\n children?: MaybeRenderProp<\n FormRenderContext<TFieldValues, TContext, TFieldTypes>\n >\n /**\n * The field resolver, used to resolve the fields from schemas.\n */\n fieldResolver?: FieldResolver\n /**\n * Field overrides\n */\n fields?: DefaultFieldOverrides\n}\n\nexport interface FormProps<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues, TExtraFieldProps>,\n> extends UseFormProps<TFieldValues, TContext>,\n Omit<\n HTMLChakraProps<'form'>,\n 'children' | 'onChange' | 'onSubmit' | 'onError'\n >,\n FormOptions<\n TSchema,\n TFieldValues,\n TContext,\n TExtraFieldProps,\n TFieldTypes\n > {}\n\n/**\n * The wrapper component provides context, state, and focus management.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const Form = forwardRef(\n <\n TSchema = any,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues>,\n >(\n props: FormProps<\n TSchema,\n TFieldValues,\n TContext,\n TExtraFieldProps,\n TFieldTypes\n >,\n ref: React.ForwardedRef<HTMLFormElement>,\n ) => {\n const {\n mode = 'all',\n resolver,\n fieldResolver,\n fields,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n schema,\n defaultValues,\n values,\n context,\n resetOptions,\n onChange,\n onSubmit,\n onError,\n formRef,\n children,\n ...rest\n } = props\n\n const form = {\n mode,\n resolver,\n defaultValues,\n values,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n context,\n resetOptions,\n }\n\n const methods = useForm<TFieldValues, TContext>(form)\n const { handleSubmit } = methods\n\n // This exposes the useForm api through the forwarded ref\n React.useImperativeHandle(formRef, () => methods, [formRef, methods])\n\n React.useEffect(() => {\n let subscription: any\n if (onChange) {\n subscription = methods.watch(onChange)\n }\n return () => subscription?.unsubscribe()\n }, [methods, onChange])\n\n let _children = children\n if (!_children && fieldResolver) {\n _children = (\n <FormLayout>\n <AutoFields />\n <SubmitButton {...fields?.submit} />\n </FormLayout>\n )\n }\n\n return (\n <FormProvider\n {...methods}\n schema={schema}\n fieldResolver={fieldResolver}\n fields={fields}\n >\n <chakra.form\n ref={ref}\n onSubmit={handleSubmit(onSubmit, onError)}\n {...rest}\n className={cx('sui-form', props.className)}\n >\n {runIfFn(_children, {\n Field: DefaultField as any,\n DisplayIf: DisplayIf as any,\n ArrayField: ArrayField as any,\n ObjectField: ObjectField as any,\n ...methods,\n })}\n </chakra.form>\n </FormProvider>\n )\n },\n) as FormComponent\n\nexport type FormComponent = (<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues>,\n>(\n props: FormProps<\n TSchema,\n TFieldValues,\n TContext,\n TExtraFieldProps,\n TFieldTypes\n > & {\n ref?: React.ForwardedRef<HTMLFormElement>\n },\n) => React.ReactElement) & {\n displayName?: string\n}\n\nForm.displayName = 'Form'\n\nexport type GetResolver = <\n TFieldValues extends FieldValues,\n TContext extends object,\n>(\n schema: unknown,\n) => (\n values: TFieldValues,\n context: TContext | undefined,\n options: ResolverOptions<TFieldValues>,\n) => Promise<ResolverResult<TFieldValues>>\n","import React, { forwardRef } from 'react'\n\nimport { Button, ButtonProps, chakra } from '@chakra-ui/react'\nimport type { MaybeRenderProp } from '@saas-ui/core/utils'\nimport { MinusIcon, PlusIcon } from '@saas-ui/react/icons'\nimport { FieldPath, FieldValues } from 'react-hook-form'\n\nimport { BaseField } from './base-field'\nimport { useFieldProps } from './form-context'\nimport { FormLayout, FormLayoutProps } from './form-layout'\nimport { BaseFieldProps } from './types'\nimport {\n ArrayFieldOptions,\n ArrayFieldProvider,\n ArrayFieldRowProvider,\n UseArrayFieldReturn,\n useArrayField,\n useArrayFieldAddButton,\n useArrayFieldContext,\n useArrayFieldRemoveButton,\n useArrayFieldRow,\n useArrayFieldRowContext,\n} from './use-array-field'\nimport { mapNestedFields } from './utils'\n\nexport interface ArrayFieldButtonProps extends ButtonProps {}\n\ninterface ArrayField {\n id: string\n [key: string]: unknown\n}\n\ninterface ArrayFieldRowProps extends FormLayoutProps {\n /**\n * The array index\n */\n index: number\n /**\n * The fields\n */\n children: React.ReactNode\n}\n\n/**\n * Render prop component, to get access to the internal fields state. Must be a child of ArrayFieldContainer.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRow: React.FC<ArrayFieldRowProps> = ({\n children,\n index,\n ...rowFieldsProps\n}) => {\n return (\n <ArrayFieldRowContainer index={index}>\n <ArrayFieldRowFields {...rowFieldsProps}>{children}</ArrayFieldRowFields>\n <ArrayFieldRemoveButton />\n </ArrayFieldRowContainer>\n )\n}\n\nArrayFieldRow.displayName = 'ArrayFieldRow'\n\nexport interface ArrayFieldRowFieldsProps extends FormLayoutProps {\n /**\n * The fields\n */\n children: React.ReactNode\n}\n/**\n * Add the name prefix to the fields and acts as a horizontal form layout by default.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRowFields: React.FC<ArrayFieldRowFieldsProps> = ({\n children,\n ...layoutProps\n}) => {\n const { name } = useArrayFieldRowContext()\n return (\n <FormLayout flex=\"1\" mr=\"2\" {...layoutProps}>\n {mapNestedFields(name, children)}\n </FormLayout>\n )\n}\n\nArrayFieldRowFields.displayName = 'ArrayFieldRowFields'\n\n/**\n * The row container component providers row context.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRowContainer: React.FC<ArrayFieldRowProps> = ({\n children,\n index,\n ...rest\n}) => {\n const context = useArrayFieldRow({ index })\n\n const styles = {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'flex-end',\n width: '100%',\n mb: 4,\n }\n\n return (\n <ArrayFieldRowProvider value={context}>\n <chakra.div {...rest} css={styles}>\n {children}\n </chakra.div>\n </ArrayFieldRowProvider>\n )\n}\n\nArrayFieldRowContainer.displayName = 'ArrayFieldRowContainer'\n\n/**\n * The default remove button.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRemoveButton: React.FC<ArrayFieldButtonProps> = (\n props,\n) => {\n return (\n <Button aria-label=\"Remove row\" {...useArrayFieldRemoveButton()} {...props}>\n {props.children || <MinusIcon />}\n </Button>\n )\n}\n\nArrayFieldRemoveButton.displayName = 'ArrayFieldRemoveButton'\n\n/**\n * The default add button.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldAddButton: React.FC<ArrayFieldButtonProps> = (props) => {\n return (\n <Button\n aria-label=\"Add row\"\n float=\"right\"\n {...useArrayFieldAddButton()}\n {...props}\n >\n {props.children || <PlusIcon />}\n </Button>\n )\n}\n\nArrayFieldAddButton.displayName = 'ArrayFieldAddButton'\n\nexport interface ArrayFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> extends ArrayFieldOptions<TFieldValues, TName>,\n Omit<\n BaseFieldProps<TFieldValues, TName>,\n 'name' | 'defaultValue' | 'children'\n > {\n children: MaybeRenderProp<ArrayField[]>\n}\n\n/**\n * The wrapper component that composes the default ArrayField functionality.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayField = forwardRef(\n (props: ArrayFieldProps, ref: React.ForwardedRef<UseArrayFieldReturn>) => {\n const { children, ...containerProps } = props\n\n const rowFn =\n typeof children === 'function'\n ? children\n : (fields: ArrayField[]) => (\n <>\n {fields.map(({ id }, index: number) => (\n <ArrayFieldRow key={id} index={index}>\n {children}\n </ArrayFieldRow>\n )) || null}\n </>\n )\n\n return (\n <ArrayFieldContainer ref={ref} {...containerProps}>\n <ArrayFieldRows>{rowFn as any}</ArrayFieldRows>\n <ArrayFieldAddButton />\n </ArrayFieldContainer>\n )\n },\n) as ((\n props: ArrayFieldProps & {\n ref?: React.ForwardedRef<UseArrayFieldReturn>\n },\n) => React.ReactElement) & {\n displayName: string\n}\n\nArrayField.displayName = 'ArrayField'\n\nexport interface ArrayFieldRowsProps {\n children: (fields: ArrayField[]) => React.ReactElement | null\n}\n\nexport const ArrayFieldRows = ({\n children,\n}: ArrayFieldRowsProps): React.ReactElement | null => {\n const { fields } = useArrayFieldContext()\n return children(fields)\n}\n\nArrayFieldRows.displayName = 'ArrayFieldRows'\n\nexport interface ArrayFieldContainerProps\n extends Omit<ArrayFieldProps, 'children'> {\n children: React.ReactNode\n}\n\n/**\n * The container component provides context and state management.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldContainer = React.forwardRef(\n (\n {\n name,\n defaultValue,\n keyName,\n min,\n max,\n children,\n ...fieldProps\n }: ArrayFieldContainerProps,\n ref: React.ForwardedRef<UseArrayFieldReturn>,\n ) => {\n const overrides = useFieldProps(name)\n\n const context = useArrayField({\n name,\n defaultValue,\n keyName,\n min: min || (overrides as any)?.min,\n max: max || (overrides as any)?.max,\n })\n\n // This exposes the useArrayField api through the forwarded ref\n React.useImperativeHandle(ref, () => context, [ref, context])\n\n return (\n <ArrayFieldProvider value={context}>\n <BaseField name={name} {...fieldProps} {...overrides}>\n {children}\n </BaseField>\n </ArrayFieldProvider>\n )\n },\n)\n\nArrayFieldContainer.displayName = 'ArrayFieldContainer'\n","import { forwardRef } from 'react'\n\nimport {\n type HTMLChakraProps,\n type RecipeProps,\n SimpleGrid,\n SimpleGridProps,\n useRecipe,\n} from '@chakra-ui/react'\nimport { cx } from '@saas-ui/core/utils'\n\nexport interface FormLayoutOptions {\n columns?: SimpleGridProps['columns']\n gap?: SimpleGridProps['gap']\n}\n\nexport interface FormLayoutProps\n extends RecipeProps<'formLayout'>,\n FormLayoutOptions,\n Omit<HTMLChakraProps<'div'>, 'columns'> {}\n\n/**\n * Create consistent field spacing and positioning.\n *\n * Renders form items in a `SimpleGrid`\n * @see https://chakra-ui.com/docs/layout/simple-grid\n *\n * @see https://saas-ui.dev/docs/components/forms/form\n */\nexport const FormLayout = forwardRef<HTMLDivElement, FormLayoutProps>(\n ({ children, rowGap = 4, ...props }, ref) => {\n const recipe = useRecipe({\n key: 'formLayout',\n })\n\n const [variantProps, gridProps] = recipe.splitVariantProps(props)\n\n const styles = recipe(variantProps)\n\n return (\n <SimpleGrid\n ref={ref}\n {...gridProps}\n className={cx('sui-form-layout', props.className)}\n css={[\n {\n rowGap,\n },\n styles,\n props.css,\n ]}\n >\n {children}\n </SimpleGrid>\n )\n },\n)\n\nFormLayout.displayName = 'FormLayout'\n","import * as React from 'react'\n\nimport { createContext } from '@saas-ui/core/utils'\nimport {\n FieldPath,\n FieldValues,\n UseFieldArrayReturn,\n useFieldArray,\n} from 'react-hook-form'\n\nimport { useFormContext } from './form-context'\n\nexport interface UseArrayFieldReturn extends UseFieldArrayReturn {\n /**\n * The array field name\n */\n name: string\n /**\n * The default value for new items\n */\n defaultValue: Record<string, any>\n /**\n * Min amount of items\n */\n min?: number\n /**\n * Max amount of items\n */\n max?: number\n}\n\nexport const [ArrayFieldProvider, useArrayFieldContext] =\n createContext<UseArrayFieldReturn>({\n name: 'ArrayFieldContext',\n })\n\nexport interface UseArrayFieldRowReturn {\n /**\n * Name of the array field including the index, eg 'field.0'\n */\n name: string\n /**\n * The field index\n */\n index: number\n /**\n * Remove this array item\n */\n remove: () => void\n /**\n * True if this is the first item\n */\n isFirst: boolean\n /**\n * True if this is the last item\n */\n isLast: boolean\n}\n\nexport const [ArrayFieldRowProvider, useArrayFieldRowContext] =\n createContext<UseArrayFieldRowReturn>({\n name: 'ArrayFieldRowContext',\n })\n\nexport interface ArrayFieldOptions<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> {\n /**\n * The field name\n */\n name: TName\n /**\n * Default value for new values in the array\n */\n defaultValue?: Record<string, any>\n /**\n * Default key name for rows, change this if your data uses a different 'id' field\n * @default \"id\"\n */\n keyName?: string\n min?: number\n max?: number\n}\n\nexport const useArrayField = ({\n name,\n defaultValue = {},\n keyName,\n min,\n max,\n}: ArrayFieldOptions) => {\n const { control } = useFormContext()\n\n const context = useFieldArray({\n control,\n name,\n keyName,\n })\n return {\n ...context,\n name,\n defaultValue,\n min,\n max,\n }\n}\n\nexport interface UseArrayFieldRowProps {\n index: number\n}\n\nexport const useArrayFieldRow = ({ index }: UseArrayFieldRowProps) => {\n const { clearErrors } = useFormContext()\n const { name, remove, fields } = useArrayFieldContext()\n\n React.useEffect(() => {\n // reset errors, to make sure min/max errors reset correctly\n clearErrors(name)\n }, [])\n\n return {\n index,\n isFirst: index === 0,\n isLast: index === fields.length - 1,\n name: `${name}.${index}`,\n remove: React.useCallback(() => {\n clearErrors(name)\n remove(index)\n }, [index]),\n }\n}\n\nexport const useArrayFieldRemoveButton = () => {\n const { isFirst, remove } = useArrayFieldRowContext()\n const { min, fields } = useArrayFieldContext()\n\n const isDisabled = isFirst && !!(min && fields.length <= min)\n\n return {\n onClick: () => remove(),\n isDisabled,\n }\n}\n\nexport const useArrayFieldAddButton = () => {\n const { append, defaultValue, max, fields } = useArrayFieldContext()\n\n const isDisabled = !!(max && fields.length >= max)\n\n return {\n onClick: () =>\n append(defaultValue, {\n shouldFocus: false,\n }),\n isDisabled,\n }\n}\n","import * as React from 'react'\nimport { FieldOption, FieldOptions } from './types'\n\nexport const mapNestedFields = (name: string, children: React.ReactNode) => {\n return React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child.props.name) {\n let childName = child.props.name\n if (childName.includes('.')) {\n childName = childName.replace(/^.*\\.(.*)/, '$1')\n } else if (childName.includes('.$')) {\n childName = childName.replace(/^.*\\.\\$(.*)/, '$1')\n }\n\n return React.cloneElement(child, {\n ...child.props,\n name: `${name}.${childName}`,\n })\n }\n return child\n })\n}\n\nexport const mapOptions = <TOption extends FieldOption = FieldOption>(\n options: FieldOptions<TOption>\n) => {\n return options.map((option) => {\n if (typeof option === 'string') {\n return {\n label: option,\n value: option,\n }\n }\n return option\n })\n}\n","import * as React from 'react'\nimport {\n useWatch,\n FieldValues,\n UseFormReturn,\n FieldPath,\n} from 'react-hook-form'\n\nimport { useFormContext } from './form-context'\n\nexport interface DisplayIfProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> {\n children: React.ReactElement\n name: TName\n defaultValue?: unknown\n isDisabled?: boolean\n isExact?: boolean\n condition?: (value: unknown, context: UseFormReturn<TFieldValues>) => boolean\n onToggle?: (\n conditionMatched: boolean,\n context: UseFormReturn<TFieldValues>\n ) => void\n}\n/**\n * Conditionally render parts of a form.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const DisplayIf = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n children,\n name,\n defaultValue,\n isDisabled,\n isExact,\n condition = (value) => !!value,\n onToggle,\n}: DisplayIfProps<TFieldValues, TName>) => {\n const initializedRef = React.useRef(false)\n const matchesRef = React.useRef(false)\n\n const value = useWatch<TFieldValues>({\n name,\n defaultValue: defaultValue as any,\n disabled: isDisabled,\n exact: isExact,\n })\n const context = useFormContext() as any\n\n const matches = condition(value, context)\n\n React.useEffect(() => {\n if (!initializedRef.current) {\n initializedRef.current = true\n return\n }\n if (matchesRef.current === matches) return\n matchesRef.current = matches\n onToggle?.(matches, context)\n }, [value])\n\n return matches ? children : null\n}\n\nDisplayIf.displayName = 'DisplayIf'\n","import * as React from 'react'\n\nimport { FieldValues, RegisterOptions } from 'react-hook-form'\n\nimport { InputField } from './default-fields'\nimport { useField } from './fields-context'\nimport { useFieldProps } from './form-context'\nimport { FieldProps, type FocusableElement } from './types'\n\nexport type FieldRules = Pick<\n RegisterOptions,\n 'required' | 'min' | 'max' | 'maxLength' | 'minLength' | 'pattern'\n>\n\nconst defaultInputType = 'text'\n\n/**\n * Form field component.\n * \n * Build-in types:\n * text, number, password, textarea, select, native-select, checkbox, radio, switch, pin\n *\n * Will default to a text field if there is no matching type.\n\n * @see Docs https://saas-ui.dev/docs/components/forms/field\n */\nexport const Field = React.forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: FieldProps<TFieldValues>,\n ref: React.ForwardedRef<FocusableElement>,\n ) => {\n const { type = defaultInputType, name } = props\n const overrides = useFieldProps(name)\n const InputComponent = useField(overrides?.type || type, InputField)\n\n return <InputComponent ref={ref} {...props} {...overrides} />\n },\n) as (<TFieldValues extends FieldValues>(\n props: FieldProps<TFieldValues> & {\n ref?: React.ForwardedRef<FocusableElement>\n },\n) => React.ReactElement) & {\n displayName?: string\n}\n","import * as React from 'react'\n\nimport { ArrayField } from './array-field'\nimport { Field } from './field'\nimport { FieldResolver } from './field-resolver'\nimport { useFormContext } from './form-context'\nimport { FormLayout } from './form-layout'\nimport { ObjectField } from './object-field'\nimport { BaseFieldProps } from './types'\n\nexport interface FieldsProps<TSchema = any> {\n schema?: TSchema\n fieldResolver?: FieldResolver\n focusFirstField?: boolean\n}\n\nconst mapNestedFields = (resolver: FieldResolver, name: string) => {\n return resolver\n .getNestedFields(name)\n ?.map(\n (\n { name, type, ...nestedFieldProps }: BaseFieldProps,\n i,\n ): React.ReactNode => (\n <Field\n key={name || i}\n name={name}\n type={type as any}\n {...nestedFieldProps}\n />\n ),\n )\n}\n\nexport const AutoFields: React.FC<FieldsProps> = ({\n schema: schemaProp,\n fieldResolver: fieldResolverProp,\n focusFirstField,\n ...props\n}) => {\n const context = useFormContext()\n const schema = schemaProp || context.schema\n const fieldResolver = fieldResolverProp || context.fieldResolver\n const resolver = React.useMemo(() => fieldResolver, [schema, fieldResolver])\n\n const fields = React.useMemo(() => resolver?.getFields(), [resolver])\n\n const form = useFormContext()\n\n React.useEffect(() => {\n if (focusFirstField && fields?.[0]?.name) {\n form.setFocus(fields[0].name)\n }\n }, [schema, fieldResolver, focusFirstField])\n\n if (!resolver) {\n return null\n }\n\n return (\n <FormLayout {...props}>\n {fields?.map(\n ({ name, type, ...fieldProps }: BaseFieldProps): React.ReactNode => {\n if (type === 'array') {\n return (\n <ArrayField key={name} name={name} {...fieldProps}>\n {mapNestedFields(resolver, name)}\n </ArrayField>\n )\n } else if (type === 'object') {\n return (\n <ObjectField key={name} name={name} {...fieldProps}>\n {mapNestedFields(resolver, name)}\n </ObjectField>\n )\n }\n\n return (\n <Field\n key={name}\n name={name}\n type={type as any}\n // defaultValue={defaultValue}\n {...fieldProps}\n />\n )\n },\n )}\n </FormLayout>\n )\n}\n\nAutoFields.displayName = 'Fields'\n","import * as React from 'react'\n\nimport { Field as FieldPrimivite } from '@chakra-ui/react'\nimport { dataAttr } from '@saas-ui/core/utils'\nimport { FieldPath, FieldValues } from 'react-hook-form'\n\nimport { useFieldProps } from './form-context'\nimport { FormLayout, type FormLayoutOptions } from './form-layout'\nimport { BaseFieldProps } from './types'\nimport { mapNestedFields } from './utils'\n\nexport interface ObjectFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> extends Omit<BaseFieldProps, keyof FormLayoutOptions>,\n FormLayoutOptions {\n name: TName\n children: React.ReactNode\n}\n\nexport const FormLegend = (props: FieldPrimivite.LabelProps) => {\n return <FieldPrimivite.Label as=\"legend\" {...props} />\n}\n\n/**\n * The object field component.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/object-field\n */\nexport const ObjectField: React.FC<ObjectFieldProps> = (props) => {\n const {\n name,\n label,\n hideLabel: hideLabelProp,\n children,\n columns: columnsProp,\n gap: gapProp,\n ...fieldProps\n } = props\n\n const { hideLabel, columns, gap, ...overrides } = useFieldProps(name) as Omit<\n ObjectFieldProps,\n 'name'\n >\n\n const hidden = hideLabelProp || hideLabel\n\n return (\n <FieldPrimivite.Root as=\"fieldset\" {...fieldProps} {...overrides}>\n <FormLegend data-hidden={dataAttr(hidden)}>{label}</FormLegend>\n <FormLayout columns={columnsProp || columns} gridGap={gapProp || gap}>\n {mapNestedFields(name, children)}\n </FormLayout>\n </FieldPrimivite.Root>\n )\n}\n\nObjectField.displayName = 'ObjectField'\n","import { forwardRef } from 'react'\n\nimport { Button, ButtonProps } from '@saas-ui/react/button'\nimport { useFormContext } from 'react-hook-form'\n\nimport { useFieldProps } from './form-context.tsx'\n\nexport interface SubmitButtonProps extends ButtonProps {\n /**\n * Disable the submit button if the form is untouched.\n */\n disableIfUntouched?: boolean\n /**\n * Disable the submit button if the form is invalid.\n */\n disableIfInvalid?: boolean\n}\n\n/**\n * A button with type submit and default color scheme primary and isLoading state when the form is submitting.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const SubmitButton = forwardRef<HTMLButtonElement, SubmitButtonProps>(\n (props, ref) => {\n const {\n variant = 'glass',\n colorPalette = 'accent',\n children = 'Submit',\n disableIfUntouched: disableIfUntouchedProp = false,\n disableIfInvalid: disableIfInvalidProp = false,\n disabled: disabledProp,\n loading,\n ...rest\n } = props\n const { formState } = useFormContext()\n\n const field = useFieldProps('submit') as SubmitButtonProps\n\n const {\n disableIfUntouched: disableIfUntouchedOverride,\n disableIfInvalid: disableIfInvalidOverride,\n ...fieldProps\n } = field\n\n const disableIfUntouched =\n disableIfUntouchedOverride ?? disableIfUntouchedProp\n const disableIfInvalid = disableIfInvalidOverride ?? disableIfInvalidProp\n\n const isDisabled =\n (disableIfUntouched && !formState.isDirty) ||\n (disableIfInvalid && !formState.isValid) ||\n disabledProp\n\n return (\n <Button\n ref={ref}\n variant={variant as any}\n colorPalette={colorPalette}\n type=\"submit\"\n loading={formState.isSubmitting || loading}\n disabled={isDisabled}\n children={children}\n {...rest}\n {...fieldProps}\n />\n )\n },\n)\n\nSubmitButton.displayName = 'SubmitButton'\n","import * as React from 'react'\n\nimport { Field as FieldPrimivite, Text } from '@chakra-ui/react'\nimport type { FieldPath, FieldValues } from 'react-hook-form'\n\nimport { useFormContext } from './form-context.tsx'\nimport type { ArrayFieldPath } from './types.ts'\n\nexport interface DisplayFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> extends Omit<FieldPrimivite.RootProps, 'type' | 'onChange' | 'defaultValue'> {\n name: TName | ArrayFieldPath<TName>\n label?: string\n}\n\n/**\n * Display a field value.\n *\n * @see Docs https://saas-ui.dev/\n */\nexport const DisplayField: React.FC<DisplayFieldProps> = ({\n name,\n label,\n ...props\n}) => {\n return (\n <FieldPrimivite.Root {...props}>\n {label ? (\n <FieldPrimivite.Label htmlFor={name}>{label}</FieldPrimivite.Label>\n ) : null}\n <Text fontSize=\"md\">\n <FormValue name={name} />\n </Text>\n </FieldPrimivite.Root>\n )\n}\n\nDisplayField.displayName = 'DisplayField'\n\nexport const FormValue: React.FC<{ name: string }> = ({ name }) => {\n const { getValues } = useFormContext()\n return getValues(name) || null\n}\n\nFormValue.displayName = 'FormValue'\n","import { FieldValues, useWatch } from 'react-hook-form'\nimport { useFormContext, UseFormReturn } from './form-context'\n\nexport interface WatchFieldProps<\n Value = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n> {\n name: string\n defaultValue?: Value\n isDisabled?: boolean\n isExact?: boolean\n children: (\n value: Value,\n form: UseFormReturn<TFieldValues, TContext>\n ) => React.ReactElement | void\n}\n\nexport const WatchField = <\n Value = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n>(\n props: WatchFieldProps<Value, TFieldValues, TContext>\n) => {\n const { name, defaultValue, isDisabled, isExact } = props\n const form = useFormContext<TFieldValues, TContext>()\n\n const field = useWatch({\n name,\n defaultValue,\n disabled: isDisabled,\n exact: isExact,\n })\n\n return props.children(field, form) || null\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAAAA;AAAA,EAAA;AAAA,cAAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAC,iBAAyD;;;ACEzD,IAAAC,gBAQO;AACP,sBAA6C;AAC7C,yBAA2B;AAC3B,0BAAmD;AACnD,4BAGO;AACP,uBAA6C;AAC7C,mBAAwD;AACxD,oBAAuB;AACvB,oBAAyC;;;ACrBzC,IAAAC,gBAIO;AAEP,IAAAC,gBAA+C;AAC/C,IAAAC,0BAAiD;;;ACLjD,mBAA2B;AAC3B,mBAA2B;AAC3B,IAAAC,0BAA+B;;;ACJ/B,YAAuB;AACvB,6BAKO;AAoED;AAxCN,IAAM,cAAoB,oBAAuC,IAAI;AAE9D,IAAM,iBAAiB,MAIvB;AACL,QAAM,UAAgB,iBAAW,WAAW;AAC5C,QAAM,kBAAc,uBAAAC,gBAA2C;AAE/D,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;AAEO,IAAM,gBAAgB,CAC3B,SAC6C;AApD/C;AAqDE,QAAM,aAAa,6BAAM,QAAQ,YAAY;AAC7C,QAAM,UAAU,eAAe;AAC/B,WAAQ,wCAAS,WAAT,mBAAkB,gBAAuB,CAAC;AACpD;AAQO,IAAM,eAAe,CAK1B,UACG;AACH,QAAM,EAAE,UAAU,eAAe,QAAQ,QAAQ,GAAG,KA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ACN,GACF;AAAA,IAEJ;AAAA,EACF;AAEA,cAAY,cAAc;AAC1B,cAAY,KAAK;AAEjB,SAAO;AACT;;;AiBjGA,IAAAC,iBAA8C;AAyB1C,IAAAC,uBAAA;AANG,IAAM,eAA4C,CAAC;AAAA,EACxD;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE,+CAAC,eAAAC,MAAe,MAAf,EAAqB,GAAG,OACtB;AAAA,YACC,8CAAC,eAAAA,MAAe,OAAf,EAAqB,SAAS,MAAO,iBAAM,IAC1C;AAAA,IACJ,8CAAC,uBAAK,UAAS,MACb,wDAAC,aAAU,MAAY,GACzB;AAAA,KACF;AAEJ;AAEA,aAAa,cAAc;AAEpB,IAAM,YAAwC,CAAC,EAAE,KAAK,MAAM;AACjE,QAAM,EAAE,UAAU,IAAI,eAAe;AACrC,SAAO,UAAU,IAAI,KAAK;AAC5B;AAEA,UAAU,cAAc;;;AC7CxB,IAAAC,0BAAsC;AAkB/B,IAAM,aAAa,CAKxB,UACG;AACH,QAAM,EAAE,MAAM,cAAc,YAAY,QAAQ,IAAI;AACpD,QAAM,OAAO,eAAuC;AAEpD,QAAM,YAAQ,kCAAS;AAAA,IACrB;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,OAAO;AAAA,EACT,CAAC;AAED,SAAO,MAAM,SAAS,OAAO,IAAI,KAAK;AACxC;;;AnByQA,IAAAC,0BAQO;AA9HA,IAAMC,QAAO,WAAW;","names":["Field","Form","import_react","import_react","import_react","import_utils","import_react_hook_form","import_react_hook_form","useHookFormContext","HookFormProvider","import_jsx_runtime","import_react","import_jsx_runtime","React","import_jsx_runtime","Field","BaseField","React","import_jsx_runtime","import_utils","import_react","import_utils","import_react_hook_form","import_react","import_react","import_utils","import_jsx_runtime","React","import_utils","import_react_hook_form","React","import_jsx_runtime","React","React","import_react_hook_form","React","import_jsx_runtime","Field","React","import_react","import_utils","import_jsx_runtime","FieldPrimivite","import_jsx_runtime","mapNestedFields","name","Field","import_react","import_react_hook_form","import_jsx_runtime","import_jsx_runtime","React","Field","import_jsx_runtime","import_react","import_jsx_runtime","FieldPrimivite","import_react_hook_form","import_react_hook_form","Form"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/create-form.tsx","../src/default-fields.tsx","../src/create-field.tsx","../src/base-field.tsx","../src/form-context.tsx","../src/fields-context.tsx","../src/field-resolver.ts","../src/form.tsx","../src/array-field.tsx","../src/form-layout.tsx","../src/use-array-field.tsx","../src/utils.ts","../src/display-if.tsx","../src/field.tsx","../src/fields.tsx","../src/object-field.tsx","../src/submit-button.tsx","../src/display-field.tsx","../src/watch-field.tsx"],"sourcesContent":["// Import and export Form and StepForm\nimport { createForm } from './create-form'\n\n// import { createStepForm } from './create-step-form'\n\n// Exporting from './display-field'\nexport { DisplayField } from './display-field'\nexport type { DisplayFieldProps } from './display-field'\nexport { FormValue } from './display-field'\n\n// Exporting from './field'\nexport { Field } from './field'\nexport type { FieldRules } from './field'\n\n// Exporting from './fields'\nexport { AutoFields } from './fields'\nexport type { FieldsProps } from './fields'\n\n// Exporting from './fields-context'\nexport { FieldsProvider, useField } from './fields-context'\n\n// Exporting from './layout'\nexport { FormLayout } from './form-layout'\nexport type { FormLayoutProps } from './form-layout'\n\n// Exporting from './submit-button'\nexport { SubmitButton } from './submit-button'\nexport type { SubmitButtonProps } from './submit-button'\n\n// Exporting from './array-field'\nexport {\n ArrayField,\n ArrayFieldAddButton,\n ArrayFieldContainer,\n ArrayFieldRemoveButton,\n ArrayFieldRow,\n ArrayFieldRowContainer,\n ArrayFieldRowFields,\n ArrayFieldRows,\n} from './array-field'\n\nexport type {\n ArrayFieldButtonProps,\n ArrayFieldContainerProps,\n ArrayFieldProps,\n ArrayFieldRowFieldsProps,\n ArrayFieldRowsProps,\n} from './array-field'\n\n// Exporting from './use-array-field'\nexport {\n ArrayFieldProvider,\n ArrayFieldRowProvider,\n useArrayField,\n useArrayFieldAddButton,\n useArrayFieldContext,\n useArrayFieldRemoveButton,\n useArrayFieldRow,\n useArrayFieldRowContext,\n} from './use-array-field'\n\nexport type {\n ArrayFieldOptions,\n UseArrayFieldReturn,\n UseArrayFieldRowProps,\n UseArrayFieldRowReturn,\n} from './use-array-field'\n\n// Exporting from './object-field'\nexport { FormLegend, ObjectField } from './object-field'\nexport type { ObjectFieldProps } from './object-field'\n\n// Exporting from './display-if'\nexport { DisplayIf } from './display-if'\nexport type { DisplayIfProps } from './display-if'\n\n// Exporting from './step-form'\n// export { FormStep, FormStepper, NextButton, PrevButton } from './step-form'\n\n// export type {\n// FormStepOptions,\n// FormStepProps,\n// FormStepperProps,\n// NextButtonProps,\n// StepFormProps,\n// StepsOptions,\n// } from './step-form'\n\n// Exporting from './use-step-form'\n// export {\n// StepFormProvider,\n// useFormStep,\n// useStepForm,\n// useStepFormContext,\n// } from './use-step-form'\n\n// export type {\n// FormStepSubmitHandler,\n// StepFormContext,\n// StepFormRenderContext,\n// StepState,\n// UseFormStepProps,\n// UseStepFormProps,\n// UseStepFormReturn,\n// } from './use-step-form'\n\n// Exporting from './field-resolver'\nexport { objectFieldResolver } from './field-resolver'\nexport type {\n FieldResolver,\n GetFieldResolver,\n ObjectSchema,\n} from './field-resolver'\n\n// Exporting from './watch-field'\nexport { WatchField } from './watch-field'\nexport type { WatchFieldProps } from './watch-field'\n\n// Exporting BaseField from './base-field'\nexport { BaseField, useBaseField } from './base-field'\n\n// Exporting from './default-fields'\nexport {\n // CheckboxField,\n InputField,\n // NativeSelectField,\n // NumberInputField,\n // PasswordInputField,\n // PinField,\n // RadioField,\n // SelectField,\n // SwitchField,\n TextareaField,\n defaultFieldTypes,\n} from './default-fields'\n\nexport type {\n DefaultFields,\n InputFieldProps,\n // NumberInputFieldProps,\n // PinFieldProps,\n // SelectFieldProps,\n // SwitchFieldProps,\n TextareaFieldProps,\n // CheckboxFieldProps,\n // NativeSelectFieldProps,\n // RadioFieldProps,\n} from './default-fields'\n\n// Exporting types from './types'\nexport type {\n FieldProps,\n WithFields,\n BaseFieldProps,\n FieldOptions,\n DefaultFieldOverrides,\n // WithStepFields,\n GetBaseField,\n} from './types'\n\n// Exporting from './create-form'\nexport { createForm } from './create-form'\nexport type { CreateFormProps, FormType } from './create-form'\n\n// Exporting from './create-field'\nexport { createField } from './create-field'\nexport type { CreateFieldOptions } from './create-field'\n\n// Exporting from './form'\nexport { Form as BaseForm } from './form'\nexport type { FormProps, FormRenderContext, FormComponent } from './form'\n\n// Exporting from './form-context'\nexport { FormProvider, useFormContext } from './form-context'\n\n// export { createStepForm } from './create-step-form'\n// export type { CreateStepFormProps } from './create-step-form'\n\n/**\n * Form component.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const Form = createForm()\n\n/**\n * Multi-step form component.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/step-form\n */\n// export const StepForm = createStepForm()\n\nexport type {\n BatchFieldArrayUpdate,\n ChangeHandler,\n Control,\n ControllerFieldState,\n ControllerProps,\n ControllerRenderProps,\n CriteriaMode,\n CustomElement,\n DeepMap,\n DeepPartial,\n DeepPartialSkipArrayKey,\n DefaultValues,\n DelayCallback,\n EmptyObject,\n ErrorOption,\n EventType,\n Field as FieldDef,\n FieldArray,\n FieldArrayMethodProps,\n FieldArrayWithId,\n FieldElement,\n FieldError,\n FieldErrors,\n FieldName,\n FieldNamesMarkedBoolean,\n FieldRefs,\n FieldValue,\n FieldValues,\n FormProviderProps,\n FormState,\n FormStateProxy,\n FormStateSubjectRef,\n GetIsDirty,\n InternalFieldErrors,\n InternalFieldName,\n InternalNameSet,\n IsAny,\n IsFlatObject,\n KeepStateOptions,\n LiteralUnion,\n Message,\n Mode,\n MultipleFieldErrors,\n Names,\n NativeFieldValue,\n NestedValue,\n NonUndefined,\n Noop,\n Primitive,\n ReadFormState,\n Ref,\n RefCallBack,\n RegisterOptions,\n Resolver,\n ResolverError,\n ResolverOptions,\n ResolverResult,\n ResolverSuccess,\n SetFieldValue,\n SetValueConfig,\n Subjects,\n SubmitErrorHandler,\n SubmitHandler,\n TriggerConfig,\n UnpackNestedValue,\n UseControllerProps,\n UseControllerReturn,\n UseFieldArrayProps,\n UseFieldArrayReturn,\n UseFormClearErrors,\n UseFormGetValues,\n UseFormHandleSubmit,\n UseFormProps,\n UseFormRegister,\n UseFormRegisterReturn,\n UseFormReset,\n UseFormResetField,\n UseFormReturn,\n UseFormSetError,\n UseFormSetFocus,\n UseFormSetValue,\n UseFormStateProps,\n UseFormStateReturn,\n UseFormTrigger,\n UseFormUnregister,\n UseFormWatch,\n UseWatchProps,\n Validate,\n ValidateResult,\n ValidationMode,\n ValidationRule,\n ValidationValue,\n ValidationValueMessage,\n WatchInternal,\n WatchObserver,\n ArrayPath,\n BrowserNativeObject,\n DeepRequired,\n ExtractObjects,\n FieldArrayPath,\n FieldArrayPathValue,\n FieldErrorsImpl,\n FieldPath,\n FieldPathByValue,\n FieldPathValue,\n FieldPathValues,\n} from 'react-hook-form'\n\nexport {\n appendErrors,\n useController,\n useFieldArray,\n useForm,\n useFormState,\n useWatch,\n Controller,\n} from 'react-hook-form'\n","import React, { ForwardedRef, forwardRef, useMemo } from 'react'\n\nimport { defaultFieldTypes } from './default-fields'\nimport { objectFieldResolver } from './field-resolver'\nimport type { GetFieldResolver } from './field-resolver'\nimport { FieldsProvider } from './fields-context'\nimport { FieldValues, Form, FormProps, GetResolver } from './form'\nimport { GetBaseField, WithFields } from './types'\n\nexport interface CreateFormProps<\n FieldDefs,\n TGetBaseField extends GetBaseField = GetBaseField,\n> {\n resolver?: GetResolver\n fieldResolver?: GetFieldResolver\n fields?: FieldDefs extends Record<string, React.FC<any>> ? FieldDefs : never\n getBaseField?: TGetBaseField\n}\n\nexport type FormType<\n FieldDefs,\n ExtraProps = object,\n ExtraFieldProps extends object = object,\n ExtraOverrides = object,\n> = (<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n>(\n props: WithFields<\n FormProps<TSchema, TFieldValues, TContext, ExtraFieldProps>,\n FieldDefs,\n ExtraOverrides\n > & {\n ref?: React.ForwardedRef<HTMLFormElement>\n } & ExtraProps,\n) => React.ReactElement) & {\n displayName?: string\n id?: string\n}\n\nexport function createForm<\n FieldDefs,\n TGetBaseField extends GetBaseField<any> = GetBaseField<any>,\n>({\n resolver,\n fieldResolver = objectFieldResolver,\n fields,\n getBaseField,\n}: CreateFormProps<FieldDefs, TGetBaseField> = {}) {\n type ExtraFieldProps =\n TGetBaseField extends GetBaseField<infer ExtraFieldProps>\n ? ExtraFieldProps\n : object\n\n const DefaultForm = forwardRef(\n <\n TSchema = any,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n >(\n props: WithFields<\n FormProps<TSchema, TFieldValues, TContext, ExtraFieldProps>,\n FieldDefs\n >,\n ref: ForwardedRef<HTMLFormElement>,\n ) => {\n const {\n schema,\n resolver: resolverProp,\n fieldResolver: fieldResolverProp,\n ...rest\n } = props\n\n const fieldsContext = useMemo(\n () => ({\n fields: { ...defaultFieldTypes, ...fields },\n getBaseField,\n }),\n [fields, getBaseField],\n )\n\n return (\n <FieldsProvider value={fieldsContext}>\n <Form\n ref={ref}\n resolver={resolverProp ?? resolver?.(props.schema)}\n fieldResolver={fieldResolverProp ?? fieldResolver?.(schema)}\n {...rest}\n />\n </FieldsProvider>\n )\n },\n ) as FormType<FieldDefs, object, ExtraFieldProps>\n\n DefaultForm.displayName = 'Form'\n DefaultForm.id = 'Form'\n\n return DefaultForm\n}\n","import React from 'react'\n\nimport {\n Input,\n InputProps,\n Stack,\n type SystemStyleObject,\n Textarea,\n TextareaProps,\n createListCollection,\n} from '@chakra-ui/react'\nimport { Checkbox, type CheckboxProps } from '@saas-ui/react/checkbox'\nimport { InputGroup } from '@saas-ui/react/input-group'\nimport { NumberInput, type NumberInputProps } from '@saas-ui/react/number-input'\nimport {\n PasswordInput,\n type PasswordInputProps,\n} from '@saas-ui/react/password-input'\nimport { PinInput, type PinInputProps } from '@saas-ui/react/pin-input'\nimport { Radio, RadioGroup, type RadioGroupProps } from '@saas-ui/react/radio'\nimport { Select } from '@saas-ui/react/select'\nimport { Switch, type SwitchProps } from '@saas-ui/react/switch'\n\nimport { createField } from './create-field.tsx'\nimport type { FieldOption, FieldOptions } from './types.ts'\n\nexport interface InputFieldProps extends InputProps {\n type?: string\n startElement?: React.ReactNode\n endElement?: React.ReactNode\n}\n\nexport const InputField = createField<HTMLInputElement, InputFieldProps>(\n ({ type = 'text', startElement, endElement, size, ...rest }, ref) => {\n return (\n <InputGroup startElement={startElement} endElement={endElement}>\n <Input type={type} size={size} {...rest} ref={ref} />\n </InputGroup>\n )\n },\n)\n\nexport interface NumberInputFieldProps extends NumberInputProps {\n type: 'number'\n}\n\nexport const NumberInputField = createField<\n HTMLInputElement,\n NumberInputFieldProps\n>((props, ref) => <NumberInput {...props} ref={ref} />, {\n isControlled: true,\n})\n\nexport const PasswordInputField = createField<\n HTMLInputElement,\n PasswordInputProps\n>(({ type = 'password', ...props }, ref) => (\n <PasswordInput ref={ref} {...props} />\n))\n\nexport interface TextareaFieldProps extends TextareaProps {}\n\nexport const TextareaField = createField<\n HTMLTextAreaElement,\n TextareaFieldProps\n>((props, ref) => <Textarea {...props} ref={ref} />)\n\nexport interface SwitchFieldProps extends SwitchProps {\n type: 'switch'\n}\n\nexport const SwitchField = createField<HTMLInputElement, SwitchFieldProps>(\n ({ type, value, ...rest }, ref) => {\n return <Switch checked={!!value} {...rest} ref={ref} />\n },\n {\n isControlled: true,\n },\n)\n\nexport interface SelectFieldProps\n extends Omit<Select.RootProps<FieldOption>, 'collection'> {\n options: FieldOptions\n placeholder?: string\n triggerProps?: Select.TriggerProps\n contentProps?: Select.ContentProps\n}\n\nexport const SelectField = createField<HTMLDivElement, SelectFieldProps>(\n (props, ref) => {\n const {\n triggerProps,\n contentProps,\n options,\n placeholder,\n onChange,\n onValueChange,\n onBlur,\n ...rest\n } = props\n\n const collection = createListCollection({\n items: options,\n })\n\n return (\n <Select.Root\n ref={ref}\n collection={collection}\n onValueChange={(details) => {\n onChange(details.value)\n }}\n onInteractOutside={() => onBlur()}\n {...rest}\n >\n <Select.Trigger {...triggerProps}>\n <Select.ValueText placeholder={placeholder} />\n </Select.Trigger>\n <Select.Content {...contentProps}>\n {collection.items.map((option) => (\n <Select.Item key={option.value} item={option}>\n {option.label || option.value}\n </Select.Item>\n ))}\n </Select.Content>\n </Select.Root>\n )\n },\n {\n isControlled: true,\n },\n)\n\nexport interface CheckboxFieldProps extends CheckboxProps {\n type: 'checkbox'\n label?: string\n}\n\nexport const CheckboxField = createField<HTMLInputElement, CheckboxFieldProps>(\n ({ label, type, ...props }, ref) => {\n return (\n <Checkbox ref={ref} {...props}>\n {label}\n </Checkbox>\n )\n },\n {\n hideLabel: true,\n },\n)\n\nexport interface RadioFieldProps extends RadioGroupProps {\n type: 'radio'\n options: FieldOptions\n flexDirection?: SystemStyleObject['flexDirection']\n gap?: SystemStyleObject['gap']\n}\n\nexport const RadioField = createField<HTMLInputElement, RadioFieldProps>(\n (props, ref) => {\n const { options, onChange, flexDirection = 'column', gap, ...rest } = props\n return (\n <RadioGroup\n ref={ref}\n onValueChange={({ value }) => {\n onChange?.(value)\n }}\n {...rest}\n >\n <Stack flexDirection={flexDirection} gap={gap}>\n {options.map((option) => (\n <Radio key={option.value} value={option.value}>\n {option.label || option.value}\n </Radio>\n ))}\n </Stack>\n </RadioGroup>\n )\n },\n {\n isControlled: true,\n },\n)\n\nexport interface PinFieldProps\n extends Omit<PinInputProps, 'type' | 'value' | 'onChange'> {\n type: 'pin'\n pinLength?: number\n pinType?: PinInputProps['type']\n value?: string\n onChange?: (value: string) => void\n}\n\nexport const PinField = createField<HTMLInputElement, PinFieldProps>(\n (props, ref) => {\n const { pinType, value: valueProp, onChange, ...inputProps } = props\n\n const value = valueProp?.split('') || []\n\n return (\n <PinInput\n ref={ref}\n {...inputProps}\n value={value}\n onValueChange={(details) => {\n onChange(details.valueAsString)\n }}\n type={pinType}\n />\n )\n },\n {\n isControlled: true,\n },\n)\n\nexport const defaultFieldTypes = {\n text: InputField,\n email: InputField,\n url: InputField,\n phone: InputField,\n time: InputField,\n number: NumberInputField,\n pin: PinField,\n checkbox: CheckboxField,\n radio: RadioField,\n password: PasswordInputField,\n select: SelectField,\n switch: SwitchField,\n textarea: TextareaField,\n}\n\nexport type DefaultFields = typeof defaultFieldTypes\n","import React, {\n type ForwardRefRenderFunction,\n type PropsWithoutRef,\n forwardRef,\n} from 'react'\n\nimport { callAll, mergeRefs, splitProps } from '@saas-ui/core/utils'\nimport { Controller, type RegisterOptions } from 'react-hook-form'\n\nimport { BaseField } from './base-field'\nimport { useFieldsContext } from './fields-context'\nimport { useFormContext } from './form-context'\nimport { BaseFieldProps, GetBaseField } from './types'\n\ninterface CreateFieldProps<ExtraFieldProps extends object = object> {\n displayName: string\n hideLabel?: boolean\n getBaseField: GetBaseField<ExtraFieldProps>\n}\n\nconst _createField = (\n InputComponent: React.FC<any>,\n { displayName, hideLabel, getBaseField: getBaseFieldProp }: CreateFieldProps,\n) => {\n const Field = forwardRef<HTMLDivElement, any>((props, ref) => {\n const { id, name, label, isRequired, rules } = props\n\n const inputRules = {\n required: isRequired,\n ...rules,\n }\n\n const fieldContext = useFieldsContext()\n\n const getBaseField = fieldContext?.getBaseField ?? getBaseFieldProp\n\n const { extraProps, BaseField } = React.useMemo(\n () => getBaseField(),\n [getBaseField],\n )\n\n const [, inputProps] = splitProps(\n props,\n [\n 'children',\n 'name',\n 'label',\n 'required',\n 'disabled',\n 'invalid',\n 'readOnly',\n 'help',\n 'hideLabel',\n ].concat(extraProps),\n )\n\n return (\n <BaseField name={name} hideLabel={hideLabel} {...props}>\n <InputComponent\n ref={ref}\n id={id}\n name={name}\n label={hideLabel ? label : undefined} // Only pass down the label when it should be inline.\n {...inputProps}\n rules={inputRules}\n />\n </BaseField>\n )\n })\n\n Field.displayName = displayName\n\n return Field\n}\n\nconst withControlledInput = (InputComponent: React.FC<any>) => {\n return forwardRef<typeof InputComponent, ControlProps>((props, ref) => {\n const { name, rules, ...inputProps } = props\n const { control } = useFormContext()\n\n const onChange = inputProps.onChange as (...event: any[]) => void\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ field: { ref: _ref, ...field } }) => (\n <InputComponent\n {...field}\n {...inputProps}\n onChange={callAll(onChange, field.onChange)}\n onBlur={callAll(inputProps.onBlur, field.onBlur)}\n ref={mergeRefs(ref, _ref)}\n />\n )}\n />\n )\n })\n}\n\nconst withUncontrolledInput = (InputComponent: React.FC<any>) => {\n return forwardRef<typeof InputComponent, ControlProps>(\n ({ name, rules, ...inputProps }, ref) => {\n const { register } = useFormContext()\n\n const { ref: _ref, ...field } = register(name, rules)\n\n const onChange = inputProps.onChange as (...event: any[]) => void\n\n return (\n <InputComponent\n {...field}\n {...inputProps}\n onChange={callAll(onChange, field.onChange)}\n onBlur={callAll(inputProps.onBlur, field.onBlur)}\n ref={mergeRefs(ref, _ref)}\n />\n )\n },\n )\n}\n\nexport interface CreateFieldOptions {\n isControlled?: boolean\n hideLabel?: boolean\n BaseField?: React.FC<any>\n}\n\ninterface ControlProps {\n name: string\n onChange: (...event: any[]) => void\n onBlur: (...event: any[]) => void\n value: unknown\n disabled?: boolean\n rules?: RegisterOptions\n}\n\n/**\n * Register a new field type\n * @param type The name for this field in kebab-case, eg `email` or `array-field`\n * @param component The React component\n * @param options\n * @param options.isControlled Set this to true if this is a controlled field.\n * @param options.hideLabel Hide the field label, for example for the checkbox field.\n */\nexport const createField = <TType = unknown, TProps extends object = object>(\n component: ForwardRefRenderFunction<\n TType,\n PropsWithoutRef<TProps & ControlProps>\n >,\n options?: CreateFieldOptions,\n) => {\n let InputComponent\n if (options?.isControlled) {\n InputComponent = withControlledInput(forwardRef(component))\n } else {\n InputComponent = withUncontrolledInput(forwardRef(component))\n }\n\n const Field = _createField(InputComponent, {\n displayName: `${component.displayName ?? 'Custom'}Field`,\n hideLabel: options?.hideLabel,\n getBaseField: () => ({\n extraProps: [],\n BaseField,\n }),\n }) as React.FC<Omit<BaseFieldProps, keyof TProps> & TProps>\n\n return Field\n}\n","import * as React from 'react'\n\nimport { Box, Field } from '@chakra-ui/react'\nimport { splitProps } from '@saas-ui/core/utils'\nimport { FormState, get } from 'react-hook-form'\n\nimport { useFormContext } from './form-context'\nimport type { BaseFieldProps } from './types'\n\nconst getError = (name: string, formState: FormState<{ [x: string]: any }>) => {\n return get(formState.errors, name)\n}\n\nconst isTouched = (\n name: string,\n formState: FormState<{ [x: string]: any }>,\n) => {\n return get(formState.touchedFields, name)\n}\n\nexport const useBaseField = (props: BaseFieldProps) => {\n const [fieldProps] = splitProps(props, ['name', 'label', 'help', 'hideLabel'])\n\n const [controlProps] = splitProps(props, [\n // 'id',\n // 'orientation',\n // 'disabled',\n // 'invalid',\n // 'readOnly',\n // 'required',\n ])\n\n const { formState } = useFormContext()\n\n const error = getError(fieldProps.name, formState)\n const touched = isTouched(fieldProps.name, formState)\n\n return {\n ...fieldProps,\n controlProps,\n error,\n touched,\n }\n}\n\n/**\n * The default BaseField component\n * Composes the Chakra UI FormControl component, with FormLabel, FormHelperText and FormErrorMessage.\n */\nexport const BaseField: React.FC<BaseFieldProps> = (props) => {\n const { label, help, hideLabel, error } = useBaseField(props)\n\n const isInvalid = !!error //|| controlProps.\n\n return (\n <Field.Root invalid={isInvalid} {...props}>\n {label && !hideLabel ? <Field.Label>{label}</Field.Label> : null}\n <Box width=\"full\">\n {props.children}\n {help && !error?.message ? (\n <Field.HelperText>{help}</Field.HelperText>\n ) : null}\n {error?.message && <Field.ErrorText>{error?.message}</Field.ErrorText>}\n </Box>\n </Field.Root>\n )\n}\n\nBaseField.displayName = 'BaseField'\n","import * as React from 'react'\n\nimport {\n FieldValues,\n FormProvider as HookFormProvider,\n FormProviderProps as HookFormProviderProps,\n useFormContext as useHookFormContext,\n} from 'react-hook-form'\n\nimport type { FieldResolver } from './field-resolver'\nimport type { BaseFieldProps } from './types'\n\nexport type FormContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n> = {\n fieldResolver?: FieldResolver\n schema?: TSchema\n fields?: {\n [key: string]: unknown\n }\n}\n\nexport type FormProviderProps<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n> = HookFormProviderProps<TFieldValues, TContext> & {\n fieldResolver?: FieldResolver\n schema?: TSchema\n fields?: {\n [key: string]: unknown\n }\n}\n\nconst FormContext = React.createContext<FormContextValue | null>(null)\n\nexport const useFormContext = <\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n>() => {\n const context = React.useContext(FormContext)\n const hookContext = useHookFormContext<TFieldValues, TContext>()\n\n return {\n ...hookContext,\n ...context,\n }\n}\n\nexport const useFieldProps = <TFieldValues extends FieldValues = FieldValues>(\n name: string,\n): BaseFieldProps<TFieldValues> | undefined => {\n const parsedName = name?.replace(/\\.[0-9]/g, '.$')\n const context = useFormContext()\n return (context?.fields?.[parsedName] as any) || {}\n}\n\nexport type UseFormReturn<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n> = ReturnType<typeof useFormContext<TFieldValues, TContext, TSchema>>\n\nexport const FormProvider = <\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n>(\n props: FormProviderProps<TFieldValues, TContext, TSchema>,\n) => {\n const { children, fieldResolver, schema, fields, ...rest } = props\n return (\n <HookFormProvider {...rest}>\n <FormContext.Provider value={{ fieldResolver, schema, fields }}>\n {children}\n </FormContext.Provider>\n </HookFormProvider>\n )\n}\n","import React from 'react'\n\nimport type { GetBaseField } from './types'\n\nexport interface FieldsContextValue {\n fields: Record<string, React.FC<any>>\n getBaseField?: GetBaseField<any>\n}\n\nconst FieldsContext = React.createContext<FieldsContextValue | null>(null)\n\nexport const FieldsProvider: React.FC<{\n value: FieldsContextValue\n children: React.ReactNode\n}> = (props) => {\n return (\n <FieldsContext.Provider value={props.value}>\n {props.children}\n </FieldsContext.Provider>\n )\n}\n\nexport const useFieldsContext = () => {\n return React.useContext(FieldsContext)\n}\n\nexport const useField = (\n type: string,\n fallback: React.FC<any>,\n): React.FC<any> => {\n const context = React.useContext(FieldsContext)\n return context?.fields?.[type] || fallback\n}\n","import { get } from '@saas-ui/core/utils'\n\nimport { ArrayFieldProps } from './array-field.tsx'\nimport { DefaultFields } from './default-fields.tsx'\nimport { ObjectFieldProps } from './object-field.tsx'\nimport { BaseFieldProps, ValueOf } from './types.ts'\n\nexport type FieldResolver = {\n getFields(): BaseFieldProps[]\n getNestedFields(name: string): BaseFieldProps[]\n}\n\nexport type GetFieldResolver<TSchema = any> = (schema: TSchema) => FieldResolver\n\ntype FieldTypes<FieldDefs = DefaultFields> = ValueOf<{\n [K in keyof FieldDefs]: FieldDefs[K] extends React.FC<infer Props>\n ? { type?: K } & Omit<Props, 'name'>\n : never\n}>\n\ntype SchemaField<FieldDefs = DefaultFields> =\n | FieldTypes<FieldDefs>\n | (Omit<ObjectFieldProps, 'name' | 'children'> & {\n type: 'object'\n properties?: Record<string, SchemaField<FieldDefs>>\n })\n | (Omit<ArrayFieldProps, 'name' | 'children'> & {\n type: 'array'\n items?: SchemaField<FieldDefs>\n })\n\nexport type ObjectSchema<FieldDefs = DefaultFields> = Record<\n string,\n SchemaField<FieldDefs>\n>\n\nconst mapFields = (schema: ObjectSchema): BaseFieldProps[] =>\n schema &&\n Object.entries(schema).map(([name, props]) => {\n const { items, label, title, ...field } = props as any\n return {\n ...field,\n name,\n label: label || title || name, // json schema compatibility\n }\n })\n\nexport const objectFieldResolver: GetFieldResolver<ObjectSchema> = (schema) => {\n const getFields = (): BaseFieldProps[] => {\n return mapFields(schema)\n }\n const getNestedFields = (name: string): BaseFieldProps[] => {\n const field = get(schema, name)\n\n if (!field) return []\n\n if (field.items?.type === 'object') {\n return mapFields(field.items.properties)\n } else if (field.type === 'object') {\n return mapFields(field.properties)\n }\n return [field.items]\n }\n\n return { getFields, getNestedFields }\n}\n","import React, { forwardRef } from 'react'\n\nimport { HTMLChakraProps, chakra } from '@chakra-ui/react'\nimport { type MaybeRenderProp, cx, runIfFn } from '@saas-ui/core/utils'\nimport {\n FieldValues,\n ResolverOptions,\n ResolverResult,\n SubmitErrorHandler,\n SubmitHandler,\n UseFormProps,\n UseFormReturn,\n WatchObserver,\n useForm,\n} from 'react-hook-form'\n\nimport { ArrayField, ArrayFieldProps } from './array-field.tsx'\nimport { DisplayIf, DisplayIfProps } from './display-if.tsx'\nimport type { FieldResolver } from './field-resolver.tsx'\nimport { Field as DefaultField } from './field.tsx'\nimport { AutoFields } from './fields.tsx'\nimport { FormProvider } from './form-context.tsx'\nimport { FormLayout } from './form-layout.tsx'\nimport { ObjectField, ObjectFieldProps } from './object-field.tsx'\nimport { SubmitButton } from './submit-button.tsx'\nimport {\n DefaultFieldOverrides,\n FieldProps,\n type FocusableElement,\n} from './types.ts'\nimport { UseArrayFieldReturn } from './use-array-field.tsx'\n\nexport type { UseFormReturn, FieldValues, SubmitHandler }\n\nexport interface FormRenderContext<\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TFieldTypes = FieldProps<TFieldValues>,\n> extends UseFormReturn<TFieldValues, TContext> {\n Field: React.FC<TFieldTypes & React.RefAttributes<FocusableElement>>\n DisplayIf: React.FC<DisplayIfProps<TFieldValues>>\n ArrayField: React.FC<\n ArrayFieldProps<TFieldValues> & React.RefAttributes<UseArrayFieldReturn>\n >\n ObjectField: React.FC<ObjectFieldProps<TFieldValues>>\n}\n\ninterface FormOptions<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues, TExtraFieldProps>,\n> {\n /**\n * The form schema.\n */\n schema?: TSchema\n /**\n * Triggers when any of the field change.\n */\n onChange?: WatchObserver<TFieldValues>\n /**\n * The submit handler.\n */\n onSubmit: SubmitHandler<TFieldValues>\n /**\n * Triggers when there are validation errors.\n */\n onError?: SubmitErrorHandler<TFieldValues>\n /**\n * The Hook Form state ref.\n */\n formRef?: React.Ref<UseFormReturn<TFieldValues, TContext>>\n /**\n * The form children, can be a render prop or a ReactNode.\n */\n children?: MaybeRenderProp<\n FormRenderContext<TFieldValues, TContext, TFieldTypes>\n >\n /**\n * The field resolver, used to resolve the fields from schemas.\n */\n fieldResolver?: FieldResolver\n /**\n * Field overrides\n */\n fields?: DefaultFieldOverrides\n}\n\nexport interface FormProps<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues, TExtraFieldProps>,\n> extends UseFormProps<TFieldValues, TContext>,\n Omit<\n HTMLChakraProps<'form'>,\n 'children' | 'onChange' | 'onSubmit' | 'onError'\n >,\n FormOptions<\n TSchema,\n TFieldValues,\n TContext,\n TExtraFieldProps,\n TFieldTypes\n > {}\n\n/**\n * The wrapper component provides context, state, and focus management.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const Form = forwardRef(\n <\n TSchema = any,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues>,\n >(\n props: FormProps<\n TSchema,\n TFieldValues,\n TContext,\n TExtraFieldProps,\n TFieldTypes\n >,\n ref: React.ForwardedRef<HTMLFormElement>,\n ) => {\n const {\n mode = 'all',\n resolver,\n fieldResolver,\n fields,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n schema,\n defaultValues,\n values,\n context,\n resetOptions,\n onChange,\n onSubmit,\n onError,\n formRef,\n children,\n ...rest\n } = props\n\n const form = {\n mode,\n resolver,\n defaultValues,\n values,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n context,\n resetOptions,\n }\n\n const methods = useForm<TFieldValues, TContext>(form)\n const { handleSubmit } = methods\n\n // This exposes the useForm api through the forwarded ref\n React.useImperativeHandle(formRef, () => methods, [formRef, methods])\n\n React.useEffect(() => {\n let subscription: any\n if (onChange) {\n subscription = methods.watch(onChange)\n }\n return () => subscription?.unsubscribe()\n }, [methods, onChange])\n\n let _children = children\n if (!_children && fieldResolver) {\n _children = (\n <FormLayout>\n <AutoFields />\n <SubmitButton {...fields?.submit} />\n </FormLayout>\n )\n }\n\n return (\n <FormProvider\n {...methods}\n schema={schema}\n fieldResolver={fieldResolver}\n fields={fields}\n >\n <chakra.form\n ref={ref}\n onSubmit={handleSubmit(onSubmit, onError)}\n {...rest}\n className={cx('sui-form', props.className)}\n >\n {runIfFn(_children, {\n Field: DefaultField as any,\n DisplayIf: DisplayIf as any,\n ArrayField: ArrayField as any,\n ObjectField: ObjectField as any,\n ...methods,\n })}\n </chakra.form>\n </FormProvider>\n )\n },\n) as FormComponent\n\nexport type FormComponent = (<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues>,\n>(\n props: FormProps<\n TSchema,\n TFieldValues,\n TContext,\n TExtraFieldProps,\n TFieldTypes\n > & {\n ref?: React.ForwardedRef<HTMLFormElement>\n },\n) => React.ReactElement) & {\n displayName?: string\n}\n\nForm.displayName = 'Form'\n\nexport type GetResolver = <\n TFieldValues extends FieldValues,\n TContext extends object,\n>(\n schema: unknown,\n) => (\n values: TFieldValues,\n context: TContext | undefined,\n options: ResolverOptions<TFieldValues>,\n) => Promise<ResolverResult<TFieldValues>>\n","import React, { forwardRef } from 'react'\n\nimport { Button, ButtonProps, chakra } from '@chakra-ui/react'\nimport type { MaybeRenderProp } from '@saas-ui/core/utils'\nimport { MinusIcon, PlusIcon } from '@saas-ui/react/icons'\nimport { FieldPath, FieldValues } from 'react-hook-form'\n\nimport { BaseField } from './base-field'\nimport { useFieldProps } from './form-context'\nimport { FormLayout, FormLayoutProps } from './form-layout'\nimport { BaseFieldProps } from './types'\nimport {\n ArrayFieldOptions,\n ArrayFieldProvider,\n ArrayFieldRowProvider,\n UseArrayFieldReturn,\n useArrayField,\n useArrayFieldAddButton,\n useArrayFieldContext,\n useArrayFieldRemoveButton,\n useArrayFieldRow,\n useArrayFieldRowContext,\n} from './use-array-field'\nimport { mapNestedFields } from './utils'\n\nexport interface ArrayFieldButtonProps extends ButtonProps {}\n\ninterface ArrayField {\n id: string\n [key: string]: unknown\n}\n\ninterface ArrayFieldRowProps extends FormLayoutProps {\n /**\n * The array index\n */\n index: number\n /**\n * The fields\n */\n children: React.ReactNode\n}\n\n/**\n * Render prop component, to get access to the internal fields state. Must be a child of ArrayFieldContainer.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRow: React.FC<ArrayFieldRowProps> = ({\n children,\n index,\n ...rowFieldsProps\n}) => {\n return (\n <ArrayFieldRowContainer index={index}>\n <ArrayFieldRowFields {...rowFieldsProps}>{children}</ArrayFieldRowFields>\n <ArrayFieldRemoveButton />\n </ArrayFieldRowContainer>\n )\n}\n\nArrayFieldRow.displayName = 'ArrayFieldRow'\n\nexport interface ArrayFieldRowFieldsProps extends FormLayoutProps {\n /**\n * The fields\n */\n children: React.ReactNode\n}\n/**\n * Add the name prefix to the fields and acts as a horizontal form layout by default.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRowFields: React.FC<ArrayFieldRowFieldsProps> = ({\n children,\n ...layoutProps\n}) => {\n const { name } = useArrayFieldRowContext()\n return (\n <FormLayout flex=\"1\" mr=\"2\" {...layoutProps}>\n {mapNestedFields(name, children)}\n </FormLayout>\n )\n}\n\nArrayFieldRowFields.displayName = 'ArrayFieldRowFields'\n\n/**\n * The row container component providers row context.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRowContainer: React.FC<ArrayFieldRowProps> = ({\n children,\n index,\n ...rest\n}) => {\n const context = useArrayFieldRow({ index })\n\n const styles = {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'flex-end',\n width: '100%',\n mb: 4,\n }\n\n return (\n <ArrayFieldRowProvider value={context}>\n <chakra.div {...rest} css={styles}>\n {children}\n </chakra.div>\n </ArrayFieldRowProvider>\n )\n}\n\nArrayFieldRowContainer.displayName = 'ArrayFieldRowContainer'\n\n/**\n * The default remove button.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRemoveButton: React.FC<ArrayFieldButtonProps> = (\n props,\n) => {\n return (\n <Button aria-label=\"Remove row\" {...useArrayFieldRemoveButton()} {...props}>\n {props.children || <MinusIcon />}\n </Button>\n )\n}\n\nArrayFieldRemoveButton.displayName = 'ArrayFieldRemoveButton'\n\n/**\n * The default add button.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldAddButton: React.FC<ArrayFieldButtonProps> = (props) => {\n return (\n <Button\n aria-label=\"Add row\"\n float=\"right\"\n {...useArrayFieldAddButton()}\n {...props}\n >\n {props.children || <PlusIcon />}\n </Button>\n )\n}\n\nArrayFieldAddButton.displayName = 'ArrayFieldAddButton'\n\nexport interface ArrayFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> extends ArrayFieldOptions<TFieldValues, TName>,\n Omit<\n BaseFieldProps<TFieldValues, TName>,\n 'name' | 'defaultValue' | 'children'\n > {\n children: MaybeRenderProp<ArrayField[]>\n}\n\n/**\n * The wrapper component that composes the default ArrayField functionality.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayField = forwardRef(\n (props: ArrayFieldProps, ref: React.ForwardedRef<UseArrayFieldReturn>) => {\n const { children, ...containerProps } = props\n\n const rowFn =\n typeof children === 'function'\n ? children\n : (fields: ArrayField[]) => (\n <>\n {fields.map(({ id }, index: number) => (\n <ArrayFieldRow key={id} index={index}>\n {children}\n </ArrayFieldRow>\n )) || null}\n </>\n )\n\n return (\n <ArrayFieldContainer ref={ref} {...containerProps}>\n <ArrayFieldRows>{rowFn as any}</ArrayFieldRows>\n <ArrayFieldAddButton />\n </ArrayFieldContainer>\n )\n },\n) as ((\n props: ArrayFieldProps & {\n ref?: React.ForwardedRef<UseArrayFieldReturn>\n },\n) => React.ReactElement) & {\n displayName: string\n}\n\nArrayField.displayName = 'ArrayField'\n\nexport interface ArrayFieldRowsProps {\n children: (fields: ArrayField[]) => React.ReactElement | null\n}\n\nexport const ArrayFieldRows = ({\n children,\n}: ArrayFieldRowsProps): React.ReactElement | null => {\n const { fields } = useArrayFieldContext()\n return children(fields)\n}\n\nArrayFieldRows.displayName = 'ArrayFieldRows'\n\nexport interface ArrayFieldContainerProps\n extends Omit<ArrayFieldProps, 'children'> {\n children: React.ReactNode\n}\n\n/**\n * The container component provides context and state management.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldContainer = React.forwardRef(\n (\n {\n name,\n defaultValue,\n keyName,\n min,\n max,\n children,\n ...fieldProps\n }: ArrayFieldContainerProps,\n ref: React.ForwardedRef<UseArrayFieldReturn>,\n ) => {\n const overrides = useFieldProps(name)\n\n const context = useArrayField({\n name,\n defaultValue,\n keyName,\n min: min || (overrides as any)?.min,\n max: max || (overrides as any)?.max,\n })\n\n // This exposes the useArrayField api through the forwarded ref\n React.useImperativeHandle(ref, () => context, [ref, context])\n\n return (\n <ArrayFieldProvider value={context}>\n <BaseField name={name} {...fieldProps} {...overrides}>\n {children}\n </BaseField>\n </ArrayFieldProvider>\n )\n },\n)\n\nArrayFieldContainer.displayName = 'ArrayFieldContainer'\n","import { forwardRef } from 'react'\n\nimport {\n type HTMLChakraProps,\n type RecipeProps,\n SimpleGrid,\n SimpleGridProps,\n useRecipe,\n} from '@chakra-ui/react'\nimport { cx } from '@saas-ui/core/utils'\n\nexport interface FormLayoutOptions {\n columns?: SimpleGridProps['columns']\n gap?: SimpleGridProps['gap']\n}\n\nexport interface FormLayoutProps\n extends RecipeProps<'formLayout'>,\n FormLayoutOptions,\n Omit<HTMLChakraProps<'div'>, 'columns'> {}\n\n/**\n * Create consistent field spacing and positioning.\n *\n * Renders form items in a `SimpleGrid`\n * @see https://chakra-ui.com/docs/layout/simple-grid\n *\n * @see https://saas-ui.dev/docs/components/forms/form\n */\nexport const FormLayout = forwardRef<HTMLDivElement, FormLayoutProps>(\n ({ children, rowGap = 4, ...props }, ref) => {\n const recipe = useRecipe({\n key: 'formLayout',\n })\n\n const [variantProps, gridProps] = recipe.splitVariantProps(props)\n\n const styles = recipe(variantProps)\n\n return (\n <SimpleGrid\n ref={ref}\n {...gridProps}\n className={cx('sui-form-layout', props.className)}\n css={[\n {\n rowGap,\n },\n styles,\n props.css,\n ]}\n >\n {children}\n </SimpleGrid>\n )\n },\n)\n\nFormLayout.displayName = 'FormLayout'\n","import * as React from 'react'\n\nimport { createContext } from '@saas-ui/core/utils'\nimport {\n FieldPath,\n FieldValues,\n UseFieldArrayReturn,\n useFieldArray,\n} from 'react-hook-form'\n\nimport { useFormContext } from './form-context'\n\nexport interface UseArrayFieldReturn extends UseFieldArrayReturn {\n /**\n * The array field name\n */\n name: string\n /**\n * The default value for new items\n */\n defaultValue: Record<string, any>\n /**\n * Min amount of items\n */\n min?: number\n /**\n * Max amount of items\n */\n max?: number\n}\n\nexport const [ArrayFieldProvider, useArrayFieldContext] =\n createContext<UseArrayFieldReturn>({\n name: 'ArrayFieldContext',\n })\n\nexport interface UseArrayFieldRowReturn {\n /**\n * Name of the array field including the index, eg 'field.0'\n */\n name: string\n /**\n * The field index\n */\n index: number\n /**\n * Remove this array item\n */\n remove: () => void\n /**\n * True if this is the first item\n */\n isFirst: boolean\n /**\n * True if this is the last item\n */\n isLast: boolean\n}\n\nexport const [ArrayFieldRowProvider, useArrayFieldRowContext] =\n createContext<UseArrayFieldRowReturn>({\n name: 'ArrayFieldRowContext',\n })\n\nexport interface ArrayFieldOptions<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> {\n /**\n * The field name\n */\n name: TName\n /**\n * Default value for new values in the array\n */\n defaultValue?: Record<string, any>\n /**\n * Default key name for rows, change this if your data uses a different 'id' field\n * @default \"id\"\n */\n keyName?: string\n min?: number\n max?: number\n}\n\nexport const useArrayField = ({\n name,\n defaultValue = {},\n keyName,\n min,\n max,\n}: ArrayFieldOptions) => {\n const { control } = useFormContext()\n\n const context = useFieldArray({\n control,\n name,\n keyName,\n })\n return {\n ...context,\n name,\n defaultValue,\n min,\n max,\n }\n}\n\nexport interface UseArrayFieldRowProps {\n index: number\n}\n\nexport const useArrayFieldRow = ({ index }: UseArrayFieldRowProps) => {\n const { clearErrors } = useFormContext()\n const { name, remove, fields } = useArrayFieldContext()\n\n React.useEffect(() => {\n // reset errors, to make sure min/max errors reset correctly\n clearErrors(name)\n }, [])\n\n return {\n index,\n isFirst: index === 0,\n isLast: index === fields.length - 1,\n name: `${name}.${index}`,\n remove: React.useCallback(() => {\n clearErrors(name)\n remove(index)\n }, [index]),\n }\n}\n\nexport const useArrayFieldRemoveButton = () => {\n const { isFirst, remove } = useArrayFieldRowContext()\n const { min, fields } = useArrayFieldContext()\n\n const isDisabled = isFirst && !!(min && fields.length <= min)\n\n return {\n onClick: () => remove(),\n isDisabled,\n }\n}\n\nexport const useArrayFieldAddButton = () => {\n const { append, defaultValue, max, fields } = useArrayFieldContext()\n\n const isDisabled = !!(max && fields.length >= max)\n\n return {\n onClick: () =>\n append(defaultValue, {\n shouldFocus: false,\n }),\n isDisabled,\n }\n}\n","import * as React from 'react'\nimport { FieldOption, FieldOptions } from './types'\n\nexport const mapNestedFields = (name: string, children: React.ReactNode) => {\n return React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child.props.name) {\n let childName = child.props.name\n if (childName.includes('.')) {\n childName = childName.replace(/^.*\\.(.*)/, '$1')\n } else if (childName.includes('.$')) {\n childName = childName.replace(/^.*\\.\\$(.*)/, '$1')\n }\n\n return React.cloneElement(child, {\n ...child.props,\n name: `${name}.${childName}`,\n })\n }\n return child\n })\n}\n\nexport const mapOptions = <TOption extends FieldOption = FieldOption>(\n options: FieldOptions<TOption>\n) => {\n return options.map((option) => {\n if (typeof option === 'string') {\n return {\n label: option,\n value: option,\n }\n }\n return option\n })\n}\n","import * as React from 'react'\n\nimport {\n FieldPath,\n FieldValues,\n UseFormReturn,\n useWatch,\n} from 'react-hook-form'\n\nimport { useFormContext } from './form-context.tsx'\n\nexport interface DisplayIfProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> {\n children: React.ReactElement\n name: TName\n defaultValue?: unknown\n isDisabled?: boolean\n isExact?: boolean\n condition?: (value: unknown, context: UseFormReturn<TFieldValues>) => boolean\n onToggle?: (\n conditionMatched: boolean,\n context: UseFormReturn<TFieldValues>,\n ) => void\n}\n/**\n * Conditionally render parts of a form.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const DisplayIf = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n children,\n name,\n defaultValue,\n isDisabled,\n isExact,\n condition = (value) => !!value,\n onToggle,\n}: DisplayIfProps<TFieldValues, TName>) => {\n const initializedRef = React.useRef(false)\n const matchesRef = React.useRef(false)\n\n const value = useWatch<TFieldValues>({\n name,\n defaultValue: defaultValue as any,\n disabled: isDisabled,\n exact: isExact,\n })\n const context = useFormContext() as any\n\n const matches = condition(value, context)\n\n React.useEffect(() => {\n if (!initializedRef.current) {\n initializedRef.current = true\n return\n }\n if (matchesRef.current === matches) return\n matchesRef.current = matches\n onToggle?.(matches, context)\n }, [value])\n\n return matches ? children : null\n}\n\nDisplayIf.displayName = 'DisplayIf'\n","import * as React from 'react'\n\nimport { FieldValues, RegisterOptions } from 'react-hook-form'\n\nimport { InputField } from './default-fields'\nimport { useField } from './fields-context'\nimport { useFieldProps } from './form-context'\nimport { FieldProps, type FocusableElement } from './types'\n\nexport type FieldRules = Pick<\n RegisterOptions,\n 'required' | 'min' | 'max' | 'maxLength' | 'minLength' | 'pattern'\n>\n\nconst defaultInputType = 'text'\n\n/**\n * Form field component.\n * \n * Build-in types:\n * text, number, password, textarea, select, native-select, checkbox, radio, switch, pin\n *\n * Will default to a text field if there is no matching type.\n\n * @see Docs https://saas-ui.dev/docs/components/forms/field\n */\nexport const Field = React.forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: FieldProps<TFieldValues>,\n ref: React.ForwardedRef<FocusableElement>,\n ) => {\n const { type = defaultInputType, name } = props\n const overrides = useFieldProps(name)\n const InputComponent = useField(overrides?.type || type, InputField)\n\n return <InputComponent ref={ref} {...props} {...overrides} />\n },\n) as (<TFieldValues extends FieldValues>(\n props: FieldProps<TFieldValues> & {\n ref?: React.ForwardedRef<FocusableElement>\n },\n) => React.ReactElement) & {\n displayName?: string\n}\n","import * as React from 'react'\n\nimport { ArrayField } from './array-field'\nimport { Field } from './field'\nimport type { FieldResolver } from './field-resolver'\nimport { useFormContext } from './form-context'\nimport { FormLayout } from './form-layout'\nimport { ObjectField } from './object-field'\nimport { BaseFieldProps } from './types'\n\nexport interface FieldsProps<TSchema = any> {\n schema?: TSchema\n fieldResolver?: FieldResolver\n focusFirstField?: boolean\n}\n\nconst mapNestedFields = (resolver: FieldResolver, name: string) => {\n return resolver\n .getNestedFields(name)\n ?.map(\n (\n { name, type, ...nestedFieldProps }: BaseFieldProps,\n i,\n ): React.ReactNode => (\n <Field\n key={name || i}\n name={name}\n type={type as any}\n {...nestedFieldProps}\n />\n ),\n )\n}\n\nexport const AutoFields: React.FC<FieldsProps> = ({\n schema: schemaProp,\n fieldResolver: fieldResolverProp,\n focusFirstField,\n ...props\n}) => {\n const context = useFormContext()\n const schema = schemaProp || context.schema\n const fieldResolver = fieldResolverProp || context.fieldResolver\n const resolver = React.useMemo(() => fieldResolver, [schema, fieldResolver])\n\n const fields = React.useMemo(() => resolver?.getFields(), [resolver])\n\n const form = useFormContext()\n\n React.useEffect(() => {\n if (focusFirstField && fields?.[0]?.name) {\n form.setFocus(fields[0].name)\n }\n }, [schema, fieldResolver, focusFirstField])\n\n if (!resolver) {\n return null\n }\n\n return (\n <FormLayout {...props}>\n {fields?.map(\n ({ name, type, ...fieldProps }: BaseFieldProps): React.ReactNode => {\n if (type === 'array') {\n return (\n <ArrayField key={name} name={name} {...fieldProps}>\n {mapNestedFields(resolver, name)}\n </ArrayField>\n )\n } else if (type === 'object') {\n return (\n <ObjectField key={name} name={name} {...fieldProps}>\n {mapNestedFields(resolver, name)}\n </ObjectField>\n )\n }\n\n return (\n <Field\n key={name}\n name={name}\n type={type as any}\n // defaultValue={defaultValue}\n {...fieldProps}\n />\n )\n },\n )}\n </FormLayout>\n )\n}\n\nAutoFields.displayName = 'Fields'\n","import * as React from 'react'\n\nimport { Field as FieldPrimivite } from '@chakra-ui/react'\nimport { dataAttr } from '@saas-ui/core/utils'\nimport { FieldPath, FieldValues } from 'react-hook-form'\n\nimport { useFieldProps } from './form-context'\nimport { FormLayout, type FormLayoutOptions } from './form-layout'\nimport { BaseFieldProps } from './types'\nimport { mapNestedFields } from './utils'\n\nexport interface ObjectFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> extends Omit<BaseFieldProps, keyof FormLayoutOptions>,\n FormLayoutOptions {\n name: TName\n children: React.ReactNode\n}\n\nexport const FormLegend = (props: FieldPrimivite.LabelProps) => {\n return <FieldPrimivite.Label as=\"legend\" {...props} />\n}\n\n/**\n * The object field component.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/object-field\n */\nexport const ObjectField: React.FC<ObjectFieldProps> = (props) => {\n const {\n name,\n label,\n hideLabel: hideLabelProp,\n children,\n columns: columnsProp,\n gap: gapProp,\n ...fieldProps\n } = props\n\n const { hideLabel, columns, gap, ...overrides } = useFieldProps(name) as Omit<\n ObjectFieldProps,\n 'name'\n >\n\n const hidden = hideLabelProp || hideLabel\n\n return (\n <FieldPrimivite.Root as=\"fieldset\" {...fieldProps} {...overrides}>\n <FormLegend data-hidden={dataAttr(hidden)}>{label}</FormLegend>\n <FormLayout columns={columnsProp || columns} gridGap={gapProp || gap}>\n {mapNestedFields(name, children)}\n </FormLayout>\n </FieldPrimivite.Root>\n )\n}\n\nObjectField.displayName = 'ObjectField'\n","import { forwardRef } from 'react'\n\nimport { Button, ButtonProps } from '@saas-ui/react/button'\nimport { useFormContext } from 'react-hook-form'\n\nimport { useFieldProps } from './form-context.tsx'\n\nexport interface SubmitButtonProps extends ButtonProps {\n /**\n * Disable the submit button if the form is untouched.\n */\n disableIfUntouched?: boolean\n /**\n * Disable the submit button if the form is invalid.\n */\n disableIfInvalid?: boolean\n}\n\n/**\n * A button with type submit and default color scheme primary and isLoading state when the form is submitting.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const SubmitButton = forwardRef<HTMLButtonElement, SubmitButtonProps>(\n (props, ref) => {\n const {\n variant = 'glass',\n colorPalette = 'accent',\n children = 'Submit',\n disableIfUntouched: disableIfUntouchedProp = false,\n disableIfInvalid: disableIfInvalidProp = false,\n disabled: disabledProp,\n loading,\n ...rest\n } = props\n const { formState } = useFormContext()\n\n const field = useFieldProps('submit') as SubmitButtonProps\n\n const {\n disableIfUntouched: disableIfUntouchedOverride,\n disableIfInvalid: disableIfInvalidOverride,\n ...fieldProps\n } = field\n\n const disableIfUntouched =\n disableIfUntouchedOverride ?? disableIfUntouchedProp\n const disableIfInvalid = disableIfInvalidOverride ?? disableIfInvalidProp\n\n const isDisabled =\n (disableIfUntouched && !formState.isDirty) ||\n (disableIfInvalid && !formState.isValid) ||\n disabledProp\n\n return (\n <Button\n ref={ref}\n variant={variant as any}\n colorPalette={colorPalette}\n type=\"submit\"\n loading={formState.isSubmitting || loading}\n disabled={isDisabled}\n children={children}\n {...rest}\n {...fieldProps}\n />\n )\n },\n)\n\nSubmitButton.displayName = 'SubmitButton'\n","import * as React from 'react'\n\nimport { Field as FieldPrimivite, Text } from '@chakra-ui/react'\nimport type { FieldPath, FieldValues } from 'react-hook-form'\n\nimport { useFormContext } from './form-context.tsx'\nimport type { ArrayFieldPath } from './types.ts'\n\nexport interface DisplayFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> extends Omit<FieldPrimivite.RootProps, 'type' | 'onChange' | 'defaultValue'> {\n name: TName | ArrayFieldPath<TName>\n label?: string\n}\n\n/**\n * Display a field value.\n *\n * @see Docs https://saas-ui.dev/\n */\nexport const DisplayField: React.FC<DisplayFieldProps> = ({\n name,\n label,\n ...props\n}) => {\n return (\n <FieldPrimivite.Root {...props}>\n {label ? (\n <FieldPrimivite.Label htmlFor={name}>{label}</FieldPrimivite.Label>\n ) : null}\n <Text fontSize=\"md\">\n <FormValue name={name} />\n </Text>\n </FieldPrimivite.Root>\n )\n}\n\nDisplayField.displayName = 'DisplayField'\n\nexport const FormValue: React.FC<{ name: string }> = ({ name }) => {\n const { getValues } = useFormContext()\n return getValues(name) || null\n}\n\nFormValue.displayName = 'FormValue'\n","import { FieldValues, useWatch } from 'react-hook-form'\nimport { useFormContext, UseFormReturn } from './form-context'\n\nexport interface WatchFieldProps<\n Value = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n> {\n name: string\n defaultValue?: Value\n isDisabled?: boolean\n isExact?: boolean\n children: (\n value: Value,\n form: UseFormReturn<TFieldValues, TContext>\n ) => React.ReactElement | void\n}\n\nexport const WatchField = <\n Value = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n>(\n props: WatchFieldProps<Value, TFieldValues, TContext>\n) => {\n const { name, defaultValue, isDisabled, isExact } = props\n const form = useFormContext<TFieldValues, TContext>()\n\n const field = useWatch({\n name,\n defaultValue,\n disabled: isDisabled,\n exact: isExact,\n })\n\n return props.children(field, form) || null\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAA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CAAC;AAAA,EACxD;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE,+CAAC,eAAAC,MAAe,MAAf,EAAqB,GAAG,OACtB;AAAA,YACC,8CAAC,eAAAA,MAAe,OAAf,EAAqB,SAAS,MAAO,iBAAM,IAC1C;AAAA,IACJ,8CAAC,uBAAK,UAAS,MACb,wDAAC,aAAU,MAAY,GACzB;AAAA,KACF;AAEJ;AAEA,aAAa,cAAc;AAEpB,IAAM,YAAwC,CAAC,EAAE,KAAK,MAAM;AACjE,QAAM,EAAE,UAAU,IAAI,eAAe;AACrC,SAAO,UAAU,IAAI,KAAK;AAC5B;AAEA,UAAU,cAAc;;;AC7CxB,IAAAC,0BAAsC;AAkB/B,IAAM,aAAa,CAKxB,UACG;AACH,QAAM,EAAE,MAAM,cAAc,YAAY,QAAQ,IAAI;AACpD,QAAM,OAAO,eAAuC;AAEpD,QAAM,YAAQ,kCAAS;AAAA,IACrB;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,OAAO;AAAA,EACT,CAAC;AAED,SAAO,MAAM,SAAS,OAAO,IAAI,KAAK;AACxC;;;AnByQA,IAAAC,0BAQO;AA9HA,IAAMC,QAAO,WAAW;","names":["Field","Form","import_react","import_react","import_react","import_utils","import_react_hook_form","import_react_hook_form","useHookFormContext","HookFormProvider","import_jsx_runtime","import_react","import_jsx_runtime","React","import_jsx_runtime","Field","BaseField","React","import_jsx_runtime","import_utils","import_react","import_utils","import_react_hook_form","import_react","import_react","import_utils","import_jsx_runtime","React","import_utils","import_react_hook_form","React","import_jsx_runtime","React","React","import_react_hook_form","React","import_jsx_runtime","Field","React","import_react","import_utils","import_jsx_runtime","FieldPrimivite","import_jsx_runtime","mapNestedFields","name","Field","import_react","import_react_hook_form","import_jsx_runtime","import_jsx_runtime","React","Field","import_jsx_runtime","import_react","import_jsx_runtime","FieldPrimivite","import_react_hook_form","import_react_hook_form","Form"]}