@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.d.cts CHANGED
@@ -368,7 +368,7 @@ interface TypographyProps {
368
368
  */
369
369
  declare function Typography({ variant, as, color, weight, align, truncate, muted, className, style, children, }: TypographyProps): react_jsx_runtime.JSX.Element;
370
370
 
371
- type IconButtonVariant = 'primary' | 'bordered';
371
+ type IconButtonVariant = 'primary' | 'bordered' | 'ghost';
372
372
  interface IconButtonProps {
373
373
  icon?: React.ReactNode;
374
374
  onClick?: React.MouseEventHandler<HTMLButtonElement>;
@@ -4746,7 +4746,10 @@ declare class FormStore {
4746
4746
  errors: ErrorMap;
4747
4747
  touched: Record<string, boolean>;
4748
4748
  submitted: boolean;
4749
+ /** True while async field validation runs. */
4749
4750
  validating: boolean;
4751
+ /** True while the submit handler (`onFinish` / `action`) is executing. */
4752
+ submitting: boolean;
4750
4753
  readonly initialValues: FormValues;
4751
4754
  private rules;
4752
4755
  readonly validateOn: ValidateTrigger[];
@@ -4778,6 +4781,7 @@ declare class FormStore {
4778
4781
  validate?: boolean;
4779
4782
  }) => void;
4780
4783
  setSubmitted: (v: boolean) => void;
4784
+ setSubmitting: (v: boolean) => void;
4781
4785
  validateField(name: string): Promise<string | undefined>;
4782
4786
  validateAll(): Promise<ErrorMap>;
4783
4787
  reset: (values?: FormValues) => void;
package/dist/index.d.ts CHANGED
@@ -368,7 +368,7 @@ interface TypographyProps {
368
368
  */
369
369
  declare function Typography({ variant, as, color, weight, align, truncate, muted, className, style, children, }: TypographyProps): react_jsx_runtime.JSX.Element;
370
370
 
371
- type IconButtonVariant = 'primary' | 'bordered';
371
+ type IconButtonVariant = 'primary' | 'bordered' | 'ghost';
372
372
  interface IconButtonProps {
373
373
  icon?: React.ReactNode;
374
374
  onClick?: React.MouseEventHandler<HTMLButtonElement>;
@@ -4746,7 +4746,10 @@ declare class FormStore {
4746
4746
  errors: ErrorMap;
4747
4747
  touched: Record<string, boolean>;
4748
4748
  submitted: boolean;
4749
+ /** True while async field validation runs. */
4749
4750
  validating: boolean;
4751
+ /** True while the submit handler (`onFinish` / `action`) is executing. */
4752
+ submitting: boolean;
4750
4753
  readonly initialValues: FormValues;
4751
4754
  private rules;
4752
4755
  readonly validateOn: ValidateTrigger[];
@@ -4778,6 +4781,7 @@ declare class FormStore {
4778
4781
  validate?: boolean;
4779
4782
  }) => void;
4780
4783
  setSubmitted: (v: boolean) => void;
4784
+ setSubmitting: (v: boolean) => void;
4781
4785
  validateField(name: string): Promise<string | undefined>;
4782
4786
  validateAll(): Promise<ErrorMap>;
4783
4787
  reset: (values?: FormValues) => void;
package/dist/index.js CHANGED
@@ -472,6 +472,9 @@ function IconButton({
472
472
  if (type === "bordered") {
473
473
  return "bg-surface text-foreground hover:bg-surface-raised border border-border-strong";
474
474
  }
475
+ if (type === "ghost") {
476
+ return "bg-transparent text-foreground-muted hover:bg-surface-raised hover:text-foreground";
477
+ }
475
478
  return "";
476
479
  }, [type]);
477
480
  return /* @__PURE__ */ jsx(
@@ -483,7 +486,7 @@ function IconButton({
483
486
  title,
484
487
  "aria-label": title,
485
488
  style,
486
- 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(),
489
+ 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(),
487
490
  children: loading ? loadingIcon : icon
488
491
  }
489
492
  );
@@ -3508,7 +3511,10 @@ var FormStore = class {
3508
3511
  errors = {};
3509
3512
  touched = {};
3510
3513
  submitted = false;
3514
+ /** True while async field validation runs. */
3511
3515
  validating = false;
3516
+ /** True while the submit handler (`onFinish` / `action`) is executing. */
3517
+ submitting = false;
3512
3518
  initialValues;
3513
3519
  rules;
3514
3520
  validateOn;
@@ -3593,6 +3599,10 @@ var FormStore = class {
3593
3599
  this.submitted = v;
3594
3600
  this.emit();
3595
3601
  };
3602
+ setSubmitting = (v) => {
3603
+ this.submitting = v;
3604
+ this.emit();
3605
+ };
3596
3606
  // ── validation ─────────────────────────────────────────────────────────────
3597
3607
  async validateField(name) {
3598
3608
  const err = await runFieldRules(getPath(this.values, name), this.rules[name], this.values);
@@ -3618,6 +3628,7 @@ var FormStore = class {
3618
3628
  this.errors = {};
3619
3629
  this.touched = {};
3620
3630
  this.submitted = false;
3631
+ this.submitting = false;
3621
3632
  this.keys = {};
3622
3633
  this.fieldCache.clear();
3623
3634
  this.emit();
@@ -3717,7 +3728,8 @@ function useForm(options = {}) {
3717
3728
  errors: store.errors,
3718
3729
  touched: store.touched,
3719
3730
  submitted: store.submitted,
3720
- isSubmitting: store.validating,
3731
+ // True for the whole submit cycle: async validation → onFinish execution.
3732
+ isSubmitting: store.submitting || store.validating,
3721
3733
  isValid: store.isValid,
3722
3734
  getValue: store.getValue,
3723
3735
  getValues: store.getValues,
@@ -3767,7 +3779,12 @@ function Form({
3767
3779
  return;
3768
3780
  }
3769
3781
  if (onFinish) {
3770
- await onFinish(store.getValues());
3782
+ store.setSubmitting(true);
3783
+ try {
3784
+ await onFinish(store.getValues());
3785
+ } finally {
3786
+ store.setSubmitting(false);
3787
+ }
3771
3788
  return;
3772
3789
  }
3773
3790
  if (typeof action === "function") {