@geomak/ui 7.4.4 → 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
@@ -509,6 +509,9 @@ function IconButton({
509
509
  if (type === "bordered") {
510
510
  return "bg-surface text-foreground hover:bg-surface-raised border border-border-strong";
511
511
  }
512
+ if (type === "ghost") {
513
+ return "bg-transparent text-foreground-muted hover:bg-surface-raised hover:text-foreground";
514
+ }
512
515
  return "";
513
516
  }, [type]);
514
517
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -520,7 +523,7 @@ function IconButton({
520
523
  title,
521
524
  "aria-label": title,
522
525
  style,
523
- className: `${size === "sm" ? "p-1" : size === "md" ? "p-1.5" : "p-2"} rounded-lg shadow-md transition-colors duration-150 ${colorScheme} disabled:bg-surface-raised disabled:text-foreground-muted disabled:cursor-not-allowed focus:outline-none focus-visible:ring-2 focus-visible:ring-accent ${className}`.trim(),
526
+ className: `${size === "sm" ? "p-1" : size === "md" ? "p-1.5" : "p-2"} rounded-lg ${type !== "ghost" ? "shadow-md" : ""} transition-colors duration-150 ${colorScheme} disabled:bg-surface-raised disabled:text-foreground-muted disabled:cursor-not-allowed focus:outline-none focus-visible:ring-2 focus-visible:ring-accent ${className}`.trim(),
524
527
  children: loading ? loadingIcon : icon
525
528
  }
526
529
  );
@@ -3545,7 +3548,10 @@ var FormStore = class {
3545
3548
  errors = {};
3546
3549
  touched = {};
3547
3550
  submitted = false;
3551
+ /** True while async field validation runs. */
3548
3552
  validating = false;
3553
+ /** True while the submit handler (`onFinish` / `action`) is executing. */
3554
+ submitting = false;
3549
3555
  initialValues;
3550
3556
  rules;
3551
3557
  validateOn;
@@ -3630,6 +3636,10 @@ var FormStore = class {
3630
3636
  this.submitted = v;
3631
3637
  this.emit();
3632
3638
  };
3639
+ setSubmitting = (v) => {
3640
+ this.submitting = v;
3641
+ this.emit();
3642
+ };
3633
3643
  // ── validation ─────────────────────────────────────────────────────────────
3634
3644
  async validateField(name) {
3635
3645
  const err = await runFieldRules(getPath(this.values, name), this.rules[name], this.values);
@@ -3655,6 +3665,7 @@ var FormStore = class {
3655
3665
  this.errors = {};
3656
3666
  this.touched = {};
3657
3667
  this.submitted = false;
3668
+ this.submitting = false;
3658
3669
  this.keys = {};
3659
3670
  this.fieldCache.clear();
3660
3671
  this.emit();
@@ -3754,7 +3765,8 @@ function useForm(options = {}) {
3754
3765
  errors: store.errors,
3755
3766
  touched: store.touched,
3756
3767
  submitted: store.submitted,
3757
- isSubmitting: store.validating,
3768
+ // True for the whole submit cycle: async validation → onFinish execution.
3769
+ isSubmitting: store.submitting || store.validating,
3758
3770
  isValid: store.isValid,
3759
3771
  getValue: store.getValue,
3760
3772
  getValues: store.getValues,
@@ -3804,7 +3816,12 @@ function Form({
3804
3816
  return;
3805
3817
  }
3806
3818
  if (onFinish) {
3807
- await onFinish(store.getValues());
3819
+ store.setSubmitting(true);
3820
+ try {
3821
+ await onFinish(store.getValues());
3822
+ } finally {
3823
+ store.setSubmitting(false);
3824
+ }
3808
3825
  return;
3809
3826
  }
3810
3827
  if (typeof action === "function") {