@su-labs/fields 19.1.0 → 21.1.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/README.md +3 -1
- package/fesm2022/su-labs-fields.mjs +69 -69
- package/fesm2022/su-labs-fields.mjs.map +1 -1
- package/package.json +7 -6
- package/types/su-labs-fields.d.ts +195 -0
- package/index.d.ts +0 -5
- package/lib/auto-grow/auto-grow.directive.d.ts +0 -13
- package/lib/checkbox/checkbox.component.d.ts +0 -17
- package/lib/chips/chips.component.d.ts +0 -24
- package/lib/code-boxes/code-boxes.component.d.ts +0 -17
- package/lib/email-field/email-check.d.ts +0 -17
- package/lib/email-field/email-field.component.d.ts +0 -37
- package/lib/strength-meter/password-strength.d.ts +0 -13
- package/lib/strength-meter/strength-meter.component.d.ts +0 -22
- package/lib/switch/switch.component.d.ts +0 -29
- package/public-api.d.ts +0 -9
package/README.md
CHANGED
|
@@ -16,9 +16,11 @@ Every animation stops for visitors who ask their device for less motion.
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
npm install @su-labs/fields
|
|
19
|
+
npm install @su-labs/fields@ng21
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
This is the Angular 21 version. For the newest Angular, install `@su-labs/fields` without a tag.
|
|
23
|
+
|
|
22
24
|
## Code boxes
|
|
23
25
|
|
|
24
26
|
```ts
|
|
@@ -6,12 +6,12 @@ import { model, input, computed, ChangeDetectionStrategy, Component, signal, eff
|
|
|
6
6
|
* One real text field lies over the boxes, so typing, pasting, the phone keyboard and screen readers all work as usual.
|
|
7
7
|
*/
|
|
8
8
|
class SuCodeBoxesComponent {
|
|
9
|
-
value = model('');
|
|
10
|
-
length = input.required();
|
|
11
|
-
label = input.required();
|
|
9
|
+
value = model('', ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
10
|
+
length = input.required(...(ngDevMode ? [{ debugName: "length" }] : /* istanbul ignore next */ []));
|
|
11
|
+
label = input.required(...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
12
12
|
/** The code is whole and well-formed: the boxes turn green */
|
|
13
|
-
complete = input(false);
|
|
14
|
-
boxes = computed(() => Array.from({ length: this.length() }, (_, index) => index));
|
|
13
|
+
complete = input(false, ...(ngDevMode ? [{ debugName: "complete" }] : /* istanbul ignore next */ []));
|
|
14
|
+
boxes = computed(() => Array.from({ length: this.length() }, (_, index) => index), ...(ngDevMode ? [{ debugName: "boxes" }] : /* istanbul ignore next */ []));
|
|
15
15
|
/** Capitals without spaces, never longer than the boxes */
|
|
16
16
|
onInput(field) {
|
|
17
17
|
const code = field.value
|
|
@@ -21,13 +21,13 @@ class SuCodeBoxesComponent {
|
|
|
21
21
|
field.value = code;
|
|
22
22
|
this.value.set(code);
|
|
23
23
|
}
|
|
24
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
25
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
24
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuCodeBoxesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
25
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.26", type: SuCodeBoxesComponent, isStandalone: true, selector: "su-lib-code-boxes", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, length: { classPropertyName: "length", publicName: "length", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, complete: { classPropertyName: "complete", publicName: "complete", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, ngImport: i0, template: "<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", styles: [":host{display:block;position:relative;width:fit-content}.field{background:transparent;border:0;caret-color:transparent;color:transparent;cursor:text;font-size:1rem;inset:0;opacity:.01;position:absolute;width:100%;z-index:1}.boxes{display:flex;gap:.5rem}.box{align-items:center;background:var(--su-field-surface, transparent);border:1px solid var(--su-field-border, rgba(127, 127, 127, .4));border-radius:.5rem;color:var(--su-field-text, currentColor);display:flex;font-family:var(--su-field-font-mono, monospace);font-size:1.375rem;height:3rem;justify-content:center;transition:border-color .2s ease,background-color .2s ease,color .2s ease;width:2.5rem}.box.is-filled{animation:box-pop .22s cubic-bezier(.34,1.56,.64,1);border-color:var(--su-field-filled-border, currentColor)}.field:focus-visible+.boxes .box.is-current,.field:focus+.boxes .box.is-current{border-color:var(--su-field-accent, #3b82f6);box-shadow:0 0 0 3px color-mix(in srgb,var(--su-field-accent, #3b82f6) 25%,transparent)}.boxes.is-complete .box{animation:box-done .36s ease calc(var(--index) * 60ms) both;background:var(--su-field-success-bg, #e6f4ea);border-color:var(--su-field-success, #2e8b57);color:var(--su-field-success, #2e8b57);transition-delay:calc(var(--index) * 60ms)}@keyframes box-pop{0%{transform:scale(.85)}}@keyframes box-done{50%{transform:translateY(-4px)}}@media(prefers-reduced-motion:reduce){.box,.boxes.is-complete .box{animation:none;transition:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
26
26
|
}
|
|
27
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuCodeBoxesComponent, decorators: [{
|
|
28
28
|
type: Component,
|
|
29
29
|
args: [{ selector: 'su-lib-code-boxes', changeDetection: ChangeDetectionStrategy.OnPush, template: "<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", styles: [":host{display:block;position:relative;width:fit-content}.field{background:transparent;border:0;caret-color:transparent;color:transparent;cursor:text;font-size:1rem;inset:0;opacity:.01;position:absolute;width:100%;z-index:1}.boxes{display:flex;gap:.5rem}.box{align-items:center;background:var(--su-field-surface, transparent);border:1px solid var(--su-field-border, rgba(127, 127, 127, .4));border-radius:.5rem;color:var(--su-field-text, currentColor);display:flex;font-family:var(--su-field-font-mono, monospace);font-size:1.375rem;height:3rem;justify-content:center;transition:border-color .2s ease,background-color .2s ease,color .2s ease;width:2.5rem}.box.is-filled{animation:box-pop .22s cubic-bezier(.34,1.56,.64,1);border-color:var(--su-field-filled-border, currentColor)}.field:focus-visible+.boxes .box.is-current,.field:focus+.boxes .box.is-current{border-color:var(--su-field-accent, #3b82f6);box-shadow:0 0 0 3px color-mix(in srgb,var(--su-field-accent, #3b82f6) 25%,transparent)}.boxes.is-complete .box{animation:box-done .36s ease calc(var(--index) * 60ms) both;background:var(--su-field-success-bg, #e6f4ea);border-color:var(--su-field-success, #2e8b57);color:var(--su-field-success, #2e8b57);transition-delay:calc(var(--index) * 60ms)}@keyframes box-pop{0%{transform:scale(.85)}}@keyframes box-done{50%{transform:translateY(-4px)}}@media(prefers-reduced-motion:reduce){.box,.boxes.is-complete .box{animation:none;transition:none}}\n"] }]
|
|
30
|
-
}] });
|
|
30
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], length: [{ type: i0.Input, args: [{ isSignal: true, alias: "length", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], complete: [{ type: i0.Input, args: [{ isSignal: true, alias: "complete", required: false }] }] } });
|
|
31
31
|
|
|
32
32
|
/** How strong a new password looks, one step per bar of the meter */
|
|
33
33
|
const SU_STRENGTH_LEVELS = ['weak', 'fair', 'good', 'strong'];
|
|
@@ -62,20 +62,20 @@ const suStrengthLevel = (bars) => SU_STRENGTH_LEVELS[bars - 1] ?? null;
|
|
|
62
62
|
* Its texts come in as inputs, so it fits any language.
|
|
63
63
|
*/
|
|
64
64
|
class SuStrengthMeterComponent {
|
|
65
|
-
field = input.required();
|
|
65
|
+
field = input.required(...(ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []));
|
|
66
66
|
/** The meter's name for screen readers, e.g. "Password strength" */
|
|
67
|
-
label = input.required();
|
|
67
|
+
label = input.required(...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
68
68
|
/** The word shown for each step */
|
|
69
|
-
levelNames = input.required();
|
|
70
|
-
minLength = input(SU_DEFAULT_MIN_PASSWORD_LENGTH);
|
|
71
|
-
password = signal('');
|
|
69
|
+
levelNames = input.required(...(ngDevMode ? [{ debugName: "levelNames" }] : /* istanbul ignore next */ []));
|
|
70
|
+
minLength = input(SU_DEFAULT_MIN_PASSWORD_LENGTH, ...(ngDevMode ? [{ debugName: "minLength" }] : /* istanbul ignore next */ []));
|
|
71
|
+
password = signal('', ...(ngDevMode ? [{ debugName: "password" }] : /* istanbul ignore next */ []));
|
|
72
72
|
steps = SU_STRENGTH_LEVELS;
|
|
73
|
-
bars = computed(() => suPasswordStrength(this.password(), this.minLength()));
|
|
74
|
-
level = computed(() => suStrengthLevel(this.bars()));
|
|
73
|
+
bars = computed(() => suPasswordStrength(this.password(), this.minLength()), ...(ngDevMode ? [{ debugName: "bars" }] : /* istanbul ignore next */ []));
|
|
74
|
+
level = computed(() => suStrengthLevel(this.bars()), ...(ngDevMode ? [{ debugName: "level" }] : /* istanbul ignore next */ []));
|
|
75
75
|
levelName = computed(() => {
|
|
76
76
|
const level = this.level();
|
|
77
77
|
return level ? this.levelNames()[level] : null;
|
|
78
|
-
});
|
|
78
|
+
}, ...(ngDevMode ? [{ debugName: "levelName" }] : /* istanbul ignore next */ []));
|
|
79
79
|
constructor() {
|
|
80
80
|
effect(onCleanup => {
|
|
81
81
|
const field = this.field();
|
|
@@ -85,13 +85,13 @@ class SuStrengthMeterComponent {
|
|
|
85
85
|
onCleanup(() => field.removeEventListener('input', read));
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
89
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
88
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuStrengthMeterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
89
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.26", type: SuStrengthMeterComponent, isStandalone: true, selector: "su-lib-strength-meter", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, levelNames: { classPropertyName: "levelNames", publicName: "levelNames", isSignal: true, isRequired: true, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<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", styles: [":host{display:grid;gap:.375rem}.bars{display:grid;gap:.375rem;grid-template-columns:repeat(4,1fr)}.bar{background:var(--su-field-track, rgba(127, 127, 127, .2));border-radius:9999px;height:.3125rem;overflow:hidden;position:relative}.bar:after{background:var(--meter-colour, var(--su-field-danger, #c0392b));border-radius:inherit;content:\"\";inset:0;position:absolute;transform:scaleX(0);transform-origin:left;transition:transform .26s cubic-bezier(.34,1.56,.64,1) calc(var(--index) * 40ms),background-color .26s ease}.bar.is-filled:after{transform:scaleX(1)}:host:has(.level[data-level=fair]){--meter-colour: var(--su-field-warning, #c98a00)}:host:has(.level[data-level=good]),:host:has(.level[data-level=strong]){--meter-colour: var(--su-field-success, #2e8b57)}.level{color:var(--meter-colour, var(--su-field-danger, #c0392b));font-size:.75rem;font-weight:600;justify-self:end}@media(prefers-reduced-motion:reduce){.bar:after{transition:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
90
90
|
}
|
|
91
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
91
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuStrengthMeterComponent, decorators: [{
|
|
92
92
|
type: Component,
|
|
93
93
|
args: [{ selector: 'su-lib-strength-meter', changeDetection: ChangeDetectionStrategy.OnPush, template: "<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", styles: [":host{display:grid;gap:.375rem}.bars{display:grid;gap:.375rem;grid-template-columns:repeat(4,1fr)}.bar{background:var(--su-field-track, rgba(127, 127, 127, .2));border-radius:9999px;height:.3125rem;overflow:hidden;position:relative}.bar:after{background:var(--meter-colour, var(--su-field-danger, #c0392b));border-radius:inherit;content:\"\";inset:0;position:absolute;transform:scaleX(0);transform-origin:left;transition:transform .26s cubic-bezier(.34,1.56,.64,1) calc(var(--index) * 40ms),background-color .26s ease}.bar.is-filled:after{transform:scaleX(1)}:host:has(.level[data-level=fair]){--meter-colour: var(--su-field-warning, #c98a00)}:host:has(.level[data-level=good]),:host:has(.level[data-level=strong]){--meter-colour: var(--su-field-success, #2e8b57)}.level{color:var(--meter-colour, var(--su-field-danger, #c0392b));font-size:.75rem;font-weight:600;justify-self:end}@media(prefers-reduced-motion:reduce){.bar:after{transition:none}}\n"] }]
|
|
94
|
-
}], ctorParameters: () => [] });
|
|
94
|
+
}], ctorParameters: () => [], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], levelNames: [{ type: i0.Input, args: [{ isSignal: true, alias: "levelNames", required: true }] }], minLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "minLength", required: false }] }] } });
|
|
95
95
|
|
|
96
96
|
/** A soft spring that overshoots a little, as the box settles on its new height */
|
|
97
97
|
const SPRING = 'height 240ms cubic-bezier(0.34, 1.56, 0.64, 1)';
|
|
@@ -100,7 +100,7 @@ const SPRING = 'height 240ms cubic-bezier(0.34, 1.56, 0.64, 1)';
|
|
|
100
100
|
* spring (none for visitors who asked their device for less motion). `[suAutoGrow]="false"` leaves it as it is.
|
|
101
101
|
*/
|
|
102
102
|
class SuAutoGrowDirective {
|
|
103
|
-
isOn = input(true, { alias: 'suAutoGrow', transform: booleanAttribute });
|
|
103
|
+
isOn = input(true, { ...(ngDevMode ? { debugName: "isOn" } : /* istanbul ignore next */ {}), alias: 'suAutoGrow', transform: booleanAttribute });
|
|
104
104
|
box = inject(ElementRef).nativeElement;
|
|
105
105
|
constructor() {
|
|
106
106
|
const destroyRef = inject(DestroyRef);
|
|
@@ -128,16 +128,16 @@ class SuAutoGrowDirective {
|
|
|
128
128
|
: SPRING;
|
|
129
129
|
box.style.height = `${to}px`;
|
|
130
130
|
}
|
|
131
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
132
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
131
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuAutoGrowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
132
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.26", type: SuAutoGrowDirective, isStandalone: true, selector: "textarea[suAutoGrow]", inputs: { isOn: { classPropertyName: "isOn", publicName: "suAutoGrow", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "input": "fit()" } }, ngImport: i0 });
|
|
133
133
|
}
|
|
134
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
134
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuAutoGrowDirective, decorators: [{
|
|
135
135
|
type: Directive,
|
|
136
136
|
args: [{
|
|
137
137
|
selector: 'textarea[suAutoGrow]',
|
|
138
138
|
host: { '(input)': 'fit()' },
|
|
139
139
|
}]
|
|
140
|
-
}], ctorParameters: () => [] });
|
|
140
|
+
}], ctorParameters: () => [], propDecorators: { isOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "suAutoGrow", required: false }] }] } });
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
143
|
* A real checkbox (`role="switch"`) drawn as a sliding switch: the knob stretches while pressed, springs across and a
|
|
@@ -147,17 +147,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
|
|
|
147
147
|
* clicks, and once no longer busy it shows `checked` again, so a change that failed to save flips back.
|
|
148
148
|
*/
|
|
149
149
|
class SuSwitchComponent {
|
|
150
|
-
checked = input(false, { transform: booleanAttribute });
|
|
151
|
-
disabled = input(false, { transform: booleanAttribute });
|
|
150
|
+
checked = input(false, { ...(ngDevMode ? { debugName: "checked" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
151
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
152
152
|
/** Busy saving the change: clicks are ignored, and `aria-busy` is set */
|
|
153
|
-
busy = input(false, { transform: booleanAttribute });
|
|
153
|
+
busy = input(false, { ...(ngDevMode ? { debugName: "busy" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
154
154
|
/** @default 'end' */
|
|
155
|
-
labelPosition = input('end');
|
|
155
|
+
labelPosition = input('end', ...(ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []));
|
|
156
156
|
/** @default 'medium' */
|
|
157
|
-
size = input('medium');
|
|
157
|
+
size = input('medium', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
158
158
|
/** Switched by the user: the new value */
|
|
159
159
|
checkedChange = output();
|
|
160
|
-
shown = linkedSignal(() => this.checked());
|
|
160
|
+
shown = linkedSignal(() => this.checked(), ...(ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []));
|
|
161
161
|
constructor() {
|
|
162
162
|
effect(() => {
|
|
163
163
|
if (!this.busy()) {
|
|
@@ -176,13 +176,13 @@ class SuSwitchComponent {
|
|
|
176
176
|
this.checkedChange.emit(event.target.checked);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
180
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
179
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuSwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
180
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.26", type: SuSwitchComponent, isStandalone: true, selector: "su-lib-switch", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, busy: { classPropertyName: "busy", publicName: "busy", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "checkedChange" }, ngImport: i0, template: "<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", styles: [":host{display:block}.su-switch{align-items:center;cursor:pointer;display:inline-flex;font-weight:var(--su-switch-label-weight, 500);gap:.75rem}.su-switch input{height:1px;opacity:0;position:absolute;width:1px}.su-switch.is-label-start{display:flex;flex-direction:row-reverse;gap:1rem;justify-content:space-between;width:100%}.su-switch-label{display:grid;gap:.125rem}.is-label-start .su-switch-label{flex:1}.su-switch-label:empty{display:none}.su-switch-track{--switch-width: var(--su-switch-width, 3rem);--switch-height: var(--su-switch-height, 1.75rem);--switch-inset: .1875rem;--switch-knob: calc(var(--switch-height) - 2 * var(--switch-inset));--switch-travel: calc(var(--switch-width) - var(--switch-height));--switch-stretch: calc(var(--switch-knob) * .3);--knob-width: var(--switch-knob);--knob-move: 0rem;--knob-scale: .7;--knob-colour: var(--su-switch-knob-off, #9b9a97);background:var(--su-switch-track-off, rgba(0, 0, 0, .06));border-radius:9999px;box-shadow:inset 0 0 0 2px var(--su-switch-border, rgba(0, 0, 0, .14));flex-shrink:0;height:var(--switch-height);position:relative;transition:background-color .2s ease,box-shadow .2s ease;width:var(--switch-width)}.su-switch-small .su-switch-track{--switch-width: var(--su-switch-small-width, 2.125rem);--switch-height: var(--su-switch-small-height, 1.25rem)}.su-switch-track:after{background:var(--knob-colour);border-radius:9999px;box-shadow:0 1px 3px #00000040;content:\"\";height:var(--switch-knob);left:var(--switch-inset);position:absolute;scale:var(--knob-scale);top:var(--switch-inset);transition:translate .25s cubic-bezier(.34,1.56,.64,1),width .2s ease,scale .25s cubic-bezier(.34,1.56,.64,1),background-color .2s ease;translate:var(--knob-move) 0;width:var(--knob-width)}.su-switch-track:before{background:var(--su-switch-tick, #fff);content:\"\";height:var(--switch-knob);left:calc(var(--switch-inset) + var(--switch-travel));-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.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E\") center/55% 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.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E\") center/55% no-repeat;opacity:0;position:absolute;scale:.3;top:var(--switch-inset);transition:opacity .15s ease,scale .25s cubic-bezier(.34,1.56,.64,1);width:var(--switch-knob);z-index:1}.su-switch:active input:not(:disabled)+.su-switch-track{--knob-scale: 1;--knob-width: calc(var(--switch-knob) + var(--switch-stretch))}.su-switch input:checked+.su-switch-track{--knob-move: var(--switch-travel);--knob-scale: 1;--knob-colour: var(--su-switch-on, #111);background:var(--su-switch-track-on, color-mix(in srgb, var(--su-switch-on, #111) 35%, Canvas));box-shadow:none}.su-switch input:checked+.su-switch-track:before{opacity:1;scale:1}.su-switch:active input:checked:not(:disabled)+.su-switch-track{--knob-move: calc(var(--switch-travel) - var(--switch-stretch))}.su-switch:active input:checked:not(:disabled)+.su-switch-track:before{opacity:0}.su-switch input:focus-visible+.su-switch-track{outline:var(--su-switch-focus-outline, 2px solid currentColor);outline-offset:2px}.su-switch:has(input:disabled){cursor:not-allowed}.su-switch input:disabled+.su-switch-track{opacity:.5}@media(prefers-reduced-motion:reduce){.su-switch-track,.su-switch-track:after,.su-switch-track:before{transition:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
181
181
|
}
|
|
182
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
182
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuSwitchComponent, decorators: [{
|
|
183
183
|
type: Component,
|
|
184
|
-
args: [{ selector: 'su-lib-switch', changeDetection: ChangeDetectionStrategy.OnPush, template: "<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", styles: [":host{display:block}.su-switch{align-items:center;cursor:pointer;display:inline-flex;font-weight:var(--su-switch-label-weight, 500);gap:.75rem}.su-switch input{height:1px;opacity:0;position:absolute;width:1px}.su-switch.is-label-start{display:flex;flex-direction:row-reverse;gap:1rem;justify-content:space-between;width:100%}.su-switch-label{display:grid;gap:.125rem}.is-label-start .su-switch-label{flex:1}.su-switch-label:empty{display:none}.su-switch-track{--switch-width: var(--su-switch-width, 3rem);--switch-height: var(--su-switch-height, 1.75rem);--switch-inset: .1875rem;--switch-knob: calc(var(--switch-height) - 2 * var(--switch-inset));--switch-travel: calc(var(--switch-width) - var(--switch-height));--switch-stretch: calc(var(--switch-knob) * .3);--knob-width: var(--switch-knob);--knob-move: 0rem;--knob-scale: .7;--knob-colour: var(--su-switch-knob-off, #9b9a97);background:var(--su-switch-track-off, rgba(0, 0, 0, .06));border-radius:9999px;box-shadow:inset 0 0 0 2px var(--su-switch-border, rgba(0, 0, 0, .14));flex-shrink:0;height:var(--switch-height);position:relative;transition:background-color .2s ease,box-shadow .2s ease;width:var(--switch-width)}.su-switch-small .su-switch-track{--switch-width: var(--su-switch-small-width, 2.125rem);--switch-height: var(--su-switch-small-height, 1.25rem)}.su-switch-track:after{background:var(--knob-colour);border-radius:9999px;box-shadow:0 1px 3px #00000040;content:\"\";height:var(--switch-knob);left:var(--switch-inset);position:absolute;scale:var(--knob-scale);top:var(--switch-inset);transition:translate .25s cubic-bezier(.34,1.56,.64,1),width .2s ease,scale .25s cubic-bezier(.34,1.56,.64,1),background-color .2s ease;translate:var(--knob-move) 0;width:var(--knob-width)}.su-switch-track:before{background:var(--su-switch-tick, #fff);content:\"\";height:var(--switch-knob);left:calc(var(--switch-inset) + var(--switch-travel));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.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E\") center/55% no-repeat;opacity:0;position:absolute;scale:.3;top:var(--switch-inset);transition:opacity .15s ease,scale .25s cubic-bezier(.34,1.56,.64,1);width:var(--switch-knob);z-index:1}.su-switch:active input:not(:disabled)+.su-switch-track{--knob-scale: 1;--knob-width: calc(var(--switch-knob) + var(--switch-stretch))}.su-switch input:checked+.su-switch-track{--knob-move: var(--switch-travel);--knob-scale: 1;--knob-colour: var(--su-switch-on, #111);background:var(--su-switch-track-on, color-mix(in srgb, var(--su-switch-on, #111) 35%, Canvas));box-shadow:none}.su-switch input:checked+.su-switch-track:before{opacity:1;scale:1}.su-switch:active input:checked:not(:disabled)+.su-switch-track{--knob-move: calc(var(--switch-travel) - var(--switch-stretch))}.su-switch:active input:checked:not(:disabled)+.su-switch-track:before{opacity:0}.su-switch input:focus-visible+.su-switch-track{outline:var(--su-switch-focus-outline, 2px solid currentColor);outline-offset:2px}.su-switch:has(input:disabled){cursor:not-allowed}.su-switch input:disabled+.su-switch-track{opacity:.5}@media(prefers-reduced-motion:reduce){.su-switch-track,.su-switch-track:after,.su-switch-track:before{transition:none}}\n"] }]
|
|
185
|
-
}], ctorParameters: () => [] });
|
|
184
|
+
args: [{ selector: 'su-lib-switch', changeDetection: ChangeDetectionStrategy.OnPush, template: "<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", styles: [":host{display:block}.su-switch{align-items:center;cursor:pointer;display:inline-flex;font-weight:var(--su-switch-label-weight, 500);gap:.75rem}.su-switch input{height:1px;opacity:0;position:absolute;width:1px}.su-switch.is-label-start{display:flex;flex-direction:row-reverse;gap:1rem;justify-content:space-between;width:100%}.su-switch-label{display:grid;gap:.125rem}.is-label-start .su-switch-label{flex:1}.su-switch-label:empty{display:none}.su-switch-track{--switch-width: var(--su-switch-width, 3rem);--switch-height: var(--su-switch-height, 1.75rem);--switch-inset: .1875rem;--switch-knob: calc(var(--switch-height) - 2 * var(--switch-inset));--switch-travel: calc(var(--switch-width) - var(--switch-height));--switch-stretch: calc(var(--switch-knob) * .3);--knob-width: var(--switch-knob);--knob-move: 0rem;--knob-scale: .7;--knob-colour: var(--su-switch-knob-off, #9b9a97);background:var(--su-switch-track-off, rgba(0, 0, 0, .06));border-radius:9999px;box-shadow:inset 0 0 0 2px var(--su-switch-border, rgba(0, 0, 0, .14));flex-shrink:0;height:var(--switch-height);position:relative;transition:background-color .2s ease,box-shadow .2s ease;width:var(--switch-width)}.su-switch-small .su-switch-track{--switch-width: var(--su-switch-small-width, 2.125rem);--switch-height: var(--su-switch-small-height, 1.25rem)}.su-switch-track:after{background:var(--knob-colour);border-radius:9999px;box-shadow:0 1px 3px #00000040;content:\"\";height:var(--switch-knob);left:var(--switch-inset);position:absolute;scale:var(--knob-scale);top:var(--switch-inset);transition:translate .25s cubic-bezier(.34,1.56,.64,1),width .2s ease,scale .25s cubic-bezier(.34,1.56,.64,1),background-color .2s ease;translate:var(--knob-move) 0;width:var(--knob-width)}.su-switch-track:before{background:var(--su-switch-tick, #fff);content:\"\";height:var(--switch-knob);left:calc(var(--switch-inset) + var(--switch-travel));-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.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E\") center/55% 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.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E\") center/55% no-repeat;opacity:0;position:absolute;scale:.3;top:var(--switch-inset);transition:opacity .15s ease,scale .25s cubic-bezier(.34,1.56,.64,1);width:var(--switch-knob);z-index:1}.su-switch:active input:not(:disabled)+.su-switch-track{--knob-scale: 1;--knob-width: calc(var(--switch-knob) + var(--switch-stretch))}.su-switch input:checked+.su-switch-track{--knob-move: var(--switch-travel);--knob-scale: 1;--knob-colour: var(--su-switch-on, #111);background:var(--su-switch-track-on, color-mix(in srgb, var(--su-switch-on, #111) 35%, Canvas));box-shadow:none}.su-switch input:checked+.su-switch-track:before{opacity:1;scale:1}.su-switch:active input:checked:not(:disabled)+.su-switch-track{--knob-move: calc(var(--switch-travel) - var(--switch-stretch))}.su-switch:active input:checked:not(:disabled)+.su-switch-track:before{opacity:0}.su-switch input:focus-visible+.su-switch-track{outline:var(--su-switch-focus-outline, 2px solid currentColor);outline-offset:2px}.su-switch:has(input:disabled){cursor:not-allowed}.su-switch input:disabled+.su-switch-track{opacity:.5}@media(prefers-reduced-motion:reduce){.su-switch-track,.su-switch-track:after,.su-switch-track:before{transition:none}}\n"] }]
|
|
185
|
+
}], ctorParameters: () => [], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], busy: [{ type: i0.Input, args: [{ isSignal: true, alias: "busy", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], checkedChange: [{ type: i0.Output, args: ["checkedChange"] }] } });
|
|
186
186
|
|
|
187
187
|
/** Domains `suCheckEmail` suggests when one is mistyped */
|
|
188
188
|
const SU_COMMON_EMAIL_DOMAINS = [
|
|
@@ -283,21 +283,21 @@ let nextId = 0;
|
|
|
283
283
|
* is left; a tick shows when the address looks right.
|
|
284
284
|
*/
|
|
285
285
|
class SuEmailFieldComponent {
|
|
286
|
-
value = model('');
|
|
286
|
+
value = model('', ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
287
287
|
/** The visible label */
|
|
288
|
-
label = input.required();
|
|
289
|
-
placeholder = input();
|
|
288
|
+
label = input.required(...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
289
|
+
placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
290
290
|
/** An empty field counts as a problem @default false */
|
|
291
|
-
required = input(false, { transform: booleanAttribute });
|
|
292
|
-
messages = input({});
|
|
291
|
+
required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
292
|
+
messages = input({}, ...(ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []));
|
|
293
293
|
/** Domains to suggest when one is mistyped */
|
|
294
|
-
domains = input(SU_COMMON_EMAIL_DOMAINS);
|
|
294
|
+
domains = input(SU_COMMON_EMAIL_DOMAINS, ...(ngDevMode ? [{ debugName: "domains" }] : /* istanbul ignore next */ []));
|
|
295
295
|
/** Whether the address is valid, on every change */
|
|
296
296
|
validityChange = output();
|
|
297
297
|
id = `su-email-${nextId++}`;
|
|
298
|
-
touched = signal(false);
|
|
299
|
-
check = computed(() => suCheckEmail(this.value(), this.domains()));
|
|
300
|
-
text = computed(() => ({ ...SU_EMAIL_MESSAGES, ...this.messages() }));
|
|
298
|
+
touched = signal(false, ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
|
|
299
|
+
check = computed(() => suCheckEmail(this.value(), this.domains()), ...(ngDevMode ? [{ debugName: "check" }] : /* istanbul ignore next */ []));
|
|
300
|
+
text = computed(() => ({ ...SU_EMAIL_MESSAGES, ...this.messages() }), ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
|
|
301
301
|
/** The problem to show: only once the field was left, and an empty field only when it's required */
|
|
302
302
|
problem = computed(() => {
|
|
303
303
|
const { problem } = this.check();
|
|
@@ -305,7 +305,7 @@ class SuEmailFieldComponent {
|
|
|
305
305
|
return null;
|
|
306
306
|
}
|
|
307
307
|
return problem;
|
|
308
|
-
});
|
|
308
|
+
}, ...(ngDevMode ? [{ debugName: "problem" }] : /* istanbul ignore next */ []));
|
|
309
309
|
constructor() {
|
|
310
310
|
effect(() => this.validityChange.emit(this.check().valid));
|
|
311
311
|
}
|
|
@@ -318,52 +318,52 @@ class SuEmailFieldComponent {
|
|
|
318
318
|
this.value.set(suggestion);
|
|
319
319
|
this.touched.set(true);
|
|
320
320
|
}
|
|
321
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
322
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
321
|
+
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 });
|
|
323
323
|
}
|
|
324
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
324
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuEmailFieldComponent, decorators: [{
|
|
325
325
|
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;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: () => [] });
|
|
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"] }] } });
|
|
328
328
|
|
|
329
329
|
/**
|
|
330
330
|
* A real checkbox whose tick draws itself in, with a small squash when pressed and a dash when partly checked. Put the
|
|
331
331
|
* label inside: `<su-lib-checkbox [(checked)]="agree">I agree</su-lib-checkbox>`.
|
|
332
332
|
*/
|
|
333
333
|
class SuCheckboxComponent {
|
|
334
|
-
checked = input(false, { transform: booleanAttribute });
|
|
334
|
+
checked = input(false, { ...(ngDevMode ? { debugName: "checked" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
335
335
|
/** Partly checked, e.g. some of a group; a click checks it */
|
|
336
|
-
indeterminate = input(false, { transform: booleanAttribute });
|
|
337
|
-
disabled = input(false, { transform: booleanAttribute });
|
|
336
|
+
indeterminate = input(false, { ...(ngDevMode ? { debugName: "indeterminate" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
337
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
338
338
|
/** Ticked or unticked by the user: the new value */
|
|
339
339
|
checkedChange = output();
|
|
340
|
-
shown = linkedSignal(() => this.checked());
|
|
340
|
+
shown = linkedSignal(() => this.checked(), ...(ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []));
|
|
341
341
|
onChange(event) {
|
|
342
342
|
if (event.target instanceof HTMLInputElement) {
|
|
343
343
|
this.shown.set(event.target.checked);
|
|
344
344
|
this.checkedChange.emit(event.target.checked);
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
348
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
347
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
348
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.26", type: SuCheckboxComponent, isStandalone: true, selector: "su-lib-checkbox", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "checkedChange" }, ngImport: i0, template: "<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", styles: [":host{display:block}.su-checkbox{align-items:center;cursor:pointer;display:inline-flex;gap:.625rem}.su-checkbox input{height:1px;opacity:0;position:absolute;width:1px}.su-checkbox-box{align-items:center;background:var(--su-field-surface, transparent);border:2px solid var(--su-field-border, rgba(127, 127, 127, .5));border-radius:.375rem;box-sizing:border-box;display:inline-flex;flex-shrink:0;height:var(--su-checkbox-size, 1.25rem);justify-content:center;transition:background-color .18s ease,border-color .18s ease,scale .25s cubic-bezier(.34,1.56,.64,1);width:var(--su-checkbox-size, 1.25rem)}.su-checkbox-box svg{fill:none;height:80%;stroke:var(--su-checkbox-tick, #fff);stroke-linecap:round;stroke-linejoin:round;stroke-width:3.5;width:80%}.su-checkbox-tick,.su-checkbox-dash{stroke-dasharray:24;stroke-dashoffset:24;transition:stroke-dashoffset .22s ease-out 60ms}.su-checkbox:active input:not(:disabled)+.su-checkbox-box{scale:.86}.su-checkbox input:checked+.su-checkbox-box,.is-mixed .su-checkbox-box{background:var(--su-field-accent, #3b82f6);border-color:var(--su-field-accent, #3b82f6)}.su-checkbox input:checked+.su-checkbox-box .su-checkbox-tick,.is-mixed .su-checkbox-dash{stroke-dashoffset:0}.su-checkbox input:focus-visible+.su-checkbox-box{outline:2px solid var(--su-field-accent, #3b82f6);outline-offset:2px}.su-checkbox:has(input:disabled){cursor:not-allowed;opacity:.5}.su-checkbox-label:empty{display:none}@media(prefers-reduced-motion:reduce){.su-checkbox-box,.su-checkbox-tick,.su-checkbox-dash{transition:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
349
349
|
}
|
|
350
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
350
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuCheckboxComponent, decorators: [{
|
|
351
351
|
type: Component,
|
|
352
352
|
args: [{ selector: 'su-lib-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, template: "<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", styles: [":host{display:block}.su-checkbox{align-items:center;cursor:pointer;display:inline-flex;gap:.625rem}.su-checkbox input{height:1px;opacity:0;position:absolute;width:1px}.su-checkbox-box{align-items:center;background:var(--su-field-surface, transparent);border:2px solid var(--su-field-border, rgba(127, 127, 127, .5));border-radius:.375rem;box-sizing:border-box;display:inline-flex;flex-shrink:0;height:var(--su-checkbox-size, 1.25rem);justify-content:center;transition:background-color .18s ease,border-color .18s ease,scale .25s cubic-bezier(.34,1.56,.64,1);width:var(--su-checkbox-size, 1.25rem)}.su-checkbox-box svg{fill:none;height:80%;stroke:var(--su-checkbox-tick, #fff);stroke-linecap:round;stroke-linejoin:round;stroke-width:3.5;width:80%}.su-checkbox-tick,.su-checkbox-dash{stroke-dasharray:24;stroke-dashoffset:24;transition:stroke-dashoffset .22s ease-out 60ms}.su-checkbox:active input:not(:disabled)+.su-checkbox-box{scale:.86}.su-checkbox input:checked+.su-checkbox-box,.is-mixed .su-checkbox-box{background:var(--su-field-accent, #3b82f6);border-color:var(--su-field-accent, #3b82f6)}.su-checkbox input:checked+.su-checkbox-box .su-checkbox-tick,.is-mixed .su-checkbox-dash{stroke-dashoffset:0}.su-checkbox input:focus-visible+.su-checkbox-box{outline:2px solid var(--su-field-accent, #3b82f6);outline-offset:2px}.su-checkbox:has(input:disabled){cursor:not-allowed;opacity:.5}.su-checkbox-label:empty{display:none}@media(prefers-reduced-motion:reduce){.su-checkbox-box,.su-checkbox-tick,.su-checkbox-dash{transition:none}}\n"] }]
|
|
353
|
-
}] });
|
|
353
|
+
}], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], checkedChange: [{ type: i0.Output, args: ["checkedChange"] }] } });
|
|
354
354
|
|
|
355
355
|
/**
|
|
356
356
|
* Toggle chips to pick several options (or one, with `multiple` off): each is a button that pops a tick in when
|
|
357
357
|
* picked. `<su-lib-chips label="Categories" [options]="categories" [(value)]="picked" />`
|
|
358
358
|
*/
|
|
359
359
|
class SuChipsComponent {
|
|
360
|
-
options = input.required();
|
|
360
|
+
options = input.required(...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
361
361
|
/** The picked values, in the options' order */
|
|
362
|
-
value = model([]);
|
|
362
|
+
value = model([], ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
363
363
|
/** The group's name for screen readers */
|
|
364
|
-
label = input.required();
|
|
364
|
+
label = input.required(...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
365
365
|
/** Several can be picked; off, picking one replaces the other @default true */
|
|
366
|
-
multiple = input(true, { transform: booleanAttribute });
|
|
366
|
+
multiple = input(true, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
367
367
|
isPicked(value) {
|
|
368
368
|
return this.value().includes(value);
|
|
369
369
|
}
|
|
@@ -377,13 +377,13 @@ class SuChipsComponent {
|
|
|
377
377
|
: [...this.value(), option.value];
|
|
378
378
|
this.value.set(this.options().map((item) => item.value).filter((value) => picked.includes(value)));
|
|
379
379
|
}
|
|
380
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
381
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
380
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuChipsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
381
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.26", type: SuChipsComponent, isStandalone: true, selector: "su-lib-chips", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, ngImport: i0, template: "<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", styles: [":host{display:block}.su-chips{display:flex;flex-wrap:wrap;gap:var(--su-chips-gap, .5rem)}.su-chip{align-items:center;background:var(--su-field-surface, transparent);border:1px solid var(--su-field-border, rgba(127, 127, 127, .4));border-radius:9999px;color:var(--su-field-text, currentColor);cursor:pointer;display:inline-flex;font:inherit;font-size:.875rem;gap:0;padding:.35rem .85rem;transition:background-color .18s ease,border-color .18s ease,color .18s ease,gap .22s cubic-bezier(.34,1.56,.64,1),scale .22s cubic-bezier(.34,1.56,.64,1)}.su-chip:active:not(:disabled){scale:.94}.su-chip[aria-pressed=true]{background:color-mix(in srgb,var(--su-field-accent, #3b82f6) 14%,transparent);border-color:var(--su-field-accent, #3b82f6);gap:.35rem}.su-chip:focus-visible{outline:2px solid var(--su-field-accent, #3b82f6);outline-offset:2px}.su-chip:disabled{cursor:not-allowed;opacity:.5}.su-chip-tick{background:var(--su-field-accent, #3b82f6);height:.9rem;-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.5' 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.5' 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;scale:.3;transition:opacity .15s ease,scale .25s cubic-bezier(.34,1.56,.64,1),width .22s cubic-bezier(.34,1.56,.64,1);width:0}[aria-pressed=true] .su-chip-tick{opacity:1;scale:1;width:.9rem}@media(prefers-reduced-motion:reduce){.su-chip,.su-chip-tick{transition:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
382
382
|
}
|
|
383
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
383
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuChipsComponent, decorators: [{
|
|
384
384
|
type: Component,
|
|
385
|
-
args: [{ selector: 'su-lib-chips', changeDetection: ChangeDetectionStrategy.OnPush, template: "<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", styles: [":host{display:block}.su-chips{display:flex;flex-wrap:wrap;gap:var(--su-chips-gap, .5rem)}.su-chip{align-items:center;background:var(--su-field-surface, transparent);border:1px solid var(--su-field-border, rgba(127, 127, 127, .4));border-radius:9999px;color:var(--su-field-text, currentColor);cursor:pointer;display:inline-flex;font:inherit;font-size:.875rem;gap:0;padding:.35rem .85rem;transition:background-color .18s ease,border-color .18s ease,color .18s ease,gap .22s cubic-bezier(.34,1.56,.64,1),scale .22s cubic-bezier(.34,1.56,.64,1)}.su-chip:active:not(:disabled){scale:.94}.su-chip[aria-pressed=true]{background:color-mix(in srgb,var(--su-field-accent, #3b82f6) 14%,transparent);border-color:var(--su-field-accent, #3b82f6);gap:.35rem}.su-chip:focus-visible{outline:2px solid var(--su-field-accent, #3b82f6);outline-offset:2px}.su-chip:disabled{cursor:not-allowed;opacity:.5}.su-chip-tick{background:var(--su-field-accent, #3b82f6);height:.9rem;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.5' 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;scale:.3;transition:opacity .15s ease,scale .25s cubic-bezier(.34,1.56,.64,1),width .22s cubic-bezier(.34,1.56,.64,1);width:0}[aria-pressed=true] .su-chip-tick{opacity:1;scale:1;width:.9rem}@media(prefers-reduced-motion:reduce){.su-chip,.su-chip-tick{transition:none}}\n"] }]
|
|
386
|
-
}] });
|
|
385
|
+
args: [{ selector: 'su-lib-chips', changeDetection: ChangeDetectionStrategy.OnPush, template: "<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", styles: [":host{display:block}.su-chips{display:flex;flex-wrap:wrap;gap:var(--su-chips-gap, .5rem)}.su-chip{align-items:center;background:var(--su-field-surface, transparent);border:1px solid var(--su-field-border, rgba(127, 127, 127, .4));border-radius:9999px;color:var(--su-field-text, currentColor);cursor:pointer;display:inline-flex;font:inherit;font-size:.875rem;gap:0;padding:.35rem .85rem;transition:background-color .18s ease,border-color .18s ease,color .18s ease,gap .22s cubic-bezier(.34,1.56,.64,1),scale .22s cubic-bezier(.34,1.56,.64,1)}.su-chip:active:not(:disabled){scale:.94}.su-chip[aria-pressed=true]{background:color-mix(in srgb,var(--su-field-accent, #3b82f6) 14%,transparent);border-color:var(--su-field-accent, #3b82f6);gap:.35rem}.su-chip:focus-visible{outline:2px solid var(--su-field-accent, #3b82f6);outline-offset:2px}.su-chip:disabled{cursor:not-allowed;opacity:.5}.su-chip-tick{background:var(--su-field-accent, #3b82f6);height:.9rem;-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.5' 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.5' 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;scale:.3;transition:opacity .15s ease,scale .25s cubic-bezier(.34,1.56,.64,1),width .22s cubic-bezier(.34,1.56,.64,1);width:0}[aria-pressed=true] .su-chip-tick{opacity:1;scale:1;width:.9rem}@media(prefers-reduced-motion:reduce){.su-chip,.su-chip-tick{transition:none}}\n"] }]
|
|
386
|
+
}], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], 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 }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }] } });
|
|
387
387
|
|
|
388
388
|
/**
|
|
389
389
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"su-labs-fields.mjs","sources":["../../../../compat/angular-19/build/fields/src/lib/code-boxes/code-boxes.component.ts","../../../../compat/angular-19/build/fields/src/lib/code-boxes/code-boxes.component.html","../../../../compat/angular-19/build/fields/src/lib/strength-meter/password-strength.ts","../../../../compat/angular-19/build/fields/src/lib/strength-meter/strength-meter.component.ts","../../../../compat/angular-19/build/fields/src/lib/strength-meter/strength-meter.component.html","../../../../compat/angular-19/build/fields/src/lib/auto-grow/auto-grow.directive.ts","../../../../compat/angular-19/build/fields/src/lib/switch/switch.component.ts","../../../../compat/angular-19/build/fields/src/lib/switch/switch.component.html","../../../../compat/angular-19/build/fields/src/lib/email-field/email-check.ts","../../../../compat/angular-19/build/fields/src/lib/email-field/email-field.component.ts","../../../../compat/angular-19/build/fields/src/lib/email-field/email-field.component.html","../../../../compat/angular-19/build/fields/src/lib/checkbox/checkbox.component.ts","../../../../compat/angular-19/build/fields/src/lib/checkbox/checkbox.component.html","../../../../compat/angular-19/build/fields/src/lib/chips/chips.component.ts","../../../../compat/angular-19/build/fields/src/lib/chips/chips.component.html","../../../../compat/angular-19/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,CAAC;AACjB,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAU;AACjC,IAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAU;;AAEhC,IAAA,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC;AAEb,IAAA,KAAK,GAAG,QAAQ,CAAC,MAClC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE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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,49CAAA,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,49CAAA,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 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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,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": "
|
|
3
|
+
"version": "21.1.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",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"url": "https://github.com/Greezaaa/settings-utils-lib/issues"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@angular/common": "^
|
|
38
|
-
"@angular/core": "^
|
|
37
|
+
"@angular/common": "^21.0.0",
|
|
38
|
+
"@angular/core": "^21.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"tslib": "^2.3.0"
|
|
@@ -43,14 +43,15 @@
|
|
|
43
43
|
"sideEffects": false,
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"module": "fesm2022/su-labs-fields.mjs",
|
|
46
|
-
"typings": "
|
|
46
|
+
"typings": "types/su-labs-fields.d.ts",
|
|
47
47
|
"exports": {
|
|
48
48
|
"./package.json": {
|
|
49
49
|
"default": "./package.json"
|
|
50
50
|
},
|
|
51
51
|
".": {
|
|
52
|
-
"types": "./
|
|
52
|
+
"types": "./types/su-labs-fields.d.ts",
|
|
53
53
|
"default": "./fesm2022/su-labs-fields.mjs"
|
|
54
54
|
}
|
|
55
|
-
}
|
|
55
|
+
},
|
|
56
|
+
"type": "module"
|
|
56
57
|
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import * as _su_labs_fields from '@su-labs/fields';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 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.
|
|
6
|
+
* One real text field lies over the boxes, so typing, pasting, the phone keyboard and screen readers all work as usual.
|
|
7
|
+
*/
|
|
8
|
+
declare class SuCodeBoxesComponent {
|
|
9
|
+
readonly value: _angular_core.ModelSignal<string>;
|
|
10
|
+
readonly length: _angular_core.InputSignal<number>;
|
|
11
|
+
readonly label: _angular_core.InputSignal<string>;
|
|
12
|
+
/** The code is whole and well-formed: the boxes turn green */
|
|
13
|
+
readonly complete: _angular_core.InputSignal<boolean>;
|
|
14
|
+
protected readonly boxes: _angular_core.Signal<number[]>;
|
|
15
|
+
/** Capitals without spaces, never longer than the boxes */
|
|
16
|
+
protected onInput(field: HTMLInputElement): void;
|
|
17
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SuCodeBoxesComponent, never>;
|
|
18
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SuCodeBoxesComponent, "su-lib-code-boxes", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "length": { "alias": "length"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": true; "isSignal": true; }; "complete": { "alias": "complete"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** How strong a new password looks, one step per bar of the meter */
|
|
22
|
+
declare const SU_STRENGTH_LEVELS: readonly ["weak", "fair", "good", "strong"];
|
|
23
|
+
type SuStrengthLevel = (typeof SU_STRENGTH_LEVELS)[number];
|
|
24
|
+
/** Shortest password the meter counts as more than weak, unless told otherwise */
|
|
25
|
+
declare const SU_DEFAULT_MIN_PASSWORD_LENGTH = 8;
|
|
26
|
+
/**
|
|
27
|
+
* Bars of the strength meter a password fills, from 0 (empty) to 4. Under the minimum length it stays at one bar,
|
|
28
|
+
* whatever else it has. Then one bar each for: four characters past the minimum, letters with digits, and symbols or
|
|
29
|
+
* mixed case.
|
|
30
|
+
*/
|
|
31
|
+
declare function suPasswordStrength(password: string, minLength?: number): number;
|
|
32
|
+
/** The meter's word for a number of bars, or null for an empty password */
|
|
33
|
+
declare const suStrengthLevel: (bars: number) => SuStrengthLevel | null;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Four bars under a new password that fill, and change colour, as the password gets stronger. It follows the field's
|
|
37
|
+
* own typing, so forms keep their plain fields; a form that empties the field by code sends it an `input` event.
|
|
38
|
+
* Its texts come in as inputs, so it fits any language.
|
|
39
|
+
*/
|
|
40
|
+
declare class SuStrengthMeterComponent {
|
|
41
|
+
readonly field: _angular_core.InputSignal<HTMLInputElement>;
|
|
42
|
+
/** The meter's name for screen readers, e.g. "Password strength" */
|
|
43
|
+
readonly label: _angular_core.InputSignal<string>;
|
|
44
|
+
/** The word shown for each step */
|
|
45
|
+
readonly levelNames: _angular_core.InputSignal<Readonly<Record<"weak" | "fair" | "good" | "strong", string>>>;
|
|
46
|
+
readonly minLength: _angular_core.InputSignal<number>;
|
|
47
|
+
private readonly password;
|
|
48
|
+
protected readonly steps: readonly ["weak", "fair", "good", "strong"];
|
|
49
|
+
protected readonly bars: _angular_core.Signal<number>;
|
|
50
|
+
protected readonly level: _angular_core.Signal<"weak" | "fair" | "good" | "strong" | null>;
|
|
51
|
+
protected readonly levelName: _angular_core.Signal<string | null>;
|
|
52
|
+
constructor();
|
|
53
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SuStrengthMeterComponent, never>;
|
|
54
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SuStrengthMeterComponent, "su-lib-strength-meter", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": true; "isSignal": true; }; "levelNames": { "alias": "levelNames"; "required": true; "isSignal": true; }; "minLength": { "alias": "minLength"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 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
|
|
59
|
+
* spring (none for visitors who asked their device for less motion). `[suAutoGrow]="false"` leaves it as it is.
|
|
60
|
+
*/
|
|
61
|
+
declare class SuAutoGrowDirective {
|
|
62
|
+
readonly isOn: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
63
|
+
private readonly box;
|
|
64
|
+
constructor();
|
|
65
|
+
protected fit(): void;
|
|
66
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SuAutoGrowDirective, never>;
|
|
67
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<SuAutoGrowDirective, "textarea[suAutoGrow]", never, { "isOn": { "alias": "suAutoGrow"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Where the label sits: after the switch, or before it with the switch at the end of the row */
|
|
71
|
+
type SuSwitchLabelPosition = 'start' | 'end';
|
|
72
|
+
type SuSwitchSize = 'small' | 'medium';
|
|
73
|
+
/**
|
|
74
|
+
* A real checkbox (`role="switch"`) drawn as a sliding switch: the knob stretches while pressed, springs across and a
|
|
75
|
+
* tick pops in when it's on. Put the label inside: `<su-lib-switch [(checked)]="on">Reduce motion</su-lib-switch>`.
|
|
76
|
+
*
|
|
77
|
+
* It shows a click at once and follows `checked` whenever it changes. While `busy` (e.g. saving the change) it ignores
|
|
78
|
+
* clicks, and once no longer busy it shows `checked` again, so a change that failed to save flips back.
|
|
79
|
+
*/
|
|
80
|
+
declare class SuSwitchComponent {
|
|
81
|
+
readonly checked: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
82
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
83
|
+
/** Busy saving the change: clicks are ignored, and `aria-busy` is set */
|
|
84
|
+
readonly busy: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
85
|
+
/** @default 'end' */
|
|
86
|
+
readonly labelPosition: _angular_core.InputSignal<SuSwitchLabelPosition>;
|
|
87
|
+
/** @default 'medium' */
|
|
88
|
+
readonly size: _angular_core.InputSignal<SuSwitchSize>;
|
|
89
|
+
/** Switched by the user: the new value */
|
|
90
|
+
readonly checkedChange: _angular_core.OutputEmitterRef<boolean>;
|
|
91
|
+
protected readonly shown: _angular_core.WritableSignal<boolean>;
|
|
92
|
+
constructor();
|
|
93
|
+
protected onClick(event: MouseEvent): void;
|
|
94
|
+
protected onChange(event: Event): void;
|
|
95
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SuSwitchComponent, never>;
|
|
96
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SuSwitchComponent, "su-lib-switch", never, { "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "busy": { "alias": "busy"; "required": false; "isSignal": true; }; "labelPosition": { "alias": "labelPosition"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, { "checkedChange": "checkedChange"; }, never, ["*"], true, never>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** What's wrong with an email address, in the order it's checked */
|
|
100
|
+
type SuEmailProblem = 'empty' | 'spaces' | 'at' | 'name' | 'domain' | 'dot' | 'ending';
|
|
101
|
+
/** The outcome of `suCheckEmail` */
|
|
102
|
+
interface SuEmailCheck {
|
|
103
|
+
readonly valid: boolean;
|
|
104
|
+
readonly problem: SuEmailProblem | null;
|
|
105
|
+
/** The address with a common domain in place of a likely typo, e.g. `jo@gmail.com` for `jo@gmial.com`, or null */
|
|
106
|
+
readonly suggestion: string | null;
|
|
107
|
+
}
|
|
108
|
+
/** Domains `suCheckEmail` suggests when one is mistyped */
|
|
109
|
+
declare const SU_COMMON_EMAIL_DOMAINS: readonly string[];
|
|
110
|
+
/**
|
|
111
|
+
* Checks an email address the way people mistype them: empty, spaces, not exactly one @, nothing before or after it,
|
|
112
|
+
* a domain without a proper dot, or an ending shorter than two letters. It also suggests a common domain for a
|
|
113
|
+
* likely typo (`gmial.com` → `gmail.com`), even when the address is otherwise valid.
|
|
114
|
+
*/
|
|
115
|
+
declare function suCheckEmail(value: string, domains?: readonly string[]): SuEmailCheck;
|
|
116
|
+
|
|
117
|
+
/** The field's texts, e.g. in the page's language */
|
|
118
|
+
interface SuEmailMessages extends Readonly<Record<SuEmailProblem, string>> {
|
|
119
|
+
/** Before a suggested address: "Did you mean jo@gmail.com?" */
|
|
120
|
+
readonly suggestion: string;
|
|
121
|
+
}
|
|
122
|
+
declare const SU_EMAIL_MESSAGES: SuEmailMessages;
|
|
123
|
+
/**
|
|
124
|
+
* An email field that checks the address the way people mistype it, and suggests a common domain for a likely typo
|
|
125
|
+
* (`gmial.com` → `gmail.com`, applied with one tap). It stays quiet while typing and says what's wrong once the field
|
|
126
|
+
* is left; a tick shows when the address looks right.
|
|
127
|
+
*/
|
|
128
|
+
declare class SuEmailFieldComponent {
|
|
129
|
+
readonly value: _angular_core.ModelSignal<string>;
|
|
130
|
+
/** The visible label */
|
|
131
|
+
readonly label: _angular_core.InputSignal<string>;
|
|
132
|
+
readonly placeholder: _angular_core.InputSignal<string | undefined>;
|
|
133
|
+
/** An empty field counts as a problem @default false */
|
|
134
|
+
readonly required: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
135
|
+
readonly messages: _angular_core.InputSignal<Partial<SuEmailMessages>>;
|
|
136
|
+
/** Domains to suggest when one is mistyped */
|
|
137
|
+
readonly domains: _angular_core.InputSignal<readonly string[]>;
|
|
138
|
+
/** Whether the address is valid, on every change */
|
|
139
|
+
readonly validityChange: _angular_core.OutputEmitterRef<boolean>;
|
|
140
|
+
protected readonly id: string;
|
|
141
|
+
protected readonly touched: _angular_core.WritableSignal<boolean>;
|
|
142
|
+
protected readonly check: _angular_core.Signal<_su_labs_fields.SuEmailCheck>;
|
|
143
|
+
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 */
|
|
145
|
+
protected readonly problem: _angular_core.Signal<"empty" | "spaces" | "at" | "name" | "domain" | "dot" | "ending" | null>;
|
|
146
|
+
constructor();
|
|
147
|
+
protected onInput(event: Event): void;
|
|
148
|
+
protected apply(suggestion: string): void;
|
|
149
|
+
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>;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* A real checkbox whose tick draws itself in, with a small squash when pressed and a dash when partly checked. Put the
|
|
155
|
+
* label inside: `<su-lib-checkbox [(checked)]="agree">I agree</su-lib-checkbox>`.
|
|
156
|
+
*/
|
|
157
|
+
declare class SuCheckboxComponent {
|
|
158
|
+
readonly checked: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
159
|
+
/** Partly checked, e.g. some of a group; a click checks it */
|
|
160
|
+
readonly indeterminate: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
161
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
162
|
+
/** Ticked or unticked by the user: the new value */
|
|
163
|
+
readonly checkedChange: _angular_core.OutputEmitterRef<boolean>;
|
|
164
|
+
protected readonly shown: _angular_core.WritableSignal<boolean>;
|
|
165
|
+
protected onChange(event: Event): void;
|
|
166
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SuCheckboxComponent, never>;
|
|
167
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SuCheckboxComponent, "su-lib-checkbox", never, { "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "indeterminate": { "alias": "indeterminate"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "checkedChange": "checkedChange"; }, never, ["*"], true, never>;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** One chip: the value it stands for and its text */
|
|
171
|
+
interface SuChipOption<TValue extends string> {
|
|
172
|
+
readonly value: TValue;
|
|
173
|
+
readonly label: string;
|
|
174
|
+
readonly disabled?: boolean;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Toggle chips to pick several options (or one, with `multiple` off): each is a button that pops a tick in when
|
|
178
|
+
* picked. `<su-lib-chips label="Categories" [options]="categories" [(value)]="picked" />`
|
|
179
|
+
*/
|
|
180
|
+
declare class SuChipsComponent<TValue extends string> {
|
|
181
|
+
readonly options: _angular_core.InputSignal<readonly SuChipOption<TValue>[]>;
|
|
182
|
+
/** The picked values, in the options' order */
|
|
183
|
+
readonly value: _angular_core.ModelSignal<readonly TValue[]>;
|
|
184
|
+
/** The group's name for screen readers */
|
|
185
|
+
readonly label: _angular_core.InputSignal<string>;
|
|
186
|
+
/** Several can be picked; off, picking one replaces the other @default true */
|
|
187
|
+
readonly multiple: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
188
|
+
protected isPicked(value: TValue): boolean;
|
|
189
|
+
protected toggle(option: SuChipOption<TValue>): void;
|
|
190
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SuChipsComponent<any>, never>;
|
|
191
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SuChipsComponent<any>, "su-lib-chips", never, { "options": { "alias": "options"; "required": true; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": true; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export { SU_COMMON_EMAIL_DOMAINS, SU_DEFAULT_MIN_PASSWORD_LENGTH, SU_EMAIL_MESSAGES, SU_STRENGTH_LEVELS, SuAutoGrowDirective, SuCheckboxComponent, SuChipsComponent, SuCodeBoxesComponent, SuEmailFieldComponent, SuStrengthMeterComponent, SuSwitchComponent, suCheckEmail, suPasswordStrength, suStrengthLevel };
|
|
195
|
+
export type { SuChipOption, SuEmailCheck, SuEmailMessages, SuEmailProblem, SuStrengthLevel, SuSwitchLabelPosition, SuSwitchSize };
|
package/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
/**
|
|
3
|
-
* 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
|
|
4
|
-
* spring (none for visitors who asked their device for less motion). `[suAutoGrow]="false"` leaves it as it is.
|
|
5
|
-
*/
|
|
6
|
-
export declare class SuAutoGrowDirective {
|
|
7
|
-
readonly isOn: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
8
|
-
private readonly box;
|
|
9
|
-
constructor();
|
|
10
|
-
protected fit(): void;
|
|
11
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SuAutoGrowDirective, never>;
|
|
12
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<SuAutoGrowDirective, "textarea[suAutoGrow]", never, { "isOn": { "alias": "suAutoGrow"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
13
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
/**
|
|
3
|
-
* A real checkbox whose tick draws itself in, with a small squash when pressed and a dash when partly checked. Put the
|
|
4
|
-
* label inside: `<su-lib-checkbox [(checked)]="agree">I agree</su-lib-checkbox>`.
|
|
5
|
-
*/
|
|
6
|
-
export declare class SuCheckboxComponent {
|
|
7
|
-
readonly checked: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
8
|
-
/** Partly checked, e.g. some of a group; a click checks it */
|
|
9
|
-
readonly indeterminate: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
10
|
-
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
11
|
-
/** Ticked or unticked by the user: the new value */
|
|
12
|
-
readonly checkedChange: import("@angular/core").OutputEmitterRef<boolean>;
|
|
13
|
-
protected readonly shown: import("@angular/core").WritableSignal<boolean>;
|
|
14
|
-
protected onChange(event: Event): void;
|
|
15
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SuCheckboxComponent, never>;
|
|
16
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SuCheckboxComponent, "su-lib-checkbox", never, { "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "indeterminate": { "alias": "indeterminate"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "checkedChange": "checkedChange"; }, never, ["*"], true, never>;
|
|
17
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
/** One chip: the value it stands for and its text */
|
|
3
|
-
export interface SuChipOption<TValue extends string> {
|
|
4
|
-
readonly value: TValue;
|
|
5
|
-
readonly label: string;
|
|
6
|
-
readonly disabled?: boolean;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Toggle chips to pick several options (or one, with `multiple` off): each is a button that pops a tick in when
|
|
10
|
-
* picked. `<su-lib-chips label="Categories" [options]="categories" [(value)]="picked" />`
|
|
11
|
-
*/
|
|
12
|
-
export declare class SuChipsComponent<TValue extends string> {
|
|
13
|
-
readonly options: import("@angular/core").InputSignal<readonly SuChipOption<TValue>[]>;
|
|
14
|
-
/** The picked values, in the options' order */
|
|
15
|
-
readonly value: import("@angular/core").ModelSignal<readonly TValue[]>;
|
|
16
|
-
/** The group's name for screen readers */
|
|
17
|
-
readonly label: import("@angular/core").InputSignal<string>;
|
|
18
|
-
/** Several can be picked; off, picking one replaces the other @default true */
|
|
19
|
-
readonly multiple: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
20
|
-
protected isPicked(value: TValue): boolean;
|
|
21
|
-
protected toggle(option: SuChipOption<TValue>): void;
|
|
22
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SuChipsComponent<any>, never>;
|
|
23
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SuChipsComponent<any>, "su-lib-chips", never, { "options": { "alias": "options"; "required": true; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": true; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
24
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
/**
|
|
3
|
-
* 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.
|
|
4
|
-
* One real text field lies over the boxes, so typing, pasting, the phone keyboard and screen readers all work as usual.
|
|
5
|
-
*/
|
|
6
|
-
export declare class SuCodeBoxesComponent {
|
|
7
|
-
readonly value: import("@angular/core").ModelSignal<string>;
|
|
8
|
-
readonly length: import("@angular/core").InputSignal<number>;
|
|
9
|
-
readonly label: import("@angular/core").InputSignal<string>;
|
|
10
|
-
/** The code is whole and well-formed: the boxes turn green */
|
|
11
|
-
readonly complete: import("@angular/core").InputSignal<boolean>;
|
|
12
|
-
protected readonly boxes: import("@angular/core").Signal<number[]>;
|
|
13
|
-
/** Capitals without spaces, never longer than the boxes */
|
|
14
|
-
protected onInput(field: HTMLInputElement): void;
|
|
15
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SuCodeBoxesComponent, never>;
|
|
16
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SuCodeBoxesComponent, "su-lib-code-boxes", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "length": { "alias": "length"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": true; "isSignal": true; }; "complete": { "alias": "complete"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
17
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** What's wrong with an email address, in the order it's checked */
|
|
2
|
-
export type SuEmailProblem = 'empty' | 'spaces' | 'at' | 'name' | 'domain' | 'dot' | 'ending';
|
|
3
|
-
/** The outcome of `suCheckEmail` */
|
|
4
|
-
export interface SuEmailCheck {
|
|
5
|
-
readonly valid: boolean;
|
|
6
|
-
readonly problem: SuEmailProblem | null;
|
|
7
|
-
/** The address with a common domain in place of a likely typo, e.g. `jo@gmail.com` for `jo@gmial.com`, or null */
|
|
8
|
-
readonly suggestion: string | null;
|
|
9
|
-
}
|
|
10
|
-
/** Domains `suCheckEmail` suggests when one is mistyped */
|
|
11
|
-
export declare const SU_COMMON_EMAIL_DOMAINS: readonly string[];
|
|
12
|
-
/**
|
|
13
|
-
* Checks an email address the way people mistype them: empty, spaces, not exactly one @, nothing before or after it,
|
|
14
|
-
* a domain without a proper dot, or an ending shorter than two letters. It also suggests a common domain for a
|
|
15
|
-
* likely typo (`gmial.com` → `gmail.com`), even when the address is otherwise valid.
|
|
16
|
-
*/
|
|
17
|
-
export declare function suCheckEmail(value: string, domains?: readonly string[]): SuEmailCheck;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { SuEmailProblem } from './email-check';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/** The field's texts, e.g. in the page's language */
|
|
4
|
-
export interface SuEmailMessages extends Readonly<Record<SuEmailProblem, string>> {
|
|
5
|
-
/** Before a suggested address: "Did you mean jo@gmail.com?" */
|
|
6
|
-
readonly suggestion: string;
|
|
7
|
-
}
|
|
8
|
-
export declare const SU_EMAIL_MESSAGES: SuEmailMessages;
|
|
9
|
-
/**
|
|
10
|
-
* An email field that checks the address the way people mistype it, and suggests a common domain for a likely typo
|
|
11
|
-
* (`gmial.com` → `gmail.com`, applied with one tap). It stays quiet while typing and says what's wrong once the field
|
|
12
|
-
* is left; a tick shows when the address looks right.
|
|
13
|
-
*/
|
|
14
|
-
export declare class SuEmailFieldComponent {
|
|
15
|
-
readonly value: import("@angular/core").ModelSignal<string>;
|
|
16
|
-
/** The visible label */
|
|
17
|
-
readonly label: import("@angular/core").InputSignal<string>;
|
|
18
|
-
readonly placeholder: import("@angular/core").InputSignal<string | undefined>;
|
|
19
|
-
/** An empty field counts as a problem @default false */
|
|
20
|
-
readonly required: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
21
|
-
readonly messages: import("@angular/core").InputSignal<Partial<SuEmailMessages>>;
|
|
22
|
-
/** Domains to suggest when one is mistyped */
|
|
23
|
-
readonly domains: import("@angular/core").InputSignal<readonly string[]>;
|
|
24
|
-
/** Whether the address is valid, on every change */
|
|
25
|
-
readonly validityChange: import("@angular/core").OutputEmitterRef<boolean>;
|
|
26
|
-
protected readonly id: string;
|
|
27
|
-
protected readonly touched: import("@angular/core").WritableSignal<boolean>;
|
|
28
|
-
protected readonly check: import("@angular/core").Signal<import("@su-labs/fields").SuEmailCheck>;
|
|
29
|
-
protected readonly text: import("@angular/core").Signal<SuEmailMessages>;
|
|
30
|
-
/** The problem to show: only once the field was left, and an empty field only when it's required */
|
|
31
|
-
protected readonly problem: import("@angular/core").Signal<"empty" | "spaces" | "at" | "name" | "domain" | "dot" | "ending" | null>;
|
|
32
|
-
constructor();
|
|
33
|
-
protected onInput(event: Event): void;
|
|
34
|
-
protected apply(suggestion: string): void;
|
|
35
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SuEmailFieldComponent, never>;
|
|
36
|
-
static ɵcmp: i0.ɵɵ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>;
|
|
37
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** How strong a new password looks, one step per bar of the meter */
|
|
2
|
-
export declare const SU_STRENGTH_LEVELS: readonly ["weak", "fair", "good", "strong"];
|
|
3
|
-
export type SuStrengthLevel = (typeof SU_STRENGTH_LEVELS)[number];
|
|
4
|
-
/** Shortest password the meter counts as more than weak, unless told otherwise */
|
|
5
|
-
export declare const SU_DEFAULT_MIN_PASSWORD_LENGTH = 8;
|
|
6
|
-
/**
|
|
7
|
-
* Bars of the strength meter a password fills, from 0 (empty) to 4. Under the minimum length it stays at one bar,
|
|
8
|
-
* whatever else it has. Then one bar each for: four characters past the minimum, letters with digits, and symbols or
|
|
9
|
-
* mixed case.
|
|
10
|
-
*/
|
|
11
|
-
export declare function suPasswordStrength(password: string, minLength?: number): number;
|
|
12
|
-
/** The meter's word for a number of bars, or null for an empty password */
|
|
13
|
-
export declare const suStrengthLevel: (bars: number) => SuStrengthLevel | null;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
/**
|
|
3
|
-
* Four bars under a new password that fill, and change colour, as the password gets stronger. It follows the field's
|
|
4
|
-
* own typing, so forms keep their plain fields; a form that empties the field by code sends it an `input` event.
|
|
5
|
-
* Its texts come in as inputs, so it fits any language.
|
|
6
|
-
*/
|
|
7
|
-
export declare class SuStrengthMeterComponent {
|
|
8
|
-
readonly field: import("@angular/core").InputSignal<HTMLInputElement>;
|
|
9
|
-
/** The meter's name for screen readers, e.g. "Password strength" */
|
|
10
|
-
readonly label: import("@angular/core").InputSignal<string>;
|
|
11
|
-
/** The word shown for each step */
|
|
12
|
-
readonly levelNames: import("@angular/core").InputSignal<Readonly<Record<"weak" | "fair" | "good" | "strong", string>>>;
|
|
13
|
-
readonly minLength: import("@angular/core").InputSignal<number>;
|
|
14
|
-
private readonly password;
|
|
15
|
-
protected readonly steps: readonly ["weak", "fair", "good", "strong"];
|
|
16
|
-
protected readonly bars: import("@angular/core").Signal<number>;
|
|
17
|
-
protected readonly level: import("@angular/core").Signal<"weak" | "fair" | "good" | "strong" | null>;
|
|
18
|
-
protected readonly levelName: import("@angular/core").Signal<string | null>;
|
|
19
|
-
constructor();
|
|
20
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SuStrengthMeterComponent, never>;
|
|
21
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SuStrengthMeterComponent, "su-lib-strength-meter", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": true; "isSignal": true; }; "levelNames": { "alias": "levelNames"; "required": true; "isSignal": true; }; "minLength": { "alias": "minLength"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
22
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
/** Where the label sits: after the switch, or before it with the switch at the end of the row */
|
|
3
|
-
export type SuSwitchLabelPosition = 'start' | 'end';
|
|
4
|
-
export type SuSwitchSize = 'small' | 'medium';
|
|
5
|
-
/**
|
|
6
|
-
* A real checkbox (`role="switch"`) drawn as a sliding switch: the knob stretches while pressed, springs across and a
|
|
7
|
-
* tick pops in when it's on. Put the label inside: `<su-lib-switch [(checked)]="on">Reduce motion</su-lib-switch>`.
|
|
8
|
-
*
|
|
9
|
-
* It shows a click at once and follows `checked` whenever it changes. While `busy` (e.g. saving the change) it ignores
|
|
10
|
-
* clicks, and once no longer busy it shows `checked` again, so a change that failed to save flips back.
|
|
11
|
-
*/
|
|
12
|
-
export declare class SuSwitchComponent {
|
|
13
|
-
readonly checked: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
14
|
-
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
15
|
-
/** Busy saving the change: clicks are ignored, and `aria-busy` is set */
|
|
16
|
-
readonly busy: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
17
|
-
/** @default 'end' */
|
|
18
|
-
readonly labelPosition: import("@angular/core").InputSignal<SuSwitchLabelPosition>;
|
|
19
|
-
/** @default 'medium' */
|
|
20
|
-
readonly size: import("@angular/core").InputSignal<SuSwitchSize>;
|
|
21
|
-
/** Switched by the user: the new value */
|
|
22
|
-
readonly checkedChange: import("@angular/core").OutputEmitterRef<boolean>;
|
|
23
|
-
protected readonly shown: import("@angular/core").WritableSignal<boolean>;
|
|
24
|
-
constructor();
|
|
25
|
-
protected onClick(event: MouseEvent): void;
|
|
26
|
-
protected onChange(event: Event): void;
|
|
27
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SuSwitchComponent, never>;
|
|
28
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SuSwitchComponent, "su-lib-switch", never, { "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "busy": { "alias": "busy"; "required": false; "isSignal": true; }; "labelPosition": { "alias": "labelPosition"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, { "checkedChange": "checkedChange"; }, never, ["*"], true, never>;
|
|
29
|
-
}
|
package/public-api.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './lib/code-boxes/code-boxes.component';
|
|
2
|
-
export * from './lib/strength-meter/password-strength';
|
|
3
|
-
export * from './lib/strength-meter/strength-meter.component';
|
|
4
|
-
export * from './lib/auto-grow/auto-grow.directive';
|
|
5
|
-
export * from './lib/switch/switch.component';
|
|
6
|
-
export * from './lib/email-field/email-check';
|
|
7
|
-
export * from './lib/email-field/email-field.component';
|
|
8
|
-
export * from './lib/checkbox/checkbox.component';
|
|
9
|
-
export * from './lib/chips/chips.component';
|