@ks-digital/designsystem-angular 0.0.1-alpha.10 → 0.0.1-alpha.11
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, Directive, isDevMode, signal,
|
|
2
|
+
import { input, Directive, booleanAttribute, Component, isDevMode, signal, computed, Injectable, numberAttribute, inject, effect, contentChild, contentChildren, ElementRef, afterNextRender } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
/* eslint-disable @angular-eslint/no-input-rename */
|
|
5
5
|
/**
|
|
@@ -26,12 +26,163 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
|
|
|
26
26
|
type: Directive
|
|
27
27
|
}] });
|
|
28
28
|
|
|
29
|
+
/* eslint-disable @angular-eslint/no-input-rename */
|
|
30
|
+
class Spinner {
|
|
31
|
+
/**
|
|
32
|
+
* Aria-label for the spinner
|
|
33
|
+
*/
|
|
34
|
+
ariaLabel = input(undefined, { alias: 'aria-label' });
|
|
35
|
+
/**
|
|
36
|
+
* Aria-label for the spinner
|
|
37
|
+
*/
|
|
38
|
+
dataSize = input(undefined, { alias: 'data-size' });
|
|
39
|
+
/**
|
|
40
|
+
* Aria-label for the spinner
|
|
41
|
+
*/
|
|
42
|
+
dataColor = input(undefined, { alias: 'data-color' });
|
|
43
|
+
/**
|
|
44
|
+
* Aria-hidden for the spinner
|
|
45
|
+
*/
|
|
46
|
+
ariaHidden = input(undefined, {
|
|
47
|
+
transform: booleanAttribute,
|
|
48
|
+
alias: 'aria-hidden',
|
|
49
|
+
});
|
|
50
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Spinner, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
51
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.4", type: Spinner, isStandalone: true, selector: "ksd-spinner", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, dataSize: { classPropertyName: "dataSize", publicName: "data-size", isSignal: true, isRequired: false, transformFunction: null }, dataColor: { classPropertyName: "dataColor", publicName: "data-color", isSignal: true, isRequired: false, transformFunction: null }, ariaHidden: { classPropertyName: "ariaHidden", publicName: "aria-hidden", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
52
|
+
<svg
|
|
53
|
+
class="ds-spinner"
|
|
54
|
+
role="img"
|
|
55
|
+
viewBox="0 0 50 50"
|
|
56
|
+
[attr.data-size]="dataSize()"
|
|
57
|
+
[attr.data-color]="dataColor()"
|
|
58
|
+
>
|
|
59
|
+
<circle
|
|
60
|
+
class="ds-spinner__background"
|
|
61
|
+
cx="25"
|
|
62
|
+
cy="25"
|
|
63
|
+
r="20"
|
|
64
|
+
fill="none"
|
|
65
|
+
stroke-width="5"
|
|
66
|
+
/>
|
|
67
|
+
<circle
|
|
68
|
+
class="ds-spinner__circle"
|
|
69
|
+
cx="25"
|
|
70
|
+
cy="25"
|
|
71
|
+
r="20"
|
|
72
|
+
fill="none"
|
|
73
|
+
stroke-width="5"
|
|
74
|
+
/>
|
|
75
|
+
</svg>
|
|
76
|
+
`, isInline: true, styles: [":host{display:contents}\n"] });
|
|
77
|
+
}
|
|
78
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Spinner, decorators: [{
|
|
79
|
+
type: Component,
|
|
80
|
+
args: [{ selector: 'ksd-spinner', template: `
|
|
81
|
+
<svg
|
|
82
|
+
class="ds-spinner"
|
|
83
|
+
role="img"
|
|
84
|
+
viewBox="0 0 50 50"
|
|
85
|
+
[attr.data-size]="dataSize()"
|
|
86
|
+
[attr.data-color]="dataColor()"
|
|
87
|
+
>
|
|
88
|
+
<circle
|
|
89
|
+
class="ds-spinner__background"
|
|
90
|
+
cx="25"
|
|
91
|
+
cy="25"
|
|
92
|
+
r="20"
|
|
93
|
+
fill="none"
|
|
94
|
+
stroke-width="5"
|
|
95
|
+
/>
|
|
96
|
+
<circle
|
|
97
|
+
class="ds-spinner__circle"
|
|
98
|
+
cx="25"
|
|
99
|
+
cy="25"
|
|
100
|
+
r="20"
|
|
101
|
+
fill="none"
|
|
102
|
+
stroke-width="5"
|
|
103
|
+
/>
|
|
104
|
+
</svg>
|
|
105
|
+
`, styles: [":host{display:contents}\n"] }]
|
|
106
|
+
}] });
|
|
107
|
+
|
|
108
|
+
class Button {
|
|
109
|
+
/**
|
|
110
|
+
* Specify which variant to use
|
|
111
|
+
* @default 'primary'
|
|
112
|
+
*/
|
|
113
|
+
variant = input('primary');
|
|
114
|
+
/**
|
|
115
|
+
* Toggle loading state.
|
|
116
|
+
* Pass an element if you want to display a custom loader.
|
|
117
|
+
*
|
|
118
|
+
* @default false
|
|
119
|
+
*/
|
|
120
|
+
loading = input(false, { transform: booleanAttribute });
|
|
121
|
+
/**
|
|
122
|
+
* Disables element
|
|
123
|
+
*/
|
|
124
|
+
disabled = input(false, { transform: booleanAttribute });
|
|
125
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Button, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
126
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: Button, isStandalone: true, selector: "button[ksd-button], a[ksd-button]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button" }, properties: { "attr.data-variant": "variant()", "attr.disabled": "disabled() ? true : null", "attr.aria-busy": "loading() ? true : null" }, classAttribute: "ds-button" }, hostDirectives: [{ directive: CommonInputs, inputs: ["data-size", "data-size", "data-color", "data-color"] }], ngImport: i0, template: `
|
|
127
|
+
@if (loading()) {
|
|
128
|
+
<ksd-spinner aria-hidden="true" />
|
|
129
|
+
}
|
|
130
|
+
<ng-content />
|
|
131
|
+
`, isInline: true, dependencies: [{ kind: "component", type: Spinner, selector: "ksd-spinner", inputs: ["aria-label", "data-size", "data-color", "aria-hidden"] }] });
|
|
132
|
+
}
|
|
133
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Button, decorators: [{
|
|
134
|
+
type: Component,
|
|
135
|
+
args: [{
|
|
136
|
+
selector: 'button[ksd-button], a[ksd-button]',
|
|
137
|
+
hostDirectives: [
|
|
138
|
+
{
|
|
139
|
+
directive: CommonInputs,
|
|
140
|
+
inputs: ['data-size', 'data-color'],
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
imports: [Spinner],
|
|
144
|
+
host: {
|
|
145
|
+
class: 'ds-button',
|
|
146
|
+
type: 'button',
|
|
147
|
+
'[attr.data-variant]': 'variant()',
|
|
148
|
+
'[attr.disabled]': 'disabled() ? true : null',
|
|
149
|
+
'[attr.aria-busy]': 'loading() ? true : null',
|
|
150
|
+
},
|
|
151
|
+
template: `
|
|
152
|
+
@if (loading()) {
|
|
153
|
+
<ksd-spinner aria-hidden="true" />
|
|
154
|
+
}
|
|
155
|
+
<ng-content />
|
|
156
|
+
`,
|
|
157
|
+
}]
|
|
158
|
+
}] });
|
|
159
|
+
|
|
29
160
|
const logIfDevMode = ({ component, message, }) => {
|
|
30
161
|
if (isDevMode()) {
|
|
31
162
|
console.log(`[${component}] ${message}`);
|
|
32
163
|
}
|
|
33
164
|
};
|
|
34
165
|
|
|
166
|
+
class FieldState {
|
|
167
|
+
/**
|
|
168
|
+
* Whether the field counter has exceeded its limit
|
|
169
|
+
*/
|
|
170
|
+
hasExceededCounter = signal(false);
|
|
171
|
+
/**
|
|
172
|
+
* Whether the field has errors projected from the outside
|
|
173
|
+
*/
|
|
174
|
+
hasProjectedErrors = signal(false);
|
|
175
|
+
/**
|
|
176
|
+
* Whether the field has any errors associated with it
|
|
177
|
+
*/
|
|
178
|
+
hasError = computed(() => this.hasExceededCounter() || this.hasProjectedErrors());
|
|
179
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldState, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
180
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldState });
|
|
181
|
+
}
|
|
182
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldState, decorators: [{
|
|
183
|
+
type: Injectable
|
|
184
|
+
}] });
|
|
185
|
+
|
|
35
186
|
class Input {
|
|
36
187
|
/**
|
|
37
188
|
* The value of the input
|
|
@@ -41,26 +192,46 @@ class Input {
|
|
|
41
192
|
* Whether the input is readonly
|
|
42
193
|
*/
|
|
43
194
|
readonly = input(false, { transform: booleanAttribute });
|
|
195
|
+
/**
|
|
196
|
+
* Disables element
|
|
197
|
+
*/
|
|
198
|
+
disabled = input(false, { transform: booleanAttribute });
|
|
199
|
+
/**
|
|
200
|
+
* Whether the element is invalid.
|
|
201
|
+
*/
|
|
202
|
+
ariaInvalid = input(false, {
|
|
203
|
+
transform: booleanAttribute,
|
|
204
|
+
alias: 'aria-invalid',
|
|
205
|
+
});
|
|
44
206
|
/**
|
|
45
207
|
* Displays a character counter. pass a number to set a limit.
|
|
46
208
|
*/
|
|
47
209
|
counter = input(0, { transform: numberAttribute });
|
|
210
|
+
fieldState = inject(FieldState, { optional: true });
|
|
48
211
|
onClick(event) {
|
|
49
212
|
if (this.readonly()) {
|
|
50
213
|
event.preventDefault();
|
|
51
214
|
}
|
|
52
215
|
}
|
|
53
216
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Input, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
54
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.4", type: Input, isStandalone: true, selector: "input[ksd-input], textarea[ksd-input]", inputs: { readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, counter: { classPropertyName: "counter", publicName: "counter", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)", "input": "value.set($event.target.value)" }, properties: { "attr.readonly": "readonly() ? true : null" }, classAttribute: "ds-input" }, ngImport: i0 });
|
|
217
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.4", type: Input, isStandalone: true, selector: "input[ksd-input], textarea[ksd-input], select[ksd-input]", inputs: { readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalid: { classPropertyName: "ariaInvalid", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null }, counter: { classPropertyName: "counter", publicName: "counter", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)", "input": "value.set($event.target.value)" }, properties: { "attr.readonly": "readonly() ? true : null", "attr.disabled": "disabled() ? true : null", "attr.aria-invalid": "ariaInvalid() ? true : (fieldState?.hasError() ? true: null)" }, classAttribute: "ds-input" }, hostDirectives: [{ directive: CommonInputs, inputs: ["data-size", "data-size", "data-color", "data-color"] }], ngImport: i0 });
|
|
55
218
|
}
|
|
56
219
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Input, decorators: [{
|
|
57
220
|
type: Directive,
|
|
58
221
|
args: [{
|
|
59
222
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
60
|
-
selector: 'input[ksd-input], textarea[ksd-input]',
|
|
223
|
+
selector: 'input[ksd-input], textarea[ksd-input], select[ksd-input]',
|
|
224
|
+
hostDirectives: [
|
|
225
|
+
{
|
|
226
|
+
directive: CommonInputs,
|
|
227
|
+
inputs: ['data-size', 'data-color'],
|
|
228
|
+
},
|
|
229
|
+
],
|
|
61
230
|
host: {
|
|
62
231
|
class: 'ds-input',
|
|
63
232
|
'[attr.readonly]': 'readonly() ? true : null',
|
|
233
|
+
'[attr.disabled]': 'disabled() ? true : null',
|
|
234
|
+
'[attr.aria-invalid]': 'ariaInvalid() ? true : (fieldState?.hasError() ? true: null)',
|
|
64
235
|
'(click)': 'onClick($event)',
|
|
65
236
|
'(input)': 'value.set($event.target.value)',
|
|
66
237
|
},
|
|
@@ -92,14 +263,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
|
|
|
92
263
|
}] });
|
|
93
264
|
|
|
94
265
|
class ValidationMessage {
|
|
95
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ValidationMessage, deps: [], target: i0.ɵɵFactoryTarget.
|
|
96
|
-
static
|
|
266
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ValidationMessage, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
267
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.4", type: ValidationMessage, isStandalone: true, selector: "[ksd-validation-message]", host: { attributes: { "data-field": "validation" }, classAttribute: "ds-validation-message" }, ngImport: i0 });
|
|
97
268
|
}
|
|
98
269
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ValidationMessage, decorators: [{
|
|
99
|
-
type:
|
|
270
|
+
type: Directive,
|
|
100
271
|
args: [{
|
|
101
|
-
|
|
102
|
-
|
|
272
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
273
|
+
selector: '[ksd-validation-message]',
|
|
103
274
|
host: {
|
|
104
275
|
class: 'ds-validation-message',
|
|
105
276
|
'data-field': 'validation',
|
|
@@ -121,6 +292,12 @@ class FieldCounter {
|
|
|
121
292
|
remainder = computed(() => this.limit() - this.count());
|
|
122
293
|
excessCount = computed(() => Math.abs(this.remainder()));
|
|
123
294
|
hasExceededLimit = computed(() => this.count() > this.limit());
|
|
295
|
+
fieldState = inject(FieldState);
|
|
296
|
+
constructor() {
|
|
297
|
+
effect(() => {
|
|
298
|
+
this.fieldState.hasExceededCounter.set(this.hasExceededLimit());
|
|
299
|
+
});
|
|
300
|
+
}
|
|
124
301
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldCounter, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
125
302
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: FieldCounter, isStandalone: true, selector: "ksd-field-counter", inputs: { limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: true, transformFunction: null }, count: { classPropertyName: "count", publicName: "count", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
126
303
|
<div data-field="description" class="ds-sr-only" aria-live="polite">
|
|
@@ -133,7 +310,7 @@ class FieldCounter {
|
|
|
133
310
|
} @else {
|
|
134
311
|
<p data-field="validation">{{ remainder() }} tegn igjen</p>
|
|
135
312
|
}
|
|
136
|
-
`, isInline: true, styles: [":host>*{margin-top:var(--dsc-field-content-spacing)}\n"], dependencies: [{ kind: "
|
|
313
|
+
`, isInline: true, styles: [":host>*{margin-top:var(--dsc-field-content-spacing)}\n"], dependencies: [{ kind: "directive", type: ValidationMessage, selector: "[ksd-validation-message]" }] });
|
|
137
314
|
}
|
|
138
315
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldCounter, decorators: [{
|
|
139
316
|
type: Component,
|
|
@@ -149,7 +326,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
|
|
|
149
326
|
<p data-field="validation">{{ remainder() }} tegn igjen</p>
|
|
150
327
|
}
|
|
151
328
|
`, styles: [":host>*{margin-top:var(--dsc-field-content-spacing)}\n"] }]
|
|
152
|
-
}] });
|
|
329
|
+
}], ctorParameters: () => [] });
|
|
153
330
|
|
|
154
331
|
/**
|
|
155
332
|
* Lifted from Designsystemet core repo.
|
|
@@ -162,6 +339,7 @@ function fieldObserver(fieldElement) {
|
|
|
162
339
|
if (!fieldElement)
|
|
163
340
|
return;
|
|
164
341
|
const elements = new Map();
|
|
342
|
+
const typeCounter = new Map(); // Track count for each data-field type
|
|
165
343
|
const uuid = `:${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`;
|
|
166
344
|
let input = null;
|
|
167
345
|
let describedby = '';
|
|
@@ -203,9 +381,20 @@ function fieldObserver(fieldElement) {
|
|
|
203
381
|
// Connect elements
|
|
204
382
|
const describedbyIds = [describedby]; // Keep original aria-describedby
|
|
205
383
|
const inputId = input?.id || uuid;
|
|
384
|
+
// Reset type counters since we reprocess all elements
|
|
385
|
+
typeCounter.clear();
|
|
206
386
|
for (const [el, value] of elements) {
|
|
207
387
|
const descriptionType = el.getAttribute('data-field');
|
|
208
|
-
|
|
388
|
+
let id;
|
|
389
|
+
if (descriptionType) {
|
|
390
|
+
// Increment type counter for this type
|
|
391
|
+
const count = (typeCounter.get(descriptionType) || 0) + 1;
|
|
392
|
+
typeCounter.set(descriptionType, count);
|
|
393
|
+
id = `${inputId}:${descriptionType}:${count}`;
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
id = inputId;
|
|
397
|
+
}
|
|
209
398
|
if (!value)
|
|
210
399
|
setAttr(el, isLabel(el) ? 'for' : 'id', id); // Ensure we have a value
|
|
211
400
|
if (descriptionType === 'validation')
|
|
@@ -259,8 +448,10 @@ class Field {
|
|
|
259
448
|
* @default start
|
|
260
449
|
*/
|
|
261
450
|
position = input('start');
|
|
451
|
+
fieldState = inject(FieldState);
|
|
262
452
|
input = contentChild(Input);
|
|
263
453
|
label = contentChild(Label);
|
|
454
|
+
projectedErrors = contentChildren(ValidationMessage);
|
|
264
455
|
el = inject(ElementRef);
|
|
265
456
|
count = computed(() => this.input()?.value().length);
|
|
266
457
|
limit = computed(() => this.input()?.counter());
|
|
@@ -275,9 +466,12 @@ class Field {
|
|
|
275
466
|
}
|
|
276
467
|
fieldObserver(this.el.nativeElement);
|
|
277
468
|
});
|
|
469
|
+
effect(() => {
|
|
470
|
+
this.fieldState.hasProjectedErrors.set(this.projectedErrors().length > 0);
|
|
471
|
+
});
|
|
278
472
|
}
|
|
279
473
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Field, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
280
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: Field, isStandalone: true, selector: "ksd-field", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.dataPosition": "position()" }, classAttribute: "ds-field" }, queries: [{ propertyName: "input", first: true, predicate: Input, descendants: true, isSignal: true }, { propertyName: "label", first: true, predicate: Label, descendants: true, isSignal: true }], hostDirectives: [{ directive: CommonInputs, inputs: ["data-size", "data-size", "data-color", "data-color"] }], ngImport: i0, template: `
|
|
474
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: Field, isStandalone: true, selector: "ksd-field", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.dataPosition": "position()" }, classAttribute: "ds-field" }, providers: [FieldState], queries: [{ propertyName: "input", first: true, predicate: Input, descendants: true, isSignal: true }, { propertyName: "label", first: true, predicate: Label, descendants: true, isSignal: true }, { propertyName: "projectedErrors", predicate: ValidationMessage, isSignal: true }], hostDirectives: [{ directive: CommonInputs, inputs: ["data-size", "data-size", "data-color", "data-color"] }], ngImport: i0, template: `
|
|
281
475
|
<ng-content />
|
|
282
476
|
@if (hasCounter()) {
|
|
283
477
|
<ksd-field-counter [limit]="limit() ?? 0" [count]="count() ?? 0" />
|
|
@@ -305,9 +499,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
|
|
|
305
499
|
}
|
|
306
500
|
`,
|
|
307
501
|
imports: [FieldCounter],
|
|
502
|
+
providers: [FieldState],
|
|
308
503
|
}]
|
|
309
504
|
}], ctorParameters: () => [] });
|
|
310
505
|
|
|
506
|
+
class FieldDescription {
|
|
507
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldDescription, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
508
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.4", type: FieldDescription, isStandalone: true, selector: "[ksd-field-description]", host: { attributes: { "data-field": "description" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
509
|
+
}
|
|
510
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldDescription, decorators: [{
|
|
511
|
+
type: Component,
|
|
512
|
+
args: [{
|
|
513
|
+
selector: '[ksd-field-description]',
|
|
514
|
+
host: {
|
|
515
|
+
'data-field': 'description',
|
|
516
|
+
},
|
|
517
|
+
template: `<ng-content />`,
|
|
518
|
+
}]
|
|
519
|
+
}] });
|
|
520
|
+
|
|
521
|
+
class FieldError {
|
|
522
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldError, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
523
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.4", type: FieldError, isStandalone: true, selector: "[ksd-error]", hostDirectives: [{ directive: ValidationMessage }], ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
524
|
+
}
|
|
525
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldError, decorators: [{
|
|
526
|
+
type: Component,
|
|
527
|
+
args: [{
|
|
528
|
+
selector: '[ksd-error]',
|
|
529
|
+
template: `<ng-content />`,
|
|
530
|
+
hostDirectives: [
|
|
531
|
+
{
|
|
532
|
+
directive: ValidationMessage,
|
|
533
|
+
},
|
|
534
|
+
],
|
|
535
|
+
}]
|
|
536
|
+
}] });
|
|
537
|
+
|
|
311
538
|
class Fieldset {
|
|
312
539
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Fieldset, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
313
540
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.4", type: Fieldset, isStandalone: true, selector: "fieldset[ksd-fieldset]", host: { attributes: { "role": "fieldset" }, classAttribute: "ds-fieldset" }, ngImport: i0, template: ` <ng-content /> `, isInline: true });
|
|
@@ -372,5 +599,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
|
|
|
372
599
|
* Generated bundle index. Do not edit.
|
|
373
600
|
*/
|
|
374
601
|
|
|
375
|
-
export { CommonInputs, Field, Fieldset, FieldsetDescription, FieldsetLegend, Input, Label, Paragraph, ValidationMessage };
|
|
602
|
+
export { Button, CommonInputs, Field, FieldDescription, FieldError, Fieldset, FieldsetDescription, FieldsetLegend, Input, Label, Paragraph, ValidationMessage };
|
|
376
603
|
//# sourceMappingURL=ks-digital-designsystem-angular.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ks-digital-designsystem-angular.mjs","sources":["../../src/components/common-inputs.ts","../../src/utils/log-if-devmode.ts","../../src/components/input/input.ts","../../src/components/label/label.ts","../../src/components/validation-message/validation-message.ts","../../src/components/field/field-counter.ts","../../src/components/field/field-observer.ts","../../src/components/field/field.ts","../../src/components/fieldset/fieldset.ts","../../src/components/fieldset/fieldset-description.ts","../../src/components/fieldset/fieldset-legend.ts","../../src/components/paragraph/paragraph.ts","../../src/ks-digital-designsystem-angular.ts"],"sourcesContent":["/* eslint-disable @angular-eslint/no-input-rename */\n\n/**\n * We use input aliasing to bridge the gap between Angular's camelCase property naming convention and our HTML data attributes.\n * This approach allows us to use valid HTML data attributes as documented by Designsystemet while maintaining\n * proper TypeScript intellisense support.\n */\n\nimport { Directive, input } from '@angular/core'\nimport { Color } from './colors'\n\nexport type Size = 'sm' | 'md' | 'lg' | 'xl'\n\n@Directive()\nexport class CommonInputs {\n /**\n * Changes size for descendant Designsystemet components. Select from predefined sizes.\n * @attribute data-size\n */\n dataSize = input<Size>(undefined, { alias: 'data-size' })\n\n /**\n * Changes color for descendant Designsystemet components.\n * Select from predefined colors and colors defined using theme.designsystemet.no.\n * @attribute data-color\n */\n dataColor = input<Color>(undefined, { alias: 'data-color' })\n}\n","import { isDevMode } from '@angular/core'\n\nexport const logIfDevMode = ({\n component,\n message,\n}: {\n component: string\n message: string\n}) => {\n if (isDevMode()) {\n console.log(`[${component}] ${message}`)\n }\n}\n","import {\n booleanAttribute,\n Directive,\n input,\n numberAttribute,\n signal,\n} from '@angular/core'\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: 'input[ksd-input], textarea[ksd-input]',\n host: {\n class: 'ds-input',\n '[attr.readonly]': 'readonly() ? true : null',\n '(click)': 'onClick($event)',\n '(input)': 'value.set($event.target.value)',\n },\n})\nexport class Input {\n /**\n * The value of the input\n */\n value = signal('')\n\n /**\n * Whether the input is readonly\n */\n readonly = input(false, { transform: booleanAttribute })\n\n /**\n * Displays a character counter. pass a number to set a limit.\n */\n counter = input(0, { transform: numberAttribute })\n\n onClick(event: Event) {\n if (this.readonly()) {\n event.preventDefault()\n }\n }\n}\n","import { Component } from '@angular/core'\nimport { CommonInputs } from '../common-inputs'\n\n@Component({\n selector: 'ksd-label',\n hostDirectives: [\n {\n directive: CommonInputs,\n inputs: ['data-size', 'data-color'],\n },\n ],\n template: `\n <!-- eslint-disable @angular-eslint/template/label-has-associated-control -- Fieldobserver handles binding the label to the input -->\n <label class=\"ds-label\"><ng-content /></label>\n `,\n})\nexport class Label {}\n","import { Component } from '@angular/core'\n\n@Component({\n selector: 'p[ksd-validation-message]',\n template: `<ng-content />`,\n host: {\n class: 'ds-validation-message',\n 'data-field': 'validation',\n },\n})\nexport class ValidationMessage {}\n","import { Component, computed, input } from '@angular/core'\nimport { ValidationMessage } from '../validation-message'\n\n@Component({\n selector: 'ksd-field-counter',\n imports: [ValidationMessage],\n template: `\n <div data-field=\"description\" class=\"ds-sr-only\" aria-live=\"polite\">\n @if (hasExceededLimit()) {\n {{ excessCount() }} tegn for mye\n }\n </div>\n @if (hasExceededLimit()) {\n <p ksd-validation-message>{{ excessCount() }} tegn for mye</p>\n } @else {\n <p data-field=\"validation\">{{ remainder() }} tegn igjen</p>\n }\n `,\n\n /**\n * Apply custom styles here to get correct spacing because\n * the rendered host element from Angular is getting in the way\n */\n styles: `\n :host > * {\n margin-top: var(--dsc-field-content-spacing);\n }\n `,\n})\nexport class FieldCounter {\n /**\n * The maximum allowed characters.\n *\n **/\n readonly limit = input.required<number>()\n\n /**\n * How many characters have been typed.\n *\n **/\n readonly count = input.required<number>()\n protected readonly remainder = computed(() => this.limit() - this.count())\n protected readonly excessCount = computed(() => Math.abs(this.remainder()))\n protected readonly hasExceededLimit = computed(\n () => this.count() > this.limit(),\n )\n}\n","/**\n * Lifted from Designsystemet core repo.\n * Takes care of binding ids, labels and aria-describedby attributes\n *\n * @param fieldElement - The field element to observe\n * @returns A function to disconnect the observer\n * */\nexport function fieldObserver(fieldElement: HTMLElement | null) {\n if (!fieldElement) return\n\n const elements = new Map<Element, string | null>()\n const uuid = `:${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`\n let input: Element | null = null\n let describedby = ''\n\n const process = (mutations: Partial<MutationRecord>[]) => {\n const changed: Node[] = []\n const removed: Node[] = []\n\n // Merge MutationRecords\n for (const mutation of mutations) {\n if (mutation.attributeName) changed.push(mutation.target ?? fieldElement)\n // @ts-expect-error - addedNodes is not typed\n changed.push(...(mutation.addedNodes || []))\n removed.push(...(mutation.removedNodes || []))\n }\n\n // Register elements\n for (const el of changed) {\n if (!isElement(el)) continue\n if (isLabel(el)) elements.set(el, el.htmlFor)\n else if (el.hasAttribute('data-field')) elements.set(el, el.id)\n else if (isInputLike(el)) {\n input = el\n describedby = el.getAttribute('aria-describedby') || ''\n }\n }\n\n // Reset removed elements\n for (const el of removed) {\n if (!isElement(el)) continue\n\n if (input === el) input = null\n if (elements.has(el)) {\n setAttr(el, isLabel(el) ? 'for' : 'id', elements.get(el))\n elements.delete(el)\n }\n }\n\n // Connect elements\n const describedbyIds = [describedby] // Keep original aria-describedby\n const inputId = input?.id || uuid\n\n for (const [el, value] of elements) {\n const descriptionType = el.getAttribute('data-field')\n const id = descriptionType ? `${inputId}:${descriptionType}` : inputId\n\n if (!value) setAttr(el, isLabel(el) ? 'for' : 'id', id) // Ensure we have a value\n if (descriptionType === 'validation')\n describedbyIds.unshift(el.id) // Validations to the front\n else if (descriptionType) describedbyIds.push(el.id) // Other descriptions to the back\n }\n\n setAttr(input, 'id', inputId)\n setAttr(input, 'aria-describedby', describedbyIds.join(' ').trim())\n }\n\n const observer = createOptimizedMutationObserver(process)\n observer.observe(fieldElement, {\n attributeFilter: ['id', 'for', 'aria-describedby'],\n attributes: true,\n childList: true,\n subtree: true,\n })\n\n process([{ addedNodes: fieldElement.querySelectorAll('*') }]) // Initial setup\n observer.takeRecords() // Clear initial setup queue\n return () => observer.disconnect()\n}\n\n// Utilities\nexport const isElement = (node: Node) => node instanceof Element\nexport const isLabel = (node: Node) => node instanceof HTMLLabelElement\nexport const isInputLike = (node: unknown): node is HTMLInputElement =>\n node instanceof HTMLElement &&\n 'validity' in node &&\n !(node instanceof HTMLButtonElement) // Matches input, textarea, select and form accosiated custom elements\n\nconst setAttr = (el: Element | null, name: string, value?: string | null) =>\n value ? el?.setAttribute(name, value) : el?.removeAttribute(name)\n\n// Speed up MutationObserver by debouncing, clearing internal queue after changes and only running when page is visible\nfunction createOptimizedMutationObserver(callback: MutationCallback) {\n const queue: MutationRecord[] = []\n const observer = new MutationObserver((mutations) => {\n if (!queue.length) requestAnimationFrame(process)\n queue.push(...mutations)\n })\n\n const process = () => {\n callback(queue, observer)\n queue.length = 0 // Reset queue\n observer.takeRecords() // Clear queue due to DOM changes in callback\n }\n\n return observer\n}\n","import {\n afterNextRender,\n Component,\n computed,\n contentChild,\n ElementRef,\n inject,\n input,\n} from '@angular/core'\nimport { logIfDevMode } from '../../utils/log-if-devmode'\nimport { CommonInputs } from '../common-inputs'\nimport { Input } from '../input/input'\nimport { Label } from '../label/label'\nimport { FieldCounter } from './field-counter'\nimport { fieldObserver } from './field-observer'\n\n/**\n * Use the Field component to connect inputs and labels\n */\n@Component({\n selector: 'ksd-field',\n hostDirectives: [\n {\n directive: CommonInputs,\n inputs: ['data-size', 'data-color'],\n },\n ],\n host: {\n class: 'ds-field',\n '[attr.dataPosition]': 'position()',\n },\n template: `\n <ng-content />\n @if (hasCounter()) {\n <ksd-field-counter [limit]=\"limit() ?? 0\" [count]=\"count() ?? 0\" />\n }\n `,\n imports: [FieldCounter],\n})\nexport class Field {\n /**\n * Position of toggle inputs (radio, checkbox, switch) in field\n * @default start\n */\n position = input<'start' | 'end'>('start')\n\n private input = contentChild(Input)\n private label = contentChild(Label)\n\n private el = inject(ElementRef)\n protected count = computed(() => this.input()?.value().length)\n protected limit = computed(() => this.input()?.counter())\n protected hasCounter = computed(() => this.limit())\n\n constructor() {\n afterNextRender(() => {\n if (!this.label() || !this.input()) {\n logIfDevMode({\n component: 'Field',\n message:\n 'Missing required elements: ksd-label and ksd-input must be provided as children. Check imports and markup.',\n })\n }\n\n fieldObserver(this.el.nativeElement)\n })\n }\n}\n","import { Component } from '@angular/core'\n\n@Component({\n selector: 'fieldset[ksd-fieldset]',\n host: {\n role: 'fieldset',\n class: 'ds-fieldset',\n },\n template: ` <ng-content /> `,\n})\nexport class Fieldset {}\n","import { Component } from '@angular/core'\n\n@Component({\n selector: 'p[ksd-fieldset-description]',\n template: `<ng-content />`,\n host: {},\n})\nexport class FieldsetDescription {}\n","import { Component } from '@angular/core'\n\n@Component({\n selector: 'legend[ksd-fieldset-legend]',\n host: {\n role: 'legend',\n class: 'ds-label',\n },\n template: ` <ng-content /> `,\n})\nexport class FieldsetLegend {}\n","import { Component } from '@angular/core'\n\n@Component({\n selector: 'p[ksd-paragraph]',\n template: `<ng-content />`,\n host: {\n class: 'ds-paragraph',\n },\n})\nexport class Paragraph {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.CommonInputs"],"mappings":";;;AAAA;AAEA;;;;AAIG;MAQU,YAAY,CAAA;AACvB;;;AAGG;IACH,QAAQ,GAAG,KAAK,CAAO,SAAS,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAEzD;;;;AAIG;IACH,SAAS,GAAG,KAAK,CAAQ,SAAS,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;uGAZjD,YAAY,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAZ,YAAY,EAAA,YAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,WAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,iBAAA,EAAA,WAAA,EAAA,UAAA,EAAA,YAAA,EAAA,QAAA,EAAA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AA;;;ACRD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ks-digital-designsystem-angular.mjs","sources":["../../src/components/common-inputs.ts","../../src/components/spinner/spinner.ts","../../src/components/button/button.ts","../../src/utils/log-if-devmode.ts","../../src/components/field/field-state.ts","../../src/components/input/input.ts","../../src/components/label/label.ts","../../src/components/validation-message/validation-message.ts","../../src/components/field/field-counter.ts","../../src/components/field/field-observer.ts","../../src/components/field/field.ts","../../src/components/field/field-description.ts","../../src/components/field/field-error.ts","../../src/components/fieldset/fieldset.ts","../../src/components/fieldset/fieldset-description.ts","../../src/components/fieldset/fieldset-legend.ts","../../src/components/paragraph/paragraph.ts","../../src/ks-digital-designsystem-angular.ts"],"sourcesContent":["/* eslint-disable @angular-eslint/no-input-rename */\n\n/**\n * We use input aliasing to bridge the gap between Angular's camelCase property naming convention and our HTML data attributes.\n * This approach allows us to use valid HTML data attributes as documented by Designsystemet while maintaining\n * proper TypeScript intellisense support.\n */\n\nimport { Directive, input } from '@angular/core'\nimport { Color } from './colors'\n\nexport type Size = 'sm' | 'md' | 'lg'\n\n@Directive()\nexport class CommonInputs {\n /**\n * Changes size for descendant Designsystemet components. Select from predefined sizes.\n * @attribute data-size\n */\n dataSize = input<Size>(undefined, { alias: 'data-size' })\n\n /**\n * Changes color for descendant Designsystemet components.\n * Select from predefined colors and colors defined using theme.designsystemet.no.\n * @attribute data-color\n */\n dataColor = input<Color>(undefined, { alias: 'data-color' })\n}\n","/* eslint-disable @angular-eslint/no-input-rename */\nimport { booleanAttribute, Component, input } from '@angular/core'\nimport { Size } from '../common-inputs'\n\n@Component({\n selector: 'ksd-spinner',\n styles: `\n :host {\n display: contents;\n }\n `,\n template: `\n <svg\n class=\"ds-spinner\"\n role=\"img\"\n viewBox=\"0 0 50 50\"\n [attr.data-size]=\"dataSize()\"\n [attr.data-color]=\"dataColor()\"\n >\n <circle\n class=\"ds-spinner__background\"\n cx=\"25\"\n cy=\"25\"\n r=\"20\"\n fill=\"none\"\n stroke-width=\"5\"\n />\n <circle\n class=\"ds-spinner__circle\"\n cx=\"25\"\n cy=\"25\"\n r=\"20\"\n fill=\"none\"\n stroke-width=\"5\"\n />\n </svg>\n `,\n})\nexport class Spinner {\n /**\n * Aria-label for the spinner\n */\n readonly ariaLabel = input<string>(undefined, { alias: 'aria-label' })\n\n /**\n * Aria-label for the spinner\n */\n readonly dataSize = input<Size>(undefined, { alias: 'data-size' })\n\n /**\n * Aria-label for the spinner\n */\n readonly dataColor = input<Size>(undefined, { alias: 'data-color' })\n\n /**\n * Aria-hidden for the spinner\n */\n readonly ariaHidden = input(undefined, {\n transform: booleanAttribute,\n alias: 'aria-hidden',\n })\n}\n","import { booleanAttribute, Component, input } from '@angular/core'\nimport { CommonInputs } from '../common-inputs'\nimport { Spinner } from '../spinner/spinner'\n\n@Component({\n selector: 'button[ksd-button], a[ksd-button]',\n hostDirectives: [\n {\n directive: CommonInputs,\n inputs: ['data-size', 'data-color'],\n },\n ],\n imports: [Spinner],\n host: {\n class: 'ds-button',\n type: 'button',\n '[attr.data-variant]': 'variant()',\n '[attr.disabled]': 'disabled() ? true : null',\n '[attr.aria-busy]': 'loading() ? true : null',\n },\n template: `\n @if (loading()) {\n <ksd-spinner aria-hidden=\"true\" />\n }\n <ng-content />\n `,\n})\nexport class Button {\n /**\n * Specify which variant to use\n * @default 'primary'\n */\n readonly variant = input<'primary' | 'secondary' | 'tertiary'>('primary')\n\n /**\n * Toggle loading state.\n * Pass an element if you want to display a custom loader.\n *\n * @default false\n */\n readonly loading = input(false, { transform: booleanAttribute })\n\n /**\n * Disables element\n */\n readonly disabled = input(false, { transform: booleanAttribute })\n}\n","import { isDevMode } from '@angular/core'\n\nexport const logIfDevMode = ({\n component,\n message,\n}: {\n component: string\n message: string\n}) => {\n if (isDevMode()) {\n console.log(`[${component}] ${message}`)\n }\n}\n","import { computed, Injectable, signal } from '@angular/core'\n\n@Injectable()\nexport class FieldState {\n /**\n * Whether the field counter has exceeded its limit\n */\n hasExceededCounter = signal(false)\n\n /**\n * Whether the field has errors projected from the outside\n */\n hasProjectedErrors = signal(false)\n\n /**\n * Whether the field has any errors associated with it\n */\n hasError = computed(\n () => this.hasExceededCounter() || this.hasProjectedErrors(),\n )\n}\n","import {\n booleanAttribute,\n Directive,\n inject,\n input,\n numberAttribute,\n signal,\n} from '@angular/core'\nimport { CommonInputs } from '../common-inputs'\nimport { FieldState } from '../field/field-state'\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: 'input[ksd-input], textarea[ksd-input], select[ksd-input]',\n hostDirectives: [\n {\n directive: CommonInputs,\n inputs: ['data-size', 'data-color'],\n },\n ],\n host: {\n class: 'ds-input',\n '[attr.readonly]': 'readonly() ? true : null',\n '[attr.disabled]': 'disabled() ? true : null',\n '[attr.aria-invalid]':\n 'ariaInvalid() ? true : (fieldState?.hasError() ? true: null)',\n '(click)': 'onClick($event)',\n '(input)': 'value.set($event.target.value)',\n },\n})\nexport class Input {\n /**\n * The value of the input\n */\n value = signal('')\n\n /**\n * Whether the input is readonly\n */\n readonly readonly = input(false, { transform: booleanAttribute })\n\n /**\n * Disables element\n */\n readonly disabled = input(false, { transform: booleanAttribute })\n\n /**\n * Whether the element is invalid.\n */\n readonly ariaInvalid = input(false, {\n transform: booleanAttribute,\n alias: 'aria-invalid',\n })\n\n /**\n * Displays a character counter. pass a number to set a limit.\n */\n counter = input(0, { transform: numberAttribute })\n\n protected fieldState = inject(FieldState, { optional: true })\n\n onClick(event: Event) {\n if (this.readonly()) {\n event.preventDefault()\n }\n }\n}\n","import { Component } from '@angular/core'\nimport { CommonInputs } from '../common-inputs'\n\n@Component({\n selector: 'ksd-label',\n hostDirectives: [\n {\n directive: CommonInputs,\n inputs: ['data-size', 'data-color'],\n },\n ],\n template: `\n <!-- eslint-disable @angular-eslint/template/label-has-associated-control -- Fieldobserver handles binding the label to the input -->\n <label class=\"ds-label\"><ng-content /></label>\n `,\n})\nexport class Label {}\n","import { Directive } from '@angular/core'\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[ksd-validation-message]',\n host: {\n class: 'ds-validation-message',\n 'data-field': 'validation',\n },\n})\nexport class ValidationMessage {}\n","import { Component, computed, effect, inject, input } from '@angular/core'\nimport { ValidationMessage } from '../validation-message'\nimport { FieldState } from './field-state'\n\n@Component({\n selector: 'ksd-field-counter',\n imports: [ValidationMessage],\n template: `\n <div data-field=\"description\" class=\"ds-sr-only\" aria-live=\"polite\">\n @if (hasExceededLimit()) {\n {{ excessCount() }} tegn for mye\n }\n </div>\n @if (hasExceededLimit()) {\n <p ksd-validation-message>{{ excessCount() }} tegn for mye</p>\n } @else {\n <p data-field=\"validation\">{{ remainder() }} tegn igjen</p>\n }\n `,\n\n /**\n * Apply custom styles here to get correct spacing because\n * the rendered host element from Angular is getting in the way\n */\n styles: `\n :host > * {\n margin-top: var(--dsc-field-content-spacing);\n }\n `,\n})\nexport class FieldCounter {\n /**\n * The maximum allowed characters.\n *\n **/\n readonly limit = input.required<number>()\n\n /**\n * How many characters have been typed.\n *\n **/\n readonly count = input.required<number>()\n protected readonly remainder = computed(() => this.limit() - this.count())\n protected readonly excessCount = computed(() => Math.abs(this.remainder()))\n protected readonly hasExceededLimit = computed(\n () => this.count() > this.limit(),\n )\n\n private fieldState = inject(FieldState)\n\n constructor() {\n effect(() => {\n this.fieldState.hasExceededCounter.set(this.hasExceededLimit())\n })\n }\n}\n","/**\n * Lifted from Designsystemet core repo.\n * Takes care of binding ids, labels and aria-describedby attributes\n *\n * @param fieldElement - The field element to observe\n * @returns A function to disconnect the observer\n * */\nexport function fieldObserver(fieldElement: HTMLElement | null) {\n if (!fieldElement) return\n\n const elements = new Map<Element, string | null>()\n const typeCounter = new Map<string, number>() // Track count for each data-field type\n const uuid = `:${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`\n let input: Element | null = null\n let describedby = ''\n\n const process = (mutations: Partial<MutationRecord>[]) => {\n const changed: Node[] = []\n const removed: Node[] = []\n\n // Merge MutationRecords\n for (const mutation of mutations) {\n if (mutation.attributeName) changed.push(mutation.target ?? fieldElement)\n // @ts-expect-error - addedNodes is not typed\n changed.push(...(mutation.addedNodes || []))\n removed.push(...(mutation.removedNodes || []))\n }\n\n // Register elements\n for (const el of changed) {\n if (!isElement(el)) continue\n\n if (isLabel(el)) elements.set(el, el.htmlFor)\n else if (el.hasAttribute('data-field')) elements.set(el, el.id)\n else if (isInputLike(el)) {\n input = el\n describedby = el.getAttribute('aria-describedby') || ''\n }\n }\n\n // Reset removed elements\n for (const el of removed) {\n if (!isElement(el)) continue\n\n if (input === el) input = null\n if (elements.has(el)) {\n setAttr(el, isLabel(el) ? 'for' : 'id', elements.get(el))\n elements.delete(el)\n }\n }\n\n // Connect elements\n const describedbyIds = [describedby] // Keep original aria-describedby\n const inputId = input?.id || uuid\n\n // Reset type counters since we reprocess all elements\n typeCounter.clear()\n\n for (const [el, value] of elements) {\n const descriptionType = el.getAttribute('data-field')\n let id: string\n\n if (descriptionType) {\n // Increment type counter for this type\n const count = (typeCounter.get(descriptionType) || 0) + 1\n typeCounter.set(descriptionType, count)\n id = `${inputId}:${descriptionType}:${count}`\n } else {\n id = inputId\n }\n\n if (!value) setAttr(el, isLabel(el) ? 'for' : 'id', id) // Ensure we have a value\n if (descriptionType === 'validation')\n describedbyIds.unshift(el.id) // Validations to the front\n else if (descriptionType) describedbyIds.push(el.id) // Other descriptions to the back\n }\n\n setAttr(input, 'id', inputId)\n setAttr(input, 'aria-describedby', describedbyIds.join(' ').trim())\n }\n\n const observer = createOptimizedMutationObserver(process)\n observer.observe(fieldElement, {\n attributeFilter: ['id', 'for', 'aria-describedby'],\n attributes: true,\n childList: true,\n subtree: true,\n })\n\n process([{ addedNodes: fieldElement.querySelectorAll('*') }]) // Initial setup\n observer.takeRecords() // Clear initial setup queue\n return () => observer.disconnect()\n}\n\n// Utilities\nexport const isElement = (node: Node) => node instanceof Element\nexport const isLabel = (node: Node) => node instanceof HTMLLabelElement\nexport const isInputLike = (node: unknown): node is HTMLInputElement =>\n node instanceof HTMLElement &&\n 'validity' in node &&\n !(node instanceof HTMLButtonElement) // Matches input, textarea, select and form accosiated custom elements\n\nconst setAttr = (el: Element | null, name: string, value?: string | null) =>\n value ? el?.setAttribute(name, value) : el?.removeAttribute(name)\n\n// Speed up MutationObserver by debouncing, clearing internal queue after changes and only running when page is visible\nfunction createOptimizedMutationObserver(callback: MutationCallback) {\n const queue: MutationRecord[] = []\n const observer = new MutationObserver((mutations) => {\n if (!queue.length) requestAnimationFrame(process)\n queue.push(...mutations)\n })\n\n const process = () => {\n callback(queue, observer)\n queue.length = 0 // Reset queue\n observer.takeRecords() // Clear queue due to DOM changes in callback\n }\n\n return observer\n}\n","import {\n afterNextRender,\n Component,\n computed,\n contentChild,\n contentChildren,\n effect,\n ElementRef,\n inject,\n input,\n} from '@angular/core'\nimport { logIfDevMode } from '../../utils/log-if-devmode'\nimport { CommonInputs } from '../common-inputs'\nimport { Input } from '../input/input'\nimport { Label } from '../label/label'\nimport { ValidationMessage } from '../validation-message'\nimport { FieldCounter } from './field-counter'\nimport { fieldObserver } from './field-observer'\nimport { FieldState } from './field-state'\n\n/**\n * Use the Field component to connect inputs and labels\n */\n@Component({\n selector: 'ksd-field',\n hostDirectives: [\n {\n directive: CommonInputs,\n inputs: ['data-size', 'data-color'],\n },\n ],\n host: {\n class: 'ds-field',\n '[attr.dataPosition]': 'position()',\n },\n template: `\n <ng-content />\n @if (hasCounter()) {\n <ksd-field-counter [limit]=\"limit() ?? 0\" [count]=\"count() ?? 0\" />\n }\n `,\n imports: [FieldCounter],\n providers: [FieldState],\n})\nexport class Field {\n /**\n * Position of toggle inputs (radio, checkbox, switch) in field\n * @default start\n */\n position = input<'start' | 'end'>('start')\n\n private readonly fieldState = inject(FieldState)\n private readonly input = contentChild(Input)\n private readonly label = contentChild(Label)\n private readonly projectedErrors = contentChildren(ValidationMessage)\n\n private readonly el = inject(ElementRef)\n protected readonly count = computed(() => this.input()?.value().length)\n protected readonly limit = computed(() => this.input()?.counter())\n protected readonly hasCounter = computed(() => this.limit())\n\n constructor() {\n afterNextRender(() => {\n if (!this.label() || !this.input()) {\n logIfDevMode({\n component: 'Field',\n message:\n 'Missing required elements: ksd-label and ksd-input must be provided as children. Check imports and markup.',\n })\n }\n\n fieldObserver(this.el.nativeElement)\n })\n\n effect(() => {\n this.fieldState.hasProjectedErrors.set(this.projectedErrors().length > 0)\n })\n }\n}\n","import { Component } from '@angular/core'\n\n@Component({\n selector: '[ksd-field-description]',\n host: {\n 'data-field': 'description',\n },\n template: `<ng-content />`,\n})\nexport class FieldDescription {}\n","import { Component } from '@angular/core'\nimport { ValidationMessage } from '../validation-message'\n\n@Component({\n selector: '[ksd-error]',\n template: `<ng-content />`,\n hostDirectives: [\n {\n directive: ValidationMessage,\n },\n ],\n})\nexport class FieldError {}\n","import { Component } from '@angular/core'\n\n@Component({\n selector: 'fieldset[ksd-fieldset]',\n host: {\n role: 'fieldset',\n class: 'ds-fieldset',\n },\n template: ` <ng-content /> `,\n})\nexport class Fieldset {}\n","import { Component } from '@angular/core'\n\n@Component({\n selector: 'p[ksd-fieldset-description]',\n template: `<ng-content />`,\n host: {},\n})\nexport class FieldsetDescription {}\n","import { Component } from '@angular/core'\n\n@Component({\n selector: 'legend[ksd-fieldset-legend]',\n host: {\n role: 'legend',\n class: 'ds-label',\n },\n template: ` <ng-content /> `,\n})\nexport class FieldsetLegend {}\n","import { Component } from '@angular/core'\n\n@Component({\n selector: 'p[ksd-paragraph]',\n template: `<ng-content />`,\n host: {\n class: 'ds-paragraph',\n },\n})\nexport class Paragraph {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.CommonInputs"],"mappings":";;;AAAA;AAEA;;;;AAIG;MAQU,YAAY,CAAA;AACvB;;;AAGG;IACH,QAAQ,GAAG,KAAK,CAAO,SAAS,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAEzD;;;;AAIG;IACH,SAAS,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AAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,SAAS,sHALV,CAAA,cAAA,CAAgB,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;2FAKf,SAAS,EAAA,UAAA,EAAA,CAAA;kBAPrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,CAAA,cAAA,CAAgB;AAC1B,oBAAA,IAAI,EAAE;AACJ,wBAAA,KAAK,EAAE,cAAc;AACtB,qBAAA;AACF,iBAAA;;;ACRD;;AAEG;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
|
|
3
|
-
type Size = 'sm' | 'md' | 'lg'
|
|
3
|
+
type Size = 'sm' | 'md' | 'lg';
|
|
4
4
|
declare class CommonInputs {
|
|
5
5
|
/**
|
|
6
6
|
* Changes size for descendant Designsystemet components. Select from predefined sizes.
|
|
@@ -17,6 +17,27 @@ declare class CommonInputs {
|
|
|
17
17
|
static ɵdir: i0.ɵɵDirectiveDeclaration<CommonInputs, never, never, { "dataSize": { "alias": "data-size"; "required": false; "isSignal": true; }; "dataColor": { "alias": "data-color"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
declare class Button {
|
|
21
|
+
/**
|
|
22
|
+
* Specify which variant to use
|
|
23
|
+
* @default 'primary'
|
|
24
|
+
*/
|
|
25
|
+
readonly variant: i0.InputSignal<"primary" | "secondary" | "tertiary">;
|
|
26
|
+
/**
|
|
27
|
+
* Toggle loading state.
|
|
28
|
+
* Pass an element if you want to display a custom loader.
|
|
29
|
+
*
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
readonly loading: i0.InputSignalWithTransform<boolean, unknown>;
|
|
33
|
+
/**
|
|
34
|
+
* Disables element
|
|
35
|
+
*/
|
|
36
|
+
readonly disabled: i0.InputSignalWithTransform<boolean, unknown>;
|
|
37
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Button, never>;
|
|
38
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Button, "button[ksd-button], a[ksd-button]", never, { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, [{ directive: typeof CommonInputs; inputs: { "data-size": "data-size"; "data-color": "data-color"; }; outputs: {}; }]>;
|
|
39
|
+
}
|
|
40
|
+
|
|
20
41
|
/**
|
|
21
42
|
* Use the Field component to connect inputs and labels
|
|
22
43
|
*/
|
|
@@ -26,15 +47,32 @@ declare class Field {
|
|
|
26
47
|
* @default start
|
|
27
48
|
*/
|
|
28
49
|
position: i0.InputSignal<"start" | "end">;
|
|
29
|
-
private
|
|
30
|
-
private
|
|
31
|
-
private
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
protected
|
|
50
|
+
private readonly fieldState;
|
|
51
|
+
private readonly input;
|
|
52
|
+
private readonly label;
|
|
53
|
+
private readonly projectedErrors;
|
|
54
|
+
private readonly el;
|
|
55
|
+
protected readonly count: i0.Signal<number>;
|
|
56
|
+
protected readonly limit: i0.Signal<number>;
|
|
57
|
+
protected readonly hasCounter: i0.Signal<number>;
|
|
35
58
|
constructor();
|
|
36
59
|
static ɵfac: i0.ɵɵFactoryDeclaration<Field, never>;
|
|
37
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<Field, "ksd-field", never, { "position": { "alias": "position"; "required": false; "isSignal": true; }; }, {}, ["input", "label"], ["*"], true, [{ directive: typeof CommonInputs; inputs: { "data-size": "data-size"; "data-color": "data-color"; }; outputs: {}; }]>;
|
|
60
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Field, "ksd-field", never, { "position": { "alias": "position"; "required": false; "isSignal": true; }; }, {}, ["input", "label", "projectedErrors"], ["*"], true, [{ directive: typeof CommonInputs; inputs: { "data-size": "data-size"; "data-color": "data-color"; }; outputs: {}; }]>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
declare class FieldDescription {
|
|
64
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FieldDescription, never>;
|
|
65
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FieldDescription, "[ksd-field-description]", never, {}, {}, never, ["*"], true, never>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
declare class ValidationMessage {
|
|
69
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ValidationMessage, never>;
|
|
70
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ValidationMessage, "[ksd-validation-message]", never, {}, {}, never, never, true, never>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare class FieldError {
|
|
74
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FieldError, never>;
|
|
75
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FieldError, "[ksd-error]", never, {}, {}, never, ["*"], true, [{ directive: typeof ValidationMessage; inputs: {}; outputs: {}; }]>;
|
|
38
76
|
}
|
|
39
77
|
|
|
40
78
|
declare class Fieldset {
|
|
@@ -52,6 +90,23 @@ declare class FieldsetLegend {
|
|
|
52
90
|
static ɵcmp: i0.ɵɵComponentDeclaration<FieldsetLegend, "legend[ksd-fieldset-legend]", never, {}, {}, never, ["*"], true, never>;
|
|
53
91
|
}
|
|
54
92
|
|
|
93
|
+
declare class FieldState {
|
|
94
|
+
/**
|
|
95
|
+
* Whether the field counter has exceeded its limit
|
|
96
|
+
*/
|
|
97
|
+
hasExceededCounter: i0.WritableSignal<boolean>;
|
|
98
|
+
/**
|
|
99
|
+
* Whether the field has errors projected from the outside
|
|
100
|
+
*/
|
|
101
|
+
hasProjectedErrors: i0.WritableSignal<boolean>;
|
|
102
|
+
/**
|
|
103
|
+
* Whether the field has any errors associated with it
|
|
104
|
+
*/
|
|
105
|
+
hasError: i0.Signal<boolean>;
|
|
106
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FieldState, never>;
|
|
107
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FieldState>;
|
|
108
|
+
}
|
|
109
|
+
|
|
55
110
|
declare class Input {
|
|
56
111
|
/**
|
|
57
112
|
* The value of the input
|
|
@@ -60,14 +115,23 @@ declare class Input {
|
|
|
60
115
|
/**
|
|
61
116
|
* Whether the input is readonly
|
|
62
117
|
*/
|
|
63
|
-
readonly: i0.InputSignalWithTransform<boolean, unknown>;
|
|
118
|
+
readonly readonly: i0.InputSignalWithTransform<boolean, unknown>;
|
|
119
|
+
/**
|
|
120
|
+
* Disables element
|
|
121
|
+
*/
|
|
122
|
+
readonly disabled: i0.InputSignalWithTransform<boolean, unknown>;
|
|
123
|
+
/**
|
|
124
|
+
* Whether the element is invalid.
|
|
125
|
+
*/
|
|
126
|
+
readonly ariaInvalid: i0.InputSignalWithTransform<boolean, unknown>;
|
|
64
127
|
/**
|
|
65
128
|
* Displays a character counter. pass a number to set a limit.
|
|
66
129
|
*/
|
|
67
130
|
counter: i0.InputSignalWithTransform<number, unknown>;
|
|
131
|
+
protected fieldState: FieldState;
|
|
68
132
|
onClick(event: Event): void;
|
|
69
133
|
static ɵfac: i0.ɵɵFactoryDeclaration<Input, never>;
|
|
70
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<Input, "input[ksd-input], textarea[ksd-input]", never, { "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "counter": { "alias": "counter"; "required": false; "isSignal": true; }; }, {}, never, never, true,
|
|
134
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<Input, "input[ksd-input], textarea[ksd-input], select[ksd-input]", never, { "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "ariaInvalid": { "alias": "aria-invalid"; "required": false; "isSignal": true; }; "counter": { "alias": "counter"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof CommonInputs; inputs: { "data-size": "data-size"; "data-color": "data-color"; }; outputs: {}; }]>;
|
|
71
135
|
}
|
|
72
136
|
|
|
73
137
|
declare class Label {
|
|
@@ -80,10 +144,5 @@ declare class Paragraph {
|
|
|
80
144
|
static ɵcmp: i0.ɵɵComponentDeclaration<Paragraph, "p[ksd-paragraph]", never, {}, {}, never, ["*"], true, never>;
|
|
81
145
|
}
|
|
82
146
|
|
|
83
|
-
|
|
84
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ValidationMessage, never>;
|
|
85
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ValidationMessage, "p[ksd-validation-message]", never, {}, {}, never, ["*"], true, never>;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export { CommonInputs, Field, Fieldset, FieldsetDescription, FieldsetLegend, Input, Label, Paragraph, ValidationMessage };
|
|
147
|
+
export { Button, CommonInputs, Field, FieldDescription, FieldError, Fieldset, FieldsetDescription, FieldsetLegend, Input, Label, Paragraph, ValidationMessage };
|
|
89
148
|
export type { Size };
|