@skra/ui 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +44 -34
- 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 +5 -5
- 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
|
@@ -22,17 +22,20 @@ export { SkraOption, SkraOptionDetail, SkraOptionLeading, SkraSelectTrigger } fr
|
|
|
22
22
|
*/
|
|
23
23
|
class SkraSelect extends _SkraSelectBase {
|
|
24
24
|
/** Consumer-owned value channel (ADR 037). */
|
|
25
|
-
value = input(
|
|
25
|
+
value = input(/* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
26
27
|
/** Fires ONLY on user selection — never on a programmatic `value()` change (ADR 037). */
|
|
27
28
|
valueChange = output();
|
|
28
29
|
/** Cardinality hint (ADR 0046) — single-select. */
|
|
29
30
|
multiple = false;
|
|
30
31
|
/** The option whose value matches `value()` (ADR 037 selection model) — feeds the trigger. */
|
|
31
|
-
selectedOption = computed(() => this.options().find((o) => this.isSelected(o.value())) ?? null,
|
|
32
|
+
selectedOption = computed(() => this.options().find((o) => this.isSelected(o.value())) ?? null, /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "selectedOption" }] : /* istanbul ignore next */ []));
|
|
32
34
|
triggerContext = computed(() => ({
|
|
33
35
|
$implicit: this.value(),
|
|
34
36
|
option: this.selectedOption(),
|
|
35
|
-
}),
|
|
37
|
+
}), /* @ts-ignore */
|
|
38
|
+
...(ngDevMode ? [{ debugName: "triggerContext" }] : /* istanbul ignore next */ []));
|
|
36
39
|
// ── SkraListboxPanel seam ──
|
|
37
40
|
isSelected(value) {
|
|
38
41
|
const current = this.value();
|
|
@@ -45,101 +48,101 @@ class SkraSelect extends _SkraSelectBase {
|
|
|
45
48
|
activeSeedItem() {
|
|
46
49
|
return this.selectedOption();
|
|
47
50
|
}
|
|
48
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
49
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
50
|
-
<button
|
|
51
|
-
#trigger
|
|
52
|
-
class="skra-select-trigger"
|
|
53
|
-
type="button"
|
|
54
|
-
role="combobox"
|
|
55
|
-
aria-haspopup="listbox"
|
|
56
|
-
[attr.id]="triggerId()"
|
|
57
|
-
[attr.popovertarget]="panelId"
|
|
58
|
-
[attr.aria-controls]="panelId"
|
|
59
|
-
[attr.aria-expanded]="isOpen()"
|
|
60
|
-
[attr.aria-activedescendant]="activeOptionId()"
|
|
61
|
-
[attr.aria-describedby]="describedBy()"
|
|
62
|
-
[attr.aria-invalid]="hasError() ? 'true' : null"
|
|
63
|
-
[attr.aria-required]="isRequired() ? 'true' : null"
|
|
64
|
-
[attr.aria-readonly]="isReadonly() ? 'true' : null"
|
|
65
|
-
[disabled]="isDisabled()"
|
|
66
|
-
(click)="onTriggerClick($event)"
|
|
67
|
-
(keydown)="onTriggerKeydown($event)"
|
|
68
|
-
>
|
|
69
|
-
<span class="skra-select-trigger-value">
|
|
70
|
-
@if (triggerTemplate(); as tpl) {
|
|
71
|
-
<ng-container
|
|
72
|
-
[ngTemplateOutlet]="tpl"
|
|
73
|
-
[ngTemplateOutletContext]="triggerContext()"
|
|
74
|
-
></ng-container>
|
|
75
|
-
} @else if (selectedOption(); as opt) {
|
|
76
|
-
{{ opt.getLabel() }}
|
|
77
|
-
} @else {
|
|
78
|
-
<span class="skra-select-placeholder">{{ placeholder() }}</span>
|
|
79
|
-
}
|
|
80
|
-
</span>
|
|
81
|
-
<span class="skra-select-arrow" aria-hidden="true"></span>
|
|
82
|
-
</button>
|
|
83
|
-
|
|
84
|
-
<div
|
|
85
|
-
#panel
|
|
86
|
-
class="skra-select-listbox"
|
|
87
|
-
[id]="panelId"
|
|
88
|
-
role="listbox"
|
|
89
|
-
popover="auto"
|
|
90
|
-
(toggle)="onPanelToggle($event)"
|
|
91
|
-
>
|
|
92
|
-
<ng-content></ng-content>
|
|
93
|
-
</div>
|
|
51
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraSelect, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
52
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: SkraSelect, isStandalone: true, selector: "skra-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, providers: [{ provide: SKRA_LISTBOX_PANEL, useExisting: SkraSelect }], exportAs: ["skraSelect"], usesInheritance: true, ngImport: i0, template: `
|
|
53
|
+
<button
|
|
54
|
+
#trigger
|
|
55
|
+
class="skra-select-trigger"
|
|
56
|
+
type="button"
|
|
57
|
+
role="combobox"
|
|
58
|
+
aria-haspopup="listbox"
|
|
59
|
+
[attr.id]="triggerId()"
|
|
60
|
+
[attr.popovertarget]="panelId"
|
|
61
|
+
[attr.aria-controls]="panelId"
|
|
62
|
+
[attr.aria-expanded]="isOpen()"
|
|
63
|
+
[attr.aria-activedescendant]="activeOptionId()"
|
|
64
|
+
[attr.aria-describedby]="describedBy()"
|
|
65
|
+
[attr.aria-invalid]="hasError() ? 'true' : null"
|
|
66
|
+
[attr.aria-required]="isRequired() ? 'true' : null"
|
|
67
|
+
[attr.aria-readonly]="isReadonly() ? 'true' : null"
|
|
68
|
+
[disabled]="isDisabled()"
|
|
69
|
+
(click)="onTriggerClick($event)"
|
|
70
|
+
(keydown)="onTriggerKeydown($event)"
|
|
71
|
+
>
|
|
72
|
+
<span class="skra-select-trigger-value">
|
|
73
|
+
@if (triggerTemplate(); as tpl) {
|
|
74
|
+
<ng-container
|
|
75
|
+
[ngTemplateOutlet]="tpl"
|
|
76
|
+
[ngTemplateOutletContext]="triggerContext()"
|
|
77
|
+
></ng-container>
|
|
78
|
+
} @else if (selectedOption(); as opt) {
|
|
79
|
+
{{ opt.getLabel() }}
|
|
80
|
+
} @else {
|
|
81
|
+
<span class="skra-select-placeholder">{{ placeholder() }}</span>
|
|
82
|
+
}
|
|
83
|
+
</span>
|
|
84
|
+
<span class="skra-select-arrow" aria-hidden="true"></span>
|
|
85
|
+
</button>
|
|
86
|
+
|
|
87
|
+
<div
|
|
88
|
+
#panel
|
|
89
|
+
class="skra-select-listbox"
|
|
90
|
+
[id]="panelId"
|
|
91
|
+
role="listbox"
|
|
92
|
+
popover="auto"
|
|
93
|
+
(toggle)="onPanelToggle($event)"
|
|
94
|
+
>
|
|
95
|
+
<ng-content></ng-content>
|
|
96
|
+
</div>
|
|
94
97
|
`, isInline: true, styles: ["@charset \"UTF-8\";:host{display:block;box-sizing:border-box;margin:0}.skra-select-trigger{display:flex;align-items:center;gap:var(--skra-comp-select-gap);inline-size:100%;min-block-size:var(--skra-comp-select-min-block-size);box-sizing:border-box;margin:0;padding-block:var(--skra-comp-select-padding-block);padding-inline:var(--skra-comp-select-padding-inline);text-align:start;cursor:pointer;background:var(--skra-comp-select-background);color:var(--skra-comp-select-foreground);border-color:var(--skra-comp-select-border-color);border-width:var(--skra-comp-select-border-width);border-style:var(--skra-comp-select-border-style);border-radius:var(--skra-comp-select-radius);box-shadow:var(--skra-comp-select-shadow);font-family:var(--skra-sys-typography-role-body-medium-font-family);font-size:var(--skra-sys-typography-role-body-medium-font-size);font-weight:var(--skra-sys-typography-role-body-medium-font-weight);line-height:var(--skra-sys-typography-role-body-medium-line-height);letter-spacing:var(--skra-sys-typography-role-body-medium-letter-spacing);transition:background-color var(--skra-comp-select-motion-duration) var(--skra-comp-select-motion-easing),border-color var(--skra-comp-select-motion-duration) var(--skra-comp-select-motion-easing)}.skra-select-trigger:hover:not(:disabled):not([aria-readonly=true]){background:var(--skra-comp-select-background-hover)}.skra-select-trigger:focus-visible{outline:var(--skra-comp-select-focus-ring-width) solid var(--skra-comp-select-focus-ring-color);outline-offset:.125rem}.skra-select-trigger:disabled{background:var(--skra-comp-select-background-disabled);color:var(--skra-comp-select-foreground-disabled);cursor:not-allowed}.skra-select-trigger[aria-readonly=true]{background:var(--skra-comp-select-background-readonly);cursor:default}.skra-select-trigger[aria-invalid=true]{border-color:var(--skra-comp-select-border-color-validation-invalid)}.skra-select-trigger-value{flex:1 1 auto;min-inline-size:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;--skra-comp-icon-size: var(--skra-comp-select-icon-size)}.skra-select-placeholder{color:var(--skra-comp-select-foreground-disabled)}.skra-select-arrow{flex:none;inline-size:var(--skra-comp-select-arrow-icon-size);block-size:var(--skra-comp-select-arrow-icon-size);background-color:var(--skra-comp-select-arrow-color);mask:url(\"data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M6%209l6%206%206-6'%20fill='none'%20stroke='%23000'%20stroke-width='2'/%3E%3C/svg%3E\") no-repeat center/contain;-webkit-mask:url(\"data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M6%209l6%206%206-6'%20fill='none'%20stroke='%23000'%20stroke-width='2'/%3E%3C/svg%3E\") no-repeat center/contain;transition:transform var(--skra-comp-select-motion-duration) var(--skra-comp-select-motion-easing)}.skra-select-trigger[aria-expanded=true] .skra-select-arrow{transform:rotate(180deg)}.skra-select-listbox{position:fixed;margin:0;inset:auto;box-sizing:border-box;padding-block:var(--skra-comp-select-panel-padding-block);padding-inline:var(--skra-comp-select-panel-padding-inline);background:var(--skra-comp-select-panel-background);color:var(--skra-comp-select-panel-foreground);border:var(--skra-comp-select-border-width) solid var(--skra-comp-select-panel-border-color);border-radius:var(--skra-comp-select-panel-radius);box-shadow:var(--skra-comp-select-panel-shadow);inline-size:max-content;max-block-size:var(--skra-comp-select-panel-max-block-size);overflow-y:auto;flex-direction:column;opacity:0;transition:opacity var(--skra-comp-select-motion-duration) var(--skra-comp-select-motion-easing),display var(--skra-comp-select-motion-duration) allow-discrete,overlay var(--skra-comp-select-motion-duration) allow-discrete}.skra-select-listbox:popover-open{display:flex;opacity:1}@starting-style{.skra-select-listbox:popover-open{opacity:0}}@media(prefers-reduced-motion:reduce){.skra-select-trigger,.skra-select-arrow,.skra-select-listbox{transition-duration:0ms}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
95
98
|
}
|
|
96
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
99
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraSelect, decorators: [{
|
|
97
100
|
type: Component,
|
|
98
|
-
args: [{ selector: 'skra-select', standalone: true, exportAs: 'skraSelect', imports: [NgTemplateOutlet], template: `
|
|
99
|
-
<button
|
|
100
|
-
#trigger
|
|
101
|
-
class="skra-select-trigger"
|
|
102
|
-
type="button"
|
|
103
|
-
role="combobox"
|
|
104
|
-
aria-haspopup="listbox"
|
|
105
|
-
[attr.id]="triggerId()"
|
|
106
|
-
[attr.popovertarget]="panelId"
|
|
107
|
-
[attr.aria-controls]="panelId"
|
|
108
|
-
[attr.aria-expanded]="isOpen()"
|
|
109
|
-
[attr.aria-activedescendant]="activeOptionId()"
|
|
110
|
-
[attr.aria-describedby]="describedBy()"
|
|
111
|
-
[attr.aria-invalid]="hasError() ? 'true' : null"
|
|
112
|
-
[attr.aria-required]="isRequired() ? 'true' : null"
|
|
113
|
-
[attr.aria-readonly]="isReadonly() ? 'true' : null"
|
|
114
|
-
[disabled]="isDisabled()"
|
|
115
|
-
(click)="onTriggerClick($event)"
|
|
116
|
-
(keydown)="onTriggerKeydown($event)"
|
|
117
|
-
>
|
|
118
|
-
<span class="skra-select-trigger-value">
|
|
119
|
-
@if (triggerTemplate(); as tpl) {
|
|
120
|
-
<ng-container
|
|
121
|
-
[ngTemplateOutlet]="tpl"
|
|
122
|
-
[ngTemplateOutletContext]="triggerContext()"
|
|
123
|
-
></ng-container>
|
|
124
|
-
} @else if (selectedOption(); as opt) {
|
|
125
|
-
{{ opt.getLabel() }}
|
|
126
|
-
} @else {
|
|
127
|
-
<span class="skra-select-placeholder">{{ placeholder() }}</span>
|
|
128
|
-
}
|
|
129
|
-
</span>
|
|
130
|
-
<span class="skra-select-arrow" aria-hidden="true"></span>
|
|
131
|
-
</button>
|
|
132
|
-
|
|
133
|
-
<div
|
|
134
|
-
#panel
|
|
135
|
-
class="skra-select-listbox"
|
|
136
|
-
[id]="panelId"
|
|
137
|
-
role="listbox"
|
|
138
|
-
popover="auto"
|
|
139
|
-
(toggle)="onPanelToggle($event)"
|
|
140
|
-
>
|
|
141
|
-
<ng-content></ng-content>
|
|
142
|
-
</div>
|
|
101
|
+
args: [{ selector: 'skra-select', standalone: true, exportAs: 'skraSelect', imports: [NgTemplateOutlet], template: `
|
|
102
|
+
<button
|
|
103
|
+
#trigger
|
|
104
|
+
class="skra-select-trigger"
|
|
105
|
+
type="button"
|
|
106
|
+
role="combobox"
|
|
107
|
+
aria-haspopup="listbox"
|
|
108
|
+
[attr.id]="triggerId()"
|
|
109
|
+
[attr.popovertarget]="panelId"
|
|
110
|
+
[attr.aria-controls]="panelId"
|
|
111
|
+
[attr.aria-expanded]="isOpen()"
|
|
112
|
+
[attr.aria-activedescendant]="activeOptionId()"
|
|
113
|
+
[attr.aria-describedby]="describedBy()"
|
|
114
|
+
[attr.aria-invalid]="hasError() ? 'true' : null"
|
|
115
|
+
[attr.aria-required]="isRequired() ? 'true' : null"
|
|
116
|
+
[attr.aria-readonly]="isReadonly() ? 'true' : null"
|
|
117
|
+
[disabled]="isDisabled()"
|
|
118
|
+
(click)="onTriggerClick($event)"
|
|
119
|
+
(keydown)="onTriggerKeydown($event)"
|
|
120
|
+
>
|
|
121
|
+
<span class="skra-select-trigger-value">
|
|
122
|
+
@if (triggerTemplate(); as tpl) {
|
|
123
|
+
<ng-container
|
|
124
|
+
[ngTemplateOutlet]="tpl"
|
|
125
|
+
[ngTemplateOutletContext]="triggerContext()"
|
|
126
|
+
></ng-container>
|
|
127
|
+
} @else if (selectedOption(); as opt) {
|
|
128
|
+
{{ opt.getLabel() }}
|
|
129
|
+
} @else {
|
|
130
|
+
<span class="skra-select-placeholder">{{ placeholder() }}</span>
|
|
131
|
+
}
|
|
132
|
+
</span>
|
|
133
|
+
<span class="skra-select-arrow" aria-hidden="true"></span>
|
|
134
|
+
</button>
|
|
135
|
+
|
|
136
|
+
<div
|
|
137
|
+
#panel
|
|
138
|
+
class="skra-select-listbox"
|
|
139
|
+
[id]="panelId"
|
|
140
|
+
role="listbox"
|
|
141
|
+
popover="auto"
|
|
142
|
+
(toggle)="onPanelToggle($event)"
|
|
143
|
+
>
|
|
144
|
+
<ng-content></ng-content>
|
|
145
|
+
</div>
|
|
143
146
|
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, providers: [{ provide: SKRA_LISTBOX_PANEL, useExisting: SkraSelect }], styles: ["@charset \"UTF-8\";:host{display:block;box-sizing:border-box;margin:0}.skra-select-trigger{display:flex;align-items:center;gap:var(--skra-comp-select-gap);inline-size:100%;min-block-size:var(--skra-comp-select-min-block-size);box-sizing:border-box;margin:0;padding-block:var(--skra-comp-select-padding-block);padding-inline:var(--skra-comp-select-padding-inline);text-align:start;cursor:pointer;background:var(--skra-comp-select-background);color:var(--skra-comp-select-foreground);border-color:var(--skra-comp-select-border-color);border-width:var(--skra-comp-select-border-width);border-style:var(--skra-comp-select-border-style);border-radius:var(--skra-comp-select-radius);box-shadow:var(--skra-comp-select-shadow);font-family:var(--skra-sys-typography-role-body-medium-font-family);font-size:var(--skra-sys-typography-role-body-medium-font-size);font-weight:var(--skra-sys-typography-role-body-medium-font-weight);line-height:var(--skra-sys-typography-role-body-medium-line-height);letter-spacing:var(--skra-sys-typography-role-body-medium-letter-spacing);transition:background-color var(--skra-comp-select-motion-duration) var(--skra-comp-select-motion-easing),border-color var(--skra-comp-select-motion-duration) var(--skra-comp-select-motion-easing)}.skra-select-trigger:hover:not(:disabled):not([aria-readonly=true]){background:var(--skra-comp-select-background-hover)}.skra-select-trigger:focus-visible{outline:var(--skra-comp-select-focus-ring-width) solid var(--skra-comp-select-focus-ring-color);outline-offset:.125rem}.skra-select-trigger:disabled{background:var(--skra-comp-select-background-disabled);color:var(--skra-comp-select-foreground-disabled);cursor:not-allowed}.skra-select-trigger[aria-readonly=true]{background:var(--skra-comp-select-background-readonly);cursor:default}.skra-select-trigger[aria-invalid=true]{border-color:var(--skra-comp-select-border-color-validation-invalid)}.skra-select-trigger-value{flex:1 1 auto;min-inline-size:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;--skra-comp-icon-size: var(--skra-comp-select-icon-size)}.skra-select-placeholder{color:var(--skra-comp-select-foreground-disabled)}.skra-select-arrow{flex:none;inline-size:var(--skra-comp-select-arrow-icon-size);block-size:var(--skra-comp-select-arrow-icon-size);background-color:var(--skra-comp-select-arrow-color);mask:url(\"data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M6%209l6%206%206-6'%20fill='none'%20stroke='%23000'%20stroke-width='2'/%3E%3C/svg%3E\") no-repeat center/contain;-webkit-mask:url(\"data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M6%209l6%206%206-6'%20fill='none'%20stroke='%23000'%20stroke-width='2'/%3E%3C/svg%3E\") no-repeat center/contain;transition:transform var(--skra-comp-select-motion-duration) var(--skra-comp-select-motion-easing)}.skra-select-trigger[aria-expanded=true] .skra-select-arrow{transform:rotate(180deg)}.skra-select-listbox{position:fixed;margin:0;inset:auto;box-sizing:border-box;padding-block:var(--skra-comp-select-panel-padding-block);padding-inline:var(--skra-comp-select-panel-padding-inline);background:var(--skra-comp-select-panel-background);color:var(--skra-comp-select-panel-foreground);border:var(--skra-comp-select-border-width) solid var(--skra-comp-select-panel-border-color);border-radius:var(--skra-comp-select-panel-radius);box-shadow:var(--skra-comp-select-panel-shadow);inline-size:max-content;max-block-size:var(--skra-comp-select-panel-max-block-size);overflow-y:auto;flex-direction:column;opacity:0;transition:opacity var(--skra-comp-select-motion-duration) var(--skra-comp-select-motion-easing),display var(--skra-comp-select-motion-duration) allow-discrete,overlay var(--skra-comp-select-motion-duration) allow-discrete}.skra-select-listbox:popover-open{display:flex;opacity:1}@starting-style{.skra-select-listbox:popover-open{opacity:0}}@media(prefers-reduced-motion:reduce){.skra-select-trigger,.skra-select-arrow,.skra-select-listbox{transition-duration:0ms}}\n"] }]
|
|
144
147
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }] } });
|
|
145
148
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skra-ui-select.mjs","sources":["../../../../libs/ui/select/src/lib/select/select.ts","../../../../libs/ui/select/src/skra-ui-select.ts"],"sourcesContent":["import { NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n computed,\n input,\n output,\n} from '@angular/core';\n\nimport { _SkraSelectBase } from '@skra/ui/core';\nimport {\n SKRA_LISTBOX_PANEL,\n type SkraListboxKeyboardItem,\n} from '@skra/ui/core';\n\n/**\n * SkraSelect — a custom single-select listbox: the WAI-ARIA APG **Select-Only Combobox** pattern. A\n * value-display **trigger** (`role=\"combobox\"`) opens a top-layer **listbox** panel (Popover API,\n * `popover=\"auto\"`, ADR 0044) of projected `skra-option` children. The thin single-select concrete\n * over `_SkraSelectBase` (ADR 0046 — cardinality split): it adds the honest `value: T` channel + the\n * replace-and-close selection model; everything else (overlay/keyboard/field substrate) lives in the\n * shared base, shared verbatim with `skra-multi-select`.\n *\n * - **Value (ADR 037):** `value` is a consumer-owned `input<T>()` + `valueChange` output — NO\n * `@angular/forms`, no CVA. Selection is signal-derived; equality is a strategy seam (`Object.is`\n * default + opt-in `compareWith`).\n * - **Trigger content (ADR 0045):** default = the selected option's `getLabel()` text (emoji/glyph\n * leading free); rich non-text triggers opt in via `<ng-template skraSelectTrigger>`.\n *\n * Full contract: adr/specs/component-select-spec.md.\n */\n@Component({\n selector: 'skra-select',\n standalone: true,\n exportAs: 'skraSelect',\n imports: [NgTemplateOutlet],\n template: `\n <button\n #trigger\n class=\"skra-select-trigger\"\n type=\"button\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n [attr.id]=\"triggerId()\"\n [attr.popovertarget]=\"panelId\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-activedescendant]=\"activeOptionId()\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-invalid]=\"hasError() ? 'true' : null\"\n [attr.aria-required]=\"isRequired() ? 'true' : null\"\n [attr.aria-readonly]=\"isReadonly() ? 'true' : null\"\n [disabled]=\"isDisabled()\"\n (click)=\"onTriggerClick($event)\"\n (keydown)=\"onTriggerKeydown($event)\"\n >\n <span class=\"skra-select-trigger-value\">\n @if (triggerTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"triggerContext()\"\n ></ng-container>\n } @else if (selectedOption(); as opt) {\n {{ opt.getLabel() }}\n } @else {\n <span class=\"skra-select-placeholder\">{{ placeholder() }}</span>\n }\n </span>\n <span class=\"skra-select-arrow\" aria-hidden=\"true\"></span>\n </button>\n\n <div\n #panel\n class=\"skra-select-listbox\"\n [id]=\"panelId\"\n role=\"listbox\"\n popover=\"auto\"\n (toggle)=\"onPanelToggle($event)\"\n >\n <ng-content></ng-content>\n </div>\n `,\n styleUrl: './select.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n providers: [{ provide: SKRA_LISTBOX_PANEL, useExisting: SkraSelect }],\n})\nexport class SkraSelect<T = unknown> extends _SkraSelectBase<T> {\n /** Consumer-owned value channel (ADR 037). */\n readonly value = input<T>();\n /** Fires ONLY on user selection — never on a programmatic `value()` change (ADR 037). */\n readonly valueChange = output<T>();\n /** Cardinality hint (ADR 0046) — single-select. */\n readonly multiple = false;\n\n /** The option whose value matches `value()` (ADR 037 selection model) — feeds the trigger. */\n protected readonly selectedOption = computed(\n () => this.options().find((o) => this.isSelected(o.value())) ?? null,\n );\n\n protected readonly triggerContext = computed(() => ({\n $implicit: this.value(),\n option: this.selectedOption(),\n }));\n\n // ── SkraListboxPanel seam ──\n isSelected(value: unknown): boolean {\n const current = this.value();\n return current !== undefined && this.compareWith()(current, value as T);\n }\n\n selectValue(value: unknown): void {\n this.valueChange.emit(value as T);\n this.close(); // single-select: pick + close\n }\n\n protected activeSeedItem(): SkraListboxKeyboardItem | null {\n return this.selectedOption();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAgBA;;;;;;;;;;;;;;;AAeG;AAyDG,MAAO,UAAwB,SAAQ,eAAkB,CAAA;;
|
|
1
|
+
{"version":3,"file":"skra-ui-select.mjs","sources":["../../../../libs/ui/select/src/lib/select/select.ts","../../../../libs/ui/select/src/skra-ui-select.ts"],"sourcesContent":["import { NgTemplateOutlet } from '@angular/common';\r\nimport {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ViewEncapsulation,\r\n computed,\r\n input,\r\n output,\r\n} from '@angular/core';\r\n\r\nimport { _SkraSelectBase } from '@skra/ui/core';\r\nimport {\r\n SKRA_LISTBOX_PANEL,\r\n type SkraListboxKeyboardItem,\r\n} from '@skra/ui/core';\r\n\r\n/**\r\n * SkraSelect — a custom single-select listbox: the WAI-ARIA APG **Select-Only Combobox** pattern. A\r\n * value-display **trigger** (`role=\"combobox\"`) opens a top-layer **listbox** panel (Popover API,\r\n * `popover=\"auto\"`, ADR 0044) of projected `skra-option` children. The thin single-select concrete\r\n * over `_SkraSelectBase` (ADR 0046 — cardinality split): it adds the honest `value: T` channel + the\r\n * replace-and-close selection model; everything else (overlay/keyboard/field substrate) lives in the\r\n * shared base, shared verbatim with `skra-multi-select`.\r\n *\r\n * - **Value (ADR 037):** `value` is a consumer-owned `input<T>()` + `valueChange` output — NO\r\n * `@angular/forms`, no CVA. Selection is signal-derived; equality is a strategy seam (`Object.is`\r\n * default + opt-in `compareWith`).\r\n * - **Trigger content (ADR 0045):** default = the selected option's `getLabel()` text (emoji/glyph\r\n * leading free); rich non-text triggers opt in via `<ng-template skraSelectTrigger>`.\r\n *\r\n * Full contract: adr/specs/component-select-spec.md.\r\n */\r\n@Component({\r\n selector: 'skra-select',\r\n standalone: true,\r\n exportAs: 'skraSelect',\r\n imports: [NgTemplateOutlet],\r\n template: `\r\n <button\r\n #trigger\r\n class=\"skra-select-trigger\"\r\n type=\"button\"\r\n role=\"combobox\"\r\n aria-haspopup=\"listbox\"\r\n [attr.id]=\"triggerId()\"\r\n [attr.popovertarget]=\"panelId\"\r\n [attr.aria-controls]=\"panelId\"\r\n [attr.aria-expanded]=\"isOpen()\"\r\n [attr.aria-activedescendant]=\"activeOptionId()\"\r\n [attr.aria-describedby]=\"describedBy()\"\r\n [attr.aria-invalid]=\"hasError() ? 'true' : null\"\r\n [attr.aria-required]=\"isRequired() ? 'true' : null\"\r\n [attr.aria-readonly]=\"isReadonly() ? 'true' : null\"\r\n [disabled]=\"isDisabled()\"\r\n (click)=\"onTriggerClick($event)\"\r\n (keydown)=\"onTriggerKeydown($event)\"\r\n >\r\n <span class=\"skra-select-trigger-value\">\r\n @if (triggerTemplate(); as tpl) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"tpl\"\r\n [ngTemplateOutletContext]=\"triggerContext()\"\r\n ></ng-container>\r\n } @else if (selectedOption(); as opt) {\r\n {{ opt.getLabel() }}\r\n } @else {\r\n <span class=\"skra-select-placeholder\">{{ placeholder() }}</span>\r\n }\r\n </span>\r\n <span class=\"skra-select-arrow\" aria-hidden=\"true\"></span>\r\n </button>\r\n\r\n <div\r\n #panel\r\n class=\"skra-select-listbox\"\r\n [id]=\"panelId\"\r\n role=\"listbox\"\r\n popover=\"auto\"\r\n (toggle)=\"onPanelToggle($event)\"\r\n >\r\n <ng-content></ng-content>\r\n </div>\r\n `,\r\n styleUrl: './select.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n providers: [{ provide: SKRA_LISTBOX_PANEL, useExisting: SkraSelect }],\r\n})\r\nexport class SkraSelect<T = unknown> extends _SkraSelectBase<T> {\r\n /** Consumer-owned value channel (ADR 037). */\r\n readonly value = input<T>();\r\n /** Fires ONLY on user selection — never on a programmatic `value()` change (ADR 037). */\r\n readonly valueChange = output<T>();\r\n /** Cardinality hint (ADR 0046) — single-select. */\r\n readonly multiple = false;\r\n\r\n /** The option whose value matches `value()` (ADR 037 selection model) — feeds the trigger. */\r\n protected readonly selectedOption = computed(\r\n () => this.options().find((o) => this.isSelected(o.value())) ?? null,\r\n );\r\n\r\n protected readonly triggerContext = computed(() => ({\r\n $implicit: this.value(),\r\n option: this.selectedOption(),\r\n }));\r\n\r\n // ── SkraListboxPanel seam ──\r\n isSelected(value: unknown): boolean {\r\n const current = this.value();\r\n return current !== undefined && this.compareWith()(current, value as T);\r\n }\r\n\r\n selectValue(value: unknown): void {\r\n this.valueChange.emit(value as T);\r\n this.close(); // single-select: pick + close\r\n }\r\n\r\n protected activeSeedItem(): SkraListboxKeyboardItem | null {\r\n return this.selectedOption();\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAgBA;;;;;;;;;;;;;;;AAeG;AAyDG,MAAO,UAAwB,SAAQ,eAAkB,CAAA;;AAEpD,IAAA,KAAK,GAAG,KAAK;yFAAK;;IAElB,WAAW,GAAG,MAAM,EAAK;;IAEzB,QAAQ,GAAG,KAAK;;AAGN,IAAA,cAAc,GAAG,QAAQ,CAC1C,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,IAAI;uFACrE;AAEkB,IAAA,cAAc,GAAG,QAAQ,CAAC,OAAO;AAClD,QAAA,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE;AACvB,QAAA,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE;KAC9B,CAAC;uFAAC;;AAGH,IAAA,UAAU,CAAC,KAAc,EAAA;AACvB,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,EAAE;AAC5B,QAAA,OAAO,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,KAAU,CAAC;IACzE;AAEA,IAAA,WAAW,CAAC,KAAc,EAAA;AACxB,QAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAU,CAAC;AACjC,QAAA,IAAI,CAAC,KAAK,EAAE,CAAC;IACf;IAEU,cAAc,GAAA;AACtB,QAAA,OAAO,IAAI,CAAC,cAAc,EAAE;IAC9B;uGA/BW,UAAU,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAV,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAU,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,WAAA,EAAA,aAAA,EAAA,EAAA,SAAA,EAFV,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,YAAA,CAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAjD3D,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,g/HAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EA9CS,gBAAgB,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,yBAAA,EAAA,kBAAA,EAAA,0BAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAoDf,UAAU,EAAA,UAAA,EAAA,CAAA;kBAxDtB,SAAS;+BACE,aAAa,EAAA,UAAA,EACX,IAAI,EAAA,QAAA,EACN,YAAY,WACb,CAAC,gBAAgB,CAAC,EAAA,QAAA,EACjB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CT,EAAA,CAAA,EAAA,eAAA,EAEgB,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,QAAQ,EAAA,SAAA,EAC9B,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAA,UAAY,EAAE,CAAC,EAAA,MAAA,EAAA,CAAA,g/HAAA,CAAA,EAAA;;;ACtFvE;;AAEG;;;;"}
|
|
@@ -28,27 +28,30 @@ import { input, computed, ViewEncapsulation, ChangeDetectionStrategy, Component
|
|
|
28
28
|
*/
|
|
29
29
|
class SkraSkeleton {
|
|
30
30
|
/** The kind of content faked — selects placeholder geometry, never colour/theme (not a look-input). */
|
|
31
|
-
shape = input('text',
|
|
31
|
+
shape = input('text', /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []));
|
|
32
33
|
/** `text` only — number of line bars (multi-line paragraph). Ignored for `block`/`circle`. */
|
|
33
|
-
lines = input(1,
|
|
34
|
+
lines = input(1, /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "lines" }] : /* istanbul ignore next */ []));
|
|
34
36
|
/** The bars to render: `lines` bars for text (≥1), a single bar for block/circle. */
|
|
35
37
|
bars = computed(() => {
|
|
36
38
|
const count = this.shape() === 'text' ? Math.max(1, Math.floor(this.lines())) : 1;
|
|
37
39
|
return Array.from({ length: count }, (_, i) => i);
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
static
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
}, /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "bars" }] : /* istanbul ignore next */ []));
|
|
42
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraSkeleton, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
43
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: SkraSkeleton, isStandalone: true, selector: "skra-skeleton", inputs: { shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, lines: { classPropertyName: "lines", publicName: "lines", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" }, properties: { "attr.data-skra-shape": "shape()" } }, ngImport: i0, template: `
|
|
44
|
+
@for (bar of bars(); track bar) {
|
|
45
|
+
<span class="skra-skeleton__bar"></span>
|
|
46
|
+
}
|
|
44
47
|
`, isInline: true, styles: [":host{display:block;inline-size:100%;margin:0}:host([data-skra-shape=text]){display:flex;flex-direction:column;gap:.5em}:host([data-skra-shape=block]),:host([data-skra-shape=circle]){block-size:100%}.skra-skeleton__bar{display:block;background-color:var(--skra-comp-skeleton-background);border-width:var(--skra-comp-skeleton-border-width);border-style:var(--skra-comp-skeleton-border-style);border-color:var(--skra-comp-skeleton-border-color);border-radius:var(--skra-comp-skeleton-radius);animation:skra-skeleton-pulse 1.4s var(--skra-comp-skeleton-motion-easing) infinite}:host([data-skra-shape=text]) .skra-skeleton__bar{block-size:.7em;inline-size:100%}:host([data-skra-shape=text]) .skra-skeleton__bar:last-child:not(:only-child){inline-size:60%}:host([data-skra-shape=block]) .skra-skeleton__bar,:host([data-skra-shape=circle]) .skra-skeleton__bar{block-size:100%;inline-size:100%}:host([data-skra-shape=circle]) .skra-skeleton__bar{border-radius:50%}@keyframes skra-skeleton-pulse{0%,to{opacity:1}50%{opacity:.7}}@media(prefers-reduced-motion:reduce){.skra-skeleton__bar{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
45
48
|
}
|
|
46
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
49
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraSkeleton, decorators: [{
|
|
47
50
|
type: Component,
|
|
48
|
-
args: [{ selector: 'skra-skeleton', standalone: true, template: `
|
|
49
|
-
@for (bar of bars(); track bar) {
|
|
50
|
-
<span class="skra-skeleton__bar"></span>
|
|
51
|
-
}
|
|
51
|
+
args: [{ selector: 'skra-skeleton', standalone: true, template: `
|
|
52
|
+
@for (bar of bars(); track bar) {
|
|
53
|
+
<span class="skra-skeleton__bar"></span>
|
|
54
|
+
}
|
|
52
55
|
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
|
|
53
56
|
// Decorative — kept out of the accessibility tree (ADR 033 decorative exemption).
|
|
54
57
|
'aria-hidden': 'true',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skra-ui-skeleton.mjs","sources":["../../../../libs/ui/skeleton/src/lib/skeleton/skeleton.ts","../../../../libs/ui/skeleton/src/skra-ui-skeleton.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n computed,\n input,\n} from '@angular/core';\n\nexport type SkraSkeletonShape = 'text' | 'block' | 'circle';\n\n/**\n * `<skra-skeleton>` — a decorative content placeholder (Wave 2, `libs/ui/indicators`).\n * Occupies the place of not-yet-loaded content with an animated, layout-shaped placeholder so\n * the layout does not shift on load (CLS) and the user perceives that content is coming.\n *\n * Third resident of the loading family, with a distinct SRP: `[skraLoadingIndicator]` (ADR 028)\n * is the *indeterminate* \"host is busy\" spinner; `SkraProgress` is the *determinate* \"task is\n * N% complete\" bar; **SkraSkeleton is the *content placeholder*** (\"the content hasn't arrived —\n * here is its shape\"). See `adr/specs/component-skeleton-spec.md` § SRP boundary.\n *\n * **A custom element, NOT a Component-on-native-host** (ADR 040): a skeleton has no semantic\n * native equivalent and is purely presentational, so it follows the custom-element atom model\n * (Badge/Chip/Alert precedent). The host is a layout container that renders its own inner\n * `.skra-skeleton__bar` element(s) — which is why a void-host directive was rejected: the\n * multi-line `text` shape needs internal structure.\n *\n * **Decorative a11y (ADR 033):** the host is `aria-hidden=\"true\"` — a skeleton conveys no\n * information to assistive tech (the decorative-icon exemption). The \"loading\" announcement\n * belongs to the consumer's content **container** (`aria-busy=\"true\"`), never to the skeleton.\n *\n * **Sizing is container/`em`-driven (ADR 021 — the CSP reason there are no `width`/`height`\n * inputs):** `text` line bars are `em`-relative (they inherit the surrounding font-size) at full\n * container width; `block`/`circle` fill a host the **consumer** sizes (e.g. via `[skraBox]`).\n * The host therefore never carries an inline `style`. State Surface all-N/A (non-interactive).\n */\n@Component({\n selector: 'skra-skeleton',\n standalone: true,\n template: `\n @for (bar of bars(); track bar) {\n <span class=\"skra-skeleton__bar\"></span>\n }\n `,\n styleUrl: './skeleton.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n // Decorative — kept out of the accessibility tree (ADR 033 decorative exemption).\n 'aria-hidden': 'true',\n // Structural variant for CSP-safe SCSS branching (a variant, not an ADR 027 state).\n '[attr.data-skra-shape]': 'shape()',\n },\n})\nexport class SkraSkeleton {\n /** The kind of content faked — selects placeholder geometry, never colour/theme (not a look-input). */\n readonly shape = input<SkraSkeletonShape>('text');\n\n /** `text` only — number of line bars (multi-line paragraph). Ignored for `block`/`circle`. */\n readonly lines = input<number>(1);\n\n /** The bars to render: `lines` bars for text (≥1), a single bar for block/circle. */\n protected readonly bars = computed(() => {\n const count =\n this.shape() === 'text' ? Math.max(1, Math.floor(this.lines())) : 1;\n return Array.from({ length: count }, (_, i) => i);\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAUA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;MAmBU,YAAY,CAAA;;
|
|
1
|
+
{"version":3,"file":"skra-ui-skeleton.mjs","sources":["../../../../libs/ui/skeleton/src/lib/skeleton/skeleton.ts","../../../../libs/ui/skeleton/src/skra-ui-skeleton.ts"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ViewEncapsulation,\r\n computed,\r\n input,\r\n} from '@angular/core';\r\n\r\nexport type SkraSkeletonShape = 'text' | 'block' | 'circle';\r\n\r\n/**\r\n * `<skra-skeleton>` — a decorative content placeholder (Wave 2, `libs/ui/indicators`).\r\n * Occupies the place of not-yet-loaded content with an animated, layout-shaped placeholder so\r\n * the layout does not shift on load (CLS) and the user perceives that content is coming.\r\n *\r\n * Third resident of the loading family, with a distinct SRP: `[skraLoadingIndicator]` (ADR 028)\r\n * is the *indeterminate* \"host is busy\" spinner; `SkraProgress` is the *determinate* \"task is\r\n * N% complete\" bar; **SkraSkeleton is the *content placeholder*** (\"the content hasn't arrived —\r\n * here is its shape\"). See `adr/specs/component-skeleton-spec.md` § SRP boundary.\r\n *\r\n * **A custom element, NOT a Component-on-native-host** (ADR 040): a skeleton has no semantic\r\n * native equivalent and is purely presentational, so it follows the custom-element atom model\r\n * (Badge/Chip/Alert precedent). The host is a layout container that renders its own inner\r\n * `.skra-skeleton__bar` element(s) — which is why a void-host directive was rejected: the\r\n * multi-line `text` shape needs internal structure.\r\n *\r\n * **Decorative a11y (ADR 033):** the host is `aria-hidden=\"true\"` — a skeleton conveys no\r\n * information to assistive tech (the decorative-icon exemption). The \"loading\" announcement\r\n * belongs to the consumer's content **container** (`aria-busy=\"true\"`), never to the skeleton.\r\n *\r\n * **Sizing is container/`em`-driven (ADR 021 — the CSP reason there are no `width`/`height`\r\n * inputs):** `text` line bars are `em`-relative (they inherit the surrounding font-size) at full\r\n * container width; `block`/`circle` fill a host the **consumer** sizes (e.g. via `[skraBox]`).\r\n * The host therefore never carries an inline `style`. State Surface all-N/A (non-interactive).\r\n */\r\n@Component({\r\n selector: 'skra-skeleton',\r\n standalone: true,\r\n template: `\r\n @for (bar of bars(); track bar) {\r\n <span class=\"skra-skeleton__bar\"></span>\r\n }\r\n `,\r\n styleUrl: './skeleton.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n host: {\r\n // Decorative — kept out of the accessibility tree (ADR 033 decorative exemption).\r\n 'aria-hidden': 'true',\r\n // Structural variant for CSP-safe SCSS branching (a variant, not an ADR 027 state).\r\n '[attr.data-skra-shape]': 'shape()',\r\n },\r\n})\r\nexport class SkraSkeleton {\r\n /** The kind of content faked — selects placeholder geometry, never colour/theme (not a look-input). */\r\n readonly shape = input<SkraSkeletonShape>('text');\r\n\r\n /** `text` only — number of line bars (multi-line paragraph). Ignored for `block`/`circle`. */\r\n readonly lines = input<number>(1);\r\n\r\n /** The bars to render: `lines` bars for text (≥1), a single bar for block/circle. */\r\n protected readonly bars = computed(() => {\r\n const count =\r\n this.shape() === 'text' ? Math.max(1, Math.floor(this.lines())) : 1;\r\n return Array.from({ length: count }, (_, i) => i);\r\n });\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAUA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;MAmBU,YAAY,CAAA;;IAEd,KAAK,GAAG,KAAK,CAAoB,MAAM;8EAAC;;IAGxC,KAAK,GAAG,KAAK,CAAS,CAAC;8EAAC;;AAGd,IAAA,IAAI,GAAG,QAAQ,CAAC,MAAK;AACtC,QAAA,MAAM,KAAK,GACT,IAAI,CAAC,KAAK,EAAE,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC;AACrE,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;6EAAC;uGAZS,YAAY,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAZ,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAY,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,eAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,aAAA,EAAA,MAAA,EAAA,EAAA,UAAA,EAAA,EAAA,sBAAA,EAAA,SAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAfb,CAAA;;;;AAIT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,0kCAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAWU,YAAY,EAAA,UAAA,EAAA,CAAA;kBAlBxB,SAAS;+BACE,eAAe,EAAA,UAAA,EACb,IAAI,EAAA,QAAA,EACN,CAAA;;;;AAIT,EAAA,CAAA,EAAA,eAAA,EAEgB,uBAAuB,CAAC,MAAM,iBAChC,iBAAiB,CAAC,QAAQ,EAAA,IAAA,EACnC;;AAEJ,wBAAA,aAAa,EAAE,MAAM;;AAErB,wBAAA,wBAAwB,EAAE,SAAS;AACpC,qBAAA,EAAA,MAAA,EAAA,CAAA,0kCAAA,CAAA,EAAA;;;ACnDH;;AAEG;;;;"}
|
|
@@ -40,18 +40,24 @@ class SkraStarRating {
|
|
|
40
40
|
idGen = inject(IdGeneratorService);
|
|
41
41
|
context = inject(SkraFieldContext, { optional: true });
|
|
42
42
|
/** Committed rating; 0 (or out of [1,max]) = unrated. Consumer-owned, controlled (ADR 037). */
|
|
43
|
-
value = input(0,
|
|
43
|
+
value = input(0, /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
44
45
|
/** Number of stars. Semantic count, not a look-input. */
|
|
45
|
-
max = input(5,
|
|
46
|
+
max = input(5, /* @ts-ignore */
|
|
47
|
+
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
46
48
|
/** ADR 035 size axis — the only variant axis. */
|
|
47
|
-
size = input('md',
|
|
49
|
+
size = input('md', /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
48
51
|
/** Fires on USER selection only (never on programmatic [value] changes). */
|
|
49
52
|
valueChange = output();
|
|
50
53
|
fallbackName = this.idGen.nextId('rating');
|
|
51
54
|
/** Unique radio-group name so multiple ratings on a page don't merge. */
|
|
52
|
-
groupName = computed(() => this.context?.fieldId() || this.fallbackName,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
groupName = computed(() => this.context?.fieldId() || this.fallbackName, /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "groupName" }] : /* istanbul ignore next */ []));
|
|
57
|
+
isDisabled = computed(() => this.context?.isDisabled() ?? false, /* @ts-ignore */
|
|
58
|
+
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
59
|
+
isReadonly = computed(() => this.context?.isReadonly() ?? false, /* @ts-ignore */
|
|
60
|
+
...(ngDevMode ? [{ debugName: "isReadonly" }] : /* istanbul ignore next */ []));
|
|
55
61
|
/**
|
|
56
62
|
* Star values HIGH→LOW (`[max, …, 1]`) so the CSS sibling combinator
|
|
57
63
|
* `input:checked ~ label` fills the checked star and every lower one. The visual
|
|
@@ -60,7 +66,8 @@ class SkraStarRating {
|
|
|
60
66
|
stars = computed(() => {
|
|
61
67
|
const n = Math.max(0, Math.floor(this.max()));
|
|
62
68
|
return Array.from({ length: n }, (_, i) => n - i);
|
|
63
|
-
},
|
|
69
|
+
}, /* @ts-ignore */
|
|
70
|
+
...(ngDevMode ? [{ debugName: "stars" }] : /* istanbul ignore next */ []));
|
|
64
71
|
starLabel(star) {
|
|
65
72
|
return star === 1 ? '1 star' : `${star} stars`;
|
|
66
73
|
}
|
|
@@ -77,10 +84,10 @@ class SkraStarRating {
|
|
|
77
84
|
if (this.isReadonly() && event.key !== 'Tab')
|
|
78
85
|
event.preventDefault();
|
|
79
86
|
}
|
|
80
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
81
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
87
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraStarRating, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
88
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: SkraStarRating, isStandalone: true, selector: "skra-star-rating", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { attributes: { "role": "radiogroup" }, listeners: { "click": "blockWhenReadonly($event)", "keydown": "blockKeyWhenReadonly($event)" }, properties: { "attr.aria-labelledby": "context?.labelId() ?? null", "attr.aria-required": "context?.isRequired() ? \"true\" : null", "attr.aria-invalid": "context?.hasError() ? \"true\" : null", "attr.aria-readonly": "context?.isReadonly() ? \"true\" : null", "attr.aria-describedby": "context?.describedByIds() ?? null", "attr.data-skra-disabled": "isDisabled() ? \"\" : null", "attr.data-skra-size": "size()", "attr.id": "context?.fieldId() ?? null" } }, ngImport: i0, template: "@for (star of stars(); track star) {\r\n<input\r\n type=\"radio\"\r\n class=\"skra-star-rating-input\"\r\n [name]=\"groupName()\"\r\n [id]=\"groupName() + '-' + star\"\r\n [value]=\"star\"\r\n [checked]=\"value() === star\"\r\n [disabled]=\"isDisabled()\"\r\n [attr.aria-label]=\"starLabel(star)\"\r\n (change)=\"onSelect(star)\"\r\n/>\r\n<label\r\n class=\"skra-star-rating-star\"\r\n [attr.for]=\"groupName() + '-' + star\"\r\n aria-hidden=\"true\"\r\n>\r\n <svg\r\n class=\"skra-star-rating-glyph\"\r\n viewBox=\"0 0 24 24\"\r\n focusable=\"false\"\r\n aria-hidden=\"true\"\r\n >\r\n <path\r\n d=\"M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z\"\r\n />\r\n </svg>\r\n</label>\r\n}\r\n", styles: [":host{margin:0;display:inline-flex;flex-direction:row-reverse;align-items:center;gap:var(--skra-comp-star-rating-gap);--_star-size: var(--skra-comp-star-rating-star-size-md)}:host([data-skra-size=sm]){--_star-size: var(--skra-comp-star-rating-star-size-sm)}:host([data-skra-size=md]){--_star-size: var(--skra-comp-star-rating-star-size-md)}:host([data-skra-size=lg]){--_star-size: var(--skra-comp-star-rating-star-size-lg)}:host([data-skra-disabled]){opacity:var(--skra-sys-opacity-disabled);cursor:not-allowed}.skra-star-rating-input{position:absolute;inline-size:1px;block-size:1px;margin:0;padding:0;opacity:0;pointer-events:none}.skra-star-rating-star{--_fill: var(--skra-comp-star-rating-star-color-empty);display:inline-flex;cursor:pointer;line-height:0;border-radius:.125rem}.skra-star-rating-glyph{inline-size:var(--_star-size);block-size:var(--_star-size);fill:var(--_fill);transition:fill var(--skra-comp-star-rating-motion-duration) var(--skra-comp-star-rating-motion-easing)}.skra-star-rating-input:checked~.skra-star-rating-star{--_fill: var(--skra-comp-star-rating-star-color-filled)}:host(:hover:not([aria-readonly=true]):not([data-skra-disabled])) .skra-star-rating-star{--_fill: var(--skra-comp-star-rating-star-color-empty)}:host(:hover:not([aria-readonly=true]):not([data-skra-disabled])) .skra-star-rating-star:hover,:host(:hover:not([aria-readonly=true]):not([data-skra-disabled])) .skra-star-rating-star:hover~.skra-star-rating-star{--_fill: var(--skra-comp-star-rating-star-color-filled)}:host([aria-readonly=true]) .skra-star-rating-star{cursor:default}.skra-star-rating-input:focus-visible+.skra-star-rating-star{outline:var(--skra-comp-star-rating-focus-ring-width) solid var(--skra-comp-star-rating-focus-ring-color);outline-offset:.125rem}@media(prefers-reduced-motion:reduce){.skra-star-rating-glyph{transition:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
82
89
|
}
|
|
83
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
90
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraStarRating, decorators: [{
|
|
84
91
|
type: Component,
|
|
85
92
|
args: [{ selector: 'skra-star-rating', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
|
|
86
93
|
role: 'radiogroup',
|
|
@@ -97,7 +104,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImpor
|
|
|
97
104
|
// Blocks the toggle from pointer (click) and keyboard (arrows fire change directly).
|
|
98
105
|
'(click)': 'blockWhenReadonly($event)',
|
|
99
106
|
'(keydown)': 'blockKeyWhenReadonly($event)',
|
|
100
|
-
}, template: "@for (star of stars(); track star) {\n<input\n type=\"radio\"\n class=\"skra-star-rating-input\"\n [name]=\"groupName()\"\n [id]=\"groupName() + '-' + star\"\n [value]=\"star\"\n [checked]=\"value() === star\"\n [disabled]=\"isDisabled()\"\n [attr.aria-label]=\"starLabel(star)\"\n (change)=\"onSelect(star)\"\n/>\n<label\n class=\"skra-star-rating-star\"\n [attr.for]=\"groupName() + '-' + star\"\n aria-hidden=\"true\"\n>\n <svg\n class=\"skra-star-rating-glyph\"\n viewBox=\"0 0 24 24\"\n focusable=\"false\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z\"\n />\n </svg>\n</label>\n}\n", styles: [":host{margin:0;display:inline-flex;flex-direction:row-reverse;align-items:center;gap:var(--skra-comp-star-rating-gap);--_star-size: var(--skra-comp-star-rating-star-size-md)}:host([data-skra-size=sm]){--_star-size: var(--skra-comp-star-rating-star-size-sm)}:host([data-skra-size=md]){--_star-size: var(--skra-comp-star-rating-star-size-md)}:host([data-skra-size=lg]){--_star-size: var(--skra-comp-star-rating-star-size-lg)}:host([data-skra-disabled]){opacity:var(--skra-sys-opacity-disabled);cursor:not-allowed}.skra-star-rating-input{position:absolute;inline-size:1px;block-size:1px;margin:0;padding:0;opacity:0;pointer-events:none}.skra-star-rating-star{--_fill: var(--skra-comp-star-rating-star-color-empty);display:inline-flex;cursor:pointer;line-height:0;border-radius:.125rem}.skra-star-rating-glyph{inline-size:var(--_star-size);block-size:var(--_star-size);fill:var(--_fill);transition:fill var(--skra-comp-star-rating-motion-duration) var(--skra-comp-star-rating-motion-easing)}.skra-star-rating-input:checked~.skra-star-rating-star{--_fill: var(--skra-comp-star-rating-star-color-filled)}:host(:hover:not([aria-readonly=true]):not([data-skra-disabled])) .skra-star-rating-star{--_fill: var(--skra-comp-star-rating-star-color-empty)}:host(:hover:not([aria-readonly=true]):not([data-skra-disabled])) .skra-star-rating-star:hover,:host(:hover:not([aria-readonly=true]):not([data-skra-disabled])) .skra-star-rating-star:hover~.skra-star-rating-star{--_fill: var(--skra-comp-star-rating-star-color-filled)}:host([aria-readonly=true]) .skra-star-rating-star{cursor:default}.skra-star-rating-input:focus-visible+.skra-star-rating-star{outline:var(--skra-comp-star-rating-focus-ring-width) solid var(--skra-comp-star-rating-focus-ring-color);outline-offset:.125rem}@media(prefers-reduced-motion:reduce){.skra-star-rating-glyph{transition:none}}\n"] }]
|
|
107
|
+
}, template: "@for (star of stars(); track star) {\r\n<input\r\n type=\"radio\"\r\n class=\"skra-star-rating-input\"\r\n [name]=\"groupName()\"\r\n [id]=\"groupName() + '-' + star\"\r\n [value]=\"star\"\r\n [checked]=\"value() === star\"\r\n [disabled]=\"isDisabled()\"\r\n [attr.aria-label]=\"starLabel(star)\"\r\n (change)=\"onSelect(star)\"\r\n/>\r\n<label\r\n class=\"skra-star-rating-star\"\r\n [attr.for]=\"groupName() + '-' + star\"\r\n aria-hidden=\"true\"\r\n>\r\n <svg\r\n class=\"skra-star-rating-glyph\"\r\n viewBox=\"0 0 24 24\"\r\n focusable=\"false\"\r\n aria-hidden=\"true\"\r\n >\r\n <path\r\n d=\"M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z\"\r\n />\r\n </svg>\r\n</label>\r\n}\r\n", styles: [":host{margin:0;display:inline-flex;flex-direction:row-reverse;align-items:center;gap:var(--skra-comp-star-rating-gap);--_star-size: var(--skra-comp-star-rating-star-size-md)}:host([data-skra-size=sm]){--_star-size: var(--skra-comp-star-rating-star-size-sm)}:host([data-skra-size=md]){--_star-size: var(--skra-comp-star-rating-star-size-md)}:host([data-skra-size=lg]){--_star-size: var(--skra-comp-star-rating-star-size-lg)}:host([data-skra-disabled]){opacity:var(--skra-sys-opacity-disabled);cursor:not-allowed}.skra-star-rating-input{position:absolute;inline-size:1px;block-size:1px;margin:0;padding:0;opacity:0;pointer-events:none}.skra-star-rating-star{--_fill: var(--skra-comp-star-rating-star-color-empty);display:inline-flex;cursor:pointer;line-height:0;border-radius:.125rem}.skra-star-rating-glyph{inline-size:var(--_star-size);block-size:var(--_star-size);fill:var(--_fill);transition:fill var(--skra-comp-star-rating-motion-duration) var(--skra-comp-star-rating-motion-easing)}.skra-star-rating-input:checked~.skra-star-rating-star{--_fill: var(--skra-comp-star-rating-star-color-filled)}:host(:hover:not([aria-readonly=true]):not([data-skra-disabled])) .skra-star-rating-star{--_fill: var(--skra-comp-star-rating-star-color-empty)}:host(:hover:not([aria-readonly=true]):not([data-skra-disabled])) .skra-star-rating-star:hover,:host(:hover:not([aria-readonly=true]):not([data-skra-disabled])) .skra-star-rating-star:hover~.skra-star-rating-star{--_fill: var(--skra-comp-star-rating-star-color-filled)}:host([aria-readonly=true]) .skra-star-rating-star{cursor:default}.skra-star-rating-input:focus-visible+.skra-star-rating-star{outline:var(--skra-comp-star-rating-focus-ring-width) solid var(--skra-comp-star-rating-focus-ring-color);outline-offset:.125rem}@media(prefers-reduced-motion:reduce){.skra-star-rating-glyph{transition:none}}\n"] }]
|
|
101
108
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }] } });
|
|
102
109
|
|
|
103
110
|
// APG-radiogroup composite rendered as stars (ADR 039 §7).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skra-ui-star-rating.mjs","sources":["../../../../libs/ui/star-rating/src/lib/star-rating/star-rating.ts","../../../../libs/ui/star-rating/src/lib/star-rating/star-rating.html","../../../../libs/ui/star-rating/src/index.ts","../../../../libs/ui/star-rating/src/skra-ui-star-rating.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n computed,\n inject,\n input,\n output,\n} from '@angular/core';\nimport { SkraFieldContext } from '@skra/ui/field';\nimport { IdGeneratorService } from '@skra/ui/field';\n\nexport type StarRatingSize = 'sm' | 'md' | 'lg';\n\n/**\n * `<skra-star-rating>` — a whole-star rating **input**. An APG Rating composite\n * (`role=\"radiogroup\"`) rendered as stars: internally N `(input[type=radio] + label)`\n * pairs sharing one `name`, where the label IS the star glyph (inline SVG) and the\n * input is sr-only but focusable.\n *\n * Governed by the **ADR 039 §7 note (2026-06-24)**: a composite widget MAY render\n * internal native radios — this is NOT the §3.3-forbidden `<skra-radio-group>` —\n * because (1) value is consumer-owned (`[value]` / `(valueChange)`, controlled-only\n * per ADR 037, the Tabs `[selected]` precedent — no internal value-of-record signal),\n * (2) there is no `SkraRadioGroupContext`, (3) it is a distinct APG composite (like\n * `skra-select`), not a generic radio-group wrapper. Custom element justified per\n * ADR 012 — there is no native single host for a rating.\n *\n * <skra-field [hasError]=\"!form.rating()\">\n * <label skraLabelFor>Rate your experience</label>\n * <skra-star-rating [value]=\"form.rating()\" (valueChange)=\"form.rating.set($event)\" />\n * <skra-error>Please pick a rating</skra-error>\n * </skra-field>\n *\n * Keyboard is the **native radio group** (arrows move + select, wrap, single tab stop)\n * — ZERO CDK. The fill + hover-preview are **pure CSS** (`:checked`/`:hover` sibling\n * combinators) — CSP-clean (ADR 021), no `[style.--var]`, no TS for the preview. The\n * committed `aria-checked` is the only thing AT observes; hover-preview is visual-only.\n *\n * Optional `SkraFieldContext` (ADR 013): the radiogroup is named via `aria-labelledby`\n * → the field label (`SkraFieldContext.labelId`, since a radiogroup is not labelable by\n * `for`/`id`); `disabled`/`required`/`readonly`/`invalid`/`describedby` cascade. Value is\n * NEVER in the context (ADR 037). The `readonly` state shows a committed whole-star rating\n * without allowing change (\"show my 4★\").\n *\n * Whole-star only (half-step input deferred). Fractional aggregate display (\"4.3★\") is the\n * separate `skra-rating-display` atom (`libs/ui/data-display`).\n */\n@Component({\n selector: 'skra-star-rating',\n standalone: true,\n templateUrl: './star-rating.html',\n styleUrl: './star-rating.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n role: 'radiogroup',\n // Named by the field label (Path 1) — radiogroups are not labelable by for/id.\n '[attr.aria-labelledby]': 'context?.labelId() ?? null',\n '[attr.aria-required]': 'context?.isRequired() ? \"true\" : null',\n '[attr.aria-invalid]': 'context?.hasError() ? \"true\" : null',\n '[attr.aria-readonly]': 'context?.isReadonly() ? \"true\" : null',\n '[attr.aria-describedby]': 'context?.describedByIds() ?? null',\n '[attr.data-skra-disabled]': 'isDisabled() ? \"\" : null',\n '[attr.data-skra-size]': 'size()',\n '[attr.id]': 'context?.fieldId() ?? null',\n // Readonly enforcement — without it the announced aria-readonly would be a lie.\n // Blocks the toggle from pointer (click) and keyboard (arrows fire change directly).\n '(click)': 'blockWhenReadonly($event)',\n '(keydown)': 'blockKeyWhenReadonly($event)',\n },\n})\nexport class SkraStarRating {\n private readonly idGen = inject(IdGeneratorService);\n readonly context = inject(SkraFieldContext, { optional: true });\n\n /** Committed rating; 0 (or out of [1,max]) = unrated. Consumer-owned, controlled (ADR 037). */\n readonly value = input<number>(0);\n /** Number of stars. Semantic count, not a look-input. */\n readonly max = input<number>(5);\n /** ADR 035 size axis — the only variant axis. */\n readonly size = input<StarRatingSize>('md');\n /** Fires on USER selection only (never on programmatic [value] changes). */\n readonly valueChange = output<number>();\n\n private readonly fallbackName = this.idGen.nextId('rating');\n /** Unique radio-group name so multiple ratings on a page don't merge. */\n readonly groupName = computed(\n () => this.context?.fieldId() || this.fallbackName,\n );\n\n readonly isDisabled = computed(() => this.context?.isDisabled() ?? false);\n readonly isReadonly = computed(() => this.context?.isReadonly() ?? false);\n\n /**\n * Star values HIGH→LOW (`[max, …, 1]`) so the CSS sibling combinator\n * `input:checked ~ label` fills the checked star and every lower one. The visual\n * order is restored left-to-right via `flex-direction: row-reverse` in the SCSS.\n */\n readonly stars = computed(() => {\n const n = Math.max(0, Math.floor(this.max()));\n return Array.from({ length: n }, (_, i) => n - i);\n });\n\n protected starLabel(star: number): string {\n return star === 1 ? '1 star' : `${star} stars`;\n }\n\n protected onSelect(star: number): void {\n // Reached only when not readonly (click/keydown are blocked below when readonly),\n // and never on programmatic [value] changes — so this is user-intent only.\n this.valueChange.emit(star);\n }\n\n protected blockWhenReadonly(event: Event): void {\n if (this.isReadonly()) event.preventDefault();\n }\n\n protected blockKeyWhenReadonly(event: KeyboardEvent): void {\n if (this.isReadonly() && event.key !== 'Tab') event.preventDefault();\n }\n}\n","@for (star of stars(); track star) {\n<input\n type=\"radio\"\n class=\"skra-star-rating-input\"\n [name]=\"groupName()\"\n [id]=\"groupName() + '-' + star\"\n [value]=\"star\"\n [checked]=\"value() === star\"\n [disabled]=\"isDisabled()\"\n [attr.aria-label]=\"starLabel(star)\"\n (change)=\"onSelect(star)\"\n/>\n<label\n class=\"skra-star-rating-star\"\n [attr.for]=\"groupName() + '-' + star\"\n aria-hidden=\"true\"\n>\n <svg\n class=\"skra-star-rating-glyph\"\n viewBox=\"0 0 24 24\"\n focusable=\"false\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z\"\n />\n </svg>\n</label>\n}\n","// APG-radiogroup composite rendered as stars (ADR 039 §7).\r\nexport * from './lib/star-rating/star-rating';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;MAyBU,cAAc,CAAA;AACR,IAAA,KAAK,GAAG,MAAM,CAAC,kBAAkB,CAAC;IAC1C,OAAO,GAAG,MAAM,CAAC,gBAAgB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;
|
|
1
|
+
{"version":3,"file":"skra-ui-star-rating.mjs","sources":["../../../../libs/ui/star-rating/src/lib/star-rating/star-rating.ts","../../../../libs/ui/star-rating/src/lib/star-rating/star-rating.html","../../../../libs/ui/star-rating/src/index.ts","../../../../libs/ui/star-rating/src/skra-ui-star-rating.ts"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ViewEncapsulation,\r\n computed,\r\n inject,\r\n input,\r\n output,\r\n} from '@angular/core';\r\nimport { SkraFieldContext } from '@skra/ui/field';\r\nimport { IdGeneratorService } from '@skra/ui/field';\r\n\r\nexport type StarRatingSize = 'sm' | 'md' | 'lg';\r\n\r\n/**\r\n * `<skra-star-rating>` — a whole-star rating **input**. An APG Rating composite\r\n * (`role=\"radiogroup\"`) rendered as stars: internally N `(input[type=radio] + label)`\r\n * pairs sharing one `name`, where the label IS the star glyph (inline SVG) and the\r\n * input is sr-only but focusable.\r\n *\r\n * Governed by the **ADR 039 §7 note (2026-06-24)**: a composite widget MAY render\r\n * internal native radios — this is NOT the §3.3-forbidden `<skra-radio-group>` —\r\n * because (1) value is consumer-owned (`[value]` / `(valueChange)`, controlled-only\r\n * per ADR 037, the Tabs `[selected]` precedent — no internal value-of-record signal),\r\n * (2) there is no `SkraRadioGroupContext`, (3) it is a distinct APG composite (like\r\n * `skra-select`), not a generic radio-group wrapper. Custom element justified per\r\n * ADR 012 — there is no native single host for a rating.\r\n *\r\n * <skra-field [hasError]=\"!form.rating()\">\r\n * <label skraLabelFor>Rate your experience</label>\r\n * <skra-star-rating [value]=\"form.rating()\" (valueChange)=\"form.rating.set($event)\" />\r\n * <skra-error>Please pick a rating</skra-error>\r\n * </skra-field>\r\n *\r\n * Keyboard is the **native radio group** (arrows move + select, wrap, single tab stop)\r\n * — ZERO CDK. The fill + hover-preview are **pure CSS** (`:checked`/`:hover` sibling\r\n * combinators) — CSP-clean (ADR 021), no `[style.--var]`, no TS for the preview. The\r\n * committed `aria-checked` is the only thing AT observes; hover-preview is visual-only.\r\n *\r\n * Optional `SkraFieldContext` (ADR 013): the radiogroup is named via `aria-labelledby`\r\n * → the field label (`SkraFieldContext.labelId`, since a radiogroup is not labelable by\r\n * `for`/`id`); `disabled`/`required`/`readonly`/`invalid`/`describedby` cascade. Value is\r\n * NEVER in the context (ADR 037). The `readonly` state shows a committed whole-star rating\r\n * without allowing change (\"show my 4★\").\r\n *\r\n * Whole-star only (half-step input deferred). Fractional aggregate display (\"4.3★\") is the\r\n * separate `skra-rating-display` atom (`libs/ui/data-display`).\r\n */\r\n@Component({\r\n selector: 'skra-star-rating',\r\n standalone: true,\r\n templateUrl: './star-rating.html',\r\n styleUrl: './star-rating.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n host: {\r\n role: 'radiogroup',\r\n // Named by the field label (Path 1) — radiogroups are not labelable by for/id.\r\n '[attr.aria-labelledby]': 'context?.labelId() ?? null',\r\n '[attr.aria-required]': 'context?.isRequired() ? \"true\" : null',\r\n '[attr.aria-invalid]': 'context?.hasError() ? \"true\" : null',\r\n '[attr.aria-readonly]': 'context?.isReadonly() ? \"true\" : null',\r\n '[attr.aria-describedby]': 'context?.describedByIds() ?? null',\r\n '[attr.data-skra-disabled]': 'isDisabled() ? \"\" : null',\r\n '[attr.data-skra-size]': 'size()',\r\n '[attr.id]': 'context?.fieldId() ?? null',\r\n // Readonly enforcement — without it the announced aria-readonly would be a lie.\r\n // Blocks the toggle from pointer (click) and keyboard (arrows fire change directly).\r\n '(click)': 'blockWhenReadonly($event)',\r\n '(keydown)': 'blockKeyWhenReadonly($event)',\r\n },\r\n})\r\nexport class SkraStarRating {\r\n private readonly idGen = inject(IdGeneratorService);\r\n readonly context = inject(SkraFieldContext, { optional: true });\r\n\r\n /** Committed rating; 0 (or out of [1,max]) = unrated. Consumer-owned, controlled (ADR 037). */\r\n readonly value = input<number>(0);\r\n /** Number of stars. Semantic count, not a look-input. */\r\n readonly max = input<number>(5);\r\n /** ADR 035 size axis — the only variant axis. */\r\n readonly size = input<StarRatingSize>('md');\r\n /** Fires on USER selection only (never on programmatic [value] changes). */\r\n readonly valueChange = output<number>();\r\n\r\n private readonly fallbackName = this.idGen.nextId('rating');\r\n /** Unique radio-group name so multiple ratings on a page don't merge. */\r\n readonly groupName = computed(\r\n () => this.context?.fieldId() || this.fallbackName,\r\n );\r\n\r\n readonly isDisabled = computed(() => this.context?.isDisabled() ?? false);\r\n readonly isReadonly = computed(() => this.context?.isReadonly() ?? false);\r\n\r\n /**\r\n * Star values HIGH→LOW (`[max, …, 1]`) so the CSS sibling combinator\r\n * `input:checked ~ label` fills the checked star and every lower one. The visual\r\n * order is restored left-to-right via `flex-direction: row-reverse` in the SCSS.\r\n */\r\n readonly stars = computed(() => {\r\n const n = Math.max(0, Math.floor(this.max()));\r\n return Array.from({ length: n }, (_, i) => n - i);\r\n });\r\n\r\n protected starLabel(star: number): string {\r\n return star === 1 ? '1 star' : `${star} stars`;\r\n }\r\n\r\n protected onSelect(star: number): void {\r\n // Reached only when not readonly (click/keydown are blocked below when readonly),\r\n // and never on programmatic [value] changes — so this is user-intent only.\r\n this.valueChange.emit(star);\r\n }\r\n\r\n protected blockWhenReadonly(event: Event): void {\r\n if (this.isReadonly()) event.preventDefault();\r\n }\r\n\r\n protected blockKeyWhenReadonly(event: KeyboardEvent): void {\r\n if (this.isReadonly() && event.key !== 'Tab') event.preventDefault();\r\n }\r\n}\r\n","@for (star of stars(); track star) {\r\n<input\r\n type=\"radio\"\r\n class=\"skra-star-rating-input\"\r\n [name]=\"groupName()\"\r\n [id]=\"groupName() + '-' + star\"\r\n [value]=\"star\"\r\n [checked]=\"value() === star\"\r\n [disabled]=\"isDisabled()\"\r\n [attr.aria-label]=\"starLabel(star)\"\r\n (change)=\"onSelect(star)\"\r\n/>\r\n<label\r\n class=\"skra-star-rating-star\"\r\n [attr.for]=\"groupName() + '-' + star\"\r\n aria-hidden=\"true\"\r\n>\r\n <svg\r\n class=\"skra-star-rating-glyph\"\r\n viewBox=\"0 0 24 24\"\r\n focusable=\"false\"\r\n aria-hidden=\"true\"\r\n >\r\n <path\r\n d=\"M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z\"\r\n />\r\n </svg>\r\n</label>\r\n}\r\n","// APG-radiogroup composite rendered as stars (ADR 039 §7).\r\nexport * from './lib/star-rating/star-rating';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"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"}
|
|
@@ -38,13 +38,15 @@ import { input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@a
|
|
|
38
38
|
*/
|
|
39
39
|
class SkraStatusDot {
|
|
40
40
|
/** Variant Surface Intent axis (ADR 035) — the fill colour (status palette subset). */
|
|
41
|
-
intent = input('neutral',
|
|
41
|
+
intent = input('neutral', /* @ts-ignore */
|
|
42
|
+
...(ngDevMode ? [{ debugName: "intent" }] : /* istanbul ignore next */ []));
|
|
42
43
|
/** Variant Surface Size axis (ADR 035) — the dot's (colored core) diameter. */
|
|
43
|
-
size = input('md',
|
|
44
|
-
|
|
45
|
-
static
|
|
44
|
+
size = input('md', /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
46
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraStatusDot, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
47
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.1", type: SkraStatusDot, isStandalone: true, selector: "skra-status-dot", inputs: { intent: { classPropertyName: "intent", publicName: "intent", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-skra-intent": "intent()", "attr.data-skra-size": "size()" } }, ngImport: i0, template: '', isInline: true, styles: ["@charset \"UTF-8\";:host{display:inline-block;flex-shrink:0;box-sizing:content-box;margin:0;inline-size:var(--skra-comp-status-dot-size-md);block-size:var(--skra-comp-status-dot-size-md);background:var(--skra-comp-status-dot-background);border-color:var(--skra-comp-status-dot-border-color);border-width:var(--skra-comp-status-dot-border-width);border-style:var(--skra-comp-status-dot-border-style);border-radius:var(--skra-comp-status-dot-radius);padding-block:var(--skra-comp-status-dot-padding-block);padding-inline:var(--skra-comp-status-dot-padding-inline);box-shadow:var(--skra-comp-status-dot-shadow)}:host([data-skra-size=sm]){inline-size:var(--skra-comp-status-dot-size-sm);block-size:var(--skra-comp-status-dot-size-sm)}:host([data-skra-size=lg]){inline-size:var(--skra-comp-status-dot-size-lg);block-size:var(--skra-comp-status-dot-size-lg)}:host([data-skra-intent=info]){--skra-comp-status-dot-background: var(--skra-sys-color-info-base)}:host([data-skra-intent=success]){--skra-comp-status-dot-background: var(--skra-sys-color-success-base)}:host([data-skra-intent=warning]){--skra-comp-status-dot-background: var(--skra-sys-color-warning-base)}:host([data-skra-intent=danger]){--skra-comp-status-dot-background: var(--skra-sys-color-danger-base)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
46
48
|
}
|
|
47
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
49
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: SkraStatusDot, decorators: [{
|
|
48
50
|
type: Component,
|
|
49
51
|
args: [{ selector: 'skra-status-dot', standalone: true, template: '', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
|
|
50
52
|
// Variant Surface reflection (ADR 035 §3.5; ADR 021 — never [style.--var]).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skra-ui-status-dot.mjs","sources":["../../../../libs/ui/status-dot/src/lib/status-dot/status-dot.ts","../../../../libs/ui/status-dot/src/skra-ui-status-dot.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n input,\n} from '@angular/core';\n\n/**\n * StatusDotIntent — the Variant Surface Intent axis (ADR 035 §3.1, the status palette subset).\n * Drops the action intents `primary`/`secondary` (those belong to interactive surfaces, not a\n * status glyph). Closed enum; extension requires an ADR 035 amendment.\n */\nexport type StatusDotIntent =\n | 'neutral'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger';\n\n/**\n * StatusDotSize — the Variant Surface Size axis (ADR 035 §3.1, downward subset `sm|md|lg`).\n * `xs`/`xl` are reserved (ADR 035 §3.2) and NOT in MVP — adding them later is purely additive.\n * Unlike content-width Badge (which has no size — its size is its text), the dot has NO content,\n * so size is a genuine free variable the consumer needs (corner-of-`lg`-avatar vs inline-in-text).\n */\nexport type StatusDotSize = 'sm' | 'md' | 'lg';\n\n/**\n * `<skra-status-dot>` — a bare, small, non-interactive status/presence indicator (a coloured dot)\n * composed beside other content: an avatar corner (online/away/busy/offline), or beside a label.\n * Second resident of `libs/ui/data-display`, sibling to `<skra-avatar>` (whose corner presence-dot\n * it provides). See `adr/specs/component-status-dot-spec.md`.\n *\n * **Element, not a decorated native (ADR 012):** there is no native `<dot>`, and a bare `<span>`\n * carries no semantics and forces a colour literal. NOT a Web Component (ADR 000).\n *\n * **No content (the SRP line vs `skra-badge`):** the dot IS the glyph — no slots, no projected\n * content, no label/count. Meaning is carried by ADJACENT text the consumer owns. The defining\n * value-add over a hand-rolled span is the semantic `intent`→token-colour mapping (no hex — ADR\n * 002/023) + the size axis that tracks the avatar.\n *\n * **Non-interactive (Avatar/Badge precedent):** no focusable node, no widget role, no keyboard, no\n * outputs → State Surface all-N/A. A clickable status = `button[skraButton]` composition, not a\n * variant.\n *\n * **Accessible name (ADR 033 Path 3 — graphic host, the SkraIcon/Avatar contract):** the host\n * carries NO default ARIA. The consumer declares semantics explicitly, exactly as for\n * `<skra-icon>`/`<skra-avatar>`:\n * - decorative (Mode A, the ~90% case — dot beside visible/sr-only status text) → `aria-hidden=\"true\"`;\n * - meaningful (Mode B — the dot is the SOLE status carrier) → **`role=\"img\"` + `aria-label`/\n * `aria-labelledby` TOGETHER**. `role=\"img\"` is REQUIRED: `aria-label` on the roleless host is\n * ARIA-prohibited (axe `aria-prohibited-attr`, the Avatar Mode-B fix) and conveys no name.\n * WCAG 1.4.1 (colour-independence) cannot be enforced by the atom — the adjacent text is the\n * consumer's; the `InlineStatus`/`A11yCheck` stories carry the editorial contract. NO `ariaLabel`\n * input (ADR 033 boundary #8).\n *\n * **Look is skin-owned:** circle-vs-square is the `radius` comp token (brutal's `radius.full: 0`\n * ships a square dot automatically). The fill is the semantic `intent`→`sys.color.<intent>.base`\n * (recolour at the sys level, not a per-dot token — skin philosophy); NO `emphasis` (always filled),\n * NO `live` (a dot has no text to announce — the consumer's adjacent live text does), NO\n * `color`/`variant`/`shape` look-inputs.\n */\n@Component({\n selector: 'skra-status-dot',\n standalone: true,\n template: '',\n styleUrl: './status-dot.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n // Variant Surface reflection (ADR 035 §3.5; ADR 021 — never [style.--var]).\n '[attr.data-skra-intent]': 'intent()',\n '[attr.data-skra-size]': 'size()',\n },\n})\nexport class SkraStatusDot {\n /** Variant Surface Intent axis (ADR 035) — the fill colour (status palette subset). */\n readonly intent = input<StatusDotIntent>('neutral');\n\n /** Variant Surface Size axis (ADR 035) — the dot's (colored core) diameter. */\n readonly size = input<StatusDotSize>('md');\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCG;MAcU,aAAa,CAAA;;
|
|
1
|
+
{"version":3,"file":"skra-ui-status-dot.mjs","sources":["../../../../libs/ui/status-dot/src/lib/status-dot/status-dot.ts","../../../../libs/ui/status-dot/src/skra-ui-status-dot.ts"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ViewEncapsulation,\r\n input,\r\n} from '@angular/core';\r\n\r\n/**\r\n * StatusDotIntent — the Variant Surface Intent axis (ADR 035 §3.1, the status palette subset).\r\n * Drops the action intents `primary`/`secondary` (those belong to interactive surfaces, not a\r\n * status glyph). Closed enum; extension requires an ADR 035 amendment.\r\n */\r\nexport type StatusDotIntent =\r\n | 'neutral'\r\n | 'info'\r\n | 'success'\r\n | 'warning'\r\n | 'danger';\r\n\r\n/**\r\n * StatusDotSize — the Variant Surface Size axis (ADR 035 §3.1, downward subset `sm|md|lg`).\r\n * `xs`/`xl` are reserved (ADR 035 §3.2) and NOT in MVP — adding them later is purely additive.\r\n * Unlike content-width Badge (which has no size — its size is its text), the dot has NO content,\r\n * so size is a genuine free variable the consumer needs (corner-of-`lg`-avatar vs inline-in-text).\r\n */\r\nexport type StatusDotSize = 'sm' | 'md' | 'lg';\r\n\r\n/**\r\n * `<skra-status-dot>` — a bare, small, non-interactive status/presence indicator (a coloured dot)\r\n * composed beside other content: an avatar corner (online/away/busy/offline), or beside a label.\r\n * Second resident of `libs/ui/data-display`, sibling to `<skra-avatar>` (whose corner presence-dot\r\n * it provides). See `adr/specs/component-status-dot-spec.md`.\r\n *\r\n * **Element, not a decorated native (ADR 012):** there is no native `<dot>`, and a bare `<span>`\r\n * carries no semantics and forces a colour literal. NOT a Web Component (ADR 000).\r\n *\r\n * **No content (the SRP line vs `skra-badge`):** the dot IS the glyph — no slots, no projected\r\n * content, no label/count. Meaning is carried by ADJACENT text the consumer owns. The defining\r\n * value-add over a hand-rolled span is the semantic `intent`→token-colour mapping (no hex — ADR\r\n * 002/023) + the size axis that tracks the avatar.\r\n *\r\n * **Non-interactive (Avatar/Badge precedent):** no focusable node, no widget role, no keyboard, no\r\n * outputs → State Surface all-N/A. A clickable status = `button[skraButton]` composition, not a\r\n * variant.\r\n *\r\n * **Accessible name (ADR 033 Path 3 — graphic host, the SkraIcon/Avatar contract):** the host\r\n * carries NO default ARIA. The consumer declares semantics explicitly, exactly as for\r\n * `<skra-icon>`/`<skra-avatar>`:\r\n * - decorative (Mode A, the ~90% case — dot beside visible/sr-only status text) → `aria-hidden=\"true\"`;\r\n * - meaningful (Mode B — the dot is the SOLE status carrier) → **`role=\"img\"` + `aria-label`/\r\n * `aria-labelledby` TOGETHER**. `role=\"img\"` is REQUIRED: `aria-label` on the roleless host is\r\n * ARIA-prohibited (axe `aria-prohibited-attr`, the Avatar Mode-B fix) and conveys no name.\r\n * WCAG 1.4.1 (colour-independence) cannot be enforced by the atom — the adjacent text is the\r\n * consumer's; the `InlineStatus`/`A11yCheck` stories carry the editorial contract. NO `ariaLabel`\r\n * input (ADR 033 boundary #8).\r\n *\r\n * **Look is skin-owned:** circle-vs-square is the `radius` comp token (brutal's `radius.full: 0`\r\n * ships a square dot automatically). The fill is the semantic `intent`→`sys.color.<intent>.base`\r\n * (recolour at the sys level, not a per-dot token — skin philosophy); NO `emphasis` (always filled),\r\n * NO `live` (a dot has no text to announce — the consumer's adjacent live text does), NO\r\n * `color`/`variant`/`shape` look-inputs.\r\n */\r\n@Component({\r\n selector: 'skra-status-dot',\r\n standalone: true,\r\n template: '',\r\n styleUrl: './status-dot.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n host: {\r\n // Variant Surface reflection (ADR 035 §3.5; ADR 021 — never [style.--var]).\r\n '[attr.data-skra-intent]': 'intent()',\r\n '[attr.data-skra-size]': 'size()',\r\n },\r\n})\r\nexport class SkraStatusDot {\r\n /** Variant Surface Intent axis (ADR 035) — the fill colour (status palette subset). */\r\n readonly intent = input<StatusDotIntent>('neutral');\r\n\r\n /** Variant Surface Size axis (ADR 035) — the dot's (colored core) diameter. */\r\n readonly size = input<StatusDotSize>('md');\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCG;MAcU,aAAa,CAAA;;IAEf,MAAM,GAAG,KAAK,CAAkB,SAAS;+EAAC;;IAG1C,IAAI,GAAG,KAAK,CAAgB,IAAI;6EAAC;uGAL/B,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAb,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,aAAa,uaAVd,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,gvCAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAUD,aAAa,EAAA,UAAA,EAAA,CAAA;kBAbzB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,EAAA,UAAA,EACf,IAAI,EAAA,QAAA,EACN,EAAE,EAAA,eAAA,EAEK,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,QAAQ,EAAA,IAAA,EACnC;;AAEJ,wBAAA,yBAAyB,EAAE,UAAU;AACrC,wBAAA,uBAAuB,EAAE,QAAQ;AAClC,qBAAA,EAAA,MAAA,EAAA,CAAA,gvCAAA,CAAA,EAAA;;;ACzEH;;AAEG;;;;"}
|