@marianmeres/stuic 3.76.5 → 3.77.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.
|
@@ -51,6 +51,14 @@
|
|
|
51
51
|
/** Override CTA section. */
|
|
52
52
|
submitButton?: Snippet<[{ isSubmitting: boolean; disabled: boolean }]>;
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Override or suppress the form heading. By default the heading is rendered
|
|
56
|
+
* with the i18n value of `email_verify_form.heading`. Pass a string to override
|
|
57
|
+
* the text, or `false` to skip rendering the heading entirely (useful when the
|
|
58
|
+
* surrounding container — e.g. a modal — already provides a title).
|
|
59
|
+
*/
|
|
60
|
+
heading?: string | false;
|
|
61
|
+
|
|
54
62
|
t?: TranslateFn;
|
|
55
63
|
unstyled?: boolean;
|
|
56
64
|
class?: string;
|
|
@@ -80,6 +88,7 @@
|
|
|
80
88
|
notifications,
|
|
81
89
|
footer,
|
|
82
90
|
submitButton,
|
|
91
|
+
heading,
|
|
83
92
|
t: tProp,
|
|
84
93
|
unstyled = false,
|
|
85
94
|
class: classProp,
|
|
@@ -196,9 +205,11 @@
|
|
|
196
205
|
|
|
197
206
|
<form bind:this={formEl} class={_class} onsubmit={handleFormSubmit} {...rest}>
|
|
198
207
|
<!-- Heading -->
|
|
199
|
-
|
|
200
|
-
{
|
|
201
|
-
|
|
208
|
+
{#if heading !== false}
|
|
209
|
+
<H level={2} class={unstyled ? undefined : "stuic-email-verify-form-heading"}>
|
|
210
|
+
{typeof heading === "string" ? heading : t("email_verify_form.heading")}
|
|
211
|
+
</H>
|
|
212
|
+
{/if}
|
|
202
213
|
|
|
203
214
|
<!-- Subheading with bolded email -->
|
|
204
215
|
<p class={unstyled ? undefined : "stuic-email-verify-form-subheading"}>
|
|
@@ -37,6 +37,13 @@ export interface Props extends Omit<HTMLAttributes<HTMLFormElement>, "children">
|
|
|
37
37
|
isSubmitting: boolean;
|
|
38
38
|
disabled: boolean;
|
|
39
39
|
}]>;
|
|
40
|
+
/**
|
|
41
|
+
* Override or suppress the form heading. By default the heading is rendered
|
|
42
|
+
* with the i18n value of `email_verify_form.heading`. Pass a string to override
|
|
43
|
+
* the text, or `false` to skip rendering the heading entirely (useful when the
|
|
44
|
+
* surrounding container — e.g. a modal — already provides a title).
|
|
45
|
+
*/
|
|
46
|
+
heading?: string | false;
|
|
40
47
|
t?: TranslateFn;
|
|
41
48
|
unstyled?: boolean;
|
|
42
49
|
class?: string;
|
|
@@ -50,6 +50,7 @@ The form owns:
|
|
|
50
50
|
| `notifications` | `NotificationsStack` | — | Route errors to notification system |
|
|
51
51
|
| `submitButton` | `Snippet` | — | Override submit section |
|
|
52
52
|
| `footer` | `Snippet` | — | Content below the resend control |
|
|
53
|
+
| `heading` | `string \| false` | — | Override heading text, or `false` to suppress entirely |
|
|
53
54
|
| `t` | `TranslateFn` | built-in | Translation function |
|
|
54
55
|
| `unstyled` | `boolean` | `false` | Skip default styling |
|
|
55
56
|
| `class` | `string` | — | Additional CSS classes on the form root |
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
</script>
|
|
96
96
|
|
|
97
97
|
<script lang="ts">
|
|
98
|
+
import { untrack } from "svelte";
|
|
98
99
|
import { twMerge } from "../../utils/tw-merge.js";
|
|
99
100
|
import { t_default } from "./_internal/register-form-i18n-defaults.js";
|
|
100
101
|
import {
|
|
@@ -146,6 +147,22 @@
|
|
|
146
147
|
// Internal validation errors (set on submit)
|
|
147
148
|
let internalErrors = $state<RegisterFormValidationError[]>([]);
|
|
148
149
|
|
|
150
|
+
// Clear internal field errors as soon as the user edits any tracked field, so a
|
|
151
|
+
// previous failed-submit's errors don't linger after the user has fixed them.
|
|
152
|
+
// Re-validation on the next submit will repopulate `internalErrors` if anything
|
|
153
|
+
// is still wrong. `untrack` for the read+write so this effect only re-runs on
|
|
154
|
+
// formData changes — otherwise `handleSubmitValid` setting `internalErrors`
|
|
155
|
+
// would immediately re-fire this effect and wipe the errors back out.
|
|
156
|
+
$effect(() => {
|
|
157
|
+
void formData.email;
|
|
158
|
+
void formData.password;
|
|
159
|
+
void formData.passwordConfirm;
|
|
160
|
+
for (const f of extraFields) void formData.extra?.[f.name];
|
|
161
|
+
untrack(() => {
|
|
162
|
+
if (internalErrors.length) internalErrors = [];
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
149
166
|
// Merge internal + external errors; external takes precedence per field
|
|
150
167
|
let allErrors = $derived.by(() => {
|
|
151
168
|
const map = new Map<string, string>();
|