@ks-digital/designsystem-angular 0.0.1-alpha.10 → 0.0.1-alpha.12

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, booleanAttribute, numberAttribute, Component, computed, contentChild, inject, ElementRef, afterNextRender } from '@angular/core';
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,162 @@ 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
+ /**
126
+ * If this is a button with only an icon
127
+ */
128
+ icon = input(false, { transform: booleanAttribute });
129
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Button, deps: [], target: i0.ɵɵFactoryTarget.Component });
130
+ 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 }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button" }, properties: { "attr.data-variant": "variant()", "attr.data-icon": "icon() || null", "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: `
131
+ @if (loading()) {
132
+ <ksd-spinner aria-hidden="true" />
133
+ }
134
+ <ng-content />
135
+ `, isInline: true, styles: [":host ::ng-deep>*{display:inline-flex}\n"], dependencies: [{ kind: "component", type: Spinner, selector: "ksd-spinner", inputs: ["aria-label", "data-size", "data-color", "aria-hidden"] }] });
136
+ }
137
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Button, decorators: [{
138
+ type: Component,
139
+ args: [{ selector: 'button[ksd-button], a[ksd-button]', hostDirectives: [
140
+ {
141
+ directive: CommonInputs,
142
+ inputs: ['data-size', 'data-color'],
143
+ },
144
+ ], imports: [Spinner], host: {
145
+ class: 'ds-button',
146
+ type: 'button',
147
+ '[attr.data-variant]': 'variant()',
148
+ '[attr.data-icon]': 'icon() || null',
149
+ '[attr.disabled]': 'disabled() ? true : null',
150
+ '[attr.aria-busy]': 'loading() ? true : null',
151
+ }, template: `
152
+ @if (loading()) {
153
+ <ksd-spinner aria-hidden="true" />
154
+ }
155
+ <ng-content />
156
+ `, styles: [":host ::ng-deep>*{display:inline-flex}\n"] }]
157
+ }] });
158
+
29
159
  const logIfDevMode = ({ component, message, }) => {
30
160
  if (isDevMode()) {
31
161
  console.log(`[${component}] ${message}`);
32
162
  }
33
163
  };
34
164
 
165
+ class FieldState {
166
+ /**
167
+ * Whether the field counter has exceeded its limit
168
+ */
169
+ hasExceededCounter = signal(false);
170
+ /**
171
+ * Whether the field has errors projected from the outside
172
+ */
173
+ hasProjectedErrors = signal(false);
174
+ /**
175
+ * Whether the field has any errors associated with it
176
+ */
177
+ hasError = computed(() => this.hasExceededCounter() || this.hasProjectedErrors());
178
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldState, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
179
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldState });
180
+ }
181
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldState, decorators: [{
182
+ type: Injectable
183
+ }] });
184
+
35
185
  class Input {
36
186
  /**
37
187
  * The value of the input
@@ -41,26 +191,46 @@ class Input {
41
191
  * Whether the input is readonly
42
192
  */
43
193
  readonly = input(false, { transform: booleanAttribute });
194
+ /**
195
+ * Disables element
196
+ */
197
+ disabled = input(false, { transform: booleanAttribute });
198
+ /**
199
+ * Whether the element is invalid.
200
+ */
201
+ ariaInvalid = input(false, {
202
+ transform: booleanAttribute,
203
+ alias: 'aria-invalid',
204
+ });
44
205
  /**
45
206
  * Displays a character counter. pass a number to set a limit.
46
207
  */
47
208
  counter = input(0, { transform: numberAttribute });
209
+ fieldState = inject(FieldState, { optional: true });
48
210
  onClick(event) {
49
211
  if (this.readonly()) {
50
212
  event.preventDefault();
51
213
  }
52
214
  }
53
215
  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 });
216
+ 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
217
  }
56
218
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Input, decorators: [{
57
219
  type: Directive,
58
220
  args: [{
59
221
  // eslint-disable-next-line @angular-eslint/directive-selector
60
- selector: 'input[ksd-input], textarea[ksd-input]',
222
+ selector: 'input[ksd-input], textarea[ksd-input], select[ksd-input]',
223
+ hostDirectives: [
224
+ {
225
+ directive: CommonInputs,
226
+ inputs: ['data-size', 'data-color'],
227
+ },
228
+ ],
61
229
  host: {
62
230
  class: 'ds-input',
63
231
  '[attr.readonly]': 'readonly() ? true : null',
232
+ '[attr.disabled]': 'disabled() ? true : null',
233
+ '[attr.aria-invalid]': 'ariaInvalid() ? true : (fieldState?.hasError() ? true: null)',
64
234
  '(click)': 'onClick($event)',
65
235
  '(input)': 'value.set($event.target.value)',
66
236
  },
@@ -92,14 +262,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
92
262
  }] });
93
263
 
94
264
  class ValidationMessage {
95
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ValidationMessage, deps: [], target: i0.ɵɵFactoryTarget.Component });
96
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.4", type: ValidationMessage, isStandalone: true, selector: "p[ksd-validation-message]", host: { attributes: { "data-field": "validation" }, classAttribute: "ds-validation-message" }, ngImport: i0, template: `<ng-content />`, isInline: true });
265
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ValidationMessage, deps: [], target: i0.ɵɵFactoryTarget.Directive });
266
+ 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
267
  }
98
268
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ValidationMessage, decorators: [{
99
- type: Component,
269
+ type: Directive,
100
270
  args: [{
101
- selector: 'p[ksd-validation-message]',
102
- template: `<ng-content />`,
271
+ // eslint-disable-next-line @angular-eslint/directive-selector
272
+ selector: '[ksd-validation-message]',
103
273
  host: {
104
274
  class: 'ds-validation-message',
105
275
  'data-field': 'validation',
@@ -121,6 +291,12 @@ class FieldCounter {
121
291
  remainder = computed(() => this.limit() - this.count());
122
292
  excessCount = computed(() => Math.abs(this.remainder()));
123
293
  hasExceededLimit = computed(() => this.count() > this.limit());
294
+ fieldState = inject(FieldState);
295
+ constructor() {
296
+ effect(() => {
297
+ this.fieldState.hasExceededCounter.set(this.hasExceededLimit());
298
+ });
299
+ }
124
300
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldCounter, deps: [], target: i0.ɵɵFactoryTarget.Component });
125
301
  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
302
  <div data-field="description" class="ds-sr-only" aria-live="polite">
@@ -133,7 +309,7 @@ class FieldCounter {
133
309
  } @else {
134
310
  <p data-field="validation">{{ remainder() }} tegn igjen</p>
135
311
  }
136
- `, isInline: true, styles: [":host>*{margin-top:var(--dsc-field-content-spacing)}\n"], dependencies: [{ kind: "component", type: ValidationMessage, selector: "p[ksd-validation-message]" }] });
312
+ `, isInline: true, styles: [":host>*{margin-top:var(--dsc-field-content-spacing)}\n"], dependencies: [{ kind: "directive", type: ValidationMessage, selector: "[ksd-validation-message]" }] });
137
313
  }
138
314
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldCounter, decorators: [{
139
315
  type: Component,
@@ -149,7 +325,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
149
325
  <p data-field="validation">{{ remainder() }} tegn igjen</p>
150
326
  }
151
327
  `, styles: [":host>*{margin-top:var(--dsc-field-content-spacing)}\n"] }]
152
- }] });
328
+ }], ctorParameters: () => [] });
153
329
 
154
330
  /**
155
331
  * Lifted from Designsystemet core repo.
@@ -162,6 +338,7 @@ function fieldObserver(fieldElement) {
162
338
  if (!fieldElement)
163
339
  return;
164
340
  const elements = new Map();
341
+ const typeCounter = new Map(); // Track count for each data-field type
165
342
  const uuid = `:${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`;
166
343
  let input = null;
167
344
  let describedby = '';
@@ -203,9 +380,20 @@ function fieldObserver(fieldElement) {
203
380
  // Connect elements
204
381
  const describedbyIds = [describedby]; // Keep original aria-describedby
205
382
  const inputId = input?.id || uuid;
383
+ // Reset type counters since we reprocess all elements
384
+ typeCounter.clear();
206
385
  for (const [el, value] of elements) {
207
386
  const descriptionType = el.getAttribute('data-field');
208
- const id = descriptionType ? `${inputId}:${descriptionType}` : inputId;
387
+ let id;
388
+ if (descriptionType) {
389
+ // Increment type counter for this type
390
+ const count = (typeCounter.get(descriptionType) || 0) + 1;
391
+ typeCounter.set(descriptionType, count);
392
+ id = `${inputId}:${descriptionType}:${count}`;
393
+ }
394
+ else {
395
+ id = inputId;
396
+ }
209
397
  if (!value)
210
398
  setAttr(el, isLabel(el) ? 'for' : 'id', id); // Ensure we have a value
211
399
  if (descriptionType === 'validation')
@@ -259,8 +447,10 @@ class Field {
259
447
  * @default start
260
448
  */
261
449
  position = input('start');
450
+ fieldState = inject(FieldState);
262
451
  input = contentChild(Input);
263
452
  label = contentChild(Label);
453
+ projectedErrors = contentChildren(ValidationMessage);
264
454
  el = inject(ElementRef);
265
455
  count = computed(() => this.input()?.value().length);
266
456
  limit = computed(() => this.input()?.counter());
@@ -275,9 +465,12 @@ class Field {
275
465
  }
276
466
  fieldObserver(this.el.nativeElement);
277
467
  });
468
+ effect(() => {
469
+ this.fieldState.hasProjectedErrors.set(this.projectedErrors().length > 0);
470
+ });
278
471
  }
279
472
  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: `
473
+ 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
474
  <ng-content />
282
475
  @if (hasCounter()) {
283
476
  <ksd-field-counter [limit]="limit() ?? 0" [count]="count() ?? 0" />
@@ -305,9 +498,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
305
498
  }
306
499
  `,
307
500
  imports: [FieldCounter],
501
+ providers: [FieldState],
308
502
  }]
309
503
  }], ctorParameters: () => [] });
310
504
 
505
+ class FieldDescription {
506
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldDescription, deps: [], target: i0.ɵɵFactoryTarget.Component });
507
+ 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 });
508
+ }
509
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldDescription, decorators: [{
510
+ type: Component,
511
+ args: [{
512
+ selector: '[ksd-field-description]',
513
+ host: {
514
+ 'data-field': 'description',
515
+ },
516
+ template: `<ng-content />`,
517
+ }]
518
+ }] });
519
+
520
+ class FieldError {
521
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldError, deps: [], target: i0.ɵɵFactoryTarget.Component });
522
+ 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 });
523
+ }
524
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldError, decorators: [{
525
+ type: Component,
526
+ args: [{
527
+ selector: '[ksd-error]',
528
+ template: `<ng-content />`,
529
+ hostDirectives: [
530
+ {
531
+ directive: ValidationMessage,
532
+ },
533
+ ],
534
+ }]
535
+ }] });
536
+
311
537
  class Fieldset {
312
538
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Fieldset, deps: [], target: i0.ɵɵFactoryTarget.Component });
313
539
  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 +598,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
372
598
  * Generated bundle index. Do not edit.
373
599
  */
374
600
 
375
- export { CommonInputs, Field, Fieldset, FieldsetDescription, FieldsetLegend, Input, Label, Paragraph, ValidationMessage };
601
+ export { Button, CommonInputs, Field, FieldDescription, FieldError, Fieldset, FieldsetDescription, FieldsetLegend, Input, Label, Paragraph, ValidationMessage };
376
602
  //# 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,C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,oBAAA,CAAA,EAAA,UAAA,EAAA,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;;;;"}
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.data-icon]': 'icon() || null',\n '[attr.disabled]': 'disabled() ? true : null',\n '[attr.aria-busy]': 'loading() ? true : null',\n },\n styles: `\n /* Ensure transcluded icons are aligned properly */\n :host ::ng-deep > * {\n display: inline-flex;\n }\n `,\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 /**\n * If this is a button with only an icon\n */\n readonly icon = 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,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,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAZ,YAAY,EAAA,UAAA,EAAA,CAAA;kBADxB;;;ACbD;MAsCa,OAAO,CAAA;AAClB;;AAEG;IACM,SAAS,GAAG,KAAK,CAAS,SAAS,EAAE,EAAE,KA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A;;;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' | 'xl';
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,31 @@ 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
+ /**
38
+ * If this is a button with only an icon
39
+ */
40
+ readonly icon: i0.InputSignalWithTransform<boolean, unknown>;
41
+ static ɵfac: i0.ɵɵFactoryDeclaration<Button, never>;
42
+ 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; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, [{ directive: typeof CommonInputs; inputs: { "data-size": "data-size"; "data-color": "data-color"; }; outputs: {}; }]>;
43
+ }
44
+
20
45
  /**
21
46
  * Use the Field component to connect inputs and labels
22
47
  */
@@ -26,15 +51,32 @@ declare class Field {
26
51
  * @default start
27
52
  */
28
53
  position: i0.InputSignal<"start" | "end">;
29
- private input;
30
- private label;
31
- private el;
32
- protected count: i0.Signal<number>;
33
- protected limit: i0.Signal<number>;
34
- protected hasCounter: i0.Signal<number>;
54
+ private readonly fieldState;
55
+ private readonly input;
56
+ private readonly label;
57
+ private readonly projectedErrors;
58
+ private readonly el;
59
+ protected readonly count: i0.Signal<number>;
60
+ protected readonly limit: i0.Signal<number>;
61
+ protected readonly hasCounter: i0.Signal<number>;
35
62
  constructor();
36
63
  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: {}; }]>;
64
+ 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: {}; }]>;
65
+ }
66
+
67
+ declare class FieldDescription {
68
+ static ɵfac: i0.ɵɵFactoryDeclaration<FieldDescription, never>;
69
+ static ɵcmp: i0.ɵɵComponentDeclaration<FieldDescription, "[ksd-field-description]", never, {}, {}, never, ["*"], true, never>;
70
+ }
71
+
72
+ declare class ValidationMessage {
73
+ static ɵfac: i0.ɵɵFactoryDeclaration<ValidationMessage, never>;
74
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ValidationMessage, "[ksd-validation-message]", never, {}, {}, never, never, true, never>;
75
+ }
76
+
77
+ declare class FieldError {
78
+ static ɵfac: i0.ɵɵFactoryDeclaration<FieldError, never>;
79
+ static ɵcmp: i0.ɵɵComponentDeclaration<FieldError, "[ksd-error]", never, {}, {}, never, ["*"], true, [{ directive: typeof ValidationMessage; inputs: {}; outputs: {}; }]>;
38
80
  }
39
81
 
40
82
  declare class Fieldset {
@@ -52,6 +94,23 @@ declare class FieldsetLegend {
52
94
  static ɵcmp: i0.ɵɵComponentDeclaration<FieldsetLegend, "legend[ksd-fieldset-legend]", never, {}, {}, never, ["*"], true, never>;
53
95
  }
54
96
 
97
+ declare class FieldState {
98
+ /**
99
+ * Whether the field counter has exceeded its limit
100
+ */
101
+ hasExceededCounter: i0.WritableSignal<boolean>;
102
+ /**
103
+ * Whether the field has errors projected from the outside
104
+ */
105
+ hasProjectedErrors: i0.WritableSignal<boolean>;
106
+ /**
107
+ * Whether the field has any errors associated with it
108
+ */
109
+ hasError: i0.Signal<boolean>;
110
+ static ɵfac: i0.ɵɵFactoryDeclaration<FieldState, never>;
111
+ static ɵprov: i0.ɵɵInjectableDeclaration<FieldState>;
112
+ }
113
+
55
114
  declare class Input {
56
115
  /**
57
116
  * The value of the input
@@ -60,14 +119,23 @@ declare class Input {
60
119
  /**
61
120
  * Whether the input is readonly
62
121
  */
63
- readonly: i0.InputSignalWithTransform<boolean, unknown>;
122
+ readonly readonly: i0.InputSignalWithTransform<boolean, unknown>;
123
+ /**
124
+ * Disables element
125
+ */
126
+ readonly disabled: i0.InputSignalWithTransform<boolean, unknown>;
127
+ /**
128
+ * Whether the element is invalid.
129
+ */
130
+ readonly ariaInvalid: i0.InputSignalWithTransform<boolean, unknown>;
64
131
  /**
65
132
  * Displays a character counter. pass a number to set a limit.
66
133
  */
67
134
  counter: i0.InputSignalWithTransform<number, unknown>;
135
+ protected fieldState: FieldState;
68
136
  onClick(event: Event): void;
69
137
  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, never>;
138
+ 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
139
  }
72
140
 
73
141
  declare class Label {
@@ -80,10 +148,5 @@ declare class Paragraph {
80
148
  static ɵcmp: i0.ɵɵComponentDeclaration<Paragraph, "p[ksd-paragraph]", never, {}, {}, never, ["*"], true, never>;
81
149
  }
82
150
 
83
- declare class ValidationMessage {
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 };
151
+ export { Button, CommonInputs, Field, FieldDescription, FieldError, Fieldset, FieldsetDescription, FieldsetLegend, Input, Label, Paragraph, ValidationMessage };
89
152
  export type { Size };
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "https://github.com/ks-no/designsystem.git",
6
6
  "directory": "packages/angular"
7
7
  },
8
- "version": "0.0.1-alpha.10",
8
+ "version": "0.0.1-alpha.12",
9
9
  "license": "MIT",
10
10
  "private": false,
11
11
  "publishConfig": {
@@ -17,6 +17,9 @@
17
17
  ],
18
18
  "main": "./dist/fesm2022/ks-digital-designsystem-angular.mjs",
19
19
  "types": "./dist/index.d.ts",
20
+ "dependencies": {
21
+ "@floating-ui/dom": "^1.7.3"
22
+ },
20
23
  "peerDependencies": {
21
24
  "@angular/common": ">=20.0.0",
22
25
  "@angular/core": ">=20.0.0",
@@ -24,7 +27,7 @@
24
27
  "@angular/platform-server": ">=20.0.0"
25
28
  },
26
29
  "devDependencies": {
27
- "@analogjs/storybook-angular": "^1.18.0",
30
+ "@analogjs/storybook-angular": "^1.19.4",
28
31
  "@analogjs/vite-plugin-angular": "~1.17.1",
29
32
  "@analogjs/vitest-angular": "~1.17.1",
30
33
  "@angular-eslint/builder": "^20.0.0",