@marianmeres/stuic 3.23.2 → 3.23.3

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.
@@ -132,9 +132,7 @@
132
132
  return allErrors.find((e) => e.field === field)?.message;
133
133
  }
134
134
 
135
- function handleSubmit(e: SubmitEvent) {
136
- e.preventDefault();
137
-
135
+ function handleSubmitValid() {
138
136
  const validationErrors = validateLoginForm(formData, t);
139
137
  internalErrors = validationErrors;
140
138
 
@@ -147,13 +145,22 @@
147
145
  if (error && notifications) notifications.error(error);
148
146
  });
149
147
 
148
+ // The onSubmitValidityCheck action intercepts native submit (capture phase,
149
+ // stopImmediatePropagation) and dispatches a custom "submit_valid" event.
150
+ // Listen for it on the form element as a fallback.
151
+ $effect(() => {
152
+ const node = el;
153
+ if (!node) return;
154
+ node.addEventListener("submit_valid", handleSubmitValid);
155
+ return () => node.removeEventListener("submit_valid", handleSubmitValid);
156
+ });
157
+
150
158
  let _class = $derived(unstyled ? classProp : twMerge("stuic-login-form", classProp));
151
159
  </script>
152
160
 
153
161
  <form
154
162
  bind:this={el}
155
163
  class={_class}
156
- onsubmit={handleSubmit}
157
164
  use:onSubmitValidityCheck
158
165
  {...rest}
159
166
  data-compact={compact ? "" : undefined}
@@ -162,10 +169,10 @@
162
169
  <DismissibleMessage message={error} intent="destructive" onDismiss={false} />
163
170
 
164
171
  <!--
165
- svelte-ignore binding_property_non_reactive:
166
- formData is a $bindable prop — deep reactivity depends on the consumer
167
- passing a $state() object. The bindings work correctly regardless.
168
- -->
172
+ svelte-ignore binding_property_non_reactive:
173
+ formData is a $bindable prop — deep reactivity depends on the consumer
174
+ passing a $state() object. The bindings work correctly regardless.
175
+ -->
169
176
  <!-- Email -->
170
177
  <!-- svelte-ignore binding_property_non_reactive -->
171
178
  <FieldInput
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "3.23.2",
3
+ "version": "3.23.3",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",