@douglasneuroinformatics/libui 3.8.2 → 3.8.4

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.
@@ -3483,22 +3483,23 @@ var Form = ({
3483
3483
  }
3484
3484
  };
3485
3485
  const handleSubmit = async (event) => {
3486
- const minSubmitTime = new Promise(
3487
- (resolve) => suspendWhileSubmitting ? setTimeout(resolve, 500) : resolve()
3488
- );
3486
+ event.preventDefault();
3487
+ const result = await validationSchema.safeParseAsync(values);
3488
+ if (!result.success) {
3489
+ console.error(result.error.issues);
3490
+ handleError(result.error);
3491
+ return;
3492
+ }
3489
3493
  try {
3490
3494
  setIsSubmitting(true);
3491
- event.preventDefault();
3492
- const result = await validationSchema.safeParseAsync(values);
3493
- if (result.success) {
3494
- reset();
3495
- await onSubmit(result.data);
3496
- } else {
3497
- console.error(result.error.issues);
3498
- handleError(result.error);
3499
- }
3495
+ await Promise.all([
3496
+ onSubmit(result.data),
3497
+ new Promise((resolve) => {
3498
+ return suspendWhileSubmitting ? setTimeout(resolve, 500) : resolve();
3499
+ })
3500
+ ]);
3501
+ reset();
3500
3502
  } finally {
3501
- await minSubmitTime;
3502
3503
  setIsSubmitting(false);
3503
3504
  }
3504
3505
  };
@@ -3521,12 +3522,13 @@ var Form = ({
3521
3522
  "form",
3522
3523
  {
3523
3524
  autoComplete: "off",
3524
- className: twMerge("w-full", isGrouped ? "space-y-8 divide-y" : "space-y-6", className),
3525
+ className: twMerge("relative w-full", isGrouped ? "space-y-8 divide-y" : "space-y-6", className),
3525
3526
  id,
3526
3527
  onBlur: revalidateOnBlur ? revalidate : void 0,
3527
3528
  onSubmit: (event) => void handleSubmit(event),
3528
3529
  ...props,
3529
3530
  children: [
3531
+ isSubmitting && /* @__PURE__ */ jsx136("div", { className: "absolute z-10 h-full w-full cursor-wait" }),
3530
3532
  isGrouped ? content.map((fieldGroup, i) => {
3531
3533
  return /* @__PURE__ */ jsxs47("div", { className: "flex flex-col space-y-6 [&:not(:first-child)]:pt-8", children: [
3532
3534
  /* @__PURE__ */ jsxs47("div", { className: "space-y-1", children: [