@marianmeres/stuic 3.70.0 → 3.71.0

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.
Files changed (28) hide show
  1. package/AGENTS.md +2 -2
  2. package/README.md +1 -1
  3. package/dist/components/EmailVerifyForm/EmailVerifyForm.svelte +269 -0
  4. package/dist/components/EmailVerifyForm/EmailVerifyForm.svelte.d.ts +47 -0
  5. package/dist/components/EmailVerifyForm/README.md +76 -0
  6. package/dist/components/EmailVerifyForm/_internal/email-verify-form-i18n-defaults.d.ts +1 -0
  7. package/dist/components/EmailVerifyForm/_internal/email-verify-form-i18n-defaults.js +21 -0
  8. package/dist/components/EmailVerifyForm/index.css +54 -0
  9. package/dist/components/EmailVerifyForm/index.d.ts +1 -0
  10. package/dist/components/EmailVerifyForm/index.js +1 -0
  11. package/dist/components/LoginOrRegisterForm/LoginOrRegisterForm.svelte +70 -21
  12. package/dist/components/LoginOrRegisterForm/LoginOrRegisterForm.svelte.d.ts +16 -2
  13. package/dist/components/LoginOrRegisterForm/LoginOrRegisterFormModal.svelte +26 -3
  14. package/dist/components/LoginOrRegisterForm/LoginOrRegisterFormModal.svelte.d.ts +9 -1
  15. package/dist/components/LoginOrRegisterForm/_internal/login-or-register-form-i18n-defaults.js +2 -0
  16. package/dist/components/OtpInput/OtpInput.svelte +0 -0
  17. package/dist/components/OtpInput/OtpInput.svelte.d.ts +30 -0
  18. package/dist/components/OtpInput/README.md +55 -0
  19. package/dist/components/OtpInput/index.css +41 -0
  20. package/dist/components/OtpInput/index.d.ts +1 -0
  21. package/dist/components/OtpInput/index.js +1 -0
  22. package/dist/components/TabbedMenu/TabbedMenu.svelte +27 -3
  23. package/dist/components/TabbedMenu/TabbedMenu.svelte.d.ts +4 -1
  24. package/dist/index.css +2 -0
  25. package/dist/index.d.ts +2 -0
  26. package/dist/index.js +2 -0
  27. package/docs/domains/components.md +204 -1
  28. package/package.json +1 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- 50 Svelte 5 component directories with consistent API patterns. All use runes-based reactivity.
5
+ 55 Svelte 5 component directories with consistent API patterns. All use runes-based reactivity.
6
6
 
7
7
  ## Component Categories
8
8
 
@@ -62,6 +62,10 @@
62
62
  | FieldKeyValues | Key-value pair editor |
63
63
  | FieldAssets | File/asset management |
64
64
  | LoginForm, LoginFormModal | Standalone login form with optional modal variant |
65
+ | RegisterForm | Standalone registration form with declarative extra fields |
66
+ | LoginOrRegisterForm, LoginOrRegisterFormModal | Composite login/register/verify form (3 modes, shared social-logins) |
67
+ | EmailVerifyForm | Post-registration email-verify form (OtpInput + resend cooldown) |
68
+ | OtpInput | Generic N-slot one-time-code input (numeric/alphanumeric, paste-distribute) |
65
69
 
66
70
  ### Display
67
71
 
@@ -154,6 +158,201 @@ Prefix: `--stuic-login-form-*`
154
158
 
155
159
  ---
156
160
 
161
+ ## RegisterForm
162
+
163
+ Standalone registration form. Mirrors `LoginForm` conventions: `formData`, `onSubmit`, validation, errors, i18n, notifications, social-logins. Adds declarative `extraFields` (top/bottom positioning, custom validators) and an `extraFieldsSlot` escape hatch (e.g., terms checkbox).
164
+
165
+ ### Exports
166
+
167
+ | Export | Kind | Description |
168
+ | ----------------------------- | --------- | -------------------------------------- |
169
+ | `RegisterForm` | component | Main register form |
170
+ | `RegisterFormProps` | type | Props for RegisterForm |
171
+ | `RegisterFormData` | type | `{ email, password, passwordConfirm, extra }` |
172
+ | `RegisterFormValidationError` | type | `{ field, message }` |
173
+ | `RegisterFieldConfig` | type | Declarative extra-field descriptor |
174
+ | `createEmptyRegisterFormData` | function | Factory for an empty `RegisterFormData` |
175
+
176
+ ### Key Props
177
+
178
+ | Prop | Type | Default | Description |
179
+ | --------------------- | --------------------------------- | -------- | ------------------------------------------ |
180
+ | `formData` | `RegisterFormData` | empty | Bindable form data |
181
+ | `onSubmit` | `(data) => void` | required | Submit callback |
182
+ | `isSubmitting` | `boolean` | `false` | Disables CTA |
183
+ | `errors` | `RegisterFormValidationError[]` | `[]` | Field-specific server errors |
184
+ | `error` | `string` | — | General error (alert above form) |
185
+ | `showPasswordConfirm` | `boolean` | `true` | Render password-confirm field |
186
+ | `passwordMinLength` | `number` | `8` | Min password length (input + validator) |
187
+ | `extraFields` | `RegisterFieldConfig[]` | `[]` | Declarative extra fields (top/bottom) |
188
+ | `extraFieldsSlot` | `Snippet` | — | Escape-hatch for non-FieldInput extras |
189
+ | `submitButton` | `Snippet` | — | Custom CTA section |
190
+ | `socialLogins` | `Snippet` | — | OAuth buttons below form |
191
+ | `footer` | `Snippet` | — | Content below form |
192
+ | `notifications` | `NotificationsStack` | — | Route errors to notifications |
193
+ | `compact` | `boolean` | `false` | Compact layout |
194
+ | `t` | `TranslateFn` | built-in | Translation function |
195
+
196
+ ### CSS Tokens
197
+
198
+ Prefix: `--stuic-register-form-*`
199
+
200
+ `gap`, `gap-row`, `social-margin-top`, `social-gap`, `social-divider-color`, `social-divider-line-color`, `social-divider-font-size`, `social-divider-margin-bottom`
201
+
202
+ ---
203
+
204
+ ## LoginOrRegisterForm
205
+
206
+ Composite form that toggles between `LoginForm`, `RegisterForm`, and (since 3.71) `EmailVerifyForm`. The mode switcher only exposes login/register tabs; verify is an outcome state entered programmatically (typically after a `requiresVerification` register response).
207
+
208
+ ### Exports
209
+
210
+ | Export | Kind | Description |
211
+ | ------------------------------ | --------- | -------------------------------------- |
212
+ | `LoginOrRegisterForm` | component | Composite form |
213
+ | `LoginOrRegisterFormModal` | component | Modal-wrapped variant |
214
+ | `LoginOrRegisterFormProps` | type | Props for the composite form |
215
+ | `LoginOrRegisterFormModalProps`| type | Props for the modal |
216
+ | `LoginOrRegisterFormMode` | type | `"login" \| "register" \| "verify"` |
217
+
218
+ ### Key Props
219
+
220
+ | Prop | Type | Default | Description |
221
+ | ------------------- | ---------------------------------------------------- | ----------- | ---------------------------------------------------------------------------- |
222
+ | `mode` | `LoginOrRegisterFormMode` | `"login"` | Bindable active mode |
223
+ | `loginData` | `LoginFormData` | empty | Bindable login form data |
224
+ | `registerData` | `RegisterFormData` | empty | Bindable register form data |
225
+ | `verifyEmail` | `string` | `""` | Bindable email used by EmailVerifyForm (auto-seeded on transitions) |
226
+ | `onLogin` | `(data) => void` | required | Login submit callback |
227
+ | `onRegister` | `(data) => void` | required | Register submit callback |
228
+ | `onVerify` | `(code: string) => void` | — | Verify submit callback (required only when using verify mode) |
229
+ | `onResendCode` | `() => Promise<void> \| void` | — | Resend handler — when set, EmailVerifyForm renders the resend control |
230
+ | `loginProps` | `Partial<LoginFormProps>` | — | Pass-through to inner LoginForm |
231
+ | `registerProps` | `Partial<RegisterFormProps>` | — | Pass-through to inner RegisterForm |
232
+ | `verifyProps` | `Partial<EmailVerifyFormProps>` | — | Pass-through to inner EmailVerifyForm (e.g., `error`, `attemptsRemaining`) |
233
+ | `modeSwitcher` | `Snippet` | — | Override the built-in ButtonGroupRadio |
234
+ | `socialLogins` | `Snippet` | — | Shared OAuth buttons (hidden in verify mode) |
235
+ | `footer` | `Snippet<[{ mode, setMode }]>` | — | Mode-aware footer |
236
+ | `isSubmitting` | `boolean` | `false` | Forwarded to all three forms |
237
+ | `notifications` | `NotificationsStack` | — | Routes errors to notifications |
238
+ | `t` | `TranslateFn` | built-in | Translation function |
239
+
240
+ ### Modal additions (`LoginOrRegisterFormModal`)
241
+
242
+ Inherits all `LoginOrRegisterForm` props, plus:
243
+
244
+ | Prop | Type | Default | Description |
245
+ | ------------ | --------------------- | --------- | ----------------------------------------------------------------- |
246
+ | `title` | `string` | mode-aware | Modal title (defaults to "Log In" / "Create account" / "Verify your email") |
247
+ | `visible` | `boolean` | `false` | Bindable visibility |
248
+ | `trigger` | `Snippet<[{ open }]>` | — | Optional trigger element |
249
+ | `noXClose` | `boolean` | `false` | Hide close button |
250
+
251
+ ### CSS Tokens
252
+
253
+ Prefix: `--stuic-login-or-register-form-*`
254
+
255
+ `gap`, `switcher-margin-bottom`, `social-margin-top`, `social-gap`, `social-divider-*`
256
+
257
+ ### i18n
258
+
259
+ | Key | Default |
260
+ | ------------------------------------------------ | -------------------- |
261
+ | `login_or_register_form.mode_login` | `Log in` |
262
+ | `login_or_register_form.mode_register` | `Sign up` |
263
+ | `login_or_register_form.mode_verify` | `Verify` |
264
+ | `login_or_register_form.modal_title_login` | `Log In` |
265
+ | `login_or_register_form.modal_title_register` | `Create account` |
266
+ | `login_or_register_form.modal_title_verify` | `Verify your email` |
267
+ | `login_or_register_form.social_divider` | `or continue with` |
268
+
269
+ ---
270
+
271
+ ## EmailVerifyForm
272
+
273
+ Post-registration email-verify form. Drop-in peer to `LoginForm` / `RegisterForm`. Renders a heading, a subhead with the bolded email address, a general error banner, an `OtpInput` (default 6 digits, auto-submits on completion), an optional attempts hint, a primary submit button, and an optional resend control with built-in cooldown countdown.
274
+
275
+ ### Exports
276
+
277
+ | Export | Kind | Description |
278
+ | ----------------------- | --------- | -------------------------- |
279
+ | `EmailVerifyForm` | component | Email-verify form |
280
+ | `EmailVerifyFormProps` | type | Props for EmailVerifyForm |
281
+
282
+ ### Key Props
283
+
284
+ | Prop | Type | Default | Description |
285
+ | ----------------------- | ------------------------------------------ | -------- | -------------------------------------------------------- |
286
+ | `email` | `string` | required | Email shown in the subhead |
287
+ | `onSubmit` | `(code: string) => void` | required | Called with the entered code (auto + manual submit) |
288
+ | `onResend` | `() => Promise<void> \| void` | — | When set, renders the resend control |
289
+ | `resendCooldownSeconds` | `number` | `30` | Cooldown after a successful resend |
290
+ | `isSubmitting` | `boolean` | `false` | Disables submit + OtpInput |
291
+ | `error` | `string` | — | General error (alert + applies error styling to OtpInput)|
292
+ | `attemptsRemaining` | `number` | — | Inline "{count} attempts remaining" hint |
293
+ | `codeLength` | `number` | `6` | Forwarded to OtpInput |
294
+ | `otpInputProps` | `Partial<OtpInputProps>` | — | Pass-through to inner OtpInput |
295
+ | `notifications` | `NotificationsStack` | — | Route errors to notifications |
296
+ | `submitButton` | `Snippet` | — | Override submit section |
297
+ | `footer` | `Snippet` | — | Content below resend control |
298
+ | `t` | `TranslateFn` | built-in | Translation function |
299
+
300
+ ### CSS Tokens
301
+
302
+ Prefix: `--stuic-email-verify-form-*`
303
+
304
+ `gap`, `subheading-color`, `attempts-color`, `resend-color`, `resend-flash-color`
305
+
306
+ ### i18n keys
307
+
308
+ `email_verify_form.heading`, `subheading`, `submit`, `submitting`, `resend_prompt`, `resend`, `resend_cooldown`, `resent`, `attempts_remaining`
309
+
310
+ ---
311
+
312
+ ## OtpInput
313
+
314
+ Generic N-slot one-time-code input. 6 numeric digits by default, configurable to 4–8. Building block for email-verify, future 2FA, and password-reset OTP flows.
315
+
316
+ ### Exports
317
+
318
+ | Export | Kind | Description |
319
+ | --------------- | --------- | --------------------- |
320
+ | `OtpInput` | component | OTP input |
321
+ | `OtpInputProps` | type | Props for OtpInput |
322
+
323
+ ### Key Props
324
+
325
+ | Prop | Type | Default | Description |
326
+ | -------------- | ------------------------------- | ------------------ | ----------------------------------------------------------------- |
327
+ | `value` | `string` | `""` | Bindable concatenated value |
328
+ | `length` | `number` | `6` | Number of slots |
329
+ | `onComplete` | `(code: string) => void` | — | Fired when all slots are filled |
330
+ | `oninput` | `(value: string) => void` | — | Fired on every change |
331
+ | `error` | `boolean` | `false` | Renders error styling + `aria-invalid` |
332
+ | `disabled` | `boolean` | `false` | Disables all slots |
333
+ | `autoFocus` | `boolean` | `true` | Auto-focus first empty slot on mount |
334
+ | `mode` | `"numeric" \| "alphanumeric"` | `"numeric"` | Restrict input characters |
335
+ | `autocomplete` | `string` | `"one-time-code"` | Pass-through to first slot for browser/iOS auto-fill |
336
+
337
+ ### Behavior
338
+
339
+ - Auto-advance on input; backspace clears or jumps back
340
+ - Arrow keys navigate without modifying values
341
+ - Paste anywhere distributes from slot 0 (after sanitization + truncation)
342
+ - iOS / Android SMS auto-fill works via `autocomplete="one-time-code"` on slot 0
343
+ - Each slot announces `aria-label="Digit {n+1} of {length}"`
344
+ - Enter bubbles native submit to surrounding `<form>`
345
+
346
+ ### CSS Tokens
347
+
348
+ Prefix: `--stuic-otp-input-*`
349
+
350
+ `gap`, `slot-size`, `font-size`, `bg`, `color`, `radius`, `border-width`, `border-color`, `border-color-focus`, `border-color-error`, `transition`
351
+
352
+ Falls back to shared structural tokens `--stuic-radius`, `--stuic-border-width`, `--stuic-transition`.
353
+
354
+ ---
355
+
157
356
  ## FieldObject
158
357
 
159
358
  Dual-mode JSON object editor with pretty-print and raw edit modes.
@@ -578,6 +777,10 @@ Prefix: `--stuic-tree-*`
578
777
  | src/lib/components/Modal/ | Complex component example |
579
778
  | src/lib/components/Input/ | Form field patterns (incl. FieldObject) |
580
779
  | src/lib/components/LoginForm/ | Standalone login form + modal variant |
780
+ | src/lib/components/RegisterForm/ | Standalone registration form |
781
+ | src/lib/components/LoginOrRegisterForm/ | Composite login/register/verify form + modal |
782
+ | src/lib/components/EmailVerifyForm/ | Post-registration email-verify form |
783
+ | src/lib/components/OtpInput/ | N-slot one-time-code input |
581
784
  | src/lib/components/Checkout/ | E-commerce checkout flow (14 exported sub-components) |
582
785
  | src/lib/components/Card/ | Card with image/title/footer variants |
583
786
  | src/lib/components/Tree/ | Hierarchical tree with drag-and-drop |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "3.70.0",
3
+ "version": "3.71.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",