@skra/ui 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/NOTICE +7 -7
- package/README.md +39 -39
- package/consumer-guide/README.md +84 -84
- package/consumer-guide/forms-and-binding.md +19 -3
- package/consumer-guide/layout.md +19 -0
- package/consumer-guide/overlays.md +100 -100
- package/consumer-guide/setup-and-gotchas.md +165 -103
- package/consumer-guide/theming-and-encapsulation.md +129 -115
- package/fesm2022/skra-ui-accordion.mjs +61 -43
- package/fesm2022/skra-ui-accordion.mjs.map +1 -1
- package/fesm2022/skra-ui-alert.mjs +26 -18
- package/fesm2022/skra-ui-alert.mjs.map +1 -1
- package/fesm2022/skra-ui-avatar.mjs +12 -8
- package/fesm2022/skra-ui-avatar.mjs.map +1 -1
- package/fesm2022/skra-ui-badge.mjs +19 -13
- package/fesm2022/skra-ui-badge.mjs.map +1 -1
- package/fesm2022/skra-ui-button.mjs +28 -19
- package/fesm2022/skra-ui-button.mjs.map +1 -1
- package/fesm2022/skra-ui-checkbox.mjs +3 -3
- package/fesm2022/skra-ui-checkbox.mjs.map +1 -1
- package/fesm2022/skra-ui-chip.mjs +15 -11
- package/fesm2022/skra-ui-chip.mjs.map +1 -1
- package/fesm2022/skra-ui-combobox.mjs +135 -130
- package/fesm2022/skra-ui-combobox.mjs.map +1 -1
- package/fesm2022/skra-ui-core.mjs +95 -73
- package/fesm2022/skra-ui-core.mjs.map +1 -1
- package/fesm2022/skra-ui-counter.mjs +9 -6
- package/fesm2022/skra-ui-counter.mjs.map +1 -1
- package/fesm2022/skra-ui-datepicker.mjs +334 -307
- package/fesm2022/skra-ui-datepicker.mjs.map +1 -1
- package/fesm2022/skra-ui-dialog.mjs +5 -4
- package/fesm2022/skra-ui-dialog.mjs.map +1 -1
- package/fesm2022/skra-ui-field.mjs +65 -43
- package/fesm2022/skra-ui-field.mjs.map +1 -1
- package/fesm2022/skra-ui-icon.mjs +5 -4
- package/fesm2022/skra-ui-icon.mjs.map +1 -1
- package/fesm2022/skra-ui-input.mjs +53 -12
- package/fesm2022/skra-ui-input.mjs.map +1 -1
- package/fesm2022/skra-ui-kbd.mjs +3 -3
- package/fesm2022/skra-ui-kbd.mjs.map +1 -1
- package/fesm2022/skra-ui-layout.mjs +33 -21
- package/fesm2022/skra-ui-layout.mjs.map +1 -1
- package/fesm2022/skra-ui-link.mjs +3 -3
- package/fesm2022/skra-ui-link.mjs.map +1 -1
- package/fesm2022/skra-ui-loading-indicator.mjs +3 -3
- package/fesm2022/skra-ui-loading-indicator.mjs.map +1 -1
- package/fesm2022/skra-ui-menu.mjs +8 -7
- package/fesm2022/skra-ui-menu.mjs.map +1 -1
- package/fesm2022/skra-ui-multi-select.mjs +102 -98
- package/fesm2022/skra-ui-multi-select.mjs.map +1 -1
- package/fesm2022/skra-ui-native-select.mjs +35 -17
- package/fesm2022/skra-ui-native-select.mjs.map +1 -1
- package/fesm2022/skra-ui-popover.mjs +5 -4
- package/fesm2022/skra-ui-popover.mjs.map +1 -1
- package/fesm2022/skra-ui-progress.mjs +7 -5
- package/fesm2022/skra-ui-progress.mjs.map +1 -1
- package/fesm2022/skra-ui-radio.mjs +3 -3
- package/fesm2022/skra-ui-radio.mjs.map +1 -1
- package/fesm2022/skra-ui-rating-display.mjs +14 -9
- package/fesm2022/skra-ui-rating-display.mjs.map +1 -1
- package/fesm2022/skra-ui-select.mjs +98 -95
- package/fesm2022/skra-ui-select.mjs.map +1 -1
- package/fesm2022/skra-ui-skeleton.mjs +16 -13
- package/fesm2022/skra-ui-skeleton.mjs.map +1 -1
- package/fesm2022/skra-ui-star-rating.mjs +18 -11
- package/fesm2022/skra-ui-star-rating.mjs.map +1 -1
- package/fesm2022/skra-ui-status-dot.mjs +7 -5
- package/fesm2022/skra-ui-status-dot.mjs.map +1 -1
- package/fesm2022/skra-ui-switch.mjs +3 -3
- package/fesm2022/skra-ui-switch.mjs.map +1 -1
- package/fesm2022/skra-ui-tabs.mjs +43 -29
- package/fesm2022/skra-ui-tabs.mjs.map +1 -1
- package/fesm2022/skra-ui-textarea.mjs +41 -15
- package/fesm2022/skra-ui-textarea.mjs.map +1 -1
- package/fesm2022/skra-ui-toast.mjs +35 -23
- package/fesm2022/skra-ui-toast.mjs.map +1 -1
- package/fesm2022/skra-ui-tooltip.mjs +12 -9
- package/fesm2022/skra-ui-tooltip.mjs.map +1 -1
- package/fesm2022/skra-ui-typography.mjs +9 -6
- package/fesm2022/skra-ui-typography.mjs.map +1 -1
- package/package.json +6 -6
- package/types/skra-ui-field.d.ts +3 -3
- package/types/skra-ui-field.d.ts.map +1 -1
- package/types/skra-ui-input.d.ts +24 -1
- package/types/skra-ui-input.d.ts.map +1 -1
- package/types/skra-ui-native-select.d.ts +9 -1
- package/types/skra-ui-native-select.d.ts.map +1 -1
- package/types/skra-ui-textarea.d.ts +10 -1
- package/types/skra-ui-textarea.d.ts.map +1 -1
|
@@ -10,10 +10,10 @@ class IdGeneratorService {
|
|
|
10
10
|
nextId(prefix = 'fg') {
|
|
11
11
|
return `${prefix}-${++this.counter}`;
|
|
12
12
|
}
|
|
13
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
14
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
13
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: IdGeneratorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
14
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: IdGeneratorService, providedIn: 'root' });
|
|
15
15
|
}
|
|
16
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: IdGeneratorService, decorators: [{
|
|
17
17
|
type: Injectable,
|
|
18
18
|
args: [{ providedIn: 'root' }]
|
|
19
19
|
}] });
|
|
@@ -24,38 +24,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImpor
|
|
|
24
24
|
* Implements ADR 013: Signal-based Contextual Interaction.
|
|
25
25
|
*/
|
|
26
26
|
class SkraFieldContext {
|
|
27
|
-
fieldId = signal('',
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
fieldId = signal('', /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "fieldId" }] : /* istanbul ignore next */ []));
|
|
29
|
+
hasError = signal(false, /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "hasError" }] : /* istanbul ignore next */ []));
|
|
31
|
+
isDisabled = signal(false, /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
33
|
+
isRequired = signal(false, /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "isRequired" }] : /* istanbul ignore next */ []));
|
|
35
|
+
isReadonly = signal(false, /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "isReadonly" }] : /* istanbul ignore next */ []));
|
|
32
37
|
// Derived IDs for aria-describedby linkage
|
|
33
|
-
hintId = computed(() => `${this.fieldId()}-hint`,
|
|
34
|
-
|
|
38
|
+
hintId = computed(() => `${this.fieldId()}-hint`, /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
|
|
40
|
+
errorId = computed(() => `${this.fieldId()}-error`, /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
35
42
|
// Derived label ID. Labelable controls (input/checkbox/radio) associate via the
|
|
36
43
|
// native `for`/`id` pair, so they never needed a referenceable label id. A
|
|
37
44
|
// `role="radiogroup"` host (<skra-star-rating>) is NOT labelable by `for`, so it
|
|
38
45
|
// must name itself via `aria-labelledby` → the label needs an id. This is the third
|
|
39
46
|
// derived id alongside hintId/errorId — an id, never a value (ADR 013 §3.6; the
|
|
40
47
|
// context carries id + derived state only). Set on `label[skraLabelFor]`.
|
|
41
|
-
labelId = computed(() => `${this.fieldId()}-label`,
|
|
48
|
+
labelId = computed(() => `${this.fieldId()}-label`, /* @ts-ignore */
|
|
49
|
+
...(ngDevMode ? [{ debugName: "labelId" }] : /* istanbul ignore next */ []));
|
|
42
50
|
// Combined aria-describedby tokens for the input/textarea host.
|
|
43
51
|
// Both ids are always emitted — when <skra-hint> or <skra-error> is not
|
|
44
52
|
// rendered, the matching DOM node is absent and browsers / screen readers
|
|
45
53
|
// gracefully ignore the dangling reference. Simpler than tracking presence
|
|
46
54
|
// via contentChild queries from the directive (which has no template).
|
|
47
|
-
describedByIds = computed(() => `${this.hintId()} ${this.errorId()}`,
|
|
48
|
-
|
|
49
|
-
static
|
|
55
|
+
describedByIds = computed(() => `${this.hintId()} ${this.errorId()}`, /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "describedByIds" }] : /* istanbul ignore next */ []));
|
|
57
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraFieldContext, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
58
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraFieldContext });
|
|
50
59
|
}
|
|
51
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
60
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraFieldContext, decorators: [{
|
|
52
61
|
type: Injectable
|
|
53
62
|
}] });
|
|
54
63
|
|
|
55
64
|
class SkraField {
|
|
56
65
|
idGen = inject(IdGeneratorService);
|
|
57
66
|
context = inject(SkraFieldContext);
|
|
58
|
-
fieldId = input(null,
|
|
67
|
+
fieldId = input(null, /* @ts-ignore */
|
|
68
|
+
...(ngDevMode ? [{ debugName: "fieldId" }] : /* istanbul ignore next */ []));
|
|
59
69
|
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
60
70
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
61
71
|
required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
@@ -78,10 +88,10 @@ class SkraField {
|
|
|
78
88
|
ngOnInit() {
|
|
79
89
|
this.context.fieldId.set(this.fieldId() ?? this.idGen.nextId('fg'));
|
|
80
90
|
}
|
|
81
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
82
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
91
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
92
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.1", type: SkraField, isStandalone: true, selector: "skra-field", inputs: { fieldId: { classPropertyName: "fieldId", publicName: "fieldId", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, hasError: { classPropertyName: "hasError", publicName: "hasError", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "attr.data-skra-validation": "context.hasError() ? \"invalid\" : null", "attr.data-skra-disabled": "context.isDisabled() ? \"\" : null", "attr.data-skra-required": "context.isRequired() ? \"\" : null", "attr.data-skra-readonly": "context.isReadonly() ? \"\" : null" } }, providers: [SkraFieldContext], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{margin:0;display:flex;flex-direction:column;gap:var(--skra-comp-field-gap)}:host[data-skra-validation=invalid]{--skra-comp-field-border-color: var( --skra-comp-field-border-color-validation-invalid )}:host[data-skra-disabled],:host:has(:disabled){pointer-events:none;cursor:not-allowed}:host[data-skra-readonly]{cursor:default;--skra-comp-field-background: var(--skra-comp-field-background-readonly);--skra-comp-field-border-color: var( --skra-comp-field-border-color-readonly );--skra-comp-field-label-cursor: default;--skra-comp-field-hint-color: var(--skra-comp-field-label-color)}:host:has(input[type=checkbox][skraCheckbox]),:host:has(input[type=checkbox][skraSwitch]),:host:has(input[type=radio][skraRadio]){display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;column-gap:var(--skra-comp-field-checkbox-gap);row-gap:var(--skra-comp-field-gap)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
83
93
|
}
|
|
84
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
94
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraField, decorators: [{
|
|
85
95
|
type: Component,
|
|
86
96
|
args: [{ selector: 'skra-field', standalone: true, template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, providers: [SkraFieldContext], host: {
|
|
87
97
|
// CSP-Safe State Reflection (ADR 021). The layout reset (margin) +
|
|
@@ -116,24 +126,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImpor
|
|
|
116
126
|
* moved here from the slice).
|
|
117
127
|
*/
|
|
118
128
|
class SkraLabel {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
129
|
+
// Optional per ADR 013 §3.7 — outside `<skra-field>` the label still carries the
|
|
130
|
+
// skin and the consumer owns association (a wrapping `<label>`, or a hand-written
|
|
131
|
+
// `for`). Mandatory injection would crash the app for a styling-only use.
|
|
132
|
+
context = inject(SkraFieldContext, { optional: true });
|
|
133
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraLabel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
134
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.1", type: SkraLabel, isStandalone: true, selector: "label[skraLabelFor]", host: { properties: { "attr.for": "context?.fieldId() ?? null", "attr.id": "context?.labelId() ?? null", "attr.data-skra-required": "context?.isRequired() ? \"\" : null" }, classAttribute: "skra-label" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{color:var(--skra-comp-field-label-color);font-family:var(--skra-sys-typography-role-label-medium-font-family);font-size:var(--skra-sys-typography-role-label-medium-font-size);font-weight:var(--skra-sys-typography-role-label-medium-font-weight);line-height:var(--skra-sys-typography-role-label-medium-line-height);letter-spacing:var(--skra-sys-typography-role-label-medium-letter-spacing);cursor:var(--skra-comp-field-label-cursor, pointer);transition:color var(--skra-comp-field-motion-duration) var(--skra-comp-field-motion-easing)}:host([data-skra-required]):after{content:\"*\"/\"\";margin-inline-start:var(--skra-sys-spacing-1);color:var(--skra-comp-field-required-color)}@media(prefers-reduced-motion:reduce){:host{transition:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
122
135
|
}
|
|
123
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
136
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraLabel, decorators: [{
|
|
124
137
|
type: Component,
|
|
125
138
|
args: [{ selector: 'label[skraLabelFor]', standalone: true, template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
|
|
126
|
-
// The magic: auto-linking label to input via shared Context ID
|
|
127
|
-
|
|
139
|
+
// The magic: auto-linking label to input via shared Context ID. Bound as an
|
|
140
|
+
// ATTRIBUTE, not the `htmlFor` property — with no field context the property
|
|
141
|
+
// form would stringify `undefined` into `for="undefined"`.
|
|
142
|
+
'[attr.for]': 'context?.fieldId() ?? null',
|
|
128
143
|
// Referenceable id so a non-labelable control (a `role="radiogroup"` host like
|
|
129
144
|
// <skra-star-rating>, which `for`/`id` can't target) can name itself via
|
|
130
145
|
// `aria-labelledby`. Harmless for labelable controls (they use `for`). ADR 013.
|
|
131
|
-
'[id]': 'context
|
|
146
|
+
'[attr.id]': 'context?.labelId() ?? null',
|
|
132
147
|
// Required marker — reflect the field's required state so the SCSS can paint a
|
|
133
148
|
// decorative asterisk (::after). The control already carries `aria-required`,
|
|
134
149
|
// so the marker is purely visual (ADR 021 data-attr reflection; ADR 033 keeps
|
|
135
150
|
// it out of the accessible name via the empty alt-text in `content`).
|
|
136
|
-
'[attr.data-skra-required]': 'context
|
|
151
|
+
'[attr.data-skra-required]': 'context?.isRequired() ? "" : null',
|
|
137
152
|
// Class hook retained for any consumer-side targeting (ADR 024 pattern).
|
|
138
153
|
class: 'skra-label',
|
|
139
154
|
}, styles: [":host{color:var(--skra-comp-field-label-color);font-family:var(--skra-sys-typography-role-label-medium-font-family);font-size:var(--skra-sys-typography-role-label-medium-font-size);font-weight:var(--skra-sys-typography-role-label-medium-font-weight);line-height:var(--skra-sys-typography-role-label-medium-line-height);letter-spacing:var(--skra-sys-typography-role-label-medium-letter-spacing);cursor:var(--skra-comp-field-label-cursor, pointer);transition:color var(--skra-comp-field-motion-duration) var(--skra-comp-field-motion-easing)}:host([data-skra-required]):after{content:\"*\"/\"\";margin-inline-start:var(--skra-sys-spacing-1);color:var(--skra-comp-field-required-color)}@media(prefers-reduced-motion:reduce){:host{transition:none}}\n"] }]
|
|
@@ -144,16 +159,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImpor
|
|
|
144
159
|
* Auto-receives ID from SkraFieldContext so aria-describedby on input works automatically.
|
|
145
160
|
*/
|
|
146
161
|
class SkraHint {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
162
|
+
// Optional per ADR 013 §3.7 — mirrors SkraError. Outside `<skra-field>` it
|
|
163
|
+
// publishes no id and is plain styled helper text the consumer associates itself.
|
|
164
|
+
context = inject(SkraFieldContext, { optional: true });
|
|
165
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraHint, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
166
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.1", type: SkraHint, isStandalone: true, selector: "skra-hint", host: { attributes: { "role": "note" }, properties: { "attr.id": "context?.hintId() ?? null" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{margin:0;display:block;font-family:var(--skra-sys-typography-role-body-small-font-family);font-size:var(--skra-sys-typography-role-body-small-font-size);font-weight:var(--skra-sys-typography-role-body-small-font-weight);line-height:var(--skra-sys-typography-role-body-small-line-height);letter-spacing:var(--skra-sys-typography-role-body-small-letter-spacing);color:var(--skra-comp-field-hint-color)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
150
167
|
}
|
|
151
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraHint, decorators: [{
|
|
152
169
|
type: Component,
|
|
153
170
|
args: [{ selector: 'skra-hint', standalone: true, template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
|
|
154
171
|
// Zero-margin reset (ADR 022) lives in hint.component.scss `:host`.
|
|
155
172
|
// ID linked from context — input's aria-describedby points here automatically
|
|
156
|
-
'[id]': 'context
|
|
173
|
+
'[attr.id]': 'context?.hintId() ?? null',
|
|
157
174
|
role: 'note',
|
|
158
175
|
}, styles: [":host{margin:0;display:block;font-family:var(--skra-sys-typography-role-body-small-font-family);font-size:var(--skra-sys-typography-role-body-small-font-size);font-weight:var(--skra-sys-typography-role-body-small-font-weight);line-height:var(--skra-sys-typography-role-body-small-line-height);letter-spacing:var(--skra-sys-typography-role-body-small-letter-spacing);color:var(--skra-comp-field-hint-color)}\n"] }]
|
|
159
176
|
}] });
|
|
@@ -190,16 +207,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImpor
|
|
|
190
207
|
* loaded two responsibilities into a single primitive.
|
|
191
208
|
*/
|
|
192
209
|
class SkraError {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
210
|
+
// Optional per ADR 013 §3.7. A GROUP-level error is a first-class pattern:
|
|
211
|
+
// `<skra-error>` sits as a direct child of `<fieldset skraFieldset>`, outside any
|
|
212
|
+
// `<skra-field>`, to carry one message for a radio/checkbox group (see the
|
|
213
|
+
// Fieldset `WithGroupError` story). It then publishes no id — nothing points at
|
|
214
|
+
// it via `aria-describedby`, and `role="alert"` announces it on its own.
|
|
215
|
+
context = inject(SkraFieldContext, { optional: true });
|
|
216
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraError, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
217
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.1", type: SkraError, isStandalone: true, selector: "skra-error", host: { attributes: { "role": "alert" }, properties: { "attr.id": "context?.errorId() ?? null" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{margin:0;display:block;font-family:var(--skra-sys-typography-role-body-small-font-family);font-size:var(--skra-sys-typography-role-body-small-font-size);font-weight:var(--skra-sys-typography-role-body-small-font-weight);line-height:var(--skra-sys-typography-role-body-small-line-height);letter-spacing:var(--skra-sys-typography-role-body-small-letter-spacing);color:var(--skra-comp-field-error-color)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
196
218
|
}
|
|
197
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
219
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraError, decorators: [{
|
|
198
220
|
type: Component,
|
|
199
221
|
args: [{ selector: 'skra-error', standalone: true, template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
|
|
200
222
|
// Zero-margin reset (ADR 022) lives in error.component.scss `:host`.
|
|
201
223
|
// ID linked from context — input's aria-describedby points here automatically
|
|
202
|
-
'[id]': 'context
|
|
224
|
+
'[attr.id]': 'context?.errorId() ?? null',
|
|
203
225
|
// role="alert" implies aria-live="assertive" + aria-atomic="true" — do NOT
|
|
204
226
|
// add an explicit aria-live (contradicts the implicit assertive). Errors are
|
|
205
227
|
// announced promptly per WAI-ARIA APG.
|
|
@@ -243,10 +265,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImpor
|
|
|
243
265
|
*/
|
|
244
266
|
class SkraFieldset {
|
|
245
267
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
246
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
247
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
268
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraFieldset, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
269
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.1", type: SkraFieldset, isStandalone: true, selector: "fieldset[skraFieldset]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "attr.disabled": "disabled() ? \"\" : null", "attr.data-skra-disabled": "disabled() ? \"\" : null" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{border:0;padding:0;margin:0;min-inline-size:0;display:flex;flex-direction:column;gap:var(--skra-comp-field-group-gap)}:host(:disabled),:host([data-skra-disabled]){cursor:not-allowed}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
248
270
|
}
|
|
249
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
271
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraFieldset, decorators: [{
|
|
250
272
|
type: Component,
|
|
251
273
|
args: [{ selector: 'fieldset[skraFieldset]', standalone: true, template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
|
|
252
274
|
role: 'group',
|
|
@@ -275,10 +297,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImpor
|
|
|
275
297
|
* legends (re-parents to fieldset), but Forge documents the canonical form.
|
|
276
298
|
*/
|
|
277
299
|
class SkraLegend {
|
|
278
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
279
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
300
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraLegend, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
301
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.1", type: SkraLegend, isStandalone: true, selector: "legend[skraLegend]", ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{padding:0;margin:0;margin-block-end:var(--skra-comp-field-group-legend-spacing-block-end);display:block;inline-size:100%;font-family:var(--skra-sys-typography-role-label-large-font-family);font-size:var(--skra-sys-typography-role-label-large-font-size);font-weight:var(--skra-sys-typography-role-label-large-font-weight);line-height:var(--skra-sys-typography-role-label-large-line-height);letter-spacing:var(--skra-sys-typography-role-label-large-letter-spacing);color:var(--skra-comp-field-group-legend-color)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
280
302
|
}
|
|
281
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
303
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraLegend, decorators: [{
|
|
282
304
|
type: Component,
|
|
283
305
|
args: [{ selector: 'legend[skraLegend]', standalone: true, template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, styles: [":host{padding:0;margin:0;margin-block-end:var(--skra-comp-field-group-legend-spacing-block-end);display:block;inline-size:100%;font-family:var(--skra-sys-typography-role-label-large-font-family);font-size:var(--skra-sys-typography-role-label-large-font-size);font-weight:var(--skra-sys-typography-role-label-large-font-weight);line-height:var(--skra-sys-typography-role-label-large-line-height);letter-spacing:var(--skra-sys-typography-role-label-large-letter-spacing);color:var(--skra-comp-field-group-legend-color)}\n"] }]
|
|
284
306
|
}] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skra-ui-field.mjs","sources":["../../../../libs/ui/field/src/lib/id-generator/id-generator.service.ts","../../../../libs/ui/field/src/lib/field-context/field-context.ts","../../../../libs/ui/field/src/lib/field/field.component.ts","../../../../libs/ui/field/src/lib/label/label.ts","../../../../libs/ui/field/src/lib/hint/hint.component.ts","../../../../libs/ui/field/src/lib/error/error.component.ts","../../../../libs/ui/field/src/lib/fieldset/fieldset.ts","../../../../libs/ui/field/src/lib/fieldset/legend.ts","../../../../libs/ui/field/src/index.ts","../../../../libs/ui/field/src/skra-ui-field.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\r\n\r\n/**\r\n * Root-level service generating unique, short IDs for form elements.\r\n * Implements ADR 013 — deterministic IDs without bloaty UUID libraries.\r\n */\r\n@Injectable({ providedIn: 'root' })\r\nexport class IdGeneratorService {\r\n private counter = 0;\r\n\r\n nextId(prefix = 'fg'): string {\r\n return `${prefix}-${++this.counter}`;\r\n }\r\n}\r\n","import { Injectable, signal, computed } from '@angular/core';\n\n/**\n * DI Context service provided per SkraField instance.\n * Acts as the synchronization bus between Field, Input, Label, Hint, and Error.\n * Implements ADR 013: Signal-based Contextual Interaction.\n */\n@Injectable()\nexport class SkraFieldContext {\n readonly fieldId = signal<string>('');\n readonly hasError = signal<boolean>(false);\n readonly isDisabled = signal<boolean>(false);\n readonly isRequired = signal<boolean>(false);\n readonly isReadonly = signal<boolean>(false);\n\n // Derived IDs for aria-describedby linkage\n readonly hintId = computed(() => `${this.fieldId()}-hint`);\n readonly errorId = computed(() => `${this.fieldId()}-error`);\n\n // Derived label ID. Labelable controls (input/checkbox/radio) associate via the\n // native `for`/`id` pair, so they never needed a referenceable label id. A\n // `role=\"radiogroup\"` host (<skra-star-rating>) is NOT labelable by `for`, so it\n // must name itself via `aria-labelledby` → the label needs an id. This is the third\n // derived id alongside hintId/errorId — an id, never a value (ADR 013 §3.6; the\n // context carries id + derived state only). Set on `label[skraLabelFor]`.\n readonly labelId = computed(() => `${this.fieldId()}-label`);\n\n // Combined aria-describedby tokens for the input/textarea host.\n // Both ids are always emitted — when <skra-hint> or <skra-error> is not\n // rendered, the matching DOM node is absent and browsers / screen readers\n // gracefully ignore the dangling reference. Simpler than tracking presence\n // via contentChild queries from the directive (which has no template).\n readonly describedByIds = computed(\n () => `${this.hintId()} ${this.errorId()}`,\n );\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n OnInit,\n ViewEncapsulation,\n booleanAttribute,\n effect,\n inject,\n input,\n} from '@angular/core';\nimport { SkraFieldContext } from '../field-context/field-context';\nimport { IdGeneratorService } from '../id-generator/id-generator.service';\n\n@Component({\n selector: 'skra-field',\n standalone: true,\n template: '<ng-content></ng-content>',\n styleUrl: './field.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n // KEY: provides a new SkraFieldContext instance per field — isolation guaranteed\n providers: [SkraFieldContext],\n host: {\n // CSP-Safe State Reflection (ADR 021). The layout reset (margin) +\n // display:flex live in field.component.scss `:host` (ADR 022) — host-metadata\n // bare keys (margin, display) render as junk attributes with no styling effect.\n // Validation state (ADR 027) — canonical `data-skra-validation=\"invalid\"`,\n // NOT the forbidden `data-skra-has-error` (migrated 2026-05-31 per ADR 027\n // §3.6 / state-surface-catalog). The control's `aria-invalid` lives on the\n // inner <input skraInput> (ADR 013), not on this group host.\n '[attr.data-skra-validation]': 'context.hasError() ? \"invalid\" : null',\n '[attr.data-skra-disabled]': 'context.isDisabled() ? \"\" : null',\n '[attr.data-skra-required]': 'context.isRequired() ? \"\" : null',\n '[attr.data-skra-readonly]': 'context.isReadonly() ? \"\" : null',\n\n // A11y: role=\"group\" groups label+input+hint semantically for screen readers\n role: 'group',\n },\n})\nexport class SkraField implements OnInit {\n private readonly idGen = inject(IdGeneratorService);\n readonly context = inject(SkraFieldContext);\n\n readonly fieldId = input<string | null>(null);\n readonly readonly = input(false, { transform: booleanAttribute });\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly required = input(false, { transform: booleanAttribute });\n readonly hasError = input(false, { transform: booleanAttribute });\n\n constructor() {\n // Reactive sync — state inputs propagate to SkraFieldContext on every\n // change (not just on init). Replaces the previous ngOnInit-only pattern\n // which caused late input changes to silently desync from the context\n // (and from sibling atoms reading the context). Matches Checkbox's\n // effect() pattern for indeterminate property sync.\n effect(() => {\n this.context.isReadonly.set(this.readonly());\n this.context.isDisabled.set(this.disabled());\n this.context.isRequired.set(this.required());\n this.context.hasError.set(this.hasError());\n });\n }\n\n // fieldId is one-shot — assigned once on init, never changes thereafter\n // (a field's identity attribute should be stable for the field's lifetime).\n ngOnInit(): void {\n this.context.fieldId.set(this.fieldId() ?? this.idGen.nextId('fg'));\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { SkraFieldContext } from '../field-context/field-context';\n\n/**\n * `label[skraLabelFor]` — form-control label atom. Per ADR 040 this is a\n * Component-on-the-native-host carrying its own `label.scss` (typography + colour\n * + cursor) via Emulated encapsulation, replacing the ADR 038 slice branch.\n *\n * `<label>` is content-bearing (its text is the label), so the template MUST be\n * `<ng-content>` — `template: ''` would discard the label text. See ADR 040 §2.\n *\n * Auto-links to its sibling control via `[htmlFor]` sourced from\n * `SkraFieldContext.fieldId()` — zero manual ID passing (ADR 013). The label's\n * error-state colour is driven by `<skra-field>[data-skra-validation=\"invalid\"]`\n * swapping `--skra-comp-field-label-color` through CSS variable inheritance; this\n * SCSS is what consumes that variable (the swap was a no-op before the binding\n * moved here from the slice).\n */\n@Component({\n selector: 'label[skraLabelFor]',\n standalone: true,\n // Content-bearing host — see ADR 040 §2.\n template: '<ng-content></ng-content>',\n styleUrl: './label.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n // The magic: auto-linking label to input via shared Context ID\n '[htmlFor]': 'context.fieldId()',\n // Referenceable id so a non-labelable control (a `role=\"radiogroup\"` host like\n // <skra-star-rating>, which `for`/`id` can't target) can name itself via\n // `aria-labelledby`. Harmless for labelable controls (they use `for`). ADR 013.\n '[id]': 'context.labelId()',\n // Required marker — reflect the field's required state so the SCSS can paint a\n // decorative asterisk (::after). The control already carries `aria-required`,\n // so the marker is purely visual (ADR 021 data-attr reflection; ADR 033 keeps\n // it out of the accessible name via the empty alt-text in `content`).\n '[attr.data-skra-required]': 'context.isRequired() ? \"\" : null',\n // Class hook retained for any consumer-side targeting (ADR 024 pattern).\n class: 'skra-label',\n },\n})\nexport class SkraLabel {\n readonly context = inject(SkraFieldContext);\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { SkraFieldContext } from '../field-context/field-context';\n\n/**\n * Hint component for supplementary field information.\n * Auto-receives ID from SkraFieldContext so aria-describedby on input works automatically.\n */\n@Component({\n selector: 'skra-hint',\n standalone: true,\n template: '<ng-content></ng-content>',\n styleUrl: './hint.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n // Zero-margin reset (ADR 022) lives in hint.component.scss `:host`.\n // ID linked from context — input's aria-describedby points here automatically\n '[id]': 'context.hintId()',\n role: 'note',\n },\n})\nexport class SkraHint {\n readonly context = inject(SkraFieldContext);\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { SkraFieldContext } from '../field-context/field-context';\n\n/**\n * Error message atom sibling to `<skra-hint>`. Renders validation feedback\n * inside `<skra-field>` with its own a11y semantics: `role=\"alert\"` (which\n * carries an implicit `aria-live=\"assertive\"` + `aria-atomic=\"true\"`), so screen\n * readers announce a validation error promptly. NO explicit `aria-live` — adding\n * `aria-live=\"polite\"` alongside `role=\"alert\"` is contradictory (alert is\n * assertive by definition) and behaves inconsistently across AT. Assertive is\n * the WAI-ARIA APG pattern for validation errors (decision 2026-05-31, Batch 4\n * cleanroom review).\n *\n * Per ADR 037 (agnostic atom co-existence) — does not infer error state from\n * any binding strategy. Consumer renders or omits `<skra-error>` based on\n * their own validation source (Signal Forms `.invalid && .touched`, Reactive\n * Forms `ctrl.errors`, raw computed signal). The atom itself just supplies\n * a11y wiring + visual treatment.\n *\n * <skra-field [hasError]=\"emailHasError()\">\n * <label skraLabelFor>Email</label>\n * <input skraInput type=\"email\" />\n * <skra-hint>We'll never share your email.</skra-hint>\n * @if (emailHasError()) {\n * <skra-error>Please enter a valid email address.</skra-error>\n * }\n * </skra-field>\n *\n * Separate from `<skra-hint>` per SRP: hint is static helper text\n * (role=\"note\", neutral colour); error is dynamic validation feedback\n * (role=\"alert\", live region, error colour). One element per visual\n * responsibility — the rejected alternative (\"hint that swaps text on error\")\n * loaded two responsibilities into a single primitive.\n */\n@Component({\n selector: 'skra-error',\n standalone: true,\n template: '<ng-content></ng-content>',\n styleUrl: './error.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n // Zero-margin reset (ADR 022) lives in error.component.scss `:host`.\n // ID linked from context — input's aria-describedby points here automatically\n '[id]': 'context.errorId()',\n // role=\"alert\" implies aria-live=\"assertive\" + aria-atomic=\"true\" — do NOT\n // add an explicit aria-live (contradicts the implicit assertive). Errors are\n // announced promptly per WAI-ARIA APG.\n role: 'alert',\n },\n})\nexport class SkraError {\n readonly context = inject(SkraFieldContext);\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n booleanAttribute,\n input,\n} from '@angular/core';\n\n/**\n * Forge marker on a native `<fieldset>` used to group related form controls\n * (checkbox group, radio group, or any related field cluster). Per ADR 039,\n * Forge ships no `<skra-radio-group>` / `<skra-checkbox-group>` component\n * wrappers — native `<fieldset>` + `<legend>` IS the WCAG-canonical group\n * idiom, and Forge stops reinventing it.\n *\n * Per ADR 040 this is a Component-on-the-native-host carrying its own\n * `fieldset.scss` (chrome reset + group layout) via Emulated encapsulation,\n * replacing the ADR 038 slice branch. `<fieldset>` is content-bearing (it holds\n * the grouped controls), so the template MUST be `<ng-content>` — `template: ''`\n * would discard the entire group. See ADR 040 §2.\n *\n * The `[disabled]` input cascades to the native `disabled` attribute, and\n * native `<fieldset disabled>` already disables every form control inside\n * (browser-native behaviour). Forge does not iterate children manually.\n *\n * Selector is opt-in (`fieldset[skraFieldset]`) so the chrome-reset rules do\n * not leak onto bare `<fieldset>` elements outside Forge.\n *\n * <fieldset skraFieldset [disabled]=\"form.disabled()\">\n * <legend skraLegend>Send notifications via</legend>\n * <!-- skra-field children with checkboxes -->\n * <skra-error *ngIf=\"form.channels().length === 0\">Choose at least one</skra-error>\n * </fieldset>\n *\n * `role=\"group\"` is the explicit ARIA role: while the browser default for\n * `<fieldset>` is already group semantics for most AT, declaring it explicitly\n * is friendlier to assistive tech that may have idiosyncratic handling.\n *\n * Native `disabled` is sufficient — `aria-disabled` is NOT set per\n * native-attr-first doctrine (memory `feedback_native_attr_first.md`). The\n * `data-skra-disabled` reflection drives the visual dimming in `fieldset.scss`.\n */\n@Component({\n selector: 'fieldset[skraFieldset]',\n standalone: true,\n // Content-bearing host — see ADR 040 §2.\n template: '<ng-content></ng-content>',\n styleUrl: './fieldset.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n role: 'group',\n '[attr.disabled]': 'disabled() ? \"\" : null',\n '[attr.data-skra-disabled]': 'disabled() ? \"\" : null',\n },\n})\nexport class SkraFieldset {\n readonly disabled = input(false, { transform: booleanAttribute });\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n} from '@angular/core';\n\n/**\n * `legend[skraLegend]` — visible group label for `<fieldset skraFieldset>`.\n * Per ADR 040 this is a Component-on-the-native-host carrying its own\n * `legend.scss` (chrome reset + typography role binding per ADR 036) via Emulated\n * encapsulation, replacing the ADR 038 slice branch.\n *\n * `<legend>` is content-bearing (its text is the group label), so the template\n * MUST be `<ng-content>` — `template: ''` would discard the label. See ADR 040 §2.\n * No host bindings, no inputs, no DI — purely a styled marker.\n *\n * <fieldset skraFieldset>\n * <legend skraLegend>Account preferences</legend>\n * ...\n * </fieldset>\n *\n * HTML requires `<legend>` to be the FIRST child of `<fieldset>` for native\n * group-label semantics. The browser HTML parser auto-corrects misplaced\n * legends (re-parents to fieldset), but Forge documents the canonical form.\n */\n@Component({\n selector: 'legend[skraLegend]',\n standalone: true,\n // Content-bearing host — see ADR 040 §2.\n template: '<ng-content></ng-content>',\n styleUrl: './legend.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n})\nexport class SkraLegend {}\n","// Public API for @skra/ui/field — the field-family (ADR 013 contextual a11y).\nexport * from './lib/id-generator/id-generator.service';\nexport * from './lib/field-context/field-context';\nexport * from './lib/field/field.component';\nexport * from './lib/label/label';\nexport * from './lib/hint/hint.component';\nexport * from './lib/error/error.component';\nexport * from './lib/fieldset/fieldset';\nexport * from './lib/fieldset/legend';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;AAGG;MAEU,kBAAkB,CAAA;IACrB,OAAO,GAAG,CAAC;IAEnB,MAAM,CAAC,MAAM,GAAG,IAAI,EAAA;QAClB,OAAO,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,EAAE,IAAI,CAAC,OAAO,EAAE;IACtC;uGALW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAlB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,cADL,MAAM,EAAA,CAAA;;2FACnB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAD9B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACJlC;;;;AAIG;MAEU,gBAAgB,CAAA;AAClB,IAAA,OAAO,GAAG,MAAM,CAAS,EAAE,8EAAC;AAC5B,IAAA,QAAQ,GAAG,MAAM,CAAU,KAAK,+EAAC;AACjC,IAAA,UAAU,GAAG,MAAM,CAAU,KAAK,iFAAC;AACnC,IAAA,UAAU,GAAG,MAAM,CAAU,KAAK,iFAAC;AACnC,IAAA,UAAU,GAAG,MAAM,CAAU,KAAK,iFAAC;;AAGnC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AAAV,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAU,8EALX,2BAA2B,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,ygBAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAK1B,UAAU,EAAA,UAAA,EAAA,CAAA;kBATtB,SAAS;+BACE,oBAAoB,EAAA,UAAA,EAClB,IAAI,EAAA,QAAA,EAEN,2BAA2B,EAAA,eAAA,EAEpB,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,QAAQ,EAAA,MAAA,EAAA,CAAA,ygBAAA,CAAA,EAAA;;;AChC3C;;ACAA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"skra-ui-field.mjs","sources":["../../../../libs/ui/field/src/lib/id-generator/id-generator.service.ts","../../../../libs/ui/field/src/lib/field-context/field-context.ts","../../../../libs/ui/field/src/lib/field/field.component.ts","../../../../libs/ui/field/src/lib/label/label.ts","../../../../libs/ui/field/src/lib/hint/hint.component.ts","../../../../libs/ui/field/src/lib/error/error.component.ts","../../../../libs/ui/field/src/lib/fieldset/fieldset.ts","../../../../libs/ui/field/src/lib/fieldset/legend.ts","../../../../libs/ui/field/src/index.ts","../../../../libs/ui/field/src/skra-ui-field.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\r\n\r\n/**\r\n * Root-level service generating unique, short IDs for form elements.\r\n * Implements ADR 013 — deterministic IDs without bloaty UUID libraries.\r\n */\r\n@Injectable({ providedIn: 'root' })\r\nexport class IdGeneratorService {\r\n private counter = 0;\r\n\r\n nextId(prefix = 'fg'): string {\r\n return `${prefix}-${++this.counter}`;\r\n }\r\n}\r\n","import { Injectable, signal, computed } from '@angular/core';\r\n\r\n/**\r\n * DI Context service provided per SkraField instance.\r\n * Acts as the synchronization bus between Field, Input, Label, Hint, and Error.\r\n * Implements ADR 013: Signal-based Contextual Interaction.\r\n */\r\n@Injectable()\r\nexport class SkraFieldContext {\r\n readonly fieldId = signal<string>('');\r\n readonly hasError = signal<boolean>(false);\r\n readonly isDisabled = signal<boolean>(false);\r\n readonly isRequired = signal<boolean>(false);\r\n readonly isReadonly = signal<boolean>(false);\r\n\r\n // Derived IDs for aria-describedby linkage\r\n readonly hintId = computed(() => `${this.fieldId()}-hint`);\r\n readonly errorId = computed(() => `${this.fieldId()}-error`);\r\n\r\n // Derived label ID. Labelable controls (input/checkbox/radio) associate via the\r\n // native `for`/`id` pair, so they never needed a referenceable label id. A\r\n // `role=\"radiogroup\"` host (<skra-star-rating>) is NOT labelable by `for`, so it\r\n // must name itself via `aria-labelledby` → the label needs an id. This is the third\r\n // derived id alongside hintId/errorId — an id, never a value (ADR 013 §3.6; the\r\n // context carries id + derived state only). Set on `label[skraLabelFor]`.\r\n readonly labelId = computed(() => `${this.fieldId()}-label`);\r\n\r\n // Combined aria-describedby tokens for the input/textarea host.\r\n // Both ids are always emitted — when <skra-hint> or <skra-error> is not\r\n // rendered, the matching DOM node is absent and browsers / screen readers\r\n // gracefully ignore the dangling reference. Simpler than tracking presence\r\n // via contentChild queries from the directive (which has no template).\r\n readonly describedByIds = computed(\r\n () => `${this.hintId()} ${this.errorId()}`,\r\n );\r\n}\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n OnInit,\r\n ViewEncapsulation,\r\n booleanAttribute,\r\n effect,\r\n inject,\r\n input,\r\n} from '@angular/core';\r\nimport { SkraFieldContext } from '../field-context/field-context';\r\nimport { IdGeneratorService } from '../id-generator/id-generator.service';\r\n\r\n@Component({\r\n selector: 'skra-field',\r\n standalone: true,\r\n template: '<ng-content></ng-content>',\r\n styleUrl: './field.component.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n // KEY: provides a new SkraFieldContext instance per field — isolation guaranteed\r\n providers: [SkraFieldContext],\r\n host: {\r\n // CSP-Safe State Reflection (ADR 021). The layout reset (margin) +\r\n // display:flex live in field.component.scss `:host` (ADR 022) — host-metadata\r\n // bare keys (margin, display) render as junk attributes with no styling effect.\r\n // Validation state (ADR 027) — canonical `data-skra-validation=\"invalid\"`,\r\n // NOT the forbidden `data-skra-has-error` (migrated 2026-05-31 per ADR 027\r\n // §3.6 / state-surface-catalog). The control's `aria-invalid` lives on the\r\n // inner <input skraInput> (ADR 013), not on this group host.\r\n '[attr.data-skra-validation]': 'context.hasError() ? \"invalid\" : null',\r\n '[attr.data-skra-disabled]': 'context.isDisabled() ? \"\" : null',\r\n '[attr.data-skra-required]': 'context.isRequired() ? \"\" : null',\r\n '[attr.data-skra-readonly]': 'context.isReadonly() ? \"\" : null',\r\n\r\n // A11y: role=\"group\" groups label+input+hint semantically for screen readers\r\n role: 'group',\r\n },\r\n})\r\nexport class SkraField implements OnInit {\r\n private readonly idGen = inject(IdGeneratorService);\r\n readonly context = inject(SkraFieldContext);\r\n\r\n readonly fieldId = input<string | null>(null);\r\n readonly readonly = input(false, { transform: booleanAttribute });\r\n readonly disabled = input(false, { transform: booleanAttribute });\r\n readonly required = input(false, { transform: booleanAttribute });\r\n readonly hasError = input(false, { transform: booleanAttribute });\r\n\r\n constructor() {\r\n // Reactive sync — state inputs propagate to SkraFieldContext on every\r\n // change (not just on init). Replaces the previous ngOnInit-only pattern\r\n // which caused late input changes to silently desync from the context\r\n // (and from sibling atoms reading the context). Matches Checkbox's\r\n // effect() pattern for indeterminate property sync.\r\n effect(() => {\r\n this.context.isReadonly.set(this.readonly());\r\n this.context.isDisabled.set(this.disabled());\r\n this.context.isRequired.set(this.required());\r\n this.context.hasError.set(this.hasError());\r\n });\r\n }\r\n\r\n // fieldId is one-shot — assigned once on init, never changes thereafter\r\n // (a field's identity attribute should be stable for the field's lifetime).\r\n ngOnInit(): void {\r\n this.context.fieldId.set(this.fieldId() ?? this.idGen.nextId('fg'));\r\n }\r\n}\r\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { SkraFieldContext } from '../field-context/field-context';\n\n/**\n * `label[skraLabelFor]` — form-control label atom. Per ADR 040 this is a\n * Component-on-the-native-host carrying its own `label.scss` (typography + colour\n * + cursor) via Emulated encapsulation, replacing the ADR 038 slice branch.\n *\n * `<label>` is content-bearing (its text is the label), so the template MUST be\n * `<ng-content>` — `template: ''` would discard the label text. See ADR 040 §2.\n *\n * Auto-links to its sibling control via `[htmlFor]` sourced from\n * `SkraFieldContext.fieldId()` — zero manual ID passing (ADR 013). The label's\n * error-state colour is driven by `<skra-field>[data-skra-validation=\"invalid\"]`\n * swapping `--skra-comp-field-label-color` through CSS variable inheritance; this\n * SCSS is what consumes that variable (the swap was a no-op before the binding\n * moved here from the slice).\n */\n@Component({\n selector: 'label[skraLabelFor]',\n standalone: true,\n // Content-bearing host — see ADR 040 §2.\n template: '<ng-content></ng-content>',\n styleUrl: './label.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n // The magic: auto-linking label to input via shared Context ID. Bound as an\n // ATTRIBUTE, not the `htmlFor` property — with no field context the property\n // form would stringify `undefined` into `for=\"undefined\"`.\n '[attr.for]': 'context?.fieldId() ?? null',\n // Referenceable id so a non-labelable control (a `role=\"radiogroup\"` host like\n // <skra-star-rating>, which `for`/`id` can't target) can name itself via\n // `aria-labelledby`. Harmless for labelable controls (they use `for`). ADR 013.\n '[attr.id]': 'context?.labelId() ?? null',\n // Required marker — reflect the field's required state so the SCSS can paint a\n // decorative asterisk (::after). The control already carries `aria-required`,\n // so the marker is purely visual (ADR 021 data-attr reflection; ADR 033 keeps\n // it out of the accessible name via the empty alt-text in `content`).\n '[attr.data-skra-required]': 'context?.isRequired() ? \"\" : null',\n // Class hook retained for any consumer-side targeting (ADR 024 pattern).\n class: 'skra-label',\n },\n})\nexport class SkraLabel {\n // Optional per ADR 013 §3.7 — outside `<skra-field>` the label still carries the\n // skin and the consumer owns association (a wrapping `<label>`, or a hand-written\n // `for`). Mandatory injection would crash the app for a styling-only use.\n readonly context = inject(SkraFieldContext, { optional: true });\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { SkraFieldContext } from '../field-context/field-context';\n\n/**\n * Hint component for supplementary field information.\n * Auto-receives ID from SkraFieldContext so aria-describedby on input works automatically.\n */\n@Component({\n selector: 'skra-hint',\n standalone: true,\n template: '<ng-content></ng-content>',\n styleUrl: './hint.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n // Zero-margin reset (ADR 022) lives in hint.component.scss `:host`.\n // ID linked from context — input's aria-describedby points here automatically\n '[attr.id]': 'context?.hintId() ?? null',\n role: 'note',\n },\n})\nexport class SkraHint {\n // Optional per ADR 013 §3.7 — mirrors SkraError. Outside `<skra-field>` it\n // publishes no id and is plain styled helper text the consumer associates itself.\n readonly context = inject(SkraFieldContext, { optional: true });\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { SkraFieldContext } from '../field-context/field-context';\n\n/**\n * Error message atom sibling to `<skra-hint>`. Renders validation feedback\n * inside `<skra-field>` with its own a11y semantics: `role=\"alert\"` (which\n * carries an implicit `aria-live=\"assertive\"` + `aria-atomic=\"true\"`), so screen\n * readers announce a validation error promptly. NO explicit `aria-live` — adding\n * `aria-live=\"polite\"` alongside `role=\"alert\"` is contradictory (alert is\n * assertive by definition) and behaves inconsistently across AT. Assertive is\n * the WAI-ARIA APG pattern for validation errors (decision 2026-05-31, Batch 4\n * cleanroom review).\n *\n * Per ADR 037 (agnostic atom co-existence) — does not infer error state from\n * any binding strategy. Consumer renders or omits `<skra-error>` based on\n * their own validation source (Signal Forms `.invalid && .touched`, Reactive\n * Forms `ctrl.errors`, raw computed signal). The atom itself just supplies\n * a11y wiring + visual treatment.\n *\n * <skra-field [hasError]=\"emailHasError()\">\n * <label skraLabelFor>Email</label>\n * <input skraInput type=\"email\" />\n * <skra-hint>We'll never share your email.</skra-hint>\n * @if (emailHasError()) {\n * <skra-error>Please enter a valid email address.</skra-error>\n * }\n * </skra-field>\n *\n * Separate from `<skra-hint>` per SRP: hint is static helper text\n * (role=\"note\", neutral colour); error is dynamic validation feedback\n * (role=\"alert\", live region, error colour). One element per visual\n * responsibility — the rejected alternative (\"hint that swaps text on error\")\n * loaded two responsibilities into a single primitive.\n */\n@Component({\n selector: 'skra-error',\n standalone: true,\n template: '<ng-content></ng-content>',\n styleUrl: './error.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n // Zero-margin reset (ADR 022) lives in error.component.scss `:host`.\n // ID linked from context — input's aria-describedby points here automatically\n '[attr.id]': 'context?.errorId() ?? null',\n // role=\"alert\" implies aria-live=\"assertive\" + aria-atomic=\"true\" — do NOT\n // add an explicit aria-live (contradicts the implicit assertive). Errors are\n // announced promptly per WAI-ARIA APG.\n role: 'alert',\n },\n})\nexport class SkraError {\n // Optional per ADR 013 §3.7. A GROUP-level error is a first-class pattern:\n // `<skra-error>` sits as a direct child of `<fieldset skraFieldset>`, outside any\n // `<skra-field>`, to carry one message for a radio/checkbox group (see the\n // Fieldset `WithGroupError` story). It then publishes no id — nothing points at\n // it via `aria-describedby`, and `role=\"alert\"` announces it on its own.\n readonly context = inject(SkraFieldContext, { optional: true });\n}\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ViewEncapsulation,\r\n booleanAttribute,\r\n input,\r\n} from '@angular/core';\r\n\r\n/**\r\n * Forge marker on a native `<fieldset>` used to group related form controls\r\n * (checkbox group, radio group, or any related field cluster). Per ADR 039,\r\n * Forge ships no `<skra-radio-group>` / `<skra-checkbox-group>` component\r\n * wrappers — native `<fieldset>` + `<legend>` IS the WCAG-canonical group\r\n * idiom, and Forge stops reinventing it.\r\n *\r\n * Per ADR 040 this is a Component-on-the-native-host carrying its own\r\n * `fieldset.scss` (chrome reset + group layout) via Emulated encapsulation,\r\n * replacing the ADR 038 slice branch. `<fieldset>` is content-bearing (it holds\r\n * the grouped controls), so the template MUST be `<ng-content>` — `template: ''`\r\n * would discard the entire group. See ADR 040 §2.\r\n *\r\n * The `[disabled]` input cascades to the native `disabled` attribute, and\r\n * native `<fieldset disabled>` already disables every form control inside\r\n * (browser-native behaviour). Forge does not iterate children manually.\r\n *\r\n * Selector is opt-in (`fieldset[skraFieldset]`) so the chrome-reset rules do\r\n * not leak onto bare `<fieldset>` elements outside Forge.\r\n *\r\n * <fieldset skraFieldset [disabled]=\"form.disabled()\">\r\n * <legend skraLegend>Send notifications via</legend>\r\n * <!-- skra-field children with checkboxes -->\r\n * <skra-error *ngIf=\"form.channels().length === 0\">Choose at least one</skra-error>\r\n * </fieldset>\r\n *\r\n * `role=\"group\"` is the explicit ARIA role: while the browser default for\r\n * `<fieldset>` is already group semantics for most AT, declaring it explicitly\r\n * is friendlier to assistive tech that may have idiosyncratic handling.\r\n *\r\n * Native `disabled` is sufficient — `aria-disabled` is NOT set per\r\n * native-attr-first doctrine (memory `feedback_native_attr_first.md`). The\r\n * `data-skra-disabled` reflection drives the visual dimming in `fieldset.scss`.\r\n */\r\n@Component({\r\n selector: 'fieldset[skraFieldset]',\r\n standalone: true,\r\n // Content-bearing host — see ADR 040 §2.\r\n template: '<ng-content></ng-content>',\r\n styleUrl: './fieldset.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n host: {\r\n role: 'group',\r\n '[attr.disabled]': 'disabled() ? \"\" : null',\r\n '[attr.data-skra-disabled]': 'disabled() ? \"\" : null',\r\n },\r\n})\r\nexport class SkraFieldset {\r\n readonly disabled = input(false, { transform: booleanAttribute });\r\n}\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ViewEncapsulation,\r\n} from '@angular/core';\r\n\r\n/**\r\n * `legend[skraLegend]` — visible group label for `<fieldset skraFieldset>`.\r\n * Per ADR 040 this is a Component-on-the-native-host carrying its own\r\n * `legend.scss` (chrome reset + typography role binding per ADR 036) via Emulated\r\n * encapsulation, replacing the ADR 038 slice branch.\r\n *\r\n * `<legend>` is content-bearing (its text is the group label), so the template\r\n * MUST be `<ng-content>` — `template: ''` would discard the label. See ADR 040 §2.\r\n * No host bindings, no inputs, no DI — purely a styled marker.\r\n *\r\n * <fieldset skraFieldset>\r\n * <legend skraLegend>Account preferences</legend>\r\n * ...\r\n * </fieldset>\r\n *\r\n * HTML requires `<legend>` to be the FIRST child of `<fieldset>` for native\r\n * group-label semantics. The browser HTML parser auto-corrects misplaced\r\n * legends (re-parents to fieldset), but Forge documents the canonical form.\r\n */\r\n@Component({\r\n selector: 'legend[skraLegend]',\r\n standalone: true,\r\n // Content-bearing host — see ADR 040 §2.\r\n template: '<ng-content></ng-content>',\r\n styleUrl: './legend.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n})\r\nexport class SkraLegend {}\r\n","// Public API for @skra/ui/field — the field-family (ADR 013 contextual a11y).\r\nexport * from './lib/id-generator/id-generator.service';\r\nexport * from './lib/field-context/field-context';\r\nexport * from './lib/field/field.component';\r\nexport * from './lib/label/label';\r\nexport * from './lib/hint/hint.component';\r\nexport * from './lib/error/error.component';\r\nexport * from './lib/fieldset/fieldset';\r\nexport * from './lib/fieldset/legend';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;AAGG;MAEU,kBAAkB,CAAA;IACrB,OAAO,GAAG,CAAC;IAEnB,MAAM,CAAC,MAAM,GAAG,IAAI,EAAA;QAClB,OAAO,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,EAAE,IAAI,CAAC,OAAO,EAAE;IACtC;uGALW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,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@ -28,11 +28,12 @@ class SkraIcon {
|
|
|
28
28
|
* forbidden by ADR 021); a consumer needing a bespoke size overrides
|
|
29
29
|
* `--skra-comp-icon-size` via the sanctioned token-cascade path (ADR 029).
|
|
30
30
|
*/
|
|
31
|
-
size = input(null,
|
|
32
|
-
|
|
33
|
-
static
|
|
31
|
+
size = input(null, /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
33
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraIcon, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
34
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.1", type: SkraIcon, isStandalone: true, selector: "skra-icon", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-skra-size": "size()" } }, ngImport: i0, template: "<ng-content></ng-content>\n", styles: [":host{display:inline-block;margin:0;vertical-align:middle;color:inherit;--_skra-icon-resolved-size: var( --skra-comp-icon-size, var(--skra-comp-icon-size-default) );width:var(--_skra-icon-resolved-size);height:var(--_skra-icon-resolved-size);font-size:var(--_skra-icon-resolved-size);line-height:1}:host[data-skra-size=sm]{--_skra-icon-resolved-size: var(--skra-comp-icon-size-sm)}:host[data-skra-size=md]{--_skra-icon-resolved-size: var(--skra-comp-icon-size-md)}:host[data-skra-size=lg]{--_skra-icon-resolved-size: var(--skra-comp-icon-size-lg)}:host>svg,:host>img{display:block;width:100%;height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
34
35
|
}
|
|
35
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraIcon, decorators: [{
|
|
36
37
|
type: Component,
|
|
37
38
|
args: [{ selector: 'skra-icon', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
|
|
38
39
|
// CSP-Safe State Reflection (ADR 021) — host carries ONLY data-attributes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skra-ui-icon.mjs","sources":["../../../../libs/ui/icon/src/lib/icon/icon.ts","../../../../libs/ui/icon/src/lib/icon/icon.html","../../../../libs/ui/icon/src/skra-ui-icon.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n input,\n} from '@angular/core';\n\nexport type IconSize = 'sm' | 'md' | 'lg';\n\n/**\n * SkraIcon — container atom for icon-shaped content (ADR 034).\n *\n * Forge owns geometry, layout isolation, color inheritance hook. The shape\n * itself is supplied by the consumer via `<ng-content>` — inline SVG, `<img>`,\n * a third-party icon library element, or a styled `<span>` are all supported\n * equally. Forge ships no icon catalog and makes no rendering-strategy choice\n * for the consumer.\n *\n * Accessibility: this host has NO default ARIA attributes (ADR 034 §3.4). The\n * consumer MUST declare semantics explicitly:\n * - decorative icon → `<skra-icon aria-hidden=\"true\">`\n * - meaningful icon → `<skra-icon role=\"img\" aria-label=\"...\">` (ADR 033 Path 3;\n * `role=\"img\"` is required — `aria-label` on the roleless host is ARIA-prohibited)\n *\n * @see ADR 034 — SkraIcon as a container atom\n * @see ADR 033 — Accessible Name Contract\n */\n@Component({\n selector: 'skra-icon',\n standalone: true,\n templateUrl: './icon.html',\n styleUrl: './icon.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n // CSP-Safe State Reflection (ADR 021) — host carries ONLY data-attributes,\n // never an inline `style`. The layout reset (display/margin/vertical-align)\n // lives in icon.scss `:host` per Visual Purism (no inline styles) and the\n // ADR 041 cleanup precedent (resets belong in SCSS, not host metadata).\n\n // Size reflection (ADR 021). `null` keeps the attribute absent so the icon\n // inherits the cascade-driven --skra-comp-icon-size (e.g. button slot\n // wrapper per ADR 030).\n '[attr.data-skra-size]': 'size()',\n },\n})\nexport class SkraIcon {\n /**\n * Preset size token (`'sm' | 'md' | 'lg'`). When `null`, the icon inherits\n * `--skra-comp-icon-size` from the surrounding context — typical in button\n * slot wrappers (ADR 030 §3.4) where the parent owns the icon size. Arbitrary\n * dimensions are not an input (a free value would require an inline style,\n * forbidden by ADR 021); a consumer needing a bespoke size overrides\n * `--skra-comp-icon-size` via the sanctioned token-cascade path (ADR 029).\n */\n readonly size = input<IconSize | null>(null);\n}\n","<ng-content></ng-content>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AASA;;;;;;;;;;;;;;;;;AAiBG;MAoBU,QAAQ,CAAA;AACnB;;;;;;;AAOG;
|
|
1
|
+
{"version":3,"file":"skra-ui-icon.mjs","sources":["../../../../libs/ui/icon/src/lib/icon/icon.ts","../../../../libs/ui/icon/src/lib/icon/icon.html","../../../../libs/ui/icon/src/skra-ui-icon.ts"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ViewEncapsulation,\r\n input,\r\n} from '@angular/core';\r\n\r\nexport type IconSize = 'sm' | 'md' | 'lg';\r\n\r\n/**\r\n * SkraIcon — container atom for icon-shaped content (ADR 034).\r\n *\r\n * Forge owns geometry, layout isolation, color inheritance hook. The shape\r\n * itself is supplied by the consumer via `<ng-content>` — inline SVG, `<img>`,\r\n * a third-party icon library element, or a styled `<span>` are all supported\r\n * equally. Forge ships no icon catalog and makes no rendering-strategy choice\r\n * for the consumer.\r\n *\r\n * Accessibility: this host has NO default ARIA attributes (ADR 034 §3.4). The\r\n * consumer MUST declare semantics explicitly:\r\n * - decorative icon → `<skra-icon aria-hidden=\"true\">`\r\n * - meaningful icon → `<skra-icon role=\"img\" aria-label=\"...\">` (ADR 033 Path 3;\r\n * `role=\"img\"` is required — `aria-label` on the roleless host is ARIA-prohibited)\r\n *\r\n * @see ADR 034 — SkraIcon as a container atom\r\n * @see ADR 033 — Accessible Name Contract\r\n */\r\n@Component({\r\n selector: 'skra-icon',\r\n standalone: true,\r\n templateUrl: './icon.html',\r\n styleUrl: './icon.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n host: {\r\n // CSP-Safe State Reflection (ADR 021) — host carries ONLY data-attributes,\r\n // never an inline `style`. The layout reset (display/margin/vertical-align)\r\n // lives in icon.scss `:host` per Visual Purism (no inline styles) and the\r\n // ADR 041 cleanup precedent (resets belong in SCSS, not host metadata).\r\n\r\n // Size reflection (ADR 021). `null` keeps the attribute absent so the icon\r\n // inherits the cascade-driven --skra-comp-icon-size (e.g. button slot\r\n // wrapper per ADR 030).\r\n '[attr.data-skra-size]': 'size()',\r\n },\r\n})\r\nexport class SkraIcon {\r\n /**\r\n * Preset size token (`'sm' | 'md' | 'lg'`). When `null`, the icon inherits\r\n * `--skra-comp-icon-size` from the surrounding context — typical in button\r\n * slot wrappers (ADR 030 §3.4) where the parent owns the icon size. Arbitrary\r\n * dimensions are not an input (a free value would require an inline style,\r\n * forbidden by ADR 021); a consumer needing a bespoke size overrides\r\n * `--skra-comp-icon-size` via the sanctioned token-cascade path (ADR 029).\r\n */\r\n readonly size = input<IconSize | null>(null);\r\n}\r\n","<ng-content></ng-content>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AASA;;;;;;;;;;;;;;;;;AAiBG;MAoBU,QAAQ,CAAA;AACnB;;;;;;;AAOG;IACM,IAAI,GAAG,KAAK,CAAkB,IAAI;6EAAC;uGATjC,QAAQ,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAR,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,QAAQ,iQC9CrB,6BACA,EAAA,MAAA,EAAA,CAAA,gmBAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FD6Ca,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAnBpB,SAAS;+BACE,WAAW,EAAA,UAAA,EACT,IAAI,EAAA,eAAA,EAGC,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,QAAQ,EAAA,IAAA,EACnC;;;;;;;;AASJ,wBAAA,uBAAuB,EAAE,QAAQ;AAClC,qBAAA,EAAA,QAAA,EAAA,6BAAA,EAAA,MAAA,EAAA,CAAA,gmBAAA,CAAA,EAAA;;;AE5CH;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, effect, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { SkraFieldContext } from '@skra/ui/field';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -12,27 +12,68 @@ import { SkraFieldContext } from '@skra/ui/field';
|
|
|
12
12
|
* DI wiring (ADR 013), host a11y bindings (ADR 021/027), and the agnostic
|
|
13
13
|
* value posture (ADR 037 — no value channel, no @angular/forms) are unchanged
|
|
14
14
|
* from the prior directive form.
|
|
15
|
+
*
|
|
16
|
+
* `SkraFieldContext` is injected `{ optional: true }` (ADR 013 §3.7) — the same
|
|
17
|
+
* posture as `skraCheckbox` / `skraRadio` / `skraSwitch`. Inside `<skra-field>`
|
|
18
|
+
* the atom takes the field's id + describedby + availability cascade; standalone
|
|
19
|
+
* it renders the skin only and the consumer owns every attribute, including the
|
|
20
|
+
* accessible name:
|
|
21
|
+
*
|
|
22
|
+
* <!-- inside Field — label association via the DI-generated id/for pair -->
|
|
23
|
+
* <skra-field>
|
|
24
|
+
* <label skraLabelFor>Email</label>
|
|
25
|
+
* <input skraInput type="email" />
|
|
26
|
+
* </skra-field>
|
|
27
|
+
*
|
|
28
|
+
* <!-- standalone: native implicit label (wrapping) — no id/for needed -->
|
|
29
|
+
* <label>Search <input skraInput type="search" /></label>
|
|
30
|
+
*
|
|
31
|
+
* Standalone use does NOT relax the ADR 033 accessible-name contract; it moves
|
|
32
|
+
* the name onto the consumer's own native markup. An input with no name is an
|
|
33
|
+
* a11y defect wherever it appears — including inside a `<skra-field>` that
|
|
34
|
+
* carries no `label[skraLabelFor]` — so the check belongs to the a11y gate, not
|
|
35
|
+
* to this injection site (ADR 013 §3.7).
|
|
15
36
|
*/
|
|
16
37
|
class SkraInput {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
38
|
+
el = inject(ElementRef);
|
|
39
|
+
context = inject(SkraFieldContext, { optional: true });
|
|
40
|
+
constructor() {
|
|
41
|
+
const el = this.el.nativeElement;
|
|
42
|
+
// Field-cascaded native properties — only bind when context is present so
|
|
43
|
+
// standalone consumers retain full control of their static attributes
|
|
44
|
+
// (a host `[attr.disabled]="null"` binding would strip a consumer-authored
|
|
45
|
+
// `disabled` / `readonly` / `id`). Mirrors SkraCheckbox.
|
|
46
|
+
if (this.context) {
|
|
47
|
+
const ctx = this.context;
|
|
48
|
+
effect(() => {
|
|
49
|
+
el.id = ctx.fieldId();
|
|
50
|
+
});
|
|
51
|
+
effect(() => {
|
|
52
|
+
el.disabled = ctx.isDisabled();
|
|
53
|
+
});
|
|
54
|
+
effect(() => {
|
|
55
|
+
el.readOnly = ctx.isReadonly();
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
60
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.1", type: SkraInput, isStandalone: true, selector: "input[skraInput]", host: { properties: { "attr.aria-describedby": "context?.describedByIds() ?? null", "attr.aria-invalid": "context?.hasError() ? \"true\" : null", "attr.aria-required": "context?.isRequired() ? \"true\" : null" } }, ngImport: i0, template: '', isInline: true, styles: [":host{background:var(--skra-comp-field-background);color:var(--skra-comp-field-foreground);border-color:var(--skra-comp-field-border-color);border-width:var(--skra-comp-field-border-width);border-style:var(--skra-comp-field-border-style);border-radius:var(--skra-comp-field-radius);padding-block:var(--skra-comp-field-padding-block);padding-inline:var(--skra-comp-field-padding-inline);box-shadow:var(--skra-comp-field-shadow);font:inherit;outline:none;transition:background-color var(--skra-comp-field-motion-duration) var(--skra-comp-field-motion-easing),border-color var(--skra-comp-field-motion-duration) var(--skra-comp-field-motion-easing),color var(--skra-comp-field-motion-duration) var(--skra-comp-field-motion-easing),box-shadow var(--skra-comp-field-motion-duration) var(--skra-comp-field-motion-easing)}:host(:hover:not(:disabled):not([readonly])){background:var(--skra-comp-field-background-hover);border-color:var(--skra-comp-field-border-color-hover)}:host(:focus-visible){border-color:var(--skra-comp-field-focus-ring-color);box-shadow:0 0 0 var(--skra-comp-field-focus-ring-width) var(--skra-comp-field-focus-ring-color)}:host(:disabled){cursor:not-allowed;opacity:var(--skra-sys-opacity-disabled)}:host([readonly]){cursor:default}:host([aria-invalid=true]){border-color:var(--skra-comp-field-error-color)}:host([aria-invalid=true]:focus-visible){box-shadow:0 0 0 var(--skra-comp-field-focus-ring-width) var(--skra-comp-field-error-color)}@media(prefers-reduced-motion:reduce){:host{transition:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
20
61
|
}
|
|
21
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
62
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraInput, decorators: [{
|
|
22
63
|
type: Component,
|
|
23
64
|
args: [{ selector: 'input[skraInput]', standalone: true, template: '', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
|
|
24
|
-
|
|
25
|
-
'[attr.aria-describedby]': 'context
|
|
26
|
-
'[attr.aria-invalid]': 'context
|
|
27
|
-
'[attr.aria-required]': 'context
|
|
65
|
+
// ARIA relationships — Skra-owned, present only while a field cascades them.
|
|
66
|
+
'[attr.aria-describedby]': 'context?.describedByIds() ?? null',
|
|
67
|
+
'[attr.aria-invalid]': 'context?.hasError() ? "true" : null',
|
|
68
|
+
'[attr.aria-required]': 'context?.isRequired() ? "true" : null',
|
|
28
69
|
// Availability — native attrs only (native-attr-first, boundary #9). <input>
|
|
29
70
|
// supports native `readonly`/`disabled`, which AT already exposes; NO
|
|
30
71
|
// `aria-readonly`/`aria-disabled` here (setting both native + ARIA for one
|
|
31
72
|
// state is forbidden). Readonly styling keys off `:read-only`/`[readonly]`.
|
|
32
|
-
|
|
33
|
-
|
|
73
|
+
// The native props are driven imperatively below, NOT as host bindings —
|
|
74
|
+
// see the constructor note on standalone attribute ownership.
|
|
34
75
|
}, styles: [":host{background:var(--skra-comp-field-background);color:var(--skra-comp-field-foreground);border-color:var(--skra-comp-field-border-color);border-width:var(--skra-comp-field-border-width);border-style:var(--skra-comp-field-border-style);border-radius:var(--skra-comp-field-radius);padding-block:var(--skra-comp-field-padding-block);padding-inline:var(--skra-comp-field-padding-inline);box-shadow:var(--skra-comp-field-shadow);font:inherit;outline:none;transition:background-color var(--skra-comp-field-motion-duration) var(--skra-comp-field-motion-easing),border-color var(--skra-comp-field-motion-duration) var(--skra-comp-field-motion-easing),color var(--skra-comp-field-motion-duration) var(--skra-comp-field-motion-easing),box-shadow var(--skra-comp-field-motion-duration) var(--skra-comp-field-motion-easing)}:host(:hover:not(:disabled):not([readonly])){background:var(--skra-comp-field-background-hover);border-color:var(--skra-comp-field-border-color-hover)}:host(:focus-visible){border-color:var(--skra-comp-field-focus-ring-color);box-shadow:0 0 0 var(--skra-comp-field-focus-ring-width) var(--skra-comp-field-focus-ring-color)}:host(:disabled){cursor:not-allowed;opacity:var(--skra-sys-opacity-disabled)}:host([readonly]){cursor:default}:host([aria-invalid=true]){border-color:var(--skra-comp-field-error-color)}:host([aria-invalid=true]:focus-visible){box-shadow:0 0 0 var(--skra-comp-field-focus-ring-width) var(--skra-comp-field-error-color)}@media(prefers-reduced-motion:reduce){:host{transition:none}}\n"] }]
|
|
35
|
-
}] });
|
|
76
|
+
}], ctorParameters: () => [] });
|
|
36
77
|
|
|
37
78
|
/**
|
|
38
79
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skra-ui-input.mjs","sources":["../../../../libs/ui/input/src/lib/input/input.ts","../../../../libs/ui/input/src/skra-ui-input.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { SkraFieldContext } from '@skra/ui/field';\n\n/**\n * `input[skraInput]` — text-input atom. Per ADR 040 this is a\n * Component-on-a-native-host (not a directive): `<input>` is a void element, so\n * `template: ''` is correct — there is no consumer content to project. Angular\n * Emulated encapsulation scopes `input.scss` to the host, the same way\n * <skra-button> carries its own CSS. Replaces the ADR 038 global slice branch.\n *\n * DI wiring (ADR 013), host a11y bindings (ADR 021/027), and the agnostic\n * value posture (ADR 037 — no value channel, no @angular/forms) are unchanged\n * from the prior directive form.\n */\n@Component({\n selector: 'input[skraInput]',\n standalone: true,\n // Void host — no <ng-content>. See ADR 040 §2.\n template: '',\n styleUrl: './input.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n
|
|
1
|
+
{"version":3,"file":"skra-ui-input.mjs","sources":["../../../../libs/ui/input/src/lib/input/input.ts","../../../../libs/ui/input/src/skra-ui-input.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n ViewEncapsulation,\n effect,\n inject,\n} from '@angular/core';\nimport { SkraFieldContext } from '@skra/ui/field';\n\n/**\n * `input[skraInput]` — text-input atom. Per ADR 040 this is a\n * Component-on-a-native-host (not a directive): `<input>` is a void element, so\n * `template: ''` is correct — there is no consumer content to project. Angular\n * Emulated encapsulation scopes `input.scss` to the host, the same way\n * <skra-button> carries its own CSS. Replaces the ADR 038 global slice branch.\n *\n * DI wiring (ADR 013), host a11y bindings (ADR 021/027), and the agnostic\n * value posture (ADR 037 — no value channel, no @angular/forms) are unchanged\n * from the prior directive form.\n *\n * `SkraFieldContext` is injected `{ optional: true }` (ADR 013 §3.7) — the same\n * posture as `skraCheckbox` / `skraRadio` / `skraSwitch`. Inside `<skra-field>`\n * the atom takes the field's id + describedby + availability cascade; standalone\n * it renders the skin only and the consumer owns every attribute, including the\n * accessible name:\n *\n * <!-- inside Field — label association via the DI-generated id/for pair -->\n * <skra-field>\n * <label skraLabelFor>Email</label>\n * <input skraInput type=\"email\" />\n * </skra-field>\n *\n * <!-- standalone: native implicit label (wrapping) — no id/for needed -->\n * <label>Search <input skraInput type=\"search\" /></label>\n *\n * Standalone use does NOT relax the ADR 033 accessible-name contract; it moves\n * the name onto the consumer's own native markup. An input with no name is an\n * a11y defect wherever it appears — including inside a `<skra-field>` that\n * carries no `label[skraLabelFor]` — so the check belongs to the a11y gate, not\n * to this injection site (ADR 013 §3.7).\n */\n@Component({\n selector: 'input[skraInput]',\n standalone: true,\n // Void host — no <ng-content>. See ADR 040 §2.\n template: '',\n styleUrl: './input.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n // ARIA relationships — Skra-owned, present only while a field cascades them.\n '[attr.aria-describedby]': 'context?.describedByIds() ?? null',\n '[attr.aria-invalid]': 'context?.hasError() ? \"true\" : null',\n '[attr.aria-required]': 'context?.isRequired() ? \"true\" : null',\n // Availability — native attrs only (native-attr-first, boundary #9). <input>\n // supports native `readonly`/`disabled`, which AT already exposes; NO\n // `aria-readonly`/`aria-disabled` here (setting both native + ARIA for one\n // state is forbidden). Readonly styling keys off `:read-only`/`[readonly]`.\n // The native props are driven imperatively below, NOT as host bindings —\n // see the constructor note on standalone attribute ownership.\n },\n})\nexport class SkraInput {\n private readonly el = inject<ElementRef<HTMLInputElement>>(ElementRef);\n readonly context = inject(SkraFieldContext, { optional: true });\n\n constructor() {\n const el = this.el.nativeElement;\n\n // Field-cascaded native properties — only bind when context is present so\n // standalone consumers retain full control of their static attributes\n // (a host `[attr.disabled]=\"null\"` binding would strip a consumer-authored\n // `disabled` / `readonly` / `id`). Mirrors SkraCheckbox.\n if (this.context) {\n const ctx = this.context;\n effect(() => {\n el.id = ctx.fieldId();\n });\n effect(() => {\n el.disabled = ctx.isDisabled();\n });\n effect(() => {\n el.readOnly = ctx.isReadonly();\n });\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;MAsBU,SAAS,CAAA;AACH,IAAA,EAAE,GAAG,MAAM,CAA+B,UAAU,CAAC;IAC7D,OAAO,GAAG,MAAM,CAAC,gBAAgB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAE/D,IAAA,WAAA,GAAA;AACE,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa;;;;;AAMhC,QAAA,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO;YACxB,MAAM,CAAC,MAAK;AACV,gBAAA,EAAE,CAAC,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE;AACvB,YAAA,CAAC,CAAC;YACF,MAAM,CAAC,MAAK;AACV,gBAAA,EAAE,CAAC,QAAQ,GAAG,GAAG,CAAC,UAAU,EAAE;AAChC,YAAA,CAAC,CAAC;YACF,MAAM,CAAC,MAAK;AACV,gBAAA,EAAE,CAAC,QAAQ,GAAG,GAAG,CAAC,UAAU,EAAE;AAChC,YAAA,CAAC,CAAC;QACJ;IACF;uGAvBW,SAAS,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAT,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,SAAS,mSAjBV,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,i/CAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAiBD,SAAS,EAAA,UAAA,EAAA,CAAA;kBArBrB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,kBAAkB,EAAA,UAAA,EAChB,IAAI,EAAA,QAAA,EAEN,EAAE,EAAA,eAAA,EAEK,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,QAAQ,EAAA,IAAA,EACnC;;AAEJ,wBAAA,yBAAyB,EAAE,mCAAmC;AAC9D,wBAAA,qBAAqB,EAAE,qCAAqC;AAC5D,wBAAA,sBAAsB,EAAE,uCAAuC;;;;;;;AAOhE,qBAAA,EAAA,MAAA,EAAA,CAAA,i/CAAA,CAAA,EAAA;;;AC7DH;;AAEG;;;;"}
|
package/fesm2022/skra-ui-kbd.mjs
CHANGED
|
@@ -26,10 +26,10 @@ import { ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/
|
|
|
26
26
|
* deliberately **not** `aria-hidden`: the key name is meaningful content AT must announce.
|
|
27
27
|
*/
|
|
28
28
|
class SkraKbd {
|
|
29
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
30
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
29
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraKbd, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
30
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.1", type: SkraKbd, isStandalone: true, selector: "kbd[skraKbd]", host: { classAttribute: "skra-kbd" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{display:inline-flex;align-items:center;justify-content:center;margin:0;white-space:nowrap;vertical-align:baseline;background:var(--skra-comp-kbd-background);color:var(--skra-comp-kbd-foreground);border:var(--skra-comp-kbd-border-width) var(--skra-comp-kbd-border-style) var(--skra-comp-kbd-border-color);border-radius:var(--skra-comp-kbd-radius);padding:var(--skra-comp-kbd-padding-block) var(--skra-comp-kbd-padding-inline);box-shadow:var(--skra-comp-kbd-shadow);font-family:var(--skra-comp-kbd-font-family);font-size:.875em;font-weight:var(--skra-sys-typography-role-label-small-font-weight);line-height:var(--skra-sys-typography-role-label-small-line-height);letter-spacing:var(--skra-sys-typography-role-label-small-letter-spacing);min-inline-size:1em;box-sizing:border-box}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
31
31
|
}
|
|
32
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
32
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraKbd, decorators: [{
|
|
33
33
|
type: Component,
|
|
34
34
|
args: [{ selector: 'kbd[skraKbd]', standalone: true, template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
|
|
35
35
|
class: 'skra-kbd',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skra-ui-kbd.mjs","sources":["../../../../libs/ui/kbd/src/lib/kbd/kbd.ts","../../../../libs/ui/kbd/src/skra-ui-kbd.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n} from '@angular/core';\n\n/**\n * `kbd[skraKbd]` — keyboard-key display atom (first resident of `libs/ui/content`, the\n * text-level inline-semantics family). Renders a single key / key-name as a styled key-cap for\n * docs, shortcut hints and help text (\"press `Esc` to close\"). See\n * `adr/specs/component-kbd-spec.md`.\n *\n * **Component-on-the-native-host (ADR 040), NOT `<skra-kbd>`:** native `<kbd>` already carries\n * the correct HTML semantic (\"user keyboard input\"), so we decorate it (ADR 012). `<kbd>` is\n * content-bearing, so the template MUST be `<ng-content>` — `template: ''` would discard the key\n * text (ADR 040 §2; the `label[skraLabelFor]` precedent).\n *\n * **Zero inputs by design.** A key display is purely presentational:\n * - sizing is em-relative (it harmonises with the surrounding text), so there is no `size` input\n * — an explicit size enum would be a look-input (skin-philosophy) and low-demand (90%-rule);\n * - no coherent semantic exists for a `type`, and a `type` enum switching appearance is the SRP\n * smell the Decision Doctrine warns against;\n * - the monospace family is skin-owned (`--skra-comp-kbd-font-family` → `sys.font-family.code`);\n * - key-combos (\"Ctrl+C\") are consumer composition of multiple `<kbd skraKbd>` (agnostic\n * doctrine), not a `combo` input.\n *\n * So there is no input, no output, no `data-skra-*` state (non-interactive — State Surface\n * all-N/A), and no `ariaLabel` (the visible text IS the accessible content, ADR 033). The host is\n * deliberately **not** `aria-hidden`: the key name is meaningful content AT must announce.\n */\n@Component({\n selector: 'kbd[skraKbd]',\n standalone: true,\n // Content-bearing host — see ADR 040 §2 (label precedent).\n template: '<ng-content></ng-content>',\n styleUrl: './kbd.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n class: 'skra-kbd',\n },\n})\nexport class SkraKbd {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAMA;;;;;;;;;;;;;;;;;;;;;;;AAuBG;MAaU,OAAO,CAAA;uGAAP,OAAO,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAP,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,OAAO,8GARR,2BAA2B,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,oxBAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAQ1B,OAAO,EAAA,UAAA,EAAA,CAAA;kBAZnB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,cAAc,EAAA,UAAA,EACZ,IAAI,EAAA,QAAA,EAEN,2BAA2B,EAAA,eAAA,EAEpB,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,QAAQ,EAAA,IAAA,EACnC;AACJ,wBAAA,KAAK,EAAE,UAAU;AAClB,qBAAA,EAAA,MAAA,EAAA,CAAA,oxBAAA,CAAA,EAAA;;;ACxCH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"skra-ui-kbd.mjs","sources":["../../../../libs/ui/kbd/src/lib/kbd/kbd.ts","../../../../libs/ui/kbd/src/skra-ui-kbd.ts"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ViewEncapsulation,\r\n} from '@angular/core';\r\n\r\n/**\r\n * `kbd[skraKbd]` — keyboard-key display atom (first resident of `libs/ui/content`, the\r\n * text-level inline-semantics family). Renders a single key / key-name as a styled key-cap for\r\n * docs, shortcut hints and help text (\"press `Esc` to close\"). See\r\n * `adr/specs/component-kbd-spec.md`.\r\n *\r\n * **Component-on-the-native-host (ADR 040), NOT `<skra-kbd>`:** native `<kbd>` already carries\r\n * the correct HTML semantic (\"user keyboard input\"), so we decorate it (ADR 012). `<kbd>` is\r\n * content-bearing, so the template MUST be `<ng-content>` — `template: ''` would discard the key\r\n * text (ADR 040 §2; the `label[skraLabelFor]` precedent).\r\n *\r\n * **Zero inputs by design.** A key display is purely presentational:\r\n * - sizing is em-relative (it harmonises with the surrounding text), so there is no `size` input\r\n * — an explicit size enum would be a look-input (skin-philosophy) and low-demand (90%-rule);\r\n * - no coherent semantic exists for a `type`, and a `type` enum switching appearance is the SRP\r\n * smell the Decision Doctrine warns against;\r\n * - the monospace family is skin-owned (`--skra-comp-kbd-font-family` → `sys.font-family.code`);\r\n * - key-combos (\"Ctrl+C\") are consumer composition of multiple `<kbd skraKbd>` (agnostic\r\n * doctrine), not a `combo` input.\r\n *\r\n * So there is no input, no output, no `data-skra-*` state (non-interactive — State Surface\r\n * all-N/A), and no `ariaLabel` (the visible text IS the accessible content, ADR 033). The host is\r\n * deliberately **not** `aria-hidden`: the key name is meaningful content AT must announce.\r\n */\r\n@Component({\r\n selector: 'kbd[skraKbd]',\r\n standalone: true,\r\n // Content-bearing host — see ADR 040 §2 (label precedent).\r\n template: '<ng-content></ng-content>',\r\n styleUrl: './kbd.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n host: {\r\n class: 'skra-kbd',\r\n },\r\n})\r\nexport class SkraKbd {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAMA;;;;;;;;;;;;;;;;;;;;;;;AAuBG;MAaU,OAAO,CAAA;uGAAP,OAAO,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAP,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,OAAO,8GARR,2BAA2B,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,oxBAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAQ1B,OAAO,EAAA,UAAA,EAAA,CAAA;kBAZnB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,cAAc,EAAA,UAAA,EACZ,IAAI,EAAA,QAAA,EAEN,2BAA2B,EAAA,eAAA,EAEpB,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,QAAQ,EAAA,IAAA,EACnC;AACJ,wBAAA,KAAK,EAAE,UAAU;AAClB,qBAAA,EAAA,MAAA,EAAA,CAAA,oxBAAA,CAAA,EAAA;;;ACxCH;;AAEG;;;;"}
|