@su-labs/fields 0.0.0-stage → 22.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/CHANGELOG.md +23 -0
- package/LICENSE +21 -0
- package/README.md +171 -2
- package/fesm2022/su-labs-fields.mjs +963 -0
- package/fesm2022/su-labs-fields.mjs.map +1 -0
- package/package.json +54 -3
- package/types/su-labs-fields.d.ts +335 -0
|
@@ -0,0 +1,963 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, afterNextRender, booleanAttribute, computed, effect, inject, input, linkedSignal, model, output, signal, untracked } from "@angular/core";
|
|
3
|
+
var SuCodeBoxesComponent = class SuCodeBoxesComponent {
|
|
4
|
+
value = model("", ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
5
|
+
length = input.required(...ngDevMode ? [{ debugName: "length" }] : /* istanbul ignore next */ []);
|
|
6
|
+
label = input.required(...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
7
|
+
complete = input(false, ...ngDevMode ? [{ debugName: "complete" }] : /* istanbul ignore next */ []);
|
|
8
|
+
boxes = computed(() => Array.from({ length: this.length() }, (_, index) => index), ...ngDevMode ? [{ debugName: "boxes" }] : /* istanbul ignore next */ []);
|
|
9
|
+
onInput(field) {
|
|
10
|
+
const code = field.value.replace(/\s/g, "").toUpperCase().slice(0, this.length());
|
|
11
|
+
field.value = code;
|
|
12
|
+
this.value.set(code);
|
|
13
|
+
}
|
|
14
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
15
|
+
minVersion: "12.0.0",
|
|
16
|
+
version: "22.2.4",
|
|
17
|
+
ngImport: i0,
|
|
18
|
+
type: SuCodeBoxesComponent,
|
|
19
|
+
deps: [],
|
|
20
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
21
|
+
});
|
|
22
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
23
|
+
minVersion: "17.0.0",
|
|
24
|
+
version: "22.2.4",
|
|
25
|
+
type: SuCodeBoxesComponent,
|
|
26
|
+
isStandalone: true,
|
|
27
|
+
selector: "su-lib-code-boxes",
|
|
28
|
+
inputs: {
|
|
29
|
+
value: {
|
|
30
|
+
classPropertyName: "value",
|
|
31
|
+
publicName: "value",
|
|
32
|
+
isSignal: true,
|
|
33
|
+
isRequired: false,
|
|
34
|
+
transformFunction: null
|
|
35
|
+
},
|
|
36
|
+
length: {
|
|
37
|
+
classPropertyName: "length",
|
|
38
|
+
publicName: "length",
|
|
39
|
+
isSignal: true,
|
|
40
|
+
isRequired: true,
|
|
41
|
+
transformFunction: null
|
|
42
|
+
},
|
|
43
|
+
label: {
|
|
44
|
+
classPropertyName: "label",
|
|
45
|
+
publicName: "label",
|
|
46
|
+
isSignal: true,
|
|
47
|
+
isRequired: true,
|
|
48
|
+
transformFunction: null
|
|
49
|
+
},
|
|
50
|
+
complete: {
|
|
51
|
+
classPropertyName: "complete",
|
|
52
|
+
publicName: "complete",
|
|
53
|
+
isSignal: true,
|
|
54
|
+
isRequired: false,
|
|
55
|
+
transformFunction: null
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
outputs: { value: "valueChange" },
|
|
59
|
+
ngImport: i0,
|
|
60
|
+
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",
|
|
61
|
+
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"],
|
|
62
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
66
|
+
minVersion: "12.0.0",
|
|
67
|
+
version: "22.2.4",
|
|
68
|
+
ngImport: i0,
|
|
69
|
+
type: SuCodeBoxesComponent,
|
|
70
|
+
decorators: [{
|
|
71
|
+
type: Component,
|
|
72
|
+
args: [{
|
|
73
|
+
selector: "su-lib-code-boxes",
|
|
74
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
75
|
+
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",
|
|
76
|
+
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"]
|
|
77
|
+
}]
|
|
78
|
+
}],
|
|
79
|
+
propDecorators: {
|
|
80
|
+
value: [{
|
|
81
|
+
type: i0.Input,
|
|
82
|
+
args: [{
|
|
83
|
+
isSignal: true,
|
|
84
|
+
alias: "value",
|
|
85
|
+
required: false
|
|
86
|
+
}]
|
|
87
|
+
}, {
|
|
88
|
+
type: i0.Output,
|
|
89
|
+
args: ["valueChange"]
|
|
90
|
+
}],
|
|
91
|
+
length: [{
|
|
92
|
+
type: i0.Input,
|
|
93
|
+
args: [{
|
|
94
|
+
isSignal: true,
|
|
95
|
+
alias: "length",
|
|
96
|
+
required: true
|
|
97
|
+
}]
|
|
98
|
+
}],
|
|
99
|
+
label: [{
|
|
100
|
+
type: i0.Input,
|
|
101
|
+
args: [{
|
|
102
|
+
isSignal: true,
|
|
103
|
+
alias: "label",
|
|
104
|
+
required: true
|
|
105
|
+
}]
|
|
106
|
+
}],
|
|
107
|
+
complete: [{
|
|
108
|
+
type: i0.Input,
|
|
109
|
+
args: [{
|
|
110
|
+
isSignal: true,
|
|
111
|
+
alias: "complete",
|
|
112
|
+
required: false
|
|
113
|
+
}]
|
|
114
|
+
}]
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
const SU_STRENGTH_LEVELS = [
|
|
118
|
+
"weak",
|
|
119
|
+
"fair",
|
|
120
|
+
"good",
|
|
121
|
+
"strong"
|
|
122
|
+
];
|
|
123
|
+
const SU_DEFAULT_MIN_PASSWORD_LENGTH = 8;
|
|
124
|
+
function suPasswordStrength(password, minLength = 8) {
|
|
125
|
+
if (password.length === 0) return 0;
|
|
126
|
+
if (password.length < minLength) return 1;
|
|
127
|
+
return 1 + [
|
|
128
|
+
password.length >= minLength + 4,
|
|
129
|
+
/\p{L}/u.test(password) && /\d/.test(password),
|
|
130
|
+
/[^\p{L}\d]/u.test(password) || /\p{Lu}/u.test(password) && /\p{Ll}/u.test(password)
|
|
131
|
+
].filter(Boolean).length;
|
|
132
|
+
}
|
|
133
|
+
const suStrengthLevel = (bars) => SU_STRENGTH_LEVELS[bars - 1] ?? null;
|
|
134
|
+
var SuStrengthMeterComponent = class SuStrengthMeterComponent {
|
|
135
|
+
field = input.required(...ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []);
|
|
136
|
+
label = input.required(...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
137
|
+
levelNames = input.required(...ngDevMode ? [{ debugName: "levelNames" }] : /* istanbul ignore next */ []);
|
|
138
|
+
minLength = input(8, ...ngDevMode ? [{ debugName: "minLength" }] : /* istanbul ignore next */ []);
|
|
139
|
+
password = signal("", ...ngDevMode ? [{ debugName: "password" }] : /* istanbul ignore next */ []);
|
|
140
|
+
steps = SU_STRENGTH_LEVELS;
|
|
141
|
+
bars = computed(() => suPasswordStrength(this.password(), this.minLength()), ...ngDevMode ? [{ debugName: "bars" }] : /* istanbul ignore next */ []);
|
|
142
|
+
level = computed(() => suStrengthLevel(this.bars()), ...ngDevMode ? [{ debugName: "level" }] : /* istanbul ignore next */ []);
|
|
143
|
+
levelName = computed(() => {
|
|
144
|
+
const level = this.level();
|
|
145
|
+
return level ? this.levelNames()[level] : null;
|
|
146
|
+
}, ...ngDevMode ? [{ debugName: "levelName" }] : /* istanbul ignore next */ []);
|
|
147
|
+
constructor() {
|
|
148
|
+
effect((onCleanup) => {
|
|
149
|
+
const field = this.field();
|
|
150
|
+
const read = () => this.password.set(field.value);
|
|
151
|
+
read();
|
|
152
|
+
field.addEventListener("input", read);
|
|
153
|
+
onCleanup(() => field.removeEventListener("input", read));
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
157
|
+
minVersion: "12.0.0",
|
|
158
|
+
version: "22.2.4",
|
|
159
|
+
ngImport: i0,
|
|
160
|
+
type: SuStrengthMeterComponent,
|
|
161
|
+
deps: [],
|
|
162
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
163
|
+
});
|
|
164
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
165
|
+
minVersion: "17.0.0",
|
|
166
|
+
version: "22.2.4",
|
|
167
|
+
type: SuStrengthMeterComponent,
|
|
168
|
+
isStandalone: true,
|
|
169
|
+
selector: "su-lib-strength-meter",
|
|
170
|
+
inputs: {
|
|
171
|
+
field: {
|
|
172
|
+
classPropertyName: "field",
|
|
173
|
+
publicName: "field",
|
|
174
|
+
isSignal: true,
|
|
175
|
+
isRequired: true,
|
|
176
|
+
transformFunction: null
|
|
177
|
+
},
|
|
178
|
+
label: {
|
|
179
|
+
classPropertyName: "label",
|
|
180
|
+
publicName: "label",
|
|
181
|
+
isSignal: true,
|
|
182
|
+
isRequired: true,
|
|
183
|
+
transformFunction: null
|
|
184
|
+
},
|
|
185
|
+
levelNames: {
|
|
186
|
+
classPropertyName: "levelNames",
|
|
187
|
+
publicName: "levelNames",
|
|
188
|
+
isSignal: true,
|
|
189
|
+
isRequired: true,
|
|
190
|
+
transformFunction: null
|
|
191
|
+
},
|
|
192
|
+
minLength: {
|
|
193
|
+
classPropertyName: "minLength",
|
|
194
|
+
publicName: "minLength",
|
|
195
|
+
isSignal: true,
|
|
196
|
+
isRequired: false,
|
|
197
|
+
transformFunction: null
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
ngImport: i0,
|
|
201
|
+
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",
|
|
202
|
+
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"],
|
|
203
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
207
|
+
minVersion: "12.0.0",
|
|
208
|
+
version: "22.2.4",
|
|
209
|
+
ngImport: i0,
|
|
210
|
+
type: SuStrengthMeterComponent,
|
|
211
|
+
decorators: [{
|
|
212
|
+
type: Component,
|
|
213
|
+
args: [{
|
|
214
|
+
selector: "su-lib-strength-meter",
|
|
215
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
216
|
+
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",
|
|
217
|
+
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"]
|
|
218
|
+
}]
|
|
219
|
+
}],
|
|
220
|
+
ctorParameters: () => [],
|
|
221
|
+
propDecorators: {
|
|
222
|
+
field: [{
|
|
223
|
+
type: i0.Input,
|
|
224
|
+
args: [{
|
|
225
|
+
isSignal: true,
|
|
226
|
+
alias: "field",
|
|
227
|
+
required: true
|
|
228
|
+
}]
|
|
229
|
+
}],
|
|
230
|
+
label: [{
|
|
231
|
+
type: i0.Input,
|
|
232
|
+
args: [{
|
|
233
|
+
isSignal: true,
|
|
234
|
+
alias: "label",
|
|
235
|
+
required: true
|
|
236
|
+
}]
|
|
237
|
+
}],
|
|
238
|
+
levelNames: [{
|
|
239
|
+
type: i0.Input,
|
|
240
|
+
args: [{
|
|
241
|
+
isSignal: true,
|
|
242
|
+
alias: "levelNames",
|
|
243
|
+
required: true
|
|
244
|
+
}]
|
|
245
|
+
}],
|
|
246
|
+
minLength: [{
|
|
247
|
+
type: i0.Input,
|
|
248
|
+
args: [{
|
|
249
|
+
isSignal: true,
|
|
250
|
+
alias: "minLength",
|
|
251
|
+
required: false
|
|
252
|
+
}]
|
|
253
|
+
}]
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
const SPRING = "height 240ms cubic-bezier(0.34, 1.56, 0.64, 1)";
|
|
257
|
+
var SuAutoGrowDirective = class SuAutoGrowDirective {
|
|
258
|
+
isOn = input(true, {
|
|
259
|
+
...ngDevMode ? { debugName: "isOn" } : /* istanbul ignore next */ {},
|
|
260
|
+
alias: "suAutoGrow",
|
|
261
|
+
transform: booleanAttribute
|
|
262
|
+
});
|
|
263
|
+
box = inject(ElementRef).nativeElement;
|
|
264
|
+
constructor() {
|
|
265
|
+
const destroyRef = inject(DestroyRef);
|
|
266
|
+
afterNextRender(() => {
|
|
267
|
+
const onReset = () => setTimeout(() => this.fit());
|
|
268
|
+
this.box.form?.addEventListener("reset", onReset);
|
|
269
|
+
destroyRef.onDestroy(() => this.box.form?.removeEventListener("reset", onReset));
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
fit() {
|
|
273
|
+
if (!this.isOn()) return;
|
|
274
|
+
const box = this.box;
|
|
275
|
+
const from = box.offsetHeight;
|
|
276
|
+
box.style.transition = "none";
|
|
277
|
+
box.style.height = "auto";
|
|
278
|
+
const to = box.scrollHeight + box.offsetHeight - box.clientHeight;
|
|
279
|
+
box.style.height = `${from}px`;
|
|
280
|
+
box.offsetHeight;
|
|
281
|
+
box.style.overflowY = "hidden";
|
|
282
|
+
box.style.transition = matchMedia("(prefers-reduced-motion: reduce)").matches ? "none" : SPRING;
|
|
283
|
+
box.style.height = `${to}px`;
|
|
284
|
+
}
|
|
285
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
286
|
+
minVersion: "12.0.0",
|
|
287
|
+
version: "22.2.4",
|
|
288
|
+
ngImport: i0,
|
|
289
|
+
type: SuAutoGrowDirective,
|
|
290
|
+
deps: [],
|
|
291
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
292
|
+
});
|
|
293
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
294
|
+
minVersion: "17.1.0",
|
|
295
|
+
version: "22.2.4",
|
|
296
|
+
type: SuAutoGrowDirective,
|
|
297
|
+
isStandalone: true,
|
|
298
|
+
selector: "textarea[suAutoGrow]",
|
|
299
|
+
inputs: { isOn: {
|
|
300
|
+
classPropertyName: "isOn",
|
|
301
|
+
publicName: "suAutoGrow",
|
|
302
|
+
isSignal: true,
|
|
303
|
+
isRequired: false,
|
|
304
|
+
transformFunction: null
|
|
305
|
+
} },
|
|
306
|
+
host: { listeners: { "input": "fit()" } },
|
|
307
|
+
ngImport: i0
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
311
|
+
minVersion: "12.0.0",
|
|
312
|
+
version: "22.2.4",
|
|
313
|
+
ngImport: i0,
|
|
314
|
+
type: SuAutoGrowDirective,
|
|
315
|
+
decorators: [{
|
|
316
|
+
type: Directive,
|
|
317
|
+
args: [{
|
|
318
|
+
selector: "textarea[suAutoGrow]",
|
|
319
|
+
host: { "(input)": "fit()" }
|
|
320
|
+
}]
|
|
321
|
+
}],
|
|
322
|
+
ctorParameters: () => [],
|
|
323
|
+
propDecorators: { isOn: [{
|
|
324
|
+
type: i0.Input,
|
|
325
|
+
args: [{
|
|
326
|
+
isSignal: true,
|
|
327
|
+
alias: "suAutoGrow",
|
|
328
|
+
required: false
|
|
329
|
+
}]
|
|
330
|
+
}] }
|
|
331
|
+
});
|
|
332
|
+
var SuSwitchComponent = class SuSwitchComponent {
|
|
333
|
+
checked = input(false, {
|
|
334
|
+
...ngDevMode ? { debugName: "checked" } : /* istanbul ignore next */ {},
|
|
335
|
+
transform: booleanAttribute
|
|
336
|
+
});
|
|
337
|
+
disabled = input(false, {
|
|
338
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
339
|
+
transform: booleanAttribute
|
|
340
|
+
});
|
|
341
|
+
busy = input(false, {
|
|
342
|
+
...ngDevMode ? { debugName: "busy" } : /* istanbul ignore next */ {},
|
|
343
|
+
transform: booleanAttribute
|
|
344
|
+
});
|
|
345
|
+
labelPosition = input("end", ...ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []);
|
|
346
|
+
size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
347
|
+
checkedChange = output();
|
|
348
|
+
shown = linkedSignal(() => this.checked(), ...ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []);
|
|
349
|
+
constructor() {
|
|
350
|
+
effect(() => {
|
|
351
|
+
if (!this.busy()) untracked(() => this.shown.set(this.checked()));
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
onClick(event) {
|
|
355
|
+
if (this.busy()) event.preventDefault();
|
|
356
|
+
}
|
|
357
|
+
onChange(event) {
|
|
358
|
+
if (event.target instanceof HTMLInputElement) {
|
|
359
|
+
this.shown.set(event.target.checked);
|
|
360
|
+
this.checkedChange.emit(event.target.checked);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
364
|
+
minVersion: "12.0.0",
|
|
365
|
+
version: "22.2.4",
|
|
366
|
+
ngImport: i0,
|
|
367
|
+
type: SuSwitchComponent,
|
|
368
|
+
deps: [],
|
|
369
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
370
|
+
});
|
|
371
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
372
|
+
minVersion: "17.1.0",
|
|
373
|
+
version: "22.2.4",
|
|
374
|
+
type: SuSwitchComponent,
|
|
375
|
+
isStandalone: true,
|
|
376
|
+
selector: "su-lib-switch",
|
|
377
|
+
inputs: {
|
|
378
|
+
checked: {
|
|
379
|
+
classPropertyName: "checked",
|
|
380
|
+
publicName: "checked",
|
|
381
|
+
isSignal: true,
|
|
382
|
+
isRequired: false,
|
|
383
|
+
transformFunction: null
|
|
384
|
+
},
|
|
385
|
+
disabled: {
|
|
386
|
+
classPropertyName: "disabled",
|
|
387
|
+
publicName: "disabled",
|
|
388
|
+
isSignal: true,
|
|
389
|
+
isRequired: false,
|
|
390
|
+
transformFunction: null
|
|
391
|
+
},
|
|
392
|
+
busy: {
|
|
393
|
+
classPropertyName: "busy",
|
|
394
|
+
publicName: "busy",
|
|
395
|
+
isSignal: true,
|
|
396
|
+
isRequired: false,
|
|
397
|
+
transformFunction: null
|
|
398
|
+
},
|
|
399
|
+
labelPosition: {
|
|
400
|
+
classPropertyName: "labelPosition",
|
|
401
|
+
publicName: "labelPosition",
|
|
402
|
+
isSignal: true,
|
|
403
|
+
isRequired: false,
|
|
404
|
+
transformFunction: null
|
|
405
|
+
},
|
|
406
|
+
size: {
|
|
407
|
+
classPropertyName: "size",
|
|
408
|
+
publicName: "size",
|
|
409
|
+
isSignal: true,
|
|
410
|
+
isRequired: false,
|
|
411
|
+
transformFunction: null
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
outputs: { checkedChange: "checkedChange" },
|
|
415
|
+
ngImport: i0,
|
|
416
|
+
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",
|
|
417
|
+
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"],
|
|
418
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
419
|
+
});
|
|
420
|
+
};
|
|
421
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
422
|
+
minVersion: "12.0.0",
|
|
423
|
+
version: "22.2.4",
|
|
424
|
+
ngImport: i0,
|
|
425
|
+
type: SuSwitchComponent,
|
|
426
|
+
decorators: [{
|
|
427
|
+
type: Component,
|
|
428
|
+
args: [{
|
|
429
|
+
selector: "su-lib-switch",
|
|
430
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
431
|
+
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",
|
|
432
|
+
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"]
|
|
433
|
+
}]
|
|
434
|
+
}],
|
|
435
|
+
ctorParameters: () => [],
|
|
436
|
+
propDecorators: {
|
|
437
|
+
checked: [{
|
|
438
|
+
type: i0.Input,
|
|
439
|
+
args: [{
|
|
440
|
+
isSignal: true,
|
|
441
|
+
alias: "checked",
|
|
442
|
+
required: false
|
|
443
|
+
}]
|
|
444
|
+
}],
|
|
445
|
+
disabled: [{
|
|
446
|
+
type: i0.Input,
|
|
447
|
+
args: [{
|
|
448
|
+
isSignal: true,
|
|
449
|
+
alias: "disabled",
|
|
450
|
+
required: false
|
|
451
|
+
}]
|
|
452
|
+
}],
|
|
453
|
+
busy: [{
|
|
454
|
+
type: i0.Input,
|
|
455
|
+
args: [{
|
|
456
|
+
isSignal: true,
|
|
457
|
+
alias: "busy",
|
|
458
|
+
required: false
|
|
459
|
+
}]
|
|
460
|
+
}],
|
|
461
|
+
labelPosition: [{
|
|
462
|
+
type: i0.Input,
|
|
463
|
+
args: [{
|
|
464
|
+
isSignal: true,
|
|
465
|
+
alias: "labelPosition",
|
|
466
|
+
required: false
|
|
467
|
+
}]
|
|
468
|
+
}],
|
|
469
|
+
size: [{
|
|
470
|
+
type: i0.Input,
|
|
471
|
+
args: [{
|
|
472
|
+
isSignal: true,
|
|
473
|
+
alias: "size",
|
|
474
|
+
required: false
|
|
475
|
+
}]
|
|
476
|
+
}],
|
|
477
|
+
checkedChange: [{
|
|
478
|
+
type: i0.Output,
|
|
479
|
+
args: ["checkedChange"]
|
|
480
|
+
}]
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
const SU_COMMON_EMAIL_DOMAINS = [
|
|
484
|
+
"gmail.com",
|
|
485
|
+
"hotmail.com",
|
|
486
|
+
"outlook.com",
|
|
487
|
+
"live.com",
|
|
488
|
+
"yahoo.com",
|
|
489
|
+
"icloud.com",
|
|
490
|
+
"me.com",
|
|
491
|
+
"aol.com",
|
|
492
|
+
"proton.me",
|
|
493
|
+
"protonmail.com",
|
|
494
|
+
"gmx.com",
|
|
495
|
+
"yandex.com",
|
|
496
|
+
"hotmail.es",
|
|
497
|
+
"yahoo.es"
|
|
498
|
+
];
|
|
499
|
+
const MAX_TYPO_DISTANCE = 2;
|
|
500
|
+
function editDistance(a, b) {
|
|
501
|
+
let previous = Array.from({ length: b.length + 1 }, (_, index) => index);
|
|
502
|
+
for (let i = 1; i <= a.length; i++) {
|
|
503
|
+
const current = [i];
|
|
504
|
+
for (let j = 1; j <= b.length; j++) current[j] = Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
505
|
+
previous = current;
|
|
506
|
+
}
|
|
507
|
+
return previous[b.length];
|
|
508
|
+
}
|
|
509
|
+
function closestDomain(domain, domains) {
|
|
510
|
+
if (!domain || domains.includes(domain)) return null;
|
|
511
|
+
let best = null;
|
|
512
|
+
for (const candidate of domains) {
|
|
513
|
+
const distance = editDistance(domain, candidate);
|
|
514
|
+
if (distance <= MAX_TYPO_DISTANCE && (!best || distance < best.distance)) best = {
|
|
515
|
+
domain: candidate,
|
|
516
|
+
distance
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
return best?.domain ?? null;
|
|
520
|
+
}
|
|
521
|
+
function problemOf(email) {
|
|
522
|
+
if (email === "") return "empty";
|
|
523
|
+
if (/\s/.test(email)) return "spaces";
|
|
524
|
+
const parts = email.split("@");
|
|
525
|
+
if (parts.length !== 2) return "at";
|
|
526
|
+
const [name, domain] = parts;
|
|
527
|
+
if (!name) return "name";
|
|
528
|
+
if (!domain) return "domain";
|
|
529
|
+
const labels = domain.split(".");
|
|
530
|
+
if (labels.length < 2 || labels.some((label) => label === "")) return "dot";
|
|
531
|
+
return /^\p{L}{2,}$/u.test(labels[labels.length - 1]) ? null : "ending";
|
|
532
|
+
}
|
|
533
|
+
function suCheckEmail(value, domains = SU_COMMON_EMAIL_DOMAINS) {
|
|
534
|
+
const email = value.trim();
|
|
535
|
+
const problem = problemOf(email);
|
|
536
|
+
const [name = "", domain = ""] = email.split("@");
|
|
537
|
+
const fix = (problem === null || problem === "dot" || problem === "ending") && name ? closestDomain(domain.toLowerCase(), domains) : null;
|
|
538
|
+
return {
|
|
539
|
+
valid: problem === null,
|
|
540
|
+
problem,
|
|
541
|
+
suggestion: fix ? `${name}@${fix}` : null
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
const SU_EMAIL_MESSAGES = {
|
|
545
|
+
empty: "Enter your email address",
|
|
546
|
+
spaces: "An email address has no spaces",
|
|
547
|
+
at: "An email address has one @, like name@example.com",
|
|
548
|
+
name: "Add the part before the @",
|
|
549
|
+
domain: "Add the part after the @, like example.com",
|
|
550
|
+
dot: "The part after the @ needs a dot, like example.com",
|
|
551
|
+
ending: "The ending after the last dot needs at least two letters",
|
|
552
|
+
suggestion: "Did you mean"
|
|
553
|
+
};
|
|
554
|
+
let nextId = 0;
|
|
555
|
+
var SuEmailFieldComponent = class SuEmailFieldComponent {
|
|
556
|
+
value = model("", ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
557
|
+
label = input.required(...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
558
|
+
placeholder = input(...ngDevMode ? [void 0, { debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
559
|
+
required = input(false, {
|
|
560
|
+
...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
|
|
561
|
+
transform: booleanAttribute
|
|
562
|
+
});
|
|
563
|
+
messages = input({}, ...ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []);
|
|
564
|
+
domains = input(SU_COMMON_EMAIL_DOMAINS, ...ngDevMode ? [{ debugName: "domains" }] : /* istanbul ignore next */ []);
|
|
565
|
+
validityChange = output();
|
|
566
|
+
id = `su-email-${nextId++}`;
|
|
567
|
+
touched = signal(false, ...ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []);
|
|
568
|
+
check = computed(() => suCheckEmail(this.value(), this.domains()), ...ngDevMode ? [{ debugName: "check" }] : /* istanbul ignore next */ []);
|
|
569
|
+
text = computed(() => ({
|
|
570
|
+
...SU_EMAIL_MESSAGES,
|
|
571
|
+
...this.messages()
|
|
572
|
+
}), ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
|
|
573
|
+
problem = computed(() => {
|
|
574
|
+
const { problem } = this.check();
|
|
575
|
+
if (!this.touched() || !problem || problem === "empty" && !this.required()) return null;
|
|
576
|
+
return problem;
|
|
577
|
+
}, ...ngDevMode ? [{ debugName: "problem" }] : /* istanbul ignore next */ []);
|
|
578
|
+
constructor() {
|
|
579
|
+
effect(() => this.validityChange.emit(this.check().valid));
|
|
580
|
+
}
|
|
581
|
+
onInput(event) {
|
|
582
|
+
if (event.target instanceof HTMLInputElement) this.value.set(event.target.value);
|
|
583
|
+
}
|
|
584
|
+
apply(suggestion) {
|
|
585
|
+
this.value.set(suggestion);
|
|
586
|
+
this.touched.set(true);
|
|
587
|
+
}
|
|
588
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
589
|
+
minVersion: "12.0.0",
|
|
590
|
+
version: "22.2.4",
|
|
591
|
+
ngImport: i0,
|
|
592
|
+
type: SuEmailFieldComponent,
|
|
593
|
+
deps: [],
|
|
594
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
595
|
+
});
|
|
596
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
597
|
+
minVersion: "17.0.0",
|
|
598
|
+
version: "22.2.4",
|
|
599
|
+
type: SuEmailFieldComponent,
|
|
600
|
+
isStandalone: true,
|
|
601
|
+
selector: "su-lib-email-field",
|
|
602
|
+
inputs: {
|
|
603
|
+
value: {
|
|
604
|
+
classPropertyName: "value",
|
|
605
|
+
publicName: "value",
|
|
606
|
+
isSignal: true,
|
|
607
|
+
isRequired: false,
|
|
608
|
+
transformFunction: null
|
|
609
|
+
},
|
|
610
|
+
label: {
|
|
611
|
+
classPropertyName: "label",
|
|
612
|
+
publicName: "label",
|
|
613
|
+
isSignal: true,
|
|
614
|
+
isRequired: true,
|
|
615
|
+
transformFunction: null
|
|
616
|
+
},
|
|
617
|
+
placeholder: {
|
|
618
|
+
classPropertyName: "placeholder",
|
|
619
|
+
publicName: "placeholder",
|
|
620
|
+
isSignal: true,
|
|
621
|
+
isRequired: false,
|
|
622
|
+
transformFunction: null
|
|
623
|
+
},
|
|
624
|
+
required: {
|
|
625
|
+
classPropertyName: "required",
|
|
626
|
+
publicName: "required",
|
|
627
|
+
isSignal: true,
|
|
628
|
+
isRequired: false,
|
|
629
|
+
transformFunction: null
|
|
630
|
+
},
|
|
631
|
+
messages: {
|
|
632
|
+
classPropertyName: "messages",
|
|
633
|
+
publicName: "messages",
|
|
634
|
+
isSignal: true,
|
|
635
|
+
isRequired: false,
|
|
636
|
+
transformFunction: null
|
|
637
|
+
},
|
|
638
|
+
domains: {
|
|
639
|
+
classPropertyName: "domains",
|
|
640
|
+
publicName: "domains",
|
|
641
|
+
isSignal: true,
|
|
642
|
+
isRequired: false,
|
|
643
|
+
transformFunction: null
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
outputs: {
|
|
647
|
+
value: "valueChange",
|
|
648
|
+
validityChange: "validityChange"
|
|
649
|
+
},
|
|
650
|
+
ngImport: i0,
|
|
651
|
+
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",
|
|
652
|
+
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"],
|
|
653
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
654
|
+
});
|
|
655
|
+
};
|
|
656
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
657
|
+
minVersion: "12.0.0",
|
|
658
|
+
version: "22.2.4",
|
|
659
|
+
ngImport: i0,
|
|
660
|
+
type: SuEmailFieldComponent,
|
|
661
|
+
decorators: [{
|
|
662
|
+
type: Component,
|
|
663
|
+
args: [{
|
|
664
|
+
selector: "su-lib-email-field",
|
|
665
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
666
|
+
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",
|
|
667
|
+
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"]
|
|
668
|
+
}]
|
|
669
|
+
}],
|
|
670
|
+
ctorParameters: () => [],
|
|
671
|
+
propDecorators: {
|
|
672
|
+
value: [{
|
|
673
|
+
type: i0.Input,
|
|
674
|
+
args: [{
|
|
675
|
+
isSignal: true,
|
|
676
|
+
alias: "value",
|
|
677
|
+
required: false
|
|
678
|
+
}]
|
|
679
|
+
}, {
|
|
680
|
+
type: i0.Output,
|
|
681
|
+
args: ["valueChange"]
|
|
682
|
+
}],
|
|
683
|
+
label: [{
|
|
684
|
+
type: i0.Input,
|
|
685
|
+
args: [{
|
|
686
|
+
isSignal: true,
|
|
687
|
+
alias: "label",
|
|
688
|
+
required: true
|
|
689
|
+
}]
|
|
690
|
+
}],
|
|
691
|
+
placeholder: [{
|
|
692
|
+
type: i0.Input,
|
|
693
|
+
args: [{
|
|
694
|
+
isSignal: true,
|
|
695
|
+
alias: "placeholder",
|
|
696
|
+
required: false
|
|
697
|
+
}]
|
|
698
|
+
}],
|
|
699
|
+
required: [{
|
|
700
|
+
type: i0.Input,
|
|
701
|
+
args: [{
|
|
702
|
+
isSignal: true,
|
|
703
|
+
alias: "required",
|
|
704
|
+
required: false
|
|
705
|
+
}]
|
|
706
|
+
}],
|
|
707
|
+
messages: [{
|
|
708
|
+
type: i0.Input,
|
|
709
|
+
args: [{
|
|
710
|
+
isSignal: true,
|
|
711
|
+
alias: "messages",
|
|
712
|
+
required: false
|
|
713
|
+
}]
|
|
714
|
+
}],
|
|
715
|
+
domains: [{
|
|
716
|
+
type: i0.Input,
|
|
717
|
+
args: [{
|
|
718
|
+
isSignal: true,
|
|
719
|
+
alias: "domains",
|
|
720
|
+
required: false
|
|
721
|
+
}]
|
|
722
|
+
}],
|
|
723
|
+
validityChange: [{
|
|
724
|
+
type: i0.Output,
|
|
725
|
+
args: ["validityChange"]
|
|
726
|
+
}]
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
var SuCheckboxComponent = class SuCheckboxComponent {
|
|
730
|
+
checked = input(false, {
|
|
731
|
+
...ngDevMode ? { debugName: "checked" } : /* istanbul ignore next */ {},
|
|
732
|
+
transform: booleanAttribute
|
|
733
|
+
});
|
|
734
|
+
indeterminate = input(false, {
|
|
735
|
+
...ngDevMode ? { debugName: "indeterminate" } : /* istanbul ignore next */ {},
|
|
736
|
+
transform: booleanAttribute
|
|
737
|
+
});
|
|
738
|
+
disabled = input(false, {
|
|
739
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
740
|
+
transform: booleanAttribute
|
|
741
|
+
});
|
|
742
|
+
checkedChange = output();
|
|
743
|
+
shown = linkedSignal(() => this.checked(), ...ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []);
|
|
744
|
+
onChange(event) {
|
|
745
|
+
if (event.target instanceof HTMLInputElement) {
|
|
746
|
+
this.shown.set(event.target.checked);
|
|
747
|
+
this.checkedChange.emit(event.target.checked);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
751
|
+
minVersion: "12.0.0",
|
|
752
|
+
version: "22.2.4",
|
|
753
|
+
ngImport: i0,
|
|
754
|
+
type: SuCheckboxComponent,
|
|
755
|
+
deps: [],
|
|
756
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
757
|
+
});
|
|
758
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
759
|
+
minVersion: "17.1.0",
|
|
760
|
+
version: "22.2.4",
|
|
761
|
+
type: SuCheckboxComponent,
|
|
762
|
+
isStandalone: true,
|
|
763
|
+
selector: "su-lib-checkbox",
|
|
764
|
+
inputs: {
|
|
765
|
+
checked: {
|
|
766
|
+
classPropertyName: "checked",
|
|
767
|
+
publicName: "checked",
|
|
768
|
+
isSignal: true,
|
|
769
|
+
isRequired: false,
|
|
770
|
+
transformFunction: null
|
|
771
|
+
},
|
|
772
|
+
indeterminate: {
|
|
773
|
+
classPropertyName: "indeterminate",
|
|
774
|
+
publicName: "indeterminate",
|
|
775
|
+
isSignal: true,
|
|
776
|
+
isRequired: false,
|
|
777
|
+
transformFunction: null
|
|
778
|
+
},
|
|
779
|
+
disabled: {
|
|
780
|
+
classPropertyName: "disabled",
|
|
781
|
+
publicName: "disabled",
|
|
782
|
+
isSignal: true,
|
|
783
|
+
isRequired: false,
|
|
784
|
+
transformFunction: null
|
|
785
|
+
}
|
|
786
|
+
},
|
|
787
|
+
outputs: { checkedChange: "checkedChange" },
|
|
788
|
+
ngImport: i0,
|
|
789
|
+
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",
|
|
790
|
+
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"],
|
|
791
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
792
|
+
});
|
|
793
|
+
};
|
|
794
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
795
|
+
minVersion: "12.0.0",
|
|
796
|
+
version: "22.2.4",
|
|
797
|
+
ngImport: i0,
|
|
798
|
+
type: SuCheckboxComponent,
|
|
799
|
+
decorators: [{
|
|
800
|
+
type: Component,
|
|
801
|
+
args: [{
|
|
802
|
+
selector: "su-lib-checkbox",
|
|
803
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
804
|
+
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",
|
|
805
|
+
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"]
|
|
806
|
+
}]
|
|
807
|
+
}],
|
|
808
|
+
propDecorators: {
|
|
809
|
+
checked: [{
|
|
810
|
+
type: i0.Input,
|
|
811
|
+
args: [{
|
|
812
|
+
isSignal: true,
|
|
813
|
+
alias: "checked",
|
|
814
|
+
required: false
|
|
815
|
+
}]
|
|
816
|
+
}],
|
|
817
|
+
indeterminate: [{
|
|
818
|
+
type: i0.Input,
|
|
819
|
+
args: [{
|
|
820
|
+
isSignal: true,
|
|
821
|
+
alias: "indeterminate",
|
|
822
|
+
required: false
|
|
823
|
+
}]
|
|
824
|
+
}],
|
|
825
|
+
disabled: [{
|
|
826
|
+
type: i0.Input,
|
|
827
|
+
args: [{
|
|
828
|
+
isSignal: true,
|
|
829
|
+
alias: "disabled",
|
|
830
|
+
required: false
|
|
831
|
+
}]
|
|
832
|
+
}],
|
|
833
|
+
checkedChange: [{
|
|
834
|
+
type: i0.Output,
|
|
835
|
+
args: ["checkedChange"]
|
|
836
|
+
}]
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
var SuChipsComponent = class SuChipsComponent {
|
|
840
|
+
options = input.required(...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
|
|
841
|
+
value = model([], ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
842
|
+
label = input.required(...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
843
|
+
multiple = input(true, {
|
|
844
|
+
...ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {},
|
|
845
|
+
transform: booleanAttribute
|
|
846
|
+
});
|
|
847
|
+
isPicked(value) {
|
|
848
|
+
return this.value().includes(value);
|
|
849
|
+
}
|
|
850
|
+
toggle(option) {
|
|
851
|
+
if (!this.multiple()) {
|
|
852
|
+
this.value.set([option.value]);
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
const picked = this.isPicked(option.value) ? this.value().filter((value) => value !== option.value) : [...this.value(), option.value];
|
|
856
|
+
this.value.set(this.options().map((item) => item.value).filter((value) => picked.includes(value)));
|
|
857
|
+
}
|
|
858
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
859
|
+
minVersion: "12.0.0",
|
|
860
|
+
version: "22.2.4",
|
|
861
|
+
ngImport: i0,
|
|
862
|
+
type: SuChipsComponent,
|
|
863
|
+
deps: [],
|
|
864
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
865
|
+
});
|
|
866
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
867
|
+
minVersion: "17.0.0",
|
|
868
|
+
version: "22.2.4",
|
|
869
|
+
type: SuChipsComponent,
|
|
870
|
+
isStandalone: true,
|
|
871
|
+
selector: "su-lib-chips",
|
|
872
|
+
inputs: {
|
|
873
|
+
options: {
|
|
874
|
+
classPropertyName: "options",
|
|
875
|
+
publicName: "options",
|
|
876
|
+
isSignal: true,
|
|
877
|
+
isRequired: true,
|
|
878
|
+
transformFunction: null
|
|
879
|
+
},
|
|
880
|
+
value: {
|
|
881
|
+
classPropertyName: "value",
|
|
882
|
+
publicName: "value",
|
|
883
|
+
isSignal: true,
|
|
884
|
+
isRequired: false,
|
|
885
|
+
transformFunction: null
|
|
886
|
+
},
|
|
887
|
+
label: {
|
|
888
|
+
classPropertyName: "label",
|
|
889
|
+
publicName: "label",
|
|
890
|
+
isSignal: true,
|
|
891
|
+
isRequired: true,
|
|
892
|
+
transformFunction: null
|
|
893
|
+
},
|
|
894
|
+
multiple: {
|
|
895
|
+
classPropertyName: "multiple",
|
|
896
|
+
publicName: "multiple",
|
|
897
|
+
isSignal: true,
|
|
898
|
+
isRequired: false,
|
|
899
|
+
transformFunction: null
|
|
900
|
+
}
|
|
901
|
+
},
|
|
902
|
+
outputs: { value: "valueChange" },
|
|
903
|
+
ngImport: i0,
|
|
904
|
+
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",
|
|
905
|
+
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"],
|
|
906
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
907
|
+
});
|
|
908
|
+
};
|
|
909
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
910
|
+
minVersion: "12.0.0",
|
|
911
|
+
version: "22.2.4",
|
|
912
|
+
ngImport: i0,
|
|
913
|
+
type: SuChipsComponent,
|
|
914
|
+
decorators: [{
|
|
915
|
+
type: Component,
|
|
916
|
+
args: [{
|
|
917
|
+
selector: "su-lib-chips",
|
|
918
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
919
|
+
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",
|
|
920
|
+
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"]
|
|
921
|
+
}]
|
|
922
|
+
}],
|
|
923
|
+
propDecorators: {
|
|
924
|
+
options: [{
|
|
925
|
+
type: i0.Input,
|
|
926
|
+
args: [{
|
|
927
|
+
isSignal: true,
|
|
928
|
+
alias: "options",
|
|
929
|
+
required: true
|
|
930
|
+
}]
|
|
931
|
+
}],
|
|
932
|
+
value: [{
|
|
933
|
+
type: i0.Input,
|
|
934
|
+
args: [{
|
|
935
|
+
isSignal: true,
|
|
936
|
+
alias: "value",
|
|
937
|
+
required: false
|
|
938
|
+
}]
|
|
939
|
+
}, {
|
|
940
|
+
type: i0.Output,
|
|
941
|
+
args: ["valueChange"]
|
|
942
|
+
}],
|
|
943
|
+
label: [{
|
|
944
|
+
type: i0.Input,
|
|
945
|
+
args: [{
|
|
946
|
+
isSignal: true,
|
|
947
|
+
alias: "label",
|
|
948
|
+
required: true
|
|
949
|
+
}]
|
|
950
|
+
}],
|
|
951
|
+
multiple: [{
|
|
952
|
+
type: i0.Input,
|
|
953
|
+
args: [{
|
|
954
|
+
isSignal: true,
|
|
955
|
+
alias: "multiple",
|
|
956
|
+
required: false
|
|
957
|
+
}]
|
|
958
|
+
}]
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
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 };
|
|
962
|
+
|
|
963
|
+
//# sourceMappingURL=su-labs-fields.mjs.map
|