@su-labs/fields 21.1.0 → 21.2.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.
package/CHANGELOG.md CHANGED
@@ -5,9 +5,17 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [22.2.0] - 2026-11-20
9
+
10
+ ### Added
11
+
12
+ - `su-lib-email-field`: `floating`, a label that sits inside the field and moves up onto its border, smaller and in the accent colour, when the field is focused or filled
13
+ - `su-lib-email-field`: `showProblem`, to show what's wrong before the field was left, for example when its form is sent (use it with `novalidate` on the form, so the browser's own bubble doesn't show)
14
+
8
15
  ## [22.1.0] - 2026-11-14
9
16
 
10
17
  ### Added
18
+
11
19
  - `su-lib-email-field`: an email input that checks the address the way people mistype it, says what's wrong once the field is left, shows a tick when it looks right, and suggests a common domain for a likely typo (`gmial.com` → `gmail.com`) applied with one tap; `required`, your own `domains` and `messages`, `validityChange`. The check is exported as `suCheckEmail`
12
20
  - `su-lib-checkbox`: a real checkbox whose tick draws itself in, with a squash when pressed and a dash when partly checked; `[(checked)]`, `indeterminate`, `disabled`
13
21
  - `su-lib-chips`: toggle chips to pick several options or one (`multiple`), each popping a tick in when picked; typed `[(value)]`, disabled options
@@ -16,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
24
  ## [22.0.0] - 2026-11-11
17
25
 
18
26
  ### Added
27
+
19
28
  - `SuCodeBoxesComponent` (`su-lib-code-boxes`): a short code typed into boxes that fill one by one and turn green in a wave once complete; one real text field underneath, so pasting, phone keyboards and screen readers work
20
29
  - `SuStrengthMeterComponent` (`su-lib-strength-meter`): four bars under a new password that fill and change colour as it gets stronger, with its word per step; a `meter` for screen readers
21
30
  - `suPasswordStrength()` and `suStrengthLevel()`: the meter's rule, usable on its own
package/README.md CHANGED
@@ -108,12 +108,23 @@ a tick shows when the address looks right. For a likely typo in a common domain
108
108
  <su-lib-email-field label="Email" required [(value)]="email" (validityChange)="emailOk.set($event)" />
109
109
  ```
110
110
 
111
+ To show your own messages instead of the browser's bubble, turn the browser's check off and show the field's problem
112
+ when the form is sent:
113
+
114
+ ```html
115
+ <form novalidate (submit)="send()">
116
+ <su-lib-email-field label="Email" floating required [showProblem]="sent()" [(value)]="email" />
117
+ </form>
118
+ ```
119
+
111
120
  | Input / output | Default | Description |
112
121
  |---|---|---|
113
122
  | `value` | `''` | The address; `[(value)]` binds both ways |
114
123
  | `label` | — | The visible label |
115
124
  | `placeholder` | — | |
116
125
  | `required` | `false` | An empty field counts as a problem |
126
+ | `floating` | `false` | The label sits inside the field and moves up onto its border when focused or filled |
127
+ | `showProblem` | `false` | Shows the problem before the field was left, e.g. once its form is sent |
117
128
  | `domains` | common providers | Domains to suggest for a typo, e.g. your company's |
118
129
  | `messages` | English | `Partial<SuEmailMessages>`: the problem texts and "Did you mean" |
119
130
  | `validityChange` | — | Whether the address is valid, on every change |
@@ -290,6 +290,10 @@ class SuEmailFieldComponent {
290
290
  /** An empty field counts as a problem @default false */
291
291
  required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
292
292
  messages = input({}, ...(ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []));
293
+ /** The label sits inside the field and moves up onto its border when the field is focused or filled @default false */
294
+ floating = input(false, { ...(ngDevMode ? { debugName: "floating" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
295
+ /** Shows the problem before the field was left, e.g. when its form is sent @default false */
296
+ showProblem = input(false, { ...(ngDevMode ? { debugName: "showProblem" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
293
297
  /** Domains to suggest when one is mistyped */
294
298
  domains = input(SU_COMMON_EMAIL_DOMAINS, ...(ngDevMode ? [{ debugName: "domains" }] : /* istanbul ignore next */ []));
295
299
  /** Whether the address is valid, on every change */
@@ -298,10 +302,11 @@ class SuEmailFieldComponent {
298
302
  touched = signal(false, ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
299
303
  check = computed(() => suCheckEmail(this.value(), this.domains()), ...(ngDevMode ? [{ debugName: "check" }] : /* istanbul ignore next */ []));
300
304
  text = computed(() => ({ ...SU_EMAIL_MESSAGES, ...this.messages() }), ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
301
- /** The problem to show: only once the field was left, and an empty field only when it's required */
305
+ /** The problem to show: once the field was left or `showProblem` is on, and an empty field only when it's required */
302
306
  problem = computed(() => {
303
307
  const { problem } = this.check();
304
- if (!this.touched() || !problem || (problem === 'empty' && !this.required())) {
308
+ const isShown = this.touched() || this.showProblem();
309
+ if (!isShown || !problem || (problem === 'empty' && !this.required())) {
305
310
  return null;
306
311
  }
307
312
  return problem;
@@ -319,12 +324,12 @@ class SuEmailFieldComponent {
319
324
  this.touched.set(true);
320
325
  }
321
326
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuEmailFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
322
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.26", type: SuEmailFieldComponent, isStandalone: true, selector: "su-lib-email-field", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: false, transformFunction: null }, domains: { classPropertyName: "domains", publicName: "domains", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", validityChange: "validityChange" }, ngImport: i0, template: "@let result = check();\n@let t = text();\n<label class=\"su-email-label\" [for]=\"id\">{{ label() }}</label>\n<div class=\"su-email-box\" [class.is-valid]=\"result.valid\" [class.is-invalid]=\"problem() !== null\">\n <input\n class=\"su-email-input\"\n type=\"email\"\n inputmode=\"email\"\n autocomplete=\"email\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [id]=\"id\"\n [value]=\"value()\"\n [required]=\"required()\"\n [attr.placeholder]=\"placeholder() ?? null\"\n [attr.aria-invalid]=\"problem() !== null ? true : null\"\n [attr.aria-describedby]=\"id + '-message'\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n />\n <span class=\"su-email-tick\" aria-hidden=\"true\"></span>\n</div>\n<p class=\"su-email-message\" aria-live=\"polite\" [id]=\"id + '-message'\">\n @if (problem(); as problem) {\n <span class=\"su-email-problem\">{{ t[problem] }}</span>\n }\n @if (result.suggestion; as suggestion) {\n <span class=\"su-email-suggestion\">\n {{ t.suggestion }}\n <button type=\"button\" class=\"su-email-fix\" (click)=\"apply(suggestion)\">{{ suggestion }}</button>?\n </span>\n }\n</p>\n", styles: [":host{display:grid;gap:.375rem}.su-email-label{font-size:.875rem}.su-email-box{position:relative}.su-email-input{background:var(--su-field-surface, transparent);border:1px solid var(--su-field-border, rgba(127, 127, 127, .4));border-radius:.5rem;box-sizing:border-box;color:var(--su-field-text, currentColor);font:inherit;min-height:2.75rem;padding:.5rem 2.5rem .5rem .75rem;transition:border-color .2s ease,box-shadow .2s ease;width:100%}.su-email-input:focus-visible{border-color:var(--su-field-accent, #3b82f6);box-shadow:0 0 0 3px color-mix(in srgb,var(--su-field-accent, #3b82f6) 25%,transparent);outline:none}.is-valid .su-email-input{border-color:var(--su-field-success, #2e8b57)}.is-invalid .su-email-input{animation:su-email-nudge .26s ease;border-color:var(--su-field-danger, #c0392b)}.su-email-tick{background:var(--su-field-success, #2e8b57);height:1.1rem;-webkit-mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E\") center/contain no-repeat;mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E\") center/contain no-repeat;opacity:0;pointer-events:none;position:absolute;right:.75rem;scale:.3;top:50%;transition:opacity .15s ease,scale .25s cubic-bezier(.34,1.56,.64,1);translate:0 -50%;width:1.1rem}.is-valid .su-email-tick{opacity:1;scale:1}.su-email-message{display:grid;font-size:.8125rem;gap:.25rem;margin:0;min-height:1.25rem}.su-email-message:empty{min-height:0}.su-email-problem{color:var(--su-field-danger, #c0392b)}.su-email-suggestion{color:var(--su-field-text, currentColor)}.su-email-fix{background:none;border:0;border-radius:4px;color:var(--su-field-accent, #3b82f6);cursor:pointer;font:inherit;font-weight:600;padding:0;text-decoration:underline;text-underline-offset:2px}.su-email-fix:focus-visible{outline:2px solid var(--su-field-accent, #3b82f6);outline-offset:2px}@keyframes su-email-nudge{25%{translate:-3px 0}75%{translate:3px 0}}@media(prefers-reduced-motion:reduce){.is-invalid .su-email-input{animation:none}.su-email-tick{transition:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
327
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.26", type: SuEmailFieldComponent, isStandalone: true, selector: "su-lib-email-field", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: false, transformFunction: null }, floating: { classPropertyName: "floating", publicName: "floating", isSignal: true, isRequired: false, transformFunction: null }, showProblem: { classPropertyName: "showProblem", publicName: "showProblem", isSignal: true, isRequired: false, transformFunction: null }, domains: { classPropertyName: "domains", publicName: "domains", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", validityChange: "validityChange" }, host: { properties: { "class.is-floating": "floating()" } }, ngImport: i0, template: "@let result = check();\n@let t = text();\n@if (!floating()) {\n <label class=\"su-email-label\" [for]=\"id\">{{ label() }}</label>\n}\n<div class=\"su-email-box\" [class.is-valid]=\"result.valid\" [class.is-invalid]=\"problem() !== null\">\n <input\n class=\"su-email-input\"\n type=\"email\"\n inputmode=\"email\"\n autocomplete=\"email\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [id]=\"id\"\n [value]=\"value()\"\n [required]=\"required()\"\n [attr.placeholder]=\"floating() ? ' ' : (placeholder() ?? null)\"\n [attr.aria-invalid]=\"problem() !== null ? true : null\"\n [attr.aria-describedby]=\"id + '-message'\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n />\n @if (floating()) {\n <label class=\"su-email-label su-email-floating-label\" [for]=\"id\">{{ label() }}</label>\n }\n <span class=\"su-email-tick\" aria-hidden=\"true\"></span>\n</div>\n<p class=\"su-email-message\" aria-live=\"polite\" [id]=\"id + '-message'\">\n @if (problem(); as problem) {\n <span class=\"su-email-problem\">{{ t[problem] }}</span>\n }\n @if (result.suggestion; as suggestion) {\n <span class=\"su-email-suggestion\">\n {{ t.suggestion }}\n <button type=\"button\" class=\"su-email-fix\" (click)=\"apply(suggestion)\">{{ suggestion }}</button>?\n </span>\n }\n</p>\n", styles: [":host{display:grid;gap:.375rem}.su-email-label{font-size:.875rem}.su-email-box{position:relative}.su-email-input{background:var(--su-field-surface, transparent);border:1px solid var(--su-field-border, rgba(127, 127, 127, .4));border-radius:.5rem;box-sizing:border-box;color:var(--su-field-text, currentColor);font:inherit;min-height:2.75rem;padding:.5rem 2.5rem .5rem .75rem;transition:border-color .2s ease,box-shadow .2s ease;width:100%}.su-email-input:focus-visible{border-color:var(--su-field-accent, #3b82f6);box-shadow:0 0 0 3px color-mix(in srgb,var(--su-field-accent, #3b82f6) 25%,transparent);outline:none}.is-valid .su-email-input{border-color:var(--su-field-success, #2e8b57)}.is-invalid .su-email-input{animation:su-email-nudge .26s ease;border-color:var(--su-field-danger, #c0392b)}.su-email-tick{background:var(--su-field-success, #2e8b57);height:1.1rem;-webkit-mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E\") center/contain no-repeat;mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E\") center/contain no-repeat;opacity:0;pointer-events:none;position:absolute;right:.75rem;scale:.3;top:50%;transition:opacity .15s ease,scale .25s cubic-bezier(.34,1.56,.64,1);translate:0 -50%;width:1.1rem}.is-valid .su-email-tick{opacity:1;scale:1}.su-email-message{display:grid;font-size:.8125rem;gap:.25rem;margin:0;min-height:1.25rem}.su-email-message:empty{min-height:0}.su-email-problem{color:var(--su-field-danger, #c0392b)}.su-email-suggestion{color:var(--su-field-text, currentColor)}.su-email-fix{background:none;border:0;border-radius:4px;color:var(--su-field-accent, #3b82f6);cursor:pointer;font:inherit;font-weight:600;padding:0;text-decoration:underline;text-underline-offset:2px}.su-email-fix:focus-visible{outline:2px solid var(--su-field-accent, #3b82f6);outline-offset:2px}:host(.is-floating) .su-email-input{line-height:1.25rem;min-height:3.25rem;padding-block:1.375rem .375rem}.su-email-floating-label{color:var(--su-field-label, color-mix(in srgb, var(--su-field-text, currentColor) 60%, transparent));font-size:1rem;left:.75rem;line-height:1.25rem;pointer-events:none;position:absolute;top:1rem;transform-origin:left top;transition:translate .2s cubic-bezier(.22,1,.36,1),scale .2s cubic-bezier(.22,1,.36,1),color .2s ease}.su-email-box:focus-within .su-email-floating-label,.su-email-box:has(.su-email-input:not(:placeholder-shown)) .su-email-floating-label{scale:.75;translate:0 -.6875rem}.su-email-box:focus-within .su-email-floating-label{color:var(--su-field-accent, #3b82f6)}.is-invalid .su-email-floating-label{color:var(--su-field-danger, #c0392b)}@keyframes su-email-nudge{25%{translate:-3px 0}75%{translate:3px 0}}@media(prefers-reduced-motion:reduce){.is-invalid .su-email-input{animation:none}.su-email-tick,.su-email-floating-label{transition:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
323
328
  }
324
329
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuEmailFieldComponent, decorators: [{
325
330
  type: Component,
326
- args: [{ selector: 'su-lib-email-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "@let result = check();\n@let t = text();\n<label class=\"su-email-label\" [for]=\"id\">{{ label() }}</label>\n<div class=\"su-email-box\" [class.is-valid]=\"result.valid\" [class.is-invalid]=\"problem() !== null\">\n <input\n class=\"su-email-input\"\n type=\"email\"\n inputmode=\"email\"\n autocomplete=\"email\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [id]=\"id\"\n [value]=\"value()\"\n [required]=\"required()\"\n [attr.placeholder]=\"placeholder() ?? null\"\n [attr.aria-invalid]=\"problem() !== null ? true : null\"\n [attr.aria-describedby]=\"id + '-message'\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n />\n <span class=\"su-email-tick\" aria-hidden=\"true\"></span>\n</div>\n<p class=\"su-email-message\" aria-live=\"polite\" [id]=\"id + '-message'\">\n @if (problem(); as problem) {\n <span class=\"su-email-problem\">{{ t[problem] }}</span>\n }\n @if (result.suggestion; as suggestion) {\n <span class=\"su-email-suggestion\">\n {{ t.suggestion }}\n <button type=\"button\" class=\"su-email-fix\" (click)=\"apply(suggestion)\">{{ suggestion }}</button>?\n </span>\n }\n</p>\n", styles: [":host{display:grid;gap:.375rem}.su-email-label{font-size:.875rem}.su-email-box{position:relative}.su-email-input{background:var(--su-field-surface, transparent);border:1px solid var(--su-field-border, rgba(127, 127, 127, .4));border-radius:.5rem;box-sizing:border-box;color:var(--su-field-text, currentColor);font:inherit;min-height:2.75rem;padding:.5rem 2.5rem .5rem .75rem;transition:border-color .2s ease,box-shadow .2s ease;width:100%}.su-email-input:focus-visible{border-color:var(--su-field-accent, #3b82f6);box-shadow:0 0 0 3px color-mix(in srgb,var(--su-field-accent, #3b82f6) 25%,transparent);outline:none}.is-valid .su-email-input{border-color:var(--su-field-success, #2e8b57)}.is-invalid .su-email-input{animation:su-email-nudge .26s ease;border-color:var(--su-field-danger, #c0392b)}.su-email-tick{background:var(--su-field-success, #2e8b57);height:1.1rem;-webkit-mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E\") center/contain no-repeat;mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E\") center/contain no-repeat;opacity:0;pointer-events:none;position:absolute;right:.75rem;scale:.3;top:50%;transition:opacity .15s ease,scale .25s cubic-bezier(.34,1.56,.64,1);translate:0 -50%;width:1.1rem}.is-valid .su-email-tick{opacity:1;scale:1}.su-email-message{display:grid;font-size:.8125rem;gap:.25rem;margin:0;min-height:1.25rem}.su-email-message:empty{min-height:0}.su-email-problem{color:var(--su-field-danger, #c0392b)}.su-email-suggestion{color:var(--su-field-text, currentColor)}.su-email-fix{background:none;border:0;border-radius:4px;color:var(--su-field-accent, #3b82f6);cursor:pointer;font:inherit;font-weight:600;padding:0;text-decoration:underline;text-underline-offset:2px}.su-email-fix:focus-visible{outline:2px solid var(--su-field-accent, #3b82f6);outline-offset:2px}@keyframes su-email-nudge{25%{translate:-3px 0}75%{translate:3px 0}}@media(prefers-reduced-motion:reduce){.is-invalid .su-email-input{animation:none}.su-email-tick{transition:none}}\n"] }]
327
- }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], messages: [{ type: i0.Input, args: [{ isSignal: true, alias: "messages", required: false }] }], domains: [{ type: i0.Input, args: [{ isSignal: true, alias: "domains", required: false }] }], validityChange: [{ type: i0.Output, args: ["validityChange"] }] } });
331
+ args: [{ selector: 'su-lib-email-field', changeDetection: ChangeDetectionStrategy.OnPush, host: { '[class.is-floating]': 'floating()' }, template: "@let result = check();\n@let t = text();\n@if (!floating()) {\n <label class=\"su-email-label\" [for]=\"id\">{{ label() }}</label>\n}\n<div class=\"su-email-box\" [class.is-valid]=\"result.valid\" [class.is-invalid]=\"problem() !== null\">\n <input\n class=\"su-email-input\"\n type=\"email\"\n inputmode=\"email\"\n autocomplete=\"email\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [id]=\"id\"\n [value]=\"value()\"\n [required]=\"required()\"\n [attr.placeholder]=\"floating() ? ' ' : (placeholder() ?? null)\"\n [attr.aria-invalid]=\"problem() !== null ? true : null\"\n [attr.aria-describedby]=\"id + '-message'\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n />\n @if (floating()) {\n <label class=\"su-email-label su-email-floating-label\" [for]=\"id\">{{ label() }}</label>\n }\n <span class=\"su-email-tick\" aria-hidden=\"true\"></span>\n</div>\n<p class=\"su-email-message\" aria-live=\"polite\" [id]=\"id + '-message'\">\n @if (problem(); as problem) {\n <span class=\"su-email-problem\">{{ t[problem] }}</span>\n }\n @if (result.suggestion; as suggestion) {\n <span class=\"su-email-suggestion\">\n {{ t.suggestion }}\n <button type=\"button\" class=\"su-email-fix\" (click)=\"apply(suggestion)\">{{ suggestion }}</button>?\n </span>\n }\n</p>\n", styles: [":host{display:grid;gap:.375rem}.su-email-label{font-size:.875rem}.su-email-box{position:relative}.su-email-input{background:var(--su-field-surface, transparent);border:1px solid var(--su-field-border, rgba(127, 127, 127, .4));border-radius:.5rem;box-sizing:border-box;color:var(--su-field-text, currentColor);font:inherit;min-height:2.75rem;padding:.5rem 2.5rem .5rem .75rem;transition:border-color .2s ease,box-shadow .2s ease;width:100%}.su-email-input:focus-visible{border-color:var(--su-field-accent, #3b82f6);box-shadow:0 0 0 3px color-mix(in srgb,var(--su-field-accent, #3b82f6) 25%,transparent);outline:none}.is-valid .su-email-input{border-color:var(--su-field-success, #2e8b57)}.is-invalid .su-email-input{animation:su-email-nudge .26s ease;border-color:var(--su-field-danger, #c0392b)}.su-email-tick{background:var(--su-field-success, #2e8b57);height:1.1rem;-webkit-mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E\") center/contain no-repeat;mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E\") center/contain no-repeat;opacity:0;pointer-events:none;position:absolute;right:.75rem;scale:.3;top:50%;transition:opacity .15s ease,scale .25s cubic-bezier(.34,1.56,.64,1);translate:0 -50%;width:1.1rem}.is-valid .su-email-tick{opacity:1;scale:1}.su-email-message{display:grid;font-size:.8125rem;gap:.25rem;margin:0;min-height:1.25rem}.su-email-message:empty{min-height:0}.su-email-problem{color:var(--su-field-danger, #c0392b)}.su-email-suggestion{color:var(--su-field-text, currentColor)}.su-email-fix{background:none;border:0;border-radius:4px;color:var(--su-field-accent, #3b82f6);cursor:pointer;font:inherit;font-weight:600;padding:0;text-decoration:underline;text-underline-offset:2px}.su-email-fix:focus-visible{outline:2px solid var(--su-field-accent, #3b82f6);outline-offset:2px}:host(.is-floating) .su-email-input{line-height:1.25rem;min-height:3.25rem;padding-block:1.375rem .375rem}.su-email-floating-label{color:var(--su-field-label, color-mix(in srgb, var(--su-field-text, currentColor) 60%, transparent));font-size:1rem;left:.75rem;line-height:1.25rem;pointer-events:none;position:absolute;top:1rem;transform-origin:left top;transition:translate .2s cubic-bezier(.22,1,.36,1),scale .2s cubic-bezier(.22,1,.36,1),color .2s ease}.su-email-box:focus-within .su-email-floating-label,.su-email-box:has(.su-email-input:not(:placeholder-shown)) .su-email-floating-label{scale:.75;translate:0 -.6875rem}.su-email-box:focus-within .su-email-floating-label{color:var(--su-field-accent, #3b82f6)}.is-invalid .su-email-floating-label{color:var(--su-field-danger, #c0392b)}@keyframes su-email-nudge{25%{translate:-3px 0}75%{translate:3px 0}}@media(prefers-reduced-motion:reduce){.is-invalid .su-email-input{animation:none}.su-email-tick,.su-email-floating-label{transition:none}}\n"] }]
332
+ }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], messages: [{ type: i0.Input, args: [{ isSignal: true, alias: "messages", required: false }] }], floating: [{ type: i0.Input, args: [{ isSignal: true, alias: "floating", required: false }] }], showProblem: [{ type: i0.Input, args: [{ isSignal: true, alias: "showProblem", required: false }] }], domains: [{ type: i0.Input, args: [{ isSignal: true, alias: "domains", required: false }] }], validityChange: [{ type: i0.Output, args: ["validityChange"] }] } });
328
333
 
329
334
  /**
330
335
  * A real checkbox whose tick draws itself in, with a small squash when pressed and a dash when partly checked. Put the
@@ -1 +1 @@
1
- {"version":3,"file":"su-labs-fields.mjs","sources":["../../../../compat/angular-21/build/fields/src/lib/code-boxes/code-boxes.component.ts","../../../../compat/angular-21/build/fields/src/lib/code-boxes/code-boxes.component.html","../../../../compat/angular-21/build/fields/src/lib/strength-meter/password-strength.ts","../../../../compat/angular-21/build/fields/src/lib/strength-meter/strength-meter.component.ts","../../../../compat/angular-21/build/fields/src/lib/strength-meter/strength-meter.component.html","../../../../compat/angular-21/build/fields/src/lib/auto-grow/auto-grow.directive.ts","../../../../compat/angular-21/build/fields/src/lib/switch/switch.component.ts","../../../../compat/angular-21/build/fields/src/lib/switch/switch.component.html","../../../../compat/angular-21/build/fields/src/lib/email-field/email-check.ts","../../../../compat/angular-21/build/fields/src/lib/email-field/email-field.component.ts","../../../../compat/angular-21/build/fields/src/lib/email-field/email-field.component.html","../../../../compat/angular-21/build/fields/src/lib/checkbox/checkbox.component.ts","../../../../compat/angular-21/build/fields/src/lib/checkbox/checkbox.component.html","../../../../compat/angular-21/build/fields/src/lib/chips/chips.component.ts","../../../../compat/angular-21/build/fields/src/lib/chips/chips.component.html","../../../../compat/angular-21/build/fields/src/su-labs-fields.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input, model } from '@angular/core';\n\n/**\n * A short code typed into a row of boxes that fill one by one, then turn green in a wave once the code is complete.\n * One real text field lies over the boxes, so typing, pasting, the phone keyboard and screen readers all work as usual.\n */\n@Component({\n selector: 'su-lib-code-boxes',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './code-boxes.component.html',\n styleUrl: './code-boxes.component.scss',\n})\nexport class SuCodeBoxesComponent {\n readonly value = model('');\n readonly length = input.required<number>();\n readonly label = input.required<string>();\n /** The code is whole and well-formed: the boxes turn green */\n readonly complete = input(false);\n\n protected readonly boxes = computed(() =>\n Array.from({ length: this.length() }, (_, index) => index)\n );\n\n /** Capitals without spaces, never longer than the boxes */\n protected onInput(field: HTMLInputElement): void {\n const code = field.value\n .replace(/\\s/g, '')\n .toUpperCase()\n .slice(0, this.length());\n field.value = code;\n this.value.set(code);\n }\n}\n","<input\n #field\n class=\"field\"\n type=\"text\"\n inputmode=\"text\"\n autocomplete=\"off\"\n autocapitalize=\"characters\"\n spellcheck=\"false\"\n required\n [attr.maxlength]=\"length()\"\n [attr.aria-label]=\"label()\"\n [value]=\"value()\"\n (input)=\"onInput(field)\"\n/>\n<span class=\"boxes\" [class.is-complete]=\"complete()\" aria-hidden=\"true\">\n @for (index of boxes(); track index) {\n <span\n class=\"box\"\n [class.is-filled]=\"index < value().length\"\n [class.is-current]=\"index === value().length\"\n [style.--index]=\"index\"\n >{{ value()[index] }}</span\n >\n }\n</span>\n","/** How strong a new password looks, one step per bar of the meter */\nexport const SU_STRENGTH_LEVELS = ['weak', 'fair', 'good', 'strong'] as const;\nexport type SuStrengthLevel = (typeof SU_STRENGTH_LEVELS)[number];\n\n/** Shortest password the meter counts as more than weak, unless told otherwise */\nexport const SU_DEFAULT_MIN_PASSWORD_LENGTH = 8;\n\n/**\n * Bars of the strength meter a password fills, from 0 (empty) to 4. Under the minimum length it stays at one bar,\n * whatever else it has. Then one bar each for: four characters past the minimum, letters with digits, and symbols or\n * mixed case.\n */\nexport function suPasswordStrength(\n password: string,\n minLength = SU_DEFAULT_MIN_PASSWORD_LENGTH\n): number {\n if (password.length === 0) {\n return 0;\n }\n if (password.length < minLength) {\n return 1;\n }\n const extras = [\n password.length >= minLength + 4,\n /\\p{L}/u.test(password) && /\\d/.test(password),\n /[^\\p{L}\\d]/u.test(password) ||\n (/\\p{Lu}/u.test(password) && /\\p{Ll}/u.test(password)),\n ].filter(Boolean).length;\n return 1 + extras;\n}\n\n/** The meter's word for a number of bars, or null for an empty password */\nexport const suStrengthLevel = (bars: number): SuStrengthLevel | null =>\n SU_STRENGTH_LEVELS[bars - 1] ?? null;\n","import { ChangeDetectionStrategy, Component, computed, effect, input, signal } from '@angular/core';\nimport { SU_DEFAULT_MIN_PASSWORD_LENGTH, SU_STRENGTH_LEVELS, suPasswordStrength, SuStrengthLevel, suStrengthLevel } from './password-strength';\n\n/**\n * Four bars under a new password that fill, and change colour, as the password gets stronger. It follows the field's\n * own typing, so forms keep their plain fields; a form that empties the field by code sends it an `input` event.\n * Its texts come in as inputs, so it fits any language.\n */\n@Component({\n selector: 'su-lib-strength-meter',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './strength-meter.component.html',\n styleUrl: './strength-meter.component.scss',\n})\nexport class SuStrengthMeterComponent {\n readonly field = input.required<HTMLInputElement>();\n /** The meter's name for screen readers, e.g. \"Password strength\" */\n readonly label = input.required<string>();\n /** The word shown for each step */\n readonly levelNames =\n input.required<Readonly<Record<SuStrengthLevel, string>>>();\n readonly minLength = input(SU_DEFAULT_MIN_PASSWORD_LENGTH);\n\n private readonly password = signal('');\n protected readonly steps = SU_STRENGTH_LEVELS;\n protected readonly bars = computed(() =>\n suPasswordStrength(this.password(), this.minLength())\n );\n protected readonly level = computed(() => suStrengthLevel(this.bars()));\n protected readonly levelName = computed(() => {\n const level = this.level();\n return level ? this.levelNames()[level] : null;\n });\n\n constructor() {\n effect(onCleanup => {\n const field = this.field();\n const read = () => this.password.set(field.value);\n read();\n field.addEventListener('input', read);\n onCleanup(() => field.removeEventListener('input', read));\n });\n }\n}\n","<div\n class=\"bars\"\n role=\"meter\"\n [attr.aria-label]=\"label()\"\n aria-valuemin=\"0\"\n [attr.aria-valuemax]=\"steps.length\"\n [attr.aria-valuenow]=\"bars()\"\n [attr.aria-valuetext]=\"levelName()\"\n>\n @for (step of steps; track step; let index = $index) {\n <span class=\"bar\" [class.is-filled]=\"index < bars()\" [style.--index]=\"index\"></span>\n }\n</div>\n@if (levelName(); as name) {\n <small class=\"level\" [attr.data-level]=\"level()\" aria-hidden=\"true\">{{ name }}</small>\n}\n","import { afterNextRender, booleanAttribute, DestroyRef, Directive, ElementRef, inject, input } from '@angular/core';\n\n/** A soft spring that overshoots a little, as the box settles on its new height */\nconst SPRING = 'height 240ms cubic-bezier(0.34, 1.56, 0.64, 1)';\n\n/**\n * A text box that grows a line at a time as the text gets longer, and shrinks back when it is emptied, with a soft\n * spring (none for visitors who asked their device for less motion). `[suAutoGrow]=\"false\"` leaves it as it is.\n */\n@Directive({\n selector: 'textarea[suAutoGrow]',\n host: { '(input)': 'fit()' },\n})\nexport class SuAutoGrowDirective {\n readonly isOn = input(true, { alias: 'suAutoGrow', transform: booleanAttribute });\n\n private readonly box: HTMLTextAreaElement = inject(ElementRef).nativeElement;\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n afterNextRender(() => {\n const onReset = () => setTimeout(() => this.fit());\n this.box.form?.addEventListener('reset', onReset);\n destroyRef.onDestroy(() =>\n this.box.form?.removeEventListener('reset', onReset)\n );\n });\n }\n\n protected fit(): void {\n if (!this.isOn()) {\n return;\n }\n const box = this.box;\n const from = box.offsetHeight;\n box.style.transition = 'none';\n box.style.height = 'auto';\n const to = box.scrollHeight + box.offsetHeight - box.clientHeight;\n box.style.height = `${from}px`;\n void box.offsetHeight;\n box.style.overflowY = 'hidden';\n box.style.transition = matchMedia('(prefers-reduced-motion: reduce)')\n .matches\n ? 'none'\n : SPRING;\n box.style.height = `${to}px`;\n }\n}\n","import { booleanAttribute, ChangeDetectionStrategy, Component, effect, input, linkedSignal, output, untracked } from '@angular/core';\n\n/** Where the label sits: after the switch, or before it with the switch at the end of the row */\nexport type SuSwitchLabelPosition = 'start' | 'end';\n\nexport type SuSwitchSize = 'small' | 'medium';\n\n/**\n * A real checkbox (`role=\"switch\"`) drawn as a sliding switch: the knob stretches while pressed, springs across and a\n * tick pops in when it's on. Put the label inside: `<su-lib-switch [(checked)]=\"on\">Reduce motion</su-lib-switch>`.\n *\n * It shows a click at once and follows `checked` whenever it changes. While `busy` (e.g. saving the change) it ignores\n * clicks, and once no longer busy it shows `checked` again, so a change that failed to save flips back.\n */\n@Component({\n selector: 'su-lib-switch',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './switch.component.html',\n styleUrl: './switch.component.scss',\n})\nexport class SuSwitchComponent {\n readonly checked = input(false, { transform: booleanAttribute });\n readonly disabled = input(false, { transform: booleanAttribute });\n /** Busy saving the change: clicks are ignored, and `aria-busy` is set */\n readonly busy = input(false, { transform: booleanAttribute });\n /** @default 'end' */\n readonly labelPosition = input<SuSwitchLabelPosition>('end');\n /** @default 'medium' */\n readonly size = input<SuSwitchSize>('medium');\n /** Switched by the user: the new value */\n readonly checkedChange = output<boolean>();\n\n protected readonly shown = linkedSignal(() => this.checked());\n\n constructor() {\n effect(() => {\n if (!this.busy()) {\n untracked(() => this.shown.set(this.checked()));\n }\n });\n }\n\n protected onClick(event: MouseEvent): void {\n if (this.busy()) {\n event.preventDefault();\n }\n }\n\n protected onChange(event: Event): void {\n if (event.target instanceof HTMLInputElement) {\n this.shown.set(event.target.checked);\n this.checkedChange.emit(event.target.checked);\n }\n }\n}\n","<label class=\"su-switch su-switch-{{ size() }}\" [class.is-label-start]=\"labelPosition() === 'start'\">\n <input\n type=\"checkbox\"\n role=\"switch\"\n [checked]=\"shown()\"\n [disabled]=\"disabled()\"\n [attr.aria-busy]=\"busy() ? true : null\"\n (click)=\"onClick($event)\"\n (change)=\"onChange($event)\"\n />\n <span class=\"su-switch-track\" aria-hidden=\"true\"></span>\n <span class=\"su-switch-label\"><ng-content /></span>\n</label>\n","/** What's wrong with an email address, in the order it's checked */\nexport type SuEmailProblem = 'empty' | 'spaces' | 'at' | 'name' | 'domain' | 'dot' | 'ending';\n\n/** The outcome of `suCheckEmail` */\nexport interface SuEmailCheck {\n readonly valid: boolean;\n readonly problem: SuEmailProblem | null;\n /** The address with a common domain in place of a likely typo, e.g. `jo@gmail.com` for `jo@gmial.com`, or null */\n readonly suggestion: string | null;\n}\n\n/** Domains `suCheckEmail` suggests when one is mistyped */\nexport const SU_COMMON_EMAIL_DOMAINS: readonly string[] = [\n 'gmail.com',\n 'hotmail.com',\n 'outlook.com',\n 'live.com',\n 'yahoo.com',\n 'icloud.com',\n 'me.com',\n 'aol.com',\n 'proton.me',\n 'protonmail.com',\n 'gmx.com',\n 'yandex.com',\n 'hotmail.es',\n 'yahoo.es',\n];\n\n/** How far a typed domain may be from a common one, in single-letter edits, to suggest it */\nconst MAX_TYPO_DISTANCE = 2;\n\nfunction editDistance(a: string, b: string): number {\n let previous = Array.from({ length: b.length + 1 }, (_, index) => index);\n for (let i = 1; i <= a.length; i++) {\n const current = [i];\n for (let j = 1; j <= b.length; j++) {\n current[j] = Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));\n }\n previous = current;\n }\n return previous[b.length];\n}\n\n/** The common domain a typed one most likely meant, or null when it's already common or nothing is close */\nfunction closestDomain(domain: string, domains: readonly string[]): string | null {\n if (!domain || domains.includes(domain)) {\n return null;\n }\n let best: { readonly domain: string; readonly distance: number } | null = null;\n for (const candidate of domains) {\n const distance = editDistance(domain, candidate);\n if (distance <= MAX_TYPO_DISTANCE && (!best || distance < best.distance)) {\n best = { domain: candidate, distance };\n }\n }\n return best?.domain ?? null;\n}\n\nfunction problemOf(email: string): SuEmailProblem | null {\n if (email === '') {\n return 'empty';\n }\n if (/\\s/.test(email)) {\n return 'spaces';\n }\n const parts = email.split('@');\n if (parts.length !== 2) {\n return 'at';\n }\n const [name, domain] = parts;\n if (!name) {\n return 'name';\n }\n if (!domain) {\n return 'domain';\n }\n const labels = domain.split('.');\n if (labels.length < 2 || labels.some((label) => label === '')) {\n return 'dot';\n }\n return /^\\p{L}{2,}$/u.test(labels[labels.length - 1]) ? null : 'ending';\n}\n\n/**\n * Checks an email address the way people mistype them: empty, spaces, not exactly one @, nothing before or after it,\n * a domain without a proper dot, or an ending shorter than two letters. It also suggests a common domain for a\n * likely typo (`gmial.com` → `gmail.com`), even when the address is otherwise valid.\n */\nexport function suCheckEmail(value: string, domains: readonly string[] = SU_COMMON_EMAIL_DOMAINS): SuEmailCheck {\n const email = value.trim();\n const problem = problemOf(email);\n const [name = '', domain = ''] = email.split('@');\n const fixable = problem === null || problem === 'dot' || problem === 'ending';\n const fix = fixable && name ? closestDomain(domain.toLowerCase(), domains) : null;\n return { valid: problem === null, problem, suggestion: fix ? `${name}@${fix}` : null };\n}\n","import { booleanAttribute, ChangeDetectionStrategy, Component, computed, effect, input, model, output, signal } from '@angular/core';\nimport { SU_COMMON_EMAIL_DOMAINS, suCheckEmail, SuEmailProblem } from './email-check';\n\n/** The field's texts, e.g. in the page's language */\nexport interface SuEmailMessages extends Readonly<Record<SuEmailProblem, string>> {\n /** Before a suggested address: \"Did you mean jo@gmail.com?\" */\n readonly suggestion: string;\n}\n\nexport const SU_EMAIL_MESSAGES: SuEmailMessages = {\n empty: 'Enter your email address',\n spaces: 'An email address has no spaces',\n at: 'An email address has one @, like name@example.com',\n name: 'Add the part before the @',\n domain: 'Add the part after the @, like example.com',\n dot: 'The part after the @ needs a dot, like example.com',\n ending: 'The ending after the last dot needs at least two letters',\n suggestion: 'Did you mean',\n};\n\nlet nextId = 0;\n\n/**\n * An email field that checks the address the way people mistype it, and suggests a common domain for a likely typo\n * (`gmial.com` → `gmail.com`, applied with one tap). It stays quiet while typing and says what's wrong once the field\n * is left; a tick shows when the address looks right.\n */\n@Component({\n selector: 'su-lib-email-field',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './email-field.component.html',\n styleUrl: './email-field.component.scss',\n})\nexport class SuEmailFieldComponent {\n readonly value = model('');\n /** The visible label */\n readonly label = input.required<string>();\n readonly placeholder = input<string>();\n /** An empty field counts as a problem @default false */\n readonly required = input(false, { transform: booleanAttribute });\n readonly messages = input<Partial<SuEmailMessages>>({});\n /** Domains to suggest when one is mistyped */\n readonly domains = input<readonly string[]>(SU_COMMON_EMAIL_DOMAINS);\n /** Whether the address is valid, on every change */\n readonly validityChange = output<boolean>();\n\n protected readonly id = `su-email-${nextId++}`;\n protected readonly touched = signal(false);\n protected readonly check = computed(() => suCheckEmail(this.value(), this.domains()));\n protected readonly text = computed<SuEmailMessages>(() => ({ ...SU_EMAIL_MESSAGES, ...this.messages() }));\n /** The problem to show: only once the field was left, and an empty field only when it's required */\n protected readonly problem = computed(() => {\n const { problem } = this.check();\n if (!this.touched() || !problem || (problem === 'empty' && !this.required())) {\n return null;\n }\n return problem;\n });\n\n constructor() {\n effect(() => this.validityChange.emit(this.check().valid));\n }\n\n protected onInput(event: Event): void {\n if (event.target instanceof HTMLInputElement) {\n this.value.set(event.target.value);\n }\n }\n\n protected apply(suggestion: string): void {\n this.value.set(suggestion);\n this.touched.set(true);\n }\n}\n","@let result = check();\n@let t = text();\n<label class=\"su-email-label\" [for]=\"id\">{{ label() }}</label>\n<div class=\"su-email-box\" [class.is-valid]=\"result.valid\" [class.is-invalid]=\"problem() !== null\">\n <input\n class=\"su-email-input\"\n type=\"email\"\n inputmode=\"email\"\n autocomplete=\"email\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [id]=\"id\"\n [value]=\"value()\"\n [required]=\"required()\"\n [attr.placeholder]=\"placeholder() ?? null\"\n [attr.aria-invalid]=\"problem() !== null ? true : null\"\n [attr.aria-describedby]=\"id + '-message'\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n />\n <span class=\"su-email-tick\" aria-hidden=\"true\"></span>\n</div>\n<p class=\"su-email-message\" aria-live=\"polite\" [id]=\"id + '-message'\">\n @if (problem(); as problem) {\n <span class=\"su-email-problem\">{{ t[problem] }}</span>\n }\n @if (result.suggestion; as suggestion) {\n <span class=\"su-email-suggestion\">\n {{ t.suggestion }}\n <button type=\"button\" class=\"su-email-fix\" (click)=\"apply(suggestion)\">{{ suggestion }}</button>?\n </span>\n }\n</p>\n","import { booleanAttribute, ChangeDetectionStrategy, Component, input, linkedSignal, output } from '@angular/core';\n\n/**\n * A real checkbox whose tick draws itself in, with a small squash when pressed and a dash when partly checked. Put the\n * label inside: `<su-lib-checkbox [(checked)]=\"agree\">I agree</su-lib-checkbox>`.\n */\n@Component({\n selector: 'su-lib-checkbox',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './checkbox.component.html',\n styleUrl: './checkbox.component.scss',\n})\nexport class SuCheckboxComponent {\n readonly checked = input(false, { transform: booleanAttribute });\n /** Partly checked, e.g. some of a group; a click checks it */\n readonly indeterminate = input(false, { transform: booleanAttribute });\n readonly disabled = input(false, { transform: booleanAttribute });\n /** Ticked or unticked by the user: the new value */\n readonly checkedChange = output<boolean>();\n\n protected readonly shown = linkedSignal(() => this.checked());\n\n protected onChange(event: Event): void {\n if (event.target instanceof HTMLInputElement) {\n this.shown.set(event.target.checked);\n this.checkedChange.emit(event.target.checked);\n }\n }\n}\n","<label class=\"su-checkbox\" [class.is-mixed]=\"indeterminate() && !shown()\">\n <input\n type=\"checkbox\"\n [checked]=\"shown()\"\n [indeterminate]=\"indeterminate() && !shown()\"\n [disabled]=\"disabled()\"\n (change)=\"onChange($event)\"\n />\n <span class=\"su-checkbox-box\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 24 24\">\n <path class=\"su-checkbox-tick\" d=\"M5 12.5l4.5 4.5L19 7.5\" />\n <path class=\"su-checkbox-dash\" d=\"M6 12h12\" />\n </svg>\n </span>\n <span class=\"su-checkbox-label\"><ng-content /></span>\n</label>\n","import { booleanAttribute, ChangeDetectionStrategy, Component, input, model } from '@angular/core';\n\n/** One chip: the value it stands for and its text */\nexport interface SuChipOption<TValue extends string> {\n readonly value: TValue;\n readonly label: string;\n readonly disabled?: boolean;\n}\n\n/**\n * Toggle chips to pick several options (or one, with `multiple` off): each is a button that pops a tick in when\n * picked. `<su-lib-chips label=\"Categories\" [options]=\"categories\" [(value)]=\"picked\" />`\n */\n@Component({\n selector: 'su-lib-chips',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './chips.component.html',\n styleUrl: './chips.component.scss',\n})\nexport class SuChipsComponent<TValue extends string> {\n readonly options = input.required<readonly SuChipOption<TValue>[]>();\n /** The picked values, in the options' order */\n readonly value = model<readonly TValue[]>([]);\n /** The group's name for screen readers */\n readonly label = input.required<string>();\n /** Several can be picked; off, picking one replaces the other @default true */\n readonly multiple = input(true, { transform: booleanAttribute });\n\n protected isPicked(value: TValue): boolean {\n return this.value().includes(value);\n }\n\n protected toggle(option: SuChipOption<TValue>): void {\n if (!this.multiple()) {\n this.value.set([option.value]);\n return;\n }\n const picked = this.isPicked(option.value)\n ? this.value().filter((value) => value !== option.value)\n : [...this.value(), option.value];\n this.value.set(this.options().map((item) => item.value).filter((value) => picked.includes(value)));\n }\n}\n","<div class=\"su-chips\" role=\"group\" [attr.aria-label]=\"label()\">\n @for (option of options(); track option.value) {\n <button\n type=\"button\"\n class=\"su-chip\"\n [attr.aria-pressed]=\"isPicked(option.value)\"\n [disabled]=\"option.disabled ?? false\"\n (click)=\"toggle(option)\"\n >\n <span class=\"su-chip-tick\" aria-hidden=\"true\"></span>\n {{ option.label }}\n </button>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAEA;;;AAGG;MAOU,oBAAoB,CAAA;AACtB,IAAA,KAAK,GAAG,KAAK,CAAC,EAAE,4EAAC;AACjB,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,4EAAU;AACjC,IAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,2EAAU;;AAEhC,IAAA,QAAQ,GAAG,KAAK,CAAC,KAAK,+EAAC;AAEb,IAAA,KAAK,GAAG,QAAQ,CAAC,MAClC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAA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CAAC,MAAM,CAAC,KAAK;AACvC,cAAE,IAAI,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,KAAK,MAAM,CAAC,KAAK;AACvD,cAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC;AACnC,QAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACpG;wGAtBW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAhB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,gBAAgB,omBCnB7B,+bAcA,EAAA,MAAA,EAAA,CAAA,4uDAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FDKa,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAN5B,SAAS;+BACE,cAAc,EAAA,eAAA,EACP,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,+bAAA,EAAA,MAAA,EAAA,CAAA,4uDAAA,CAAA,EAAA;;;AEfjD;;AAEG;;"}
1
+ {"version":3,"file":"su-labs-fields.mjs","sources":["../../../../compat/angular-21/build/fields/src/lib/code-boxes/code-boxes.component.ts","../../../../compat/angular-21/build/fields/src/lib/code-boxes/code-boxes.component.html","../../../../compat/angular-21/build/fields/src/lib/strength-meter/password-strength.ts","../../../../compat/angular-21/build/fields/src/lib/strength-meter/strength-meter.component.ts","../../../../compat/angular-21/build/fields/src/lib/strength-meter/strength-meter.component.html","../../../../compat/angular-21/build/fields/src/lib/auto-grow/auto-grow.directive.ts","../../../../compat/angular-21/build/fields/src/lib/switch/switch.component.ts","../../../../compat/angular-21/build/fields/src/lib/switch/switch.component.html","../../../../compat/angular-21/build/fields/src/lib/email-field/email-check.ts","../../../../compat/angular-21/build/fields/src/lib/email-field/email-field.component.ts","../../../../compat/angular-21/build/fields/src/lib/email-field/email-field.component.html","../../../../compat/angular-21/build/fields/src/lib/checkbox/checkbox.component.ts","../../../../compat/angular-21/build/fields/src/lib/checkbox/checkbox.component.html","../../../../compat/angular-21/build/fields/src/lib/chips/chips.component.ts","../../../../compat/angular-21/build/fields/src/lib/chips/chips.component.html","../../../../compat/angular-21/build/fields/src/su-labs-fields.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input, model } from '@angular/core';\n\n/**\n * A short code typed into a row of boxes that fill one by one, then turn green in a wave once the code is complete.\n * One real text field lies over the boxes, so typing, pasting, the phone keyboard and screen readers all work as usual.\n */\n@Component({\n selector: 'su-lib-code-boxes',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './code-boxes.component.html',\n styleUrl: './code-boxes.component.scss',\n})\nexport class SuCodeBoxesComponent {\n readonly value = model('');\n readonly length = input.required<number>();\n readonly label = input.required<string>();\n /** The code is whole and well-formed: the boxes turn green */\n readonly complete = input(false);\n\n protected readonly boxes = computed(() =>\n Array.from({ length: this.length() }, (_, index) => index)\n );\n\n /** Capitals without spaces, never longer than the boxes */\n protected onInput(field: HTMLInputElement): void {\n const code = field.value\n .replace(/\\s/g, '')\n .toUpperCase()\n .slice(0, this.length());\n field.value = code;\n this.value.set(code);\n }\n}\n","<input\n #field\n class=\"field\"\n type=\"text\"\n inputmode=\"text\"\n autocomplete=\"off\"\n autocapitalize=\"characters\"\n spellcheck=\"false\"\n required\n [attr.maxlength]=\"length()\"\n [attr.aria-label]=\"label()\"\n [value]=\"value()\"\n (input)=\"onInput(field)\"\n/>\n<span class=\"boxes\" [class.is-complete]=\"complete()\" aria-hidden=\"true\">\n @for (index of boxes(); track index) {\n <span\n class=\"box\"\n [class.is-filled]=\"index < value().length\"\n [class.is-current]=\"index === value().length\"\n [style.--index]=\"index\"\n >{{ value()[index] }}</span\n >\n }\n</span>\n","/** How strong a new password looks, one step per bar of the meter */\nexport const SU_STRENGTH_LEVELS = ['weak', 'fair', 'good', 'strong'] as const;\nexport type SuStrengthLevel = (typeof SU_STRENGTH_LEVELS)[number];\n\n/** Shortest password the meter counts as more than weak, unless told otherwise */\nexport const SU_DEFAULT_MIN_PASSWORD_LENGTH = 8;\n\n/**\n * Bars of the strength meter a password fills, from 0 (empty) to 4. Under the minimum length it stays at one bar,\n * whatever else it has. Then one bar each for: four characters past the minimum, letters with digits, and symbols or\n * mixed case.\n */\nexport function suPasswordStrength(\n password: string,\n minLength = SU_DEFAULT_MIN_PASSWORD_LENGTH\n): number {\n if (password.length === 0) {\n return 0;\n }\n if (password.length < minLength) {\n return 1;\n }\n const extras = [\n password.length >= minLength + 4,\n /\\p{L}/u.test(password) && /\\d/.test(password),\n /[^\\p{L}\\d]/u.test(password) ||\n (/\\p{Lu}/u.test(password) && /\\p{Ll}/u.test(password)),\n ].filter(Boolean).length;\n return 1 + extras;\n}\n\n/** The meter's word for a number of bars, or null for an empty password */\nexport const suStrengthLevel = (bars: number): SuStrengthLevel | null =>\n SU_STRENGTH_LEVELS[bars - 1] ?? null;\n","import { ChangeDetectionStrategy, Component, computed, effect, input, signal } from '@angular/core';\nimport { SU_DEFAULT_MIN_PASSWORD_LENGTH, SU_STRENGTH_LEVELS, suPasswordStrength, SuStrengthLevel, suStrengthLevel } from './password-strength';\n\n/**\n * Four bars under a new password that fill, and change colour, as the password gets stronger. It follows the field's\n * own typing, so forms keep their plain fields; a form that empties the field by code sends it an `input` event.\n * Its texts come in as inputs, so it fits any language.\n */\n@Component({\n selector: 'su-lib-strength-meter',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './strength-meter.component.html',\n styleUrl: './strength-meter.component.scss',\n})\nexport class SuStrengthMeterComponent {\n readonly field = input.required<HTMLInputElement>();\n /** The meter's name for screen readers, e.g. \"Password strength\" */\n readonly label = input.required<string>();\n /** The word shown for each step */\n readonly levelNames =\n input.required<Readonly<Record<SuStrengthLevel, string>>>();\n readonly minLength = input(SU_DEFAULT_MIN_PASSWORD_LENGTH);\n\n private readonly password = signal('');\n protected readonly steps = SU_STRENGTH_LEVELS;\n protected readonly bars = computed(() =>\n suPasswordStrength(this.password(), this.minLength())\n );\n protected readonly level = computed(() => suStrengthLevel(this.bars()));\n protected readonly levelName = computed(() => {\n const level = this.level();\n return level ? this.levelNames()[level] : null;\n });\n\n constructor() {\n effect(onCleanup => {\n const field = this.field();\n const read = () => this.password.set(field.value);\n read();\n field.addEventListener('input', read);\n onCleanup(() => field.removeEventListener('input', read));\n });\n }\n}\n","<div\n class=\"bars\"\n role=\"meter\"\n [attr.aria-label]=\"label()\"\n aria-valuemin=\"0\"\n [attr.aria-valuemax]=\"steps.length\"\n [attr.aria-valuenow]=\"bars()\"\n [attr.aria-valuetext]=\"levelName()\"\n>\n @for (step of steps; track step; let index = $index) {\n <span class=\"bar\" [class.is-filled]=\"index < bars()\" [style.--index]=\"index\"></span>\n }\n</div>\n@if (levelName(); as name) {\n <small class=\"level\" [attr.data-level]=\"level()\" aria-hidden=\"true\">{{ name }}</small>\n}\n","import { afterNextRender, booleanAttribute, DestroyRef, Directive, ElementRef, inject, input } from '@angular/core';\n\n/** A soft spring that overshoots a little, as the box settles on its new height */\nconst SPRING = 'height 240ms cubic-bezier(0.34, 1.56, 0.64, 1)';\n\n/**\n * A text box that grows a line at a time as the text gets longer, and shrinks back when it is emptied, with a soft\n * spring (none for visitors who asked their device for less motion). `[suAutoGrow]=\"false\"` leaves it as it is.\n */\n@Directive({\n selector: 'textarea[suAutoGrow]',\n host: { '(input)': 'fit()' },\n})\nexport class SuAutoGrowDirective {\n readonly isOn = input(true, { alias: 'suAutoGrow', transform: booleanAttribute });\n\n private readonly box: HTMLTextAreaElement = inject(ElementRef).nativeElement;\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n afterNextRender(() => {\n const onReset = () => setTimeout(() => this.fit());\n this.box.form?.addEventListener('reset', onReset);\n destroyRef.onDestroy(() =>\n this.box.form?.removeEventListener('reset', onReset)\n );\n });\n }\n\n protected fit(): void {\n if (!this.isOn()) {\n return;\n }\n const box = this.box;\n const from = box.offsetHeight;\n box.style.transition = 'none';\n box.style.height = 'auto';\n const to = box.scrollHeight + box.offsetHeight - box.clientHeight;\n box.style.height = `${from}px`;\n void box.offsetHeight;\n box.style.overflowY = 'hidden';\n box.style.transition = matchMedia('(prefers-reduced-motion: reduce)')\n .matches\n ? 'none'\n : SPRING;\n box.style.height = `${to}px`;\n }\n}\n","import { booleanAttribute, ChangeDetectionStrategy, Component, effect, input, linkedSignal, output, untracked } from '@angular/core';\n\n/** Where the label sits: after the switch, or before it with the switch at the end of the row */\nexport type SuSwitchLabelPosition = 'start' | 'end';\n\nexport type SuSwitchSize = 'small' | 'medium';\n\n/**\n * A real checkbox (`role=\"switch\"`) drawn as a sliding switch: the knob stretches while pressed, springs across and a\n * tick pops in when it's on. Put the label inside: `<su-lib-switch [(checked)]=\"on\">Reduce motion</su-lib-switch>`.\n *\n * It shows a click at once and follows `checked` whenever it changes. While `busy` (e.g. saving the change) it ignores\n * clicks, and once no longer busy it shows `checked` again, so a change that failed to save flips back.\n */\n@Component({\n selector: 'su-lib-switch',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './switch.component.html',\n styleUrl: './switch.component.scss',\n})\nexport class SuSwitchComponent {\n readonly checked = input(false, { transform: booleanAttribute });\n readonly disabled = input(false, { transform: booleanAttribute });\n /** Busy saving the change: clicks are ignored, and `aria-busy` is set */\n readonly busy = input(false, { transform: booleanAttribute });\n /** @default 'end' */\n readonly labelPosition = input<SuSwitchLabelPosition>('end');\n /** @default 'medium' */\n readonly size = input<SuSwitchSize>('medium');\n /** Switched by the user: the new value */\n readonly checkedChange = output<boolean>();\n\n protected readonly shown = linkedSignal(() => this.checked());\n\n constructor() {\n effect(() => {\n if (!this.busy()) {\n untracked(() => this.shown.set(this.checked()));\n }\n });\n }\n\n protected onClick(event: MouseEvent): void {\n if (this.busy()) {\n event.preventDefault();\n }\n }\n\n protected onChange(event: Event): void {\n if (event.target instanceof HTMLInputElement) {\n this.shown.set(event.target.checked);\n this.checkedChange.emit(event.target.checked);\n }\n }\n}\n","<label class=\"su-switch su-switch-{{ size() }}\" [class.is-label-start]=\"labelPosition() === 'start'\">\n <input\n type=\"checkbox\"\n role=\"switch\"\n [checked]=\"shown()\"\n [disabled]=\"disabled()\"\n [attr.aria-busy]=\"busy() ? true : null\"\n (click)=\"onClick($event)\"\n (change)=\"onChange($event)\"\n />\n <span class=\"su-switch-track\" aria-hidden=\"true\"></span>\n <span class=\"su-switch-label\"><ng-content /></span>\n</label>\n","/** What's wrong with an email address, in the order it's checked */\nexport type SuEmailProblem = 'empty' | 'spaces' | 'at' | 'name' | 'domain' | 'dot' | 'ending';\n\n/** The outcome of `suCheckEmail` */\nexport interface SuEmailCheck {\n readonly valid: boolean;\n readonly problem: SuEmailProblem | null;\n /** The address with a common domain in place of a likely typo, e.g. `jo@gmail.com` for `jo@gmial.com`, or null */\n readonly suggestion: string | null;\n}\n\n/** Domains `suCheckEmail` suggests when one is mistyped */\nexport const SU_COMMON_EMAIL_DOMAINS: readonly string[] = [\n 'gmail.com',\n 'hotmail.com',\n 'outlook.com',\n 'live.com',\n 'yahoo.com',\n 'icloud.com',\n 'me.com',\n 'aol.com',\n 'proton.me',\n 'protonmail.com',\n 'gmx.com',\n 'yandex.com',\n 'hotmail.es',\n 'yahoo.es',\n];\n\n/** How far a typed domain may be from a common one, in single-letter edits, to suggest it */\nconst MAX_TYPO_DISTANCE = 2;\n\nfunction editDistance(a: string, b: string): number {\n let previous = Array.from({ length: b.length + 1 }, (_, index) => index);\n for (let i = 1; i <= a.length; i++) {\n const current = [i];\n for (let j = 1; j <= b.length; j++) {\n current[j] = Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));\n }\n previous = current;\n }\n return previous[b.length];\n}\n\n/** The common domain a typed one most likely meant, or null when it's already common or nothing is close */\nfunction closestDomain(domain: string, domains: readonly string[]): string | null {\n if (!domain || domains.includes(domain)) {\n return null;\n }\n let best: { readonly domain: string; readonly distance: number } | null = null;\n for (const candidate of domains) {\n const distance = editDistance(domain, candidate);\n if (distance <= MAX_TYPO_DISTANCE && (!best || distance < best.distance)) {\n best = { domain: candidate, distance };\n }\n }\n return best?.domain ?? null;\n}\n\nfunction problemOf(email: string): SuEmailProblem | null {\n if (email === '') {\n return 'empty';\n }\n if (/\\s/.test(email)) {\n return 'spaces';\n }\n const parts = email.split('@');\n if (parts.length !== 2) {\n return 'at';\n }\n const [name, domain] = parts;\n if (!name) {\n return 'name';\n }\n if (!domain) {\n return 'domain';\n }\n const labels = domain.split('.');\n if (labels.length < 2 || labels.some((label) => label === '')) {\n return 'dot';\n }\n return /^\\p{L}{2,}$/u.test(labels[labels.length - 1]) ? null : 'ending';\n}\n\n/**\n * Checks an email address the way people mistype them: empty, spaces, not exactly one @, nothing before or after it,\n * a domain without a proper dot, or an ending shorter than two letters. It also suggests a common domain for a\n * likely typo (`gmial.com` → `gmail.com`), even when the address is otherwise valid.\n */\nexport function suCheckEmail(value: string, domains: readonly string[] = SU_COMMON_EMAIL_DOMAINS): SuEmailCheck {\n const email = value.trim();\n const problem = problemOf(email);\n const [name = '', domain = ''] = email.split('@');\n const fixable = problem === null || problem === 'dot' || problem === 'ending';\n const fix = fixable && name ? closestDomain(domain.toLowerCase(), domains) : null;\n return { valid: problem === null, problem, suggestion: fix ? `${name}@${fix}` : null };\n}\n","import { booleanAttribute, ChangeDetectionStrategy, Component, computed, effect, input, model, output, signal } from '@angular/core';\nimport { SU_COMMON_EMAIL_DOMAINS, suCheckEmail, SuEmailProblem } from './email-check';\n\n/** The field's texts, e.g. in the page's language */\nexport interface SuEmailMessages extends Readonly<Record<SuEmailProblem, string>> {\n /** Before a suggested address: \"Did you mean jo@gmail.com?\" */\n readonly suggestion: string;\n}\n\nexport const SU_EMAIL_MESSAGES: SuEmailMessages = {\n empty: 'Enter your email address',\n spaces: 'An email address has no spaces',\n at: 'An email address has one @, like name@example.com',\n name: 'Add the part before the @',\n domain: 'Add the part after the @, like example.com',\n dot: 'The part after the @ needs a dot, like example.com',\n ending: 'The ending after the last dot needs at least two letters',\n suggestion: 'Did you mean',\n};\n\nlet nextId = 0;\n\n/**\n * An email field that checks the address the way people mistype it, and suggests a common domain for a likely typo\n * (`gmial.com` → `gmail.com`, applied with one tap). It stays quiet while typing and says what's wrong once the field\n * is left; a tick shows when the address looks right.\n */\n@Component({\n selector: 'su-lib-email-field',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { '[class.is-floating]': 'floating()' },\n templateUrl: './email-field.component.html',\n styleUrl: './email-field.component.scss',\n})\nexport class SuEmailFieldComponent {\n readonly value = model('');\n /** The visible label */\n readonly label = input.required<string>();\n readonly placeholder = input<string>();\n /** An empty field counts as a problem @default false */\n readonly required = input(false, { transform: booleanAttribute });\n readonly messages = input<Partial<SuEmailMessages>>({});\n /** The label sits inside the field and moves up onto its border when the field is focused or filled @default false */\n readonly floating = input(false, { transform: booleanAttribute });\n /** Shows the problem before the field was left, e.g. when its form is sent @default false */\n readonly showProblem = input(false, { transform: booleanAttribute });\n /** Domains to suggest when one is mistyped */\n readonly domains = input<readonly string[]>(SU_COMMON_EMAIL_DOMAINS);\n /** Whether the address is valid, on every change */\n readonly validityChange = output<boolean>();\n\n protected readonly id = `su-email-${nextId++}`;\n protected readonly touched = signal(false);\n protected readonly check = computed(() => suCheckEmail(this.value(), this.domains()));\n protected readonly text = computed<SuEmailMessages>(() => ({ ...SU_EMAIL_MESSAGES, ...this.messages() }));\n /** The problem to show: once the field was left or `showProblem` is on, and an empty field only when it's required */\n protected readonly problem = computed(() => {\n const { problem } = this.check();\n const isShown = this.touched() || this.showProblem();\n if (!isShown || !problem || (problem === 'empty' && !this.required())) {\n return null;\n }\n return problem;\n });\n\n constructor() {\n effect(() => this.validityChange.emit(this.check().valid));\n }\n\n protected onInput(event: Event): void {\n if (event.target instanceof HTMLInputElement) {\n this.value.set(event.target.value);\n }\n }\n\n protected apply(suggestion: string): void {\n this.value.set(suggestion);\n this.touched.set(true);\n }\n}\n","@let result = check();\n@let t = text();\n@if (!floating()) {\n <label class=\"su-email-label\" [for]=\"id\">{{ label() }}</label>\n}\n<div class=\"su-email-box\" [class.is-valid]=\"result.valid\" [class.is-invalid]=\"problem() !== null\">\n <input\n class=\"su-email-input\"\n type=\"email\"\n inputmode=\"email\"\n autocomplete=\"email\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [id]=\"id\"\n [value]=\"value()\"\n [required]=\"required()\"\n [attr.placeholder]=\"floating() ? ' ' : (placeholder() ?? null)\"\n [attr.aria-invalid]=\"problem() !== null ? true : null\"\n [attr.aria-describedby]=\"id + '-message'\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n />\n @if (floating()) {\n <label class=\"su-email-label su-email-floating-label\" [for]=\"id\">{{ label() }}</label>\n }\n <span class=\"su-email-tick\" aria-hidden=\"true\"></span>\n</div>\n<p class=\"su-email-message\" aria-live=\"polite\" [id]=\"id + '-message'\">\n @if (problem(); as problem) {\n <span class=\"su-email-problem\">{{ t[problem] }}</span>\n }\n @if (result.suggestion; as suggestion) {\n <span class=\"su-email-suggestion\">\n {{ t.suggestion }}\n <button type=\"button\" class=\"su-email-fix\" (click)=\"apply(suggestion)\">{{ suggestion }}</button>?\n </span>\n }\n</p>\n","import { booleanAttribute, ChangeDetectionStrategy, Component, input, linkedSignal, output } from '@angular/core';\n\n/**\n * A real checkbox whose tick draws itself in, with a small squash when pressed and a dash when partly checked. Put the\n * label inside: `<su-lib-checkbox [(checked)]=\"agree\">I agree</su-lib-checkbox>`.\n */\n@Component({\n selector: 'su-lib-checkbox',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './checkbox.component.html',\n styleUrl: './checkbox.component.scss',\n})\nexport class SuCheckboxComponent {\n readonly checked = input(false, { transform: booleanAttribute });\n /** Partly checked, e.g. some of a group; a click checks it */\n readonly indeterminate = input(false, { transform: booleanAttribute });\n readonly disabled = input(false, { transform: booleanAttribute });\n /** Ticked or unticked by the user: the new value */\n readonly checkedChange = output<boolean>();\n\n protected readonly shown = linkedSignal(() => this.checked());\n\n protected onChange(event: Event): void {\n if (event.target instanceof HTMLInputElement) {\n this.shown.set(event.target.checked);\n this.checkedChange.emit(event.target.checked);\n }\n }\n}\n","<label class=\"su-checkbox\" [class.is-mixed]=\"indeterminate() && !shown()\">\n <input\n type=\"checkbox\"\n [checked]=\"shown()\"\n [indeterminate]=\"indeterminate() && !shown()\"\n [disabled]=\"disabled()\"\n (change)=\"onChange($event)\"\n />\n <span class=\"su-checkbox-box\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 24 24\">\n <path class=\"su-checkbox-tick\" d=\"M5 12.5l4.5 4.5L19 7.5\" />\n <path class=\"su-checkbox-dash\" d=\"M6 12h12\" />\n </svg>\n </span>\n <span class=\"su-checkbox-label\"><ng-content /></span>\n</label>\n","import { booleanAttribute, ChangeDetectionStrategy, Component, input, model } from '@angular/core';\n\n/** One chip: the value it stands for and its text */\nexport interface SuChipOption<TValue extends string> {\n readonly value: TValue;\n readonly label: string;\n readonly disabled?: boolean;\n}\n\n/**\n * Toggle chips to pick several options (or one, with `multiple` off): each is a button that pops a tick in when\n * picked. `<su-lib-chips label=\"Categories\" [options]=\"categories\" [(value)]=\"picked\" />`\n */\n@Component({\n selector: 'su-lib-chips',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './chips.component.html',\n styleUrl: './chips.component.scss',\n})\nexport class SuChipsComponent<TValue extends string> {\n readonly options = input.required<readonly SuChipOption<TValue>[]>();\n /** The picked values, in the options' order */\n readonly value = model<readonly TValue[]>([]);\n /** The group's name for screen readers */\n readonly label = input.required<string>();\n /** Several can be picked; off, picking one replaces the other @default true */\n readonly multiple = input(true, { transform: booleanAttribute });\n\n protected isPicked(value: TValue): boolean {\n return this.value().includes(value);\n }\n\n protected toggle(option: SuChipOption<TValue>): void {\n if (!this.multiple()) {\n this.value.set([option.value]);\n return;\n }\n const picked = this.isPicked(option.value)\n ? this.value().filter((value) => value !== option.value)\n : [...this.value(), option.value];\n this.value.set(this.options().map((item) => item.value).filter((value) => picked.includes(value)));\n }\n}\n","<div class=\"su-chips\" role=\"group\" [attr.aria-label]=\"label()\">\n @for (option of options(); track option.value) {\n <button\n type=\"button\"\n class=\"su-chip\"\n [attr.aria-pressed]=\"isPicked(option.value)\"\n [disabled]=\"option.disabled ?? false\"\n (click)=\"toggle(option)\"\n >\n <span class=\"su-chip-tick\" aria-hidden=\"true\"></span>\n {{ option.label }}\n </button>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAEA;;;AAGG;MAOU,oBAAoB,CAAA;AACtB,IAAA,KAAK,GAAG,KAAK,CAAC,EAAE,4EAAC;AACjB,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,4EAAU;AACjC,IAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,2EAAU;;AAEhC,IAAA,QAAQ,GAAG,KAAK,CAAC,KAAK,+EAAC;AAEb,IAAA,KAAK,GAAG,QAAQ,CAAC,MAClC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,KAAK,CAAC,4EAC3D;;AAGS,IAAA,OAAO,CAAC,KAAuB,EAAA;AACvC,QAAA,MAAM,IAAI,GAAG,KAAK,CAAC;AAChB,aAAA,OAAO,CAAC,KAAK,EAAE,EAAE;AACjB,aAAA,WAAW;aACX,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,MA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,MAAM,CAAC,KAAK;AACvC,cAAE,IAAI,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,KAAK,MAAM,CAAC,KAAK;AACvD,cAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC;AACnC,QAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACpG;wGAtBW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAhB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,gBAAgB,omBCnB7B,+bAcA,EAAA,MAAA,EAAA,CAAA,4uDAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FDKa,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAN5B,SAAS;+BACE,cAAc,EAAA,eAAA,EACP,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,+bAAA,EAAA,MAAA,EAAA,CAAA,4uDAAA,CAAA,EAAA;;;AEfjD;;AAEG;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@su-labs/fields",
3
- "version": "21.1.0",
3
+ "version": "21.2.0",
4
4
  "description": "Animated Angular form fields: code boxes that fill one by one, a password strength meter, an email field that catches typos, a sliding switch, checkboxes, chips, and a text box that grows as you type.",
5
5
  "keywords": [
6
6
  "angular",
@@ -133,6 +133,10 @@ declare class SuEmailFieldComponent {
133
133
  /** An empty field counts as a problem @default false */
134
134
  readonly required: _angular_core.InputSignalWithTransform<boolean, unknown>;
135
135
  readonly messages: _angular_core.InputSignal<Partial<SuEmailMessages>>;
136
+ /** The label sits inside the field and moves up onto its border when the field is focused or filled @default false */
137
+ readonly floating: _angular_core.InputSignalWithTransform<boolean, unknown>;
138
+ /** Shows the problem before the field was left, e.g. when its form is sent @default false */
139
+ readonly showProblem: _angular_core.InputSignalWithTransform<boolean, unknown>;
136
140
  /** Domains to suggest when one is mistyped */
137
141
  readonly domains: _angular_core.InputSignal<readonly string[]>;
138
142
  /** Whether the address is valid, on every change */
@@ -141,13 +145,13 @@ declare class SuEmailFieldComponent {
141
145
  protected readonly touched: _angular_core.WritableSignal<boolean>;
142
146
  protected readonly check: _angular_core.Signal<_su_labs_fields.SuEmailCheck>;
143
147
  protected readonly text: _angular_core.Signal<SuEmailMessages>;
144
- /** The problem to show: only once the field was left, and an empty field only when it's required */
148
+ /** The problem to show: once the field was left or `showProblem` is on, and an empty field only when it's required */
145
149
  protected readonly problem: _angular_core.Signal<"empty" | "spaces" | "at" | "name" | "domain" | "dot" | "ending" | null>;
146
150
  constructor();
147
151
  protected onInput(event: Event): void;
148
152
  protected apply(suggestion: string): void;
149
153
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SuEmailFieldComponent, never>;
150
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<SuEmailFieldComponent, "su-lib-email-field", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": true; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "messages": { "alias": "messages"; "required": false; "isSignal": true; }; "domains": { "alias": "domains"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "validityChange": "validityChange"; }, never, never, true, never>;
154
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SuEmailFieldComponent, "su-lib-email-field", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": true; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "messages": { "alias": "messages"; "required": false; "isSignal": true; }; "floating": { "alias": "floating"; "required": false; "isSignal": true; }; "showProblem": { "alias": "showProblem"; "required": false; "isSignal": true; }; "domains": { "alias": "domains"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "validityChange": "validityChange"; }, never, never, true, never>;
151
155
  }
152
156
 
153
157
  /**