@geomak/ui 7.5.0 → 7.5.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.
package/dist/index.cjs CHANGED
@@ -3548,7 +3548,10 @@ var FormStore = class {
3548
3548
  errors = {};
3549
3549
  touched = {};
3550
3550
  submitted = false;
3551
+ /** True while async field validation runs. */
3551
3552
  validating = false;
3553
+ /** True while the submit handler (`onFinish` / `action`) is executing. */
3554
+ submitting = false;
3552
3555
  initialValues;
3553
3556
  rules;
3554
3557
  validateOn;
@@ -3633,6 +3636,10 @@ var FormStore = class {
3633
3636
  this.submitted = v;
3634
3637
  this.emit();
3635
3638
  };
3639
+ setSubmitting = (v) => {
3640
+ this.submitting = v;
3641
+ this.emit();
3642
+ };
3636
3643
  // ── validation ─────────────────────────────────────────────────────────────
3637
3644
  async validateField(name) {
3638
3645
  const err = await runFieldRules(getPath(this.values, name), this.rules[name], this.values);
@@ -3658,6 +3665,7 @@ var FormStore = class {
3658
3665
  this.errors = {};
3659
3666
  this.touched = {};
3660
3667
  this.submitted = false;
3668
+ this.submitting = false;
3661
3669
  this.keys = {};
3662
3670
  this.fieldCache.clear();
3663
3671
  this.emit();
@@ -3757,7 +3765,8 @@ function useForm(options = {}) {
3757
3765
  errors: store.errors,
3758
3766
  touched: store.touched,
3759
3767
  submitted: store.submitted,
3760
- isSubmitting: store.validating,
3768
+ // True for the whole submit cycle: async validation → onFinish execution.
3769
+ isSubmitting: store.submitting || store.validating,
3761
3770
  isValid: store.isValid,
3762
3771
  getValue: store.getValue,
3763
3772
  getValues: store.getValues,
@@ -3807,7 +3816,12 @@ function Form({
3807
3816
  return;
3808
3817
  }
3809
3818
  if (onFinish) {
3810
- await onFinish(store.getValues());
3819
+ store.setSubmitting(true);
3820
+ try {
3821
+ await onFinish(store.getValues());
3822
+ } finally {
3823
+ store.setSubmitting(false);
3824
+ }
3811
3825
  return;
3812
3826
  }
3813
3827
  if (typeof action === "function") {