@samuel-charpentier/sform 0.0.8 → 0.0.9

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/README.md CHANGED
@@ -125,11 +125,12 @@ Wrapper component that provides form context to all child fields.
125
125
  </Sform>
126
126
  ```
127
127
 
128
- | Prop | Type | Default | Description |
129
- | ------------ | -------------------------------- | ----------- | ------------------------------------ |
130
- | `form` | `RemoteForm` | required | Remote form object from `form()` API |
131
- | `validateOn` | `'blur' \| 'change' \| 'submit'` | `'blur'` | When to validate and show errors |
132
- | `class` | `string` | `undefined` | CSS class for form element |
128
+ | Prop | Type | Default | Description |
129
+ | --------------- | -------------------------------- | ----------- | ------------------------------------------------- |
130
+ | `form` | `RemoteForm` | required | Remote form object from `form()` API |
131
+ | `validateOn` | `'blur' \| 'change' \| 'submit'` | `'blur'` | When to validate and show errors |
132
+ | `class` | `string` | `undefined` | CSS class for form element |
133
+ | `preflightOnly` | `boolean` | `false` | If true, client side validation is preflight only |
133
134
 
134
135
  **Validate Modes:**
135
136
 
@@ -17,6 +17,7 @@
17
17
  enhance,
18
18
  validateOn = 'blur',
19
19
  class: className,
20
+ preflightOnly = false,
20
21
  children
21
22
  }: {
22
23
  /** Remote form object from form() API, or the result of form.for(id) */
@@ -27,6 +28,8 @@
27
28
  enhance?: EnhanceCallback<Input>;
28
29
  /** When to validate and show issues: 'blur' (default), 'change', or 'submit' */
29
30
  validateOn?: ValidateOn;
31
+ /** If true, only run preflight validation (no submission) */
32
+ preflightOnly?: boolean;
30
33
  /** Form element class */
31
34
  class?: string;
32
35
  /**
@@ -50,7 +53,7 @@
50
53
 
51
54
  // Trigger validation including untouched fields (for blur mode)
52
55
  const triggerValidation = () => {
53
- form.validate({ includeUntouched: true });
56
+ form.validate({ includeUntouched: true, preflightOnly });
54
57
  };
55
58
 
56
59
  const context = createSformContext(
@@ -86,7 +89,7 @@
86
89
  });
87
90
 
88
91
  function handleInput() {
89
- form.validate({ includeUntouched: true });
92
+ triggerValidation();
90
93
  }
91
94
 
92
95
  function handleSubmit() {
@@ -12,6 +12,8 @@ declare function $$render<Input extends import('@sveltejs/kit').RemoteFormInput,
12
12
  enhance?: EnhanceCallback<Input>;
13
13
  /** When to validate and show issues: 'blur' (default), 'change', or 'submit' */
14
14
  validateOn?: ValidateOn;
15
+ /** If true, only run preflight validation (no submission) */
16
+ preflightOnly?: boolean;
15
17
  /** Form element class */
16
18
  class?: string;
17
19
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samuel-charpentier/sform",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "A Svelte 5 form library for SvelteKit remote forms",
5
5
  "keywords": [
6
6
  "svelte",