@douglasneuroinformatics/libui 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1283,12 +1283,6 @@ type FormProps<TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<T
1283
1283
  left?: React.ReactNode;
1284
1284
  right?: React.ReactNode;
1285
1285
  };
1286
- beforeSubmit?: (data: NoInfer<TData>) => Promisable<{
1287
- errorMessage: string;
1288
- success: false;
1289
- } | {
1290
- success: true;
1291
- }>;
1292
1286
  className?: string;
1293
1287
  content: FormContent<TData>;
1294
1288
  customStyles?: {
@@ -1298,6 +1292,12 @@ type FormProps<TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<T
1298
1292
  fieldsFooter?: React.ReactNode;
1299
1293
  id?: string;
1300
1294
  initialValues?: PartialNullableFormDataType<NoInfer<TData>>;
1295
+ onBeforeSubmit?: (data: NoInfer<TData>) => Promisable<{
1296
+ errorMessage: string;
1297
+ success: false;
1298
+ } | {
1299
+ success: true;
1300
+ }>;
1301
1301
  onError?: (error: z.ZodError<NoInfer<TData>>) => void;
1302
1302
  onSubmit: (data: NoInfer<TData>) => Promisable<void>;
1303
1303
  preventResetValuesOnReset?: boolean;
@@ -1308,7 +1308,7 @@ type FormProps<TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<T
1308
1308
  suspendWhileSubmitting?: boolean;
1309
1309
  validationSchema: z.ZodType<TData>;
1310
1310
  };
1311
- declare const Form: <TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TSchema> = z.TypeOf<TSchema>>({ additionalButtons, beforeSubmit, className, content, customStyles, fieldsFooter, id, initialValues, onError, onSubmit, preventResetValuesOnReset, readOnly, resetBtn, revalidateOnBlur, submitBtnLabel, suspendWhileSubmitting, validationSchema, ...props }: FormProps<TSchema, TData>) => react_jsx_runtime.JSX.Element;
1311
+ declare const Form: <TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TSchema> = z.TypeOf<TSchema>>({ additionalButtons, className, content, customStyles, fieldsFooter, id, initialValues, onBeforeSubmit, onError, onSubmit, preventResetValuesOnReset, readOnly, resetBtn, revalidateOnBlur, submitBtnLabel, suspendWhileSubmitting, validationSchema, ...props }: FormProps<TSchema, TData>) => react_jsx_runtime.JSX.Element;
1312
1312
 
1313
1313
  type HeadingProps = {
1314
1314
  children: string;
@@ -3476,13 +3476,13 @@ function getInitialValues(values) {
3476
3476
  import { jsx as jsx136, jsxs as jsxs47 } from "react/jsx-runtime";
3477
3477
  var Form = ({
3478
3478
  additionalButtons,
3479
- beforeSubmit,
3480
3479
  className,
3481
3480
  content,
3482
3481
  customStyles,
3483
3482
  fieldsFooter,
3484
3483
  id,
3485
3484
  initialValues,
3485
+ onBeforeSubmit,
3486
3486
  onError,
3487
3487
  onSubmit,
3488
3488
  preventResetValuesOnReset,
@@ -3537,8 +3537,8 @@ var Form = ({
3537
3537
  handleError(result.error);
3538
3538
  return;
3539
3539
  }
3540
- if (beforeSubmit) {
3541
- const beforeSubmitResult = await beforeSubmit(result.data);
3540
+ if (onBeforeSubmit) {
3541
+ const beforeSubmitResult = await onBeforeSubmit(result.data);
3542
3542
  if (!beforeSubmitResult.success) {
3543
3543
  setErrors({});
3544
3544
  setRootErrors([beforeSubmitResult.errorMessage]);