remix-forms
Advanced tools
Comparing version 1.6.2 to 1.6.3
@@ -101,5 +101,6 @@ import * as React$1 from 'react'; | ||
declare type FormMethod = 'get' | 'post' | 'put' | 'patch' | 'delete'; | ||
declare type LowerCaseFormMethod = 'get' | 'post' | 'put' | 'patch' | 'delete'; | ||
declare type UpperCaseFormMethod = Uppercase<LowerCaseFormMethod>; | ||
declare type HTMLFormMethod = LowerCaseFormMethod | UpperCaseFormMethod; | ||
declare type BaseFormProps = { | ||
method?: FormMethod; | ||
onSubmit?: React$1.FormEventHandler<HTMLFormElement>; | ||
@@ -109,4 +110,9 @@ preventScrollReset?: boolean; | ||
}; | ||
declare type BaseFormPropsWithHTMLAttributes = React$1.FormHTMLAttributes<HTMLFormElement> & BaseFormProps; | ||
declare type FormComponent = React$1.ForwardRefExoticComponent<React$1.PropsWithoutRef<BaseFormProps> & React$1.RefAttributes<HTMLFormElement>>; | ||
declare type BaseFormPropsWithHTMLAttributes = Omit<React$1.FormHTMLAttributes<HTMLFormElement>, 'method'> & BaseFormProps; | ||
declare type LegacyFormComponent = React$1.ForwardRefExoticComponent<React$1.PropsWithoutRef<BaseFormProps & { | ||
method?: LowerCaseFormMethod; | ||
}> & React$1.RefAttributes<HTMLFormElement>>; | ||
declare type FormComponent = React$1.ForwardRefExoticComponent<React$1.PropsWithoutRef<BaseFormProps & { | ||
method?: HTMLFormMethod; | ||
}> & React$1.RefAttributes<HTMLFormElement>>; | ||
declare type Field<SchemaType> = { | ||
@@ -147,8 +153,13 @@ shape: ZodTypeAny; | ||
}, options?: { | ||
method: FormMethod; | ||
method: LowerCaseFormMethod; | ||
}) => void; | ||
declare type IntermediateSubmitFunction = (event: { | ||
target: any; | ||
}, options?: { | ||
method: HTMLFormMethod; | ||
}) => void; | ||
declare type SubmitFunction = (event: { | ||
target: any; | ||
}, options?: { | ||
method: FormMethod; | ||
method: HTMLFormMethod; | ||
preventScrollReset?: boolean; | ||
@@ -158,7 +169,8 @@ }) => void; | ||
data: any; | ||
Form: FormComponent; | ||
submit: SubmitFunction | LegacySubmitFunction; | ||
Form: FormComponent | LegacyFormComponent; | ||
submit: SubmitFunction | IntermediateSubmitFunction | LegacySubmitFunction; | ||
}; | ||
declare type FormProps<Schema extends FormSchema> = ComponentMappings & { | ||
component?: FormComponent; | ||
component?: FormComponent | LegacyFormComponent; | ||
method?: HTMLFormMethod; | ||
fetcher?: FetcherWithComponents; | ||
@@ -189,5 +201,5 @@ mode?: keyof ValidationMode; | ||
declare function createForm({ component: DefaultComponent, useNavigation, useSubmit, useActionData, }: { | ||
component: FormComponent; | ||
component: FormComponent | LegacyFormComponent; | ||
useNavigation: () => Transition; | ||
useSubmit: (() => SubmitFunction) | (() => LegacySubmitFunction); | ||
useSubmit: (() => SubmitFunction) | (() => IntermediateSubmitFunction) | (() => LegacySubmitFunction); | ||
useActionData: () => unknown; | ||
@@ -194,0 +206,0 @@ }): <Schema extends FormSchema<SomeZodObject | z.ZodEffects<any, any, any>>>({ component, fetcher, mode, reValidateMode, renderField, fieldComponent, globalErrorsComponent: Errors, errorComponent: Error, fieldErrorsComponent, labelComponent, inputComponent, multilineComponent, selectComponent, checkboxComponent, radioComponent, checkboxWrapperComponent, radioGroupComponent, radioWrapperComponent, buttonComponent: Button, buttonLabel: rawButtonLabel, pendingButtonLabel, method, schema, beforeChildren, onTransition, parseActionData, children: childrenFn, labels, placeholders, options, hiddenFields, multiline, radio, autoFocus: autoFocusProp, errors: errorsProp, values: valuesProp, ...props }: FormProps<Schema>) => JSX.Element; |
@@ -654,3 +654,3 @@ "use strict"; | ||
pendingButtonLabel = "OK", | ||
method = "post", | ||
method = "POST", | ||
schema, | ||
@@ -926,6 +926,15 @@ beforeChildren, | ||
}, [transition.state]); | ||
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_hook_form.FormProvider, { ...form, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Component, { ref: formRef, method, onSubmit, ...props, children: [ | ||
beforeChildren, | ||
customChildren != null ? customChildren : defaultChildren() | ||
] }) }); | ||
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_hook_form.FormProvider, { ...form, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)( | ||
Component, | ||
{ | ||
ref: formRef, | ||
method, | ||
onSubmit, | ||
...props, | ||
children: [ | ||
beforeChildren, | ||
customChildren != null ? customChildren : defaultChildren() | ||
] | ||
} | ||
) }); | ||
}; | ||
@@ -932,0 +941,0 @@ } |
{ | ||
"name": "remix-forms", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"description": "The full-stack form library for Remix and React Router", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
78246
2184