@agorapulse/ui-components 22.4.12 → 22.4.13-beta.2

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.
Files changed (26) hide show
  1. package/agorapulse-ui-components-22.4.13-beta.2.tgz +0 -0
  2. package/fesm2022/agorapulse-ui-components-autocomplete.mjs.map +1 -1
  3. package/fesm2022/agorapulse-ui-components-datepicker.mjs +6 -5
  4. package/fesm2022/agorapulse-ui-components-datepicker.mjs.map +1 -1
  5. package/fesm2022/agorapulse-ui-components-filter-chips-list.mjs +3 -2
  6. package/fesm2022/agorapulse-ui-components-filter-chips-list.mjs.map +1 -1
  7. package/fesm2022/agorapulse-ui-components-filter-dropdown.mjs +2 -2
  8. package/fesm2022/agorapulse-ui-components-filter-dropdown.mjs.map +1 -1
  9. package/fesm2022/agorapulse-ui-components-form-field.mjs +193 -5
  10. package/fesm2022/agorapulse-ui-components-form-field.mjs.map +1 -1
  11. package/fesm2022/agorapulse-ui-components-form-message.mjs +14 -1
  12. package/fesm2022/agorapulse-ui-components-form-message.mjs.map +1 -1
  13. package/fesm2022/agorapulse-ui-components-input.mjs +5 -1
  14. package/fesm2022/agorapulse-ui-components-input.mjs.map +1 -1
  15. package/fesm2022/agorapulse-ui-components-segmented-control.mjs +4 -3
  16. package/fesm2022/agorapulse-ui-components-segmented-control.mjs.map +1 -1
  17. package/fesm2022/agorapulse-ui-components-select.mjs +15 -1
  18. package/fesm2022/agorapulse-ui-components-select.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/types/agorapulse-ui-components-autocomplete.d.ts +1 -2
  21. package/types/agorapulse-ui-components-datepicker.d.ts +2 -3
  22. package/types/agorapulse-ui-components-form-field.d.ts +84 -4
  23. package/types/agorapulse-ui-components-form-message.d.ts +2 -0
  24. package/types/agorapulse-ui-components-input.d.ts +2 -1
  25. package/types/agorapulse-ui-components-select.d.ts +5 -1
  26. package/agorapulse-ui-components-22.4.12.tgz +0 -0
@@ -1,18 +1,206 @@
1
1
  import * as i0 from '@angular/core';
2
- import { ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { inject, APP_ID, viewChild, signal, computed, afterRenderEffect, untracked, ViewEncapsulation, ChangeDetectionStrategy, Component, input, booleanAttribute, ElementRef, Renderer2, DestroyRef, effect, Directive } from '@angular/core';
3
3
 
4
4
  class FormFieldComponent {
5
+ /**
6
+ * Combines the application id — federated Angular apps can share a page — with a per-instance random suffix.
7
+ * Not `crypto.randomUUID()`, which browsers refuse outside a secure context.
8
+ */
9
+ uid = `${inject(APP_ID)}-form-field-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
10
+ content = viewChild.required('content');
11
+ control = signal(undefined, /* @ts-ignore */
12
+ ...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
13
+ descriptions = signal([], /* @ts-ignore */
14
+ ...(ngDevMode ? [{ debugName: "descriptions" }] : /* istanbul ignore next */ []));
15
+ labelledById = signal(undefined, /* @ts-ignore */
16
+ ...(ngDevMode ? [{ debugName: "labelledById" }] : /* istanbul ignore next */ []));
17
+ labelled = signal(false, /* @ts-ignore */
18
+ ...(ngDevMode ? [{ debugName: "labelled" }] : /* istanbul ignore next */ []));
19
+ /**
20
+ * The label's id when `aria-labelledby` has to carry the association — never on the native branch, where `for` suffices.
21
+ * Undefined until the first render, and when the field has no label: a control must not emit a dangling reference.
22
+ */
23
+ labelledBy = this.labelledById.asReadonly();
24
+ /** Whether a label already names the control, by `for` or by `aria-labelledby`. */
25
+ hasLabel = this.labelled.asReadonly();
26
+ /** The ids of everything describing the control, for its `aria-describedby`. */
27
+ describedBy = computed(() => this.descriptions().join(' ') || undefined, /* @ts-ignore */
28
+ ...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
29
+ constructor() {
30
+ // After render, so outside change detection: the projected content exists and writing signals
31
+ // here cannot trigger NG0100. Re-runs when the control registers, since it picks the branch.
32
+ afterRenderEffect(() => {
33
+ this.content();
34
+ this.control();
35
+ untracked(() => this.associate());
36
+ });
37
+ }
38
+ /**
39
+ * Links the projected label to the registered control.
40
+ *
41
+ * Public because `detectChanges()` does not run after-render hooks in a zone.js harness, so a spec has to force the pass —
42
+ * as does a consumer whose label only appears after the first render.
43
+ */
44
+ associate() {
45
+ // `:scope >` and not `querySelector('label')`: `ng-content select="label"` only projects direct
46
+ // children, so a deeper label belongs to something else. Among several, the first names the field.
47
+ const label = this.content().nativeElement.querySelector(':scope > label');
48
+ if (!label) {
49
+ this.labelledById.set(undefined);
50
+ this.labelled.set(false);
51
+ return;
52
+ }
53
+ // When the control offers a target `for` can reach, the browser supplies the name and the focusing click, so no ARIA is owed;
54
+ // an author's `for` that reaches no control — one aimed at a component host — names nothing, so it is re-aimed.
55
+ const target = this.control()?.labelTarget(`${this.uid}-control`);
56
+ if (target) {
57
+ if (!label.control) {
58
+ label.htmlFor = target;
59
+ }
60
+ this.labelledById.set(undefined);
61
+ this.labelled.set(true);
62
+ return;
63
+ }
64
+ this.labelledById.set(this.ensureId(label, 'label'));
65
+ this.labelled.set(true);
66
+ }
67
+ registerControl(control) {
68
+ this.control.set(control);
69
+ }
70
+ unregisterControl(control) {
71
+ // By identity: a destruction racing a new registration must not clear the live control.
72
+ this.control.update(current => (current === control ? undefined : current));
73
+ }
74
+ registerDescription(id) {
75
+ this.descriptions.update(ids => (ids.includes(id) ? ids : [...ids, id]));
76
+ }
77
+ unregisterDescription(id) {
78
+ this.descriptions.update(ids => ids.filter(current => current !== id));
79
+ }
80
+ /** Only stamps what has no id yet: the author's own may already be referenced elsewhere. */
81
+ ensureId(element, suffix) {
82
+ if (!element.id) {
83
+ element.id = `${this.uid}-${suffix}`;
84
+ }
85
+ return element.id;
86
+ }
87
+ onClick(event) {
88
+ const control = this.control();
89
+ if (!control) {
90
+ return;
91
+ }
92
+ const label = event.target?.closest('label');
93
+ if (!label || label.parentElement !== this.content().nativeElement) {
94
+ return;
95
+ }
96
+ // `label.control` is null exactly when the `for` reaches nothing, the case this exists for.
97
+ // `hasAttribute('for')` would instead let an inert `for` through — precisely what is repaired.
98
+ if (label.control) {
99
+ return;
100
+ }
101
+ control.focus();
102
+ }
5
103
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
6
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.5", type: FormFieldComponent, isStandalone: true, selector: "ap-form-field", ngImport: i0, template: "<div class=\"ap-form-field\">\n <ng-content select=\"label\"></ng-content>\n <ng-content></ng-content>\n <ng-content select=\"ap-form-message\"></ng-content>\n</div>\n", styles: ["ap-form-field{display:block}.ap-form-field{display:inline-flex;flex-direction:column;gap:var(--comp-input-spacing-horizontal);width:100%}.ap-form-field label{display:flex;flex-direction:column;gap:var(--comp-forms-label-spacing-vertical);font-size:var(--comp-forms-label-size);font-weight:var(--comp-forms-label-font-weight);line-height:var(--comp-forms-label-line-height);font-family:var(--comp-forms-label-font-family);color:var(--comp-forms-label-text-color)}.ap-form-field label .description{font-size:var(--comp-forms-label-description-text-size);font-weight:var(--comp-forms-label-description-text-font-weight);line-height:var(--comp-forms-label-description-text-line-height);font-family:var(--comp-forms-label-description-text-font-family);color:var(--comp-forms-label-description-text-color)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
104
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.5", type: FormFieldComponent, isStandalone: true, selector: "ap-form-field", host: { listeners: { "click": "onClick($event)" } }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n #content\n class=\"ap-form-field\">\n <ng-content select=\"label\"></ng-content>\n <ng-content></ng-content>\n <ng-content select=\"ap-form-message\"></ng-content>\n</div>\n", styles: ["ap-form-field{display:block}.ap-form-field{display:inline-flex;flex-direction:column;gap:var(--comp-input-spacing-horizontal);width:100%}.ap-form-field label{display:flex;flex-direction:column;gap:var(--comp-forms-label-spacing-vertical);font-size:var(--comp-forms-label-size);font-weight:var(--comp-forms-label-font-weight);line-height:var(--comp-forms-label-line-height);font-family:var(--comp-forms-label-font-family);color:var(--comp-forms-label-text-color)}.ap-form-field label .description{font-size:var(--comp-forms-label-description-text-size);font-weight:var(--comp-forms-label-description-text-font-weight);line-height:var(--comp-forms-label-description-text-line-height);font-family:var(--comp-forms-label-description-text-font-family);color:var(--comp-forms-label-description-text-color)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
7
105
  }
8
106
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FormFieldComponent, decorators: [{
9
107
  type: Component,
10
- args: [{ selector: 'ap-form-field', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div class=\"ap-form-field\">\n <ng-content select=\"label\"></ng-content>\n <ng-content></ng-content>\n <ng-content select=\"ap-form-message\"></ng-content>\n</div>\n", styles: ["ap-form-field{display:block}.ap-form-field{display:inline-flex;flex-direction:column;gap:var(--comp-input-spacing-horizontal);width:100%}.ap-form-field label{display:flex;flex-direction:column;gap:var(--comp-forms-label-spacing-vertical);font-size:var(--comp-forms-label-size);font-weight:var(--comp-forms-label-font-weight);line-height:var(--comp-forms-label-line-height);font-family:var(--comp-forms-label-font-family);color:var(--comp-forms-label-text-color)}.ap-form-field label .description{font-size:var(--comp-forms-label-description-text-size);font-weight:var(--comp-forms-label-description-text-font-weight);line-height:var(--comp-forms-label-description-text-line-height);font-family:var(--comp-forms-label-description-text-font-family);color:var(--comp-forms-label-description-text-color)}\n"] }]
11
- }] });
108
+ args: [{ selector: 'ap-form-field', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
109
+ '(click)': 'onClick($event)',
110
+ }, template: "<div\n #content\n class=\"ap-form-field\">\n <ng-content select=\"label\"></ng-content>\n <ng-content></ng-content>\n <ng-content select=\"ap-form-message\"></ng-content>\n</div>\n", styles: ["ap-form-field{display:block}.ap-form-field{display:inline-flex;flex-direction:column;gap:var(--comp-input-spacing-horizontal);width:100%}.ap-form-field label{display:flex;flex-direction:column;gap:var(--comp-forms-label-spacing-vertical);font-size:var(--comp-forms-label-size);font-weight:var(--comp-forms-label-font-weight);line-height:var(--comp-forms-label-line-height);font-family:var(--comp-forms-label-font-family);color:var(--comp-forms-label-text-color)}.ap-form-field label .description{font-size:var(--comp-forms-label-description-text-size);font-weight:var(--comp-forms-label-description-text-font-weight);line-height:var(--comp-forms-label-description-text-line-height);font-family:var(--comp-forms-label-description-text-font-family);color:var(--comp-forms-label-description-text-color)}\n"] }]
111
+ }], ctorParameters: () => [], propDecorators: { content: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }] } });
112
+
113
+ /** The elements a `<label for>` can reach. Everything else has to go through `aria-labelledby`. */
114
+ const LABELABLE = ['BUTTON', 'INPUT', 'METER', 'OUTPUT', 'PROGRESS', 'SELECT', 'TEXTAREA'];
115
+ /** Finds the first focusable descendant, for when the designated element is not focusable itself. */
116
+ const FOCUSABLE = 'button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';
117
+ /**
118
+ * Points the surrounding `ap-form-field` at a control's focusable element, and carries the naming that follows.
119
+ *
120
+ * Put it on the element the user actually focuses: the component host when that is it (via `hostDirectives`), otherwise the
121
+ * inner element, in the component's template. With no `ap-form-field` around, it falls back to the `aria-label` it is given.
122
+ */
123
+ class FormFieldControlDirective {
124
+ /** Fallback name, for a field with no visible label. */
125
+ ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'apFormFieldControl' });
126
+ /** A disabled control does not take focus from a click on its label. */
127
+ disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
128
+ element = inject(ElementRef).nativeElement;
129
+ renderer = inject(Renderer2);
130
+ formField = inject(FormFieldComponent, { optional: true });
131
+ authoredDescribedBy = this.element.getAttribute('aria-describedby');
132
+ /** Empty on the native branch, where the label's `for` already carries the association. */
133
+ labelledBy = computed(() => this.formField?.labelledBy(), /* @ts-ignore */
134
+ ...(ngDevMode ? [{ debugName: "labelledBy" }] : /* istanbul ignore next */ []));
135
+ /** The fallback only: an `aria-label` wins over a visible label, so it goes out only when no label names the control. */
136
+ label = computed(() => (this.formField?.hasLabel() ? undefined : this.ariaLabel() || undefined), /* @ts-ignore */
137
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
138
+ describedBy = computed(() => [this.authoredDescribedBy, this.formField?.describedBy()].filter(Boolean).join(' ') || undefined, /* @ts-ignore */
139
+ ...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
140
+ constructor() {
141
+ this.formField?.registerControl(this);
142
+ inject(DestroyRef).onDestroy(() => this.formField?.unregisterControl(this));
143
+ this.reflect('aria-labelledby', this.labelledBy);
144
+ this.reflect('aria-label', this.label);
145
+ this.reflect('aria-describedby', this.describedBy);
146
+ }
147
+ labelTarget(fallbackId) {
148
+ if (!LABELABLE.includes(this.element.tagName)) {
149
+ return undefined;
150
+ }
151
+ if (!this.element.id) {
152
+ this.element.id = fallbackId;
153
+ }
154
+ return this.element.id;
155
+ }
156
+ /**
157
+ * Writes the attribute only while there is a value for it, and gives back what the author wrote after: a host binding would
158
+ * clear an author's own `aria-label`, static or bound, whenever the field has nothing to say.
159
+ */
160
+ reflect(name, value) {
161
+ const authored = this.element.getAttribute(name);
162
+ let written = false;
163
+ effect(() => {
164
+ const next = value();
165
+ if (next !== undefined) {
166
+ this.renderer.setAttribute(this.element, name, next);
167
+ written = true;
168
+ }
169
+ else if (written) {
170
+ if (authored === null) {
171
+ this.renderer.removeAttribute(this.element, name);
172
+ }
173
+ else {
174
+ this.renderer.setAttribute(this.element, name, authored);
175
+ }
176
+ written = false;
177
+ }
178
+ });
179
+ }
180
+ focus() {
181
+ if (this.disabled()) {
182
+ return;
183
+ }
184
+ this.element.focus();
185
+ // A named container — `role="group"`, `role="listbox"` — is not always in the tab order; the
186
+ // label should then reach its first focusable element.
187
+ if (document.activeElement !== this.element) {
188
+ this.element.querySelector(FOCUSABLE)?.focus();
189
+ }
190
+ }
191
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FormFieldControlDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
192
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: FormFieldControlDirective, isStandalone: true, selector: "[apFormFieldControl]", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "apFormFieldControl", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
193
+ }
194
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FormFieldControlDirective, decorators: [{
195
+ type: Directive,
196
+ args: [{
197
+ selector: '[apFormFieldControl]',
198
+ }]
199
+ }], ctorParameters: () => [], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "apFormFieldControl", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
12
200
 
13
201
  /**
14
202
  * Generated bundle index. Do not edit.
15
203
  */
16
204
 
17
- export { FormFieldComponent };
205
+ export { FormFieldComponent, FormFieldControlDirective };
18
206
  //# sourceMappingURL=agorapulse-ui-components-form-field.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"agorapulse-ui-components-form-field.mjs","sources":["../../../libs/ui-components/form-field/src/form-field.component.ts","../../../libs/ui-components/form-field/src/form-field.component.html","../../../libs/ui-components/form-field/src/agorapulse-ui-components-form-field.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';\n\n@Component({\n selector: 'ap-form-field',\n templateUrl: './form-field.component.html',\n styleUrls: ['./form-field.component.scss'],\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class FormFieldComponent {}\n","<div class=\"ap-form-field\">\n <ng-content select=\"label\"></ng-content>\n <ng-content></ng-content>\n <ng-content select=\"ap-form-message\"></ng-content>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;MAUa,kBAAkB,CAAA;uGAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAlB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,kBAAkB,yECV/B,kLAKA,EAAA,MAAA,EAAA,CAAA,oyBAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FDKa,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAR9B,SAAS;+BACI,eAAe,EAAA,UAAA,EAGb,IAAI,EAAA,eAAA,EACC,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,IAAI,EAAA,QAAA,EAAA,kLAAA,EAAA,MAAA,EAAA,CAAA,oyBAAA,CAAA,EAAA;;;AERzC;;AAEG;;;;"}
1
+ {"version":3,"file":"agorapulse-ui-components-form-field.mjs","sources":["../../../libs/ui-components/form-field/src/form-field.component.ts","../../../libs/ui-components/form-field/src/form-field.component.html","../../../libs/ui-components/form-field/src/form-field-control.directive.ts","../../../libs/ui-components/form-field/src/agorapulse-ui-components-form-field.ts"],"sourcesContent":["import {\n afterRenderEffect,\n APP_ID,\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n inject,\n signal,\n untracked,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { FormFieldControl } from './form-field-control';\n\n@Component({\n selector: 'ap-form-field',\n templateUrl: './form-field.component.html',\n styleUrls: ['./form-field.component.scss'],\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n '(click)': 'onClick($event)',\n },\n})\nexport class FormFieldComponent {\n /**\n * Combines the application id — federated Angular apps can share a page — with a per-instance random suffix.\n * Not `crypto.randomUUID()`, which browsers refuse outside a secure context.\n */\n private readonly uid = `${inject(APP_ID)}-form-field-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;\n\n private readonly content = viewChild.required<ElementRef<HTMLElement>>('content');\n private readonly control = signal<FormFieldControl | undefined>(undefined);\n private readonly descriptions = signal<readonly string[]>([]);\n\n private readonly labelledById = signal<string | undefined>(undefined);\n private readonly labelled = signal(false);\n\n /**\n * The label's id when `aria-labelledby` has to carry the association — never on the native branch, where `for` suffices.\n * Undefined until the first render, and when the field has no label: a control must not emit a dangling reference.\n */\n readonly labelledBy = this.labelledById.asReadonly();\n\n /** Whether a label already names the control, by `for` or by `aria-labelledby`. */\n readonly hasLabel = this.labelled.asReadonly();\n\n /** The ids of everything describing the control, for its `aria-describedby`. */\n readonly describedBy = computed(() => this.descriptions().join(' ') || undefined);\n\n constructor() {\n // After render, so outside change detection: the projected content exists and writing signals\n // here cannot trigger NG0100. Re-runs when the control registers, since it picks the branch.\n afterRenderEffect(() => {\n this.content();\n this.control();\n untracked(() => this.associate());\n });\n }\n\n /**\n * Links the projected label to the registered control.\n *\n * Public because `detectChanges()` does not run after-render hooks in a zone.js harness, so a spec has to force the pass —\n * as does a consumer whose label only appears after the first render.\n */\n associate(): void {\n // `:scope >` and not `querySelector('label')`: `ng-content select=\"label\"` only projects direct\n // children, so a deeper label belongs to something else. Among several, the first names the field.\n const label = this.content().nativeElement.querySelector<HTMLLabelElement>(':scope > label');\n if (!label) {\n this.labelledById.set(undefined);\n this.labelled.set(false);\n return;\n }\n\n // When the control offers a target `for` can reach, the browser supplies the name and the focusing click, so no ARIA is owed;\n // an author's `for` that reaches no control — one aimed at a component host — names nothing, so it is re-aimed.\n const target = this.control()?.labelTarget(`${this.uid}-control`);\n if (target) {\n if (!label.control) {\n label.htmlFor = target;\n }\n this.labelledById.set(undefined);\n this.labelled.set(true);\n return;\n }\n\n this.labelledById.set(this.ensureId(label, 'label'));\n this.labelled.set(true);\n }\n\n registerControl(control: FormFieldControl): void {\n this.control.set(control);\n }\n\n unregisterControl(control: FormFieldControl): void {\n // By identity: a destruction racing a new registration must not clear the live control.\n this.control.update(current => (current === control ? undefined : current));\n }\n\n registerDescription(id: string): void {\n this.descriptions.update(ids => (ids.includes(id) ? ids : [...ids, id]));\n }\n\n unregisterDescription(id: string): void {\n this.descriptions.update(ids => ids.filter(current => current !== id));\n }\n\n /** Only stamps what has no id yet: the author's own may already be referenced elsewhere. */\n private ensureId(element: HTMLElement, suffix: string): string {\n if (!element.id) {\n element.id = `${this.uid}-${suffix}`;\n }\n return element.id;\n }\n\n protected onClick(event: MouseEvent): void {\n const control = this.control();\n if (!control) {\n return;\n }\n\n const label = (event.target as HTMLElement | null)?.closest('label');\n if (!label || label.parentElement !== this.content().nativeElement) {\n return;\n }\n\n // `label.control` is null exactly when the `for` reaches nothing, the case this exists for.\n // `hasAttribute('for')` would instead let an inert `for` through — precisely what is repaired.\n if (label.control) {\n return;\n }\n\n control.focus();\n }\n}\n","<div\n #content\n class=\"ap-form-field\">\n <ng-content select=\"label\"></ng-content>\n <ng-content></ng-content>\n <ng-content select=\"ap-form-message\"></ng-content>\n</div>\n","import { booleanAttribute, computed, DestroyRef, Directive, effect, ElementRef, inject, input, Renderer2, Signal } from '@angular/core';\nimport type { FormFieldControl } from './form-field-control';\nimport { FormFieldComponent } from './form-field.component';\n\n/** The elements a `<label for>` can reach. Everything else has to go through `aria-labelledby`. */\nconst LABELABLE = ['BUTTON', 'INPUT', 'METER', 'OUTPUT', 'PROGRESS', 'SELECT', 'TEXTAREA'];\n\n/** Finds the first focusable descendant, for when the designated element is not focusable itself. */\nconst FOCUSABLE =\n 'button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * Points the surrounding `ap-form-field` at a control's focusable element, and carries the naming that follows.\n *\n * Put it on the element the user actually focuses: the component host when that is it (via `hostDirectives`), otherwise the\n * inner element, in the component's template. With no `ap-form-field` around, it falls back to the `aria-label` it is given.\n */\n@Directive({\n selector: '[apFormFieldControl]',\n})\nexport class FormFieldControlDirective implements FormFieldControl {\n /** Fallback name, for a field with no visible label. */\n readonly ariaLabel = input<string | undefined>(undefined, { alias: 'apFormFieldControl' });\n\n /** A disabled control does not take focus from a click on its label. */\n readonly disabled = input(false, { transform: booleanAttribute });\n\n private readonly element: HTMLElement = inject(ElementRef).nativeElement;\n private readonly renderer = inject(Renderer2);\n private readonly formField = inject(FormFieldComponent, { optional: true });\n private readonly authoredDescribedBy = this.element.getAttribute('aria-describedby');\n\n /** Empty on the native branch, where the label's `for` already carries the association. */\n protected readonly labelledBy = computed(() => this.formField?.labelledBy());\n\n /** The fallback only: an `aria-label` wins over a visible label, so it goes out only when no label names the control. */\n protected readonly label = computed(() => (this.formField?.hasLabel() ? undefined : this.ariaLabel() || undefined));\n\n protected readonly describedBy = computed(\n () => [this.authoredDescribedBy, this.formField?.describedBy()].filter(Boolean).join(' ') || undefined\n );\n\n constructor() {\n this.formField?.registerControl(this);\n inject(DestroyRef).onDestroy(() => this.formField?.unregisterControl(this));\n this.reflect('aria-labelledby', this.labelledBy);\n this.reflect('aria-label', this.label);\n this.reflect('aria-describedby', this.describedBy);\n }\n\n labelTarget(fallbackId: string): string | undefined {\n if (!LABELABLE.includes(this.element.tagName)) {\n return undefined;\n }\n if (!this.element.id) {\n this.element.id = fallbackId;\n }\n return this.element.id;\n }\n\n /**\n * Writes the attribute only while there is a value for it, and gives back what the author wrote after: a host binding would\n * clear an author's own `aria-label`, static or bound, whenever the field has nothing to say.\n */\n private reflect(name: string, value: Signal<string | undefined>): void {\n const authored = this.element.getAttribute(name);\n let written = false;\n effect(() => {\n const next = value();\n if (next !== undefined) {\n this.renderer.setAttribute(this.element, name, next);\n written = true;\n } else if (written) {\n if (authored === null) {\n this.renderer.removeAttribute(this.element, name);\n } else {\n this.renderer.setAttribute(this.element, name, authored);\n }\n written = false;\n }\n });\n }\n\n focus(): void {\n if (this.disabled()) {\n return;\n }\n\n this.element.focus();\n // A named container — `role=\"group\"`, `role=\"listbox\"` — is not always in the tab order; the\n // label should then reach its first focusable element.\n if (document.activeElement !== this.element) {\n this.element.querySelector<HTMLElement>(FOCUSABLE)?.focus();\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;MA0Ba,kBAAkB,CAAA;AAC3B;;;AAGG;AACc,IAAA,GAAG,GAAG,CAAA,EAAG,MAAM,CAAC,MAAM,CAAC,CAAA,YAAA,EAAe,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA,EAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE;AAErG,IAAA,OAAO,GAAG,SAAS,CAAC,QAAQ,CAA0B,SAAS,CAAC;IAChE,OAAO,GAAG,MAAM,CAA+B,SAAS;gFAAC;IACzD,YAAY,GAAG,MAAM,CAAoB,EAAE;qFAAC;IAE5C,YAAY,GAAG,MAAM,CAAqB,SAAS;qFAAC;IACpD,QAAQ,GAAG,MAAM,CAAC,KAAK;iFAAC;AAEzC;;;AAGG;AACM,IAAA,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE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AA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAzB,yBAAyB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,MAAA,EAAA,EAAA,SAAA,EAAA,EAAA,iBAAA,EAAA,WAAA,EAAA,UAAA,EAAA,oBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAzB,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBAHrC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,sBAAsB;AACnC,iBAAA;;;ACnBD;;AAEG;;;;"}
@@ -1,6 +1,7 @@
1
+ import { FormFieldComponent } from '@agorapulse/ui-components/form-field';
1
2
  import { SymbolRegistry, apErrorFill, apRoundedCheckFill, SymbolComponent } from '@agorapulse/ui-symbol';
2
3
  import * as i0 from '@angular/core';
3
- import { signal, computed, inject, Input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
4
+ import { signal, computed, inject, ElementRef, APP_ID, DestroyRef, Input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
4
5
 
5
6
  class FormMessageComponent {
6
7
  set messageType(messageType) {
@@ -13,9 +14,21 @@ class FormMessageComponent {
13
14
  return this.messageTypeSignal() === 'error' ? 'error_fill' : 'rounded-check_fill';
14
15
  }, /* @ts-ignore */
15
16
  ...(ngDevMode ? [{ debugName: "symbolIdSignal" }] : /* istanbul ignore next */ []));
17
+ /** The id this message is referenced by. A bound `[id]` would land after construction and leave the reference dangling. */
18
+ messageId;
16
19
  symbolRegistry = inject(SymbolRegistry);
17
20
  constructor() {
18
21
  this.symbolRegistry.registerSymbols([apErrorFill, apRoundedCheckFill]);
22
+ // The field cannot query for this: a message usually sits under `@if`, which a non-recursive
23
+ // query misses, while a recursive one would let an outer field adopt a nested field's message.
24
+ const element = inject(ElementRef).nativeElement;
25
+ if (!element.id) {
26
+ element.id = `${inject(APP_ID)}-form-message-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
27
+ }
28
+ this.messageId = element.id;
29
+ const formField = inject(FormFieldComponent, { optional: true });
30
+ formField?.registerDescription(this.messageId);
31
+ inject(DestroyRef).onDestroy(() => formField?.unregisterDescription(this.messageId));
19
32
  }
20
33
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FormMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
21
34
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.5", type: FormMessageComponent, isStandalone: true, selector: "ap-form-message", inputs: { messageType: "messageType", message: "message" }, host: { properties: { "class.error": "messageTypeSignal() === 'error'", "class.success": "messageTypeSignal() === 'success'" }, classAttribute: "ap-form-message" }, ngImport: i0, template: "<ap-symbol\n size=\"sm\"\n [symbolId]=\"symbolIdSignal()\" />\n<span>\n {{ message }}\n</span>\n", styles: [".ap-form-message{font-size:var(--comp-forms-status-text-size);font-weight:var(--comp-forms-status-text-font-weight);line-height:var(--comp-forms-status-text-line-height);font-family:var(--comp-forms-status-text-font-family);margin:0;display:flex;align-items:center;gap:var(--ref-spacing-xxxs)}.ap-form-message.error{color:var(--comp-forms-status-text-error-color)}.ap-form-message.error ap-symbol{color:var(--comp-forms-status-icon-error-color)}.ap-form-message.success{color:var(--comp-forms-status-text-success-color)}.ap-form-message.success ap-symbol{color:var(--ref-color-green-150)}\n"], dependencies: [{ kind: "component", type: SymbolComponent, selector: "ap-symbol", inputs: ["symbolId", "color", "size"], outputs: ["sizeChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
@@ -1 +1 @@
1
- {"version":3,"file":"agorapulse-ui-components-form-message.mjs","sources":["../../../libs/ui-components/form-message/src/form-message.component.ts","../../../libs/ui-components/form-message/src/form-message.component.html","../../../libs/ui-components/form-message/src/agorapulse-ui-components-form-message.ts"],"sourcesContent":["import { SymbolComponent, SymbolRegistry, apErrorFill, apRoundedCheckFill } from '@agorapulse/ui-symbol';\nimport { ChangeDetectionStrategy, Component, Input, ViewEncapsulation, computed, inject, signal } from '@angular/core';\n\nexport type MessageType = 'error' | 'success';\n\n@Component({\n selector: 'ap-form-message',\n templateUrl: './form-message.component.html',\n styleUrls: ['./form-message.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [SymbolComponent],\n host: {\n class: 'ap-form-message',\n '[class.error]': \"messageTypeSignal() === 'error'\",\n '[class.success]': \"messageTypeSignal() === 'success'\",\n },\n})\nexport class FormMessageComponent {\n @Input({ required: true })\n set messageType(messageType: MessageType) {\n this.messageTypeSignal.set(messageType);\n }\n\n @Input({ required: true })\n message!: string;\n\n messageTypeSignal = signal<MessageType>('error');\n\n symbolIdSignal = computed(() => {\n return this.messageTypeSignal() === 'error' ? 'error_fill' : 'rounded-check_fill';\n });\n\n private symbolRegistry = inject(SymbolRegistry);\n\n constructor() {\n this.symbolRegistry.registerSymbols([apErrorFill, apRoundedCheckFill]);\n }\n}\n","<ap-symbol\n size=\"sm\"\n [symbolId]=\"symbolIdSignal()\" />\n<span>\n {{ message }}\n</span>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;MAkBa,oBAAoB,CAAA;IAC7B,IACI,WAAW,CAAC,WAAwB,EAAA;AACpC,QAAA,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC;IAC3C;AAGA,IAAA,OAAO;IAEP,iBAAiB,GAAG,MAAM,CAAc,OAAO;0FAAC;AAEhD,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C,iBAAiB,CAAC,IAAI,EAAA,OAAA,EAC5B,CAAC,eAAe,CAAC,EAAA,IAAA,EACpB;AACF,wBAAA,KAAK,EAAE,iBAAiB;AACxB,wBAAA,eAAe,EAAE,iCAAiC;AAClD,wBAAA,iBAAiB,EAAE,mCAAmC;AACzD,qBAAA,EAAA,QAAA,EAAA,2GAAA,EAAA,MAAA,EAAA,CAAA,glBAAA,CAAA,EAAA;;sBAGA,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAKxB,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;;AExB7B;;AAEG;;;;"}
1
+ {"version":3,"file":"agorapulse-ui-components-form-message.mjs","sources":["../../../libs/ui-components/form-message/src/form-message.component.ts","../../../libs/ui-components/form-message/src/form-message.component.html","../../../libs/ui-components/form-message/src/agorapulse-ui-components-form-message.ts"],"sourcesContent":["import { FormFieldComponent } from '@agorapulse/ui-components/form-field';\nimport { SymbolComponent, SymbolRegistry, apErrorFill, apRoundedCheckFill } from '@agorapulse/ui-symbol';\nimport {\n APP_ID,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n Input,\n ViewEncapsulation,\n computed,\n inject,\n signal,\n} from '@angular/core';\n\nexport type MessageType = 'error' | 'success';\n\n@Component({\n selector: 'ap-form-message',\n templateUrl: './form-message.component.html',\n styleUrls: ['./form-message.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [SymbolComponent],\n host: {\n class: 'ap-form-message',\n '[class.error]': \"messageTypeSignal() === 'error'\",\n '[class.success]': \"messageTypeSignal() === 'success'\",\n },\n})\nexport class FormMessageComponent {\n @Input({ required: true })\n set messageType(messageType: MessageType) {\n this.messageTypeSignal.set(messageType);\n }\n\n @Input({ required: true })\n message!: string;\n\n messageTypeSignal = signal<MessageType>('error');\n\n symbolIdSignal = computed(() => {\n return this.messageTypeSignal() === 'error' ? 'error_fill' : 'rounded-check_fill';\n });\n\n /** The id this message is referenced by. A bound `[id]` would land after construction and leave the reference dangling. */\n readonly messageId: string;\n\n private symbolRegistry = inject(SymbolRegistry);\n\n constructor() {\n this.symbolRegistry.registerSymbols([apErrorFill, apRoundedCheckFill]);\n\n // The field cannot query for this: a message usually sits under `@if`, which a non-recursive\n // query misses, while a recursive one would let an outer field adopt a nested field's message.\n const element: HTMLElement = inject(ElementRef).nativeElement;\n if (!element.id) {\n element.id = `${inject(APP_ID)}-form-message-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;\n }\n this.messageId = element.id;\n\n const formField = inject(FormFieldComponent, { optional: true });\n formField?.registerDescription(this.messageId);\n inject(DestroyRef).onDestroy(() => formField?.unregisterDescription(this.messageId));\n }\n}\n","<ap-symbol\n size=\"sm\"\n [symbolId]=\"symbolIdSignal()\" />\n<span>\n {{ message }}\n</span>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;MA8Ba,oBAAoB,CAAA;IAC7B,IACI,WAAW,CAAC,WAAwB,EAAA;AACpC,QAAA,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC;IAC3C;AAGA,IAAA,OAAO;IAEP,iBAAiB,GAAG,MAAM,CAAc,OAAO;0FAAC;AAEhD,IAAA,cAAc,GAAG,QAAQ,CAAC,MAAK;AAC3B,QAAA,OAAO,IAAI,CAAC,iBAAiB,EAAE,KAAK,OAAO,GAAG,YAAY,GAAG,oBAAoB;IACrF,CAAC;uFAAC;;AAGO,IAAA,SAAS;AAEV,IAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AAE/C,IAAA,WAAA,GAAA;QACI,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;;;QAItE,MAAM,OAAO,GAAgB,MAAM,CAAC,UAAU,CAAC,CAAC,aAAa;AAC7D,QAAA,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE;AACb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AAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAOhB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAbhC,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,EAAA,eAAA,EAGV,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,IAAI,EAAA,OAAA,EAC5B,CAAC,eAAe,CAAC,EAAA,IAAA,EACpB;AACF,wBAAA,KAAK,EAAE,iBAAiB;AACxB,wBAAA,eAAe,EAAE,iCAAiC;AAClD,wBAAA,iBAAiB,EAAE,mCAAmC;AACzD,qBAAA,EAAA,QAAA,EAAA,2GAAA,EAAA,MAAA,EAAA,CAAA,glBAAA,CAAA,EAAA;;sBAGA,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAKxB,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;;AEpC7B;;AAEG;;;;"}
@@ -1,3 +1,5 @@
1
+ import * as i1 from '@agorapulse/ui-components/form-field';
2
+ import { FormFieldControlDirective } from '@agorapulse/ui-components/form-field';
1
3
  import * as i0 from '@angular/core';
2
4
  import { inject, ElementRef, Directive } from '@angular/core';
3
5
 
@@ -5,13 +7,15 @@ class InputDirective {
5
7
  elementRef = inject(ElementRef);
6
8
  input = this.elementRef.nativeElement;
7
9
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: InputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
8
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: InputDirective, isStandalone: true, selector: "[apInput]", host: { classAttribute: "ap-input" }, ngImport: i0 });
10
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: InputDirective, isStandalone: true, selector: "[apInput]", host: { classAttribute: "ap-input" }, hostDirectives: [{ directive: i1.FormFieldControlDirective }], ngImport: i0 });
9
11
  }
10
12
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: InputDirective, decorators: [{
11
13
  type: Directive,
12
14
  args: [{
13
15
  selector: '[apInput]',
14
16
  standalone: true,
17
+ // The host is the focusable element, and it is labelable: the surrounding field points its label's `for` at it.
18
+ hostDirectives: [FormFieldControlDirective],
15
19
  host: {
16
20
  class: 'ap-input',
17
21
  },
@@ -1 +1 @@
1
- {"version":3,"file":"agorapulse-ui-components-input.mjs","sources":["../../../libs/ui-components/input/src/input.directive.ts","../../../libs/ui-components/input/src/agorapulse-ui-components-input.ts"],"sourcesContent":["import { Directive, ElementRef, inject } from '@angular/core';\n\n@Directive({\n selector: '[apInput]',\n standalone: true,\n host: {\n class: 'ap-input',\n },\n})\nexport class InputDirective {\n private elementRef = inject(ElementRef);\n\n input: HTMLInputElement = this.elementRef.nativeElement;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;MASa,cAAc,CAAA;AACf,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAEvC,IAAA,KAAK,GAAqB,IAAI,CAAC,UAAU,CAAC,aAAa;uGAH9C,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAd,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,cAAA,EAAA,UAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAP1B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,KAAK,EAAE,UAAU;AACpB,qBAAA;AACJ,iBAAA;;;ACRD;;AAEG;;;;"}
1
+ {"version":3,"file":"agorapulse-ui-components-input.mjs","sources":["../../../libs/ui-components/input/src/input.directive.ts","../../../libs/ui-components/input/src/agorapulse-ui-components-input.ts"],"sourcesContent":["import { FormFieldControlDirective } from '@agorapulse/ui-components/form-field';\nimport { Directive, ElementRef, inject } from '@angular/core';\n\n@Directive({\n selector: '[apInput]',\n standalone: true,\n // The host is the focusable element, and it is labelable: the surrounding field points its label's `for` at it.\n hostDirectives: [FormFieldControlDirective],\n host: {\n class: 'ap-input',\n },\n})\nexport class InputDirective {\n private elementRef = inject(ElementRef);\n\n input: HTMLInputElement = this.elementRef.nativeElement;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;MAYa,cAAc,CAAA;AACf,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAEvC,IAAA,KAAK,GAAqB,IAAI,CAAC,UAAU,CAAC,aAAa;uGAH9C,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAd,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,cAAA,EAAA,UAAA,EAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,yBAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAT1B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,UAAU,EAAE,IAAI;;oBAEhB,cAAc,EAAE,CAAC,yBAAyB,CAAC;AAC3C,oBAAA,IAAI,EAAE;AACF,wBAAA,KAAK,EAAE,UAAU;AACpB,qBAAA;AACJ,iBAAA;;;ACXD;;AAEG;;;;"}
@@ -1,3 +1,4 @@
1
+ import { FormFieldControlDirective } from '@agorapulse/ui-components/form-field';
1
2
  import { UI_COMPONENTS_SYMBOLS } from '@agorapulse/ui-components/providers';
2
3
  import { SymbolRegistry, SymbolComponent } from '@agorapulse/ui-symbol';
3
4
  import * as i0 from '@angular/core';
@@ -49,13 +50,13 @@ class SegmentedControlComponent {
49
50
  this.value.set(option.value);
50
51
  }
51
52
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SegmentedControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
52
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: SegmentedControlComponent, isStandalone: true, selector: "ap-segmented-control", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, fullWidth: { classPropertyName: "fullWidth", publicName: "fullWidth", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class.ap-segmented-control--full-width": "fullWidth()" } }, ngImport: i0, template: "<div\n class=\"ap-segmented-control\"\n role=\"group\"\n [attr.aria-label]=\"ariaLabel() || null\">\n @for (option of options(); track option.value) {\n <button\n type=\"button\"\n class=\"ap-segmented-control__segment\"\n [class.ap-segmented-control__segment--selected]=\"value() === option.value\"\n [attr.aria-pressed]=\"value() === option.value\"\n [disabled]=\"disabled() || (option.disabled ?? false)\"\n (click)=\"select(option)\">\n @if (option.symbolId) {\n <ap-symbol\n class=\"ap-segmented-control__icon\"\n [symbolId]=\"option.symbolId\"\n [size]=\"16\"\n [color]=\"value() === option.value ? 'blue' : 'grey-blue'\" />\n }\n <span class=\"ap-segmented-control__label\">{{ option.label }}</span>\n </button>\n }\n</div>\n", styles: ["ap-segmented-control{display:inline-block}ap-segmented-control.ap-segmented-control--full-width{display:block}ap-segmented-control.ap-segmented-control--full-width .ap-segmented-control{display:flex;width:100%}ap-segmented-control.ap-segmented-control--full-width .ap-segmented-control__segment{flex:1 1 0}.ap-segmented-control{display:inline-flex;align-items:center}.ap-segmented-control .ap-segmented-control__segment{display:inline-flex;align-items:center;justify-content:center;gap:var(--ref-spacing-xxs);box-sizing:border-box;min-height:36px;margin:0;padding:var(--ref-spacing-xxs) var(--ref-spacing-sm);border:1px solid var(--ref-color-grey-20);background-color:var(--ref-color-white);color:var(--ref-color-grey-100);font-family:var(--ref-font-family);font-size:var(--ref-font-size-sm);font-weight:var(--ref-font-weight-bold);line-height:var(--ref-font-line-height-md);white-space:nowrap;cursor:pointer;transition:color .15s ease,border-color .15s ease,background-color .15s ease}.ap-segmented-control .ap-segmented-control__segment:not(:first-child){margin-left:-1px}.ap-segmented-control .ap-segmented-control__segment:first-child{border-top-left-radius:var(--ref-border-radius-sm);border-bottom-left-radius:var(--ref-border-radius-sm)}.ap-segmented-control .ap-segmented-control__segment:last-child{border-top-right-radius:var(--ref-border-radius-sm);border-bottom-right-radius:var(--ref-border-radius-sm)}.ap-segmented-control .ap-segmented-control__segment:hover:not(:disabled){z-index:1;border-color:var(--ref-color-electric-blue-100)}.ap-segmented-control .ap-segmented-control__segment:focus-visible{z-index:2;outline:none;border-color:var(--ref-color-electric-blue-100);box-shadow:0 0 0 1px var(--ref-color-white),0 0 0 3px var(--ref-color-electric-blue-100)}.ap-segmented-control .ap-segmented-control__segment.ap-segmented-control__segment--selected{z-index:1;border-color:var(--ref-color-electric-blue-100);color:var(--ref-color-electric-blue-100)}.ap-segmented-control .ap-segmented-control__segment:disabled{border-color:var(--ref-color-grey-20);background-color:var(--ref-color-grey-05);color:var(--ref-color-grey-40);cursor:not-allowed}.ap-segmented-control .ap-segmented-control__label{font:inherit;min-width:0;overflow:hidden;text-overflow:ellipsis}\n"], dependencies: [{ kind: "component", type: SymbolComponent, selector: "ap-symbol", inputs: ["symbolId", "color", "size"], outputs: ["sizeChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
53
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: SegmentedControlComponent, isStandalone: true, selector: "ap-segmented-control", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, fullWidth: { classPropertyName: "fullWidth", publicName: "fullWidth", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class.ap-segmented-control--full-width": "fullWidth()" } }, ngImport: i0, template: "<div\n class=\"ap-segmented-control\"\n role=\"group\"\n [apFormFieldControl]=\"ariaLabel() || undefined\"\n [disabled]=\"disabled()\">\n @for (option of options(); track option.value) {\n <button\n type=\"button\"\n class=\"ap-segmented-control__segment\"\n [class.ap-segmented-control__segment--selected]=\"value() === option.value\"\n [attr.aria-pressed]=\"value() === option.value\"\n [disabled]=\"disabled() || (option.disabled ?? false)\"\n (click)=\"select(option)\">\n @if (option.symbolId) {\n <ap-symbol\n class=\"ap-segmented-control__icon\"\n [symbolId]=\"option.symbolId\"\n [size]=\"16\"\n [color]=\"value() === option.value ? 'blue' : 'grey-blue'\" />\n }\n <span class=\"ap-segmented-control__label\">{{ option.label }}</span>\n </button>\n }\n</div>\n", styles: ["ap-segmented-control{display:inline-block}ap-segmented-control.ap-segmented-control--full-width{display:block}ap-segmented-control.ap-segmented-control--full-width .ap-segmented-control{display:flex;width:100%}ap-segmented-control.ap-segmented-control--full-width .ap-segmented-control__segment{flex:1 1 0}.ap-segmented-control{display:inline-flex;align-items:center}.ap-segmented-control .ap-segmented-control__segment{display:inline-flex;align-items:center;justify-content:center;gap:var(--ref-spacing-xxs);box-sizing:border-box;min-height:36px;margin:0;padding:var(--ref-spacing-xxs) var(--ref-spacing-sm);border:1px solid var(--ref-color-grey-20);background-color:var(--ref-color-white);color:var(--ref-color-grey-100);font-family:var(--ref-font-family);font-size:var(--ref-font-size-sm);font-weight:var(--ref-font-weight-bold);line-height:var(--ref-font-line-height-md);white-space:nowrap;cursor:pointer;transition:color .15s ease,border-color .15s ease,background-color .15s ease}.ap-segmented-control .ap-segmented-control__segment:not(:first-child){margin-left:-1px}.ap-segmented-control .ap-segmented-control__segment:first-child{border-top-left-radius:var(--ref-border-radius-sm);border-bottom-left-radius:var(--ref-border-radius-sm)}.ap-segmented-control .ap-segmented-control__segment:last-child{border-top-right-radius:var(--ref-border-radius-sm);border-bottom-right-radius:var(--ref-border-radius-sm)}.ap-segmented-control .ap-segmented-control__segment:hover:not(:disabled){z-index:1;border-color:var(--ref-color-electric-blue-100)}.ap-segmented-control .ap-segmented-control__segment:focus-visible{z-index:2;outline:none;border-color:var(--ref-color-electric-blue-100);box-shadow:0 0 0 1px var(--ref-color-white),0 0 0 3px var(--ref-color-electric-blue-100)}.ap-segmented-control .ap-segmented-control__segment.ap-segmented-control__segment--selected{z-index:1;border-color:var(--ref-color-electric-blue-100);color:var(--ref-color-electric-blue-100)}.ap-segmented-control .ap-segmented-control__segment:disabled{border-color:var(--ref-color-grey-20);background-color:var(--ref-color-grey-05);color:var(--ref-color-grey-40);cursor:not-allowed}.ap-segmented-control .ap-segmented-control__label{font:inherit;min-width:0;overflow:hidden;text-overflow:ellipsis}\n"], dependencies: [{ kind: "directive", type: FormFieldControlDirective, selector: "[apFormFieldControl]", inputs: ["apFormFieldControl", "disabled"] }, { kind: "component", type: SymbolComponent, selector: "ap-symbol", inputs: ["symbolId", "color", "size"], outputs: ["sizeChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
53
54
  }
54
55
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SegmentedControlComponent, decorators: [{
55
56
  type: Component,
56
- args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-segmented-control', imports: [SymbolComponent], host: {
57
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-segmented-control', imports: [FormFieldControlDirective, SymbolComponent], host: {
57
58
  '[class.ap-segmented-control--full-width]': 'fullWidth()',
58
- }, encapsulation: ViewEncapsulation.None, template: "<div\n class=\"ap-segmented-control\"\n role=\"group\"\n [attr.aria-label]=\"ariaLabel() || null\">\n @for (option of options(); track option.value) {\n <button\n type=\"button\"\n class=\"ap-segmented-control__segment\"\n [class.ap-segmented-control__segment--selected]=\"value() === option.value\"\n [attr.aria-pressed]=\"value() === option.value\"\n [disabled]=\"disabled() || (option.disabled ?? false)\"\n (click)=\"select(option)\">\n @if (option.symbolId) {\n <ap-symbol\n class=\"ap-segmented-control__icon\"\n [symbolId]=\"option.symbolId\"\n [size]=\"16\"\n [color]=\"value() === option.value ? 'blue' : 'grey-blue'\" />\n }\n <span class=\"ap-segmented-control__label\">{{ option.label }}</span>\n </button>\n }\n</div>\n", styles: ["ap-segmented-control{display:inline-block}ap-segmented-control.ap-segmented-control--full-width{display:block}ap-segmented-control.ap-segmented-control--full-width .ap-segmented-control{display:flex;width:100%}ap-segmented-control.ap-segmented-control--full-width .ap-segmented-control__segment{flex:1 1 0}.ap-segmented-control{display:inline-flex;align-items:center}.ap-segmented-control .ap-segmented-control__segment{display:inline-flex;align-items:center;justify-content:center;gap:var(--ref-spacing-xxs);box-sizing:border-box;min-height:36px;margin:0;padding:var(--ref-spacing-xxs) var(--ref-spacing-sm);border:1px solid var(--ref-color-grey-20);background-color:var(--ref-color-white);color:var(--ref-color-grey-100);font-family:var(--ref-font-family);font-size:var(--ref-font-size-sm);font-weight:var(--ref-font-weight-bold);line-height:var(--ref-font-line-height-md);white-space:nowrap;cursor:pointer;transition:color .15s ease,border-color .15s ease,background-color .15s ease}.ap-segmented-control .ap-segmented-control__segment:not(:first-child){margin-left:-1px}.ap-segmented-control .ap-segmented-control__segment:first-child{border-top-left-radius:var(--ref-border-radius-sm);border-bottom-left-radius:var(--ref-border-radius-sm)}.ap-segmented-control .ap-segmented-control__segment:last-child{border-top-right-radius:var(--ref-border-radius-sm);border-bottom-right-radius:var(--ref-border-radius-sm)}.ap-segmented-control .ap-segmented-control__segment:hover:not(:disabled){z-index:1;border-color:var(--ref-color-electric-blue-100)}.ap-segmented-control .ap-segmented-control__segment:focus-visible{z-index:2;outline:none;border-color:var(--ref-color-electric-blue-100);box-shadow:0 0 0 1px var(--ref-color-white),0 0 0 3px var(--ref-color-electric-blue-100)}.ap-segmented-control .ap-segmented-control__segment.ap-segmented-control__segment--selected{z-index:1;border-color:var(--ref-color-electric-blue-100);color:var(--ref-color-electric-blue-100)}.ap-segmented-control .ap-segmented-control__segment:disabled{border-color:var(--ref-color-grey-20);background-color:var(--ref-color-grey-05);color:var(--ref-color-grey-40);cursor:not-allowed}.ap-segmented-control .ap-segmented-control__label{font:inherit;min-width:0;overflow:hidden;text-overflow:ellipsis}\n"] }]
59
+ }, encapsulation: ViewEncapsulation.None, template: "<div\n class=\"ap-segmented-control\"\n role=\"group\"\n [apFormFieldControl]=\"ariaLabel() || undefined\"\n [disabled]=\"disabled()\">\n @for (option of options(); track option.value) {\n <button\n type=\"button\"\n class=\"ap-segmented-control__segment\"\n [class.ap-segmented-control__segment--selected]=\"value() === option.value\"\n [attr.aria-pressed]=\"value() === option.value\"\n [disabled]=\"disabled() || (option.disabled ?? false)\"\n (click)=\"select(option)\">\n @if (option.symbolId) {\n <ap-symbol\n class=\"ap-segmented-control__icon\"\n [symbolId]=\"option.symbolId\"\n [size]=\"16\"\n [color]=\"value() === option.value ? 'blue' : 'grey-blue'\" />\n }\n <span class=\"ap-segmented-control__label\">{{ option.label }}</span>\n </button>\n }\n</div>\n", styles: ["ap-segmented-control{display:inline-block}ap-segmented-control.ap-segmented-control--full-width{display:block}ap-segmented-control.ap-segmented-control--full-width .ap-segmented-control{display:flex;width:100%}ap-segmented-control.ap-segmented-control--full-width .ap-segmented-control__segment{flex:1 1 0}.ap-segmented-control{display:inline-flex;align-items:center}.ap-segmented-control .ap-segmented-control__segment{display:inline-flex;align-items:center;justify-content:center;gap:var(--ref-spacing-xxs);box-sizing:border-box;min-height:36px;margin:0;padding:var(--ref-spacing-xxs) var(--ref-spacing-sm);border:1px solid var(--ref-color-grey-20);background-color:var(--ref-color-white);color:var(--ref-color-grey-100);font-family:var(--ref-font-family);font-size:var(--ref-font-size-sm);font-weight:var(--ref-font-weight-bold);line-height:var(--ref-font-line-height-md);white-space:nowrap;cursor:pointer;transition:color .15s ease,border-color .15s ease,background-color .15s ease}.ap-segmented-control .ap-segmented-control__segment:not(:first-child){margin-left:-1px}.ap-segmented-control .ap-segmented-control__segment:first-child{border-top-left-radius:var(--ref-border-radius-sm);border-bottom-left-radius:var(--ref-border-radius-sm)}.ap-segmented-control .ap-segmented-control__segment:last-child{border-top-right-radius:var(--ref-border-radius-sm);border-bottom-right-radius:var(--ref-border-radius-sm)}.ap-segmented-control .ap-segmented-control__segment:hover:not(:disabled){z-index:1;border-color:var(--ref-color-electric-blue-100)}.ap-segmented-control .ap-segmented-control__segment:focus-visible{z-index:2;outline:none;border-color:var(--ref-color-electric-blue-100);box-shadow:0 0 0 1px var(--ref-color-white),0 0 0 3px var(--ref-color-electric-blue-100)}.ap-segmented-control .ap-segmented-control__segment.ap-segmented-control__segment--selected{z-index:1;border-color:var(--ref-color-electric-blue-100);color:var(--ref-color-electric-blue-100)}.ap-segmented-control .ap-segmented-control__segment:disabled{border-color:var(--ref-color-grey-20);background-color:var(--ref-color-grey-05);color:var(--ref-color-grey-40);cursor:not-allowed}.ap-segmented-control .ap-segmented-control__label{font:inherit;min-width:0;overflow:hidden;text-overflow:ellipsis}\n"] }]
59
60
  }], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], fullWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullWidth", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
60
61
 
61
62
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"agorapulse-ui-components-segmented-control.mjs","sources":["../../../libs/ui-components/segmented-control/src/segmented-control.component.ts","../../../libs/ui-components/segmented-control/src/segmented-control.component.html","../../../libs/ui-components/segmented-control/src/agorapulse-ui-components-segmented-control.ts"],"sourcesContent":["import { UI_COMPONENTS_SYMBOLS } from '@agorapulse/ui-components/providers';\nimport { agorapulseSymbol, SymbolComponent, SymbolRegistry } from '@agorapulse/ui-symbol';\nimport { ChangeDetectionStrategy, Component, effect, inject, input, model, untracked, ViewEncapsulation } from '@angular/core';\n\nexport interface SegmentedControlOption {\n /** The value bound to the control when this option is selected. */\n value: string;\n /** The text shown on the segment. */\n label: string;\n /** Optional leading icon symbol id. */\n symbolId?: agorapulseSymbol;\n /** Disables this segment only. */\n disabled?: boolean;\n}\n\n/**\n * A single-select control for switching between a small set (2–4) of mutually\n * exclusive options laid out side by side.\n *\n * @example\n * ```html\n * <ap-segmented-control\n * [options]=\"[{ value: 'list', label: 'List' }, { value: 'board', label: 'Board' }]\"\n * [(value)]=\"view\"\n * ariaLabel=\"Choose a view\" />\n * ```\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'ap-segmented-control',\n templateUrl: './segmented-control.component.html',\n styleUrls: ['./segmented-control.component.scss'],\n imports: [SymbolComponent],\n host: {\n '[class.ap-segmented-control--full-width]': 'fullWidth()',\n },\n // Emit plain, global `.ap-segmented-control*` classes (no Angular scoping) so the\n // styling stays framework-agnostic and readable/reusable outside Angular.\n encapsulation: ViewEncapsulation.None,\n})\nexport class SegmentedControlComponent {\n private readonly symbolRegistry = inject(SymbolRegistry);\n\n readonly options = input.required<SegmentedControlOption[]>();\n /** The currently selected value. Supports two-way binding via `[(value)]`. Defaults to the first option's value when unset. */\n readonly value = model<string>('');\n /** Disables the whole control. */\n readonly disabled = input(false);\n /** When true, the control fills its container width and segments share it equally instead of fitting their text. */\n readonly fullWidth = input(false);\n /** Accessible name for the group of segments. */\n readonly ariaLabel = input('');\n\n // Keep `value` defined: fall back to the first option whenever it is unset.\n private readonly defaultValueEffect = effect(() => {\n const [firstOption] = this.options();\n if (!this.value() && firstOption) {\n untracked(() => this.value.set(firstOption.value));\n }\n });\n\n constructor() {\n this.symbolRegistry.withSymbols(...(inject(UI_COMPONENTS_SYMBOLS, { optional: true })?.flat() ?? []));\n }\n\n protected select(option: SegmentedControlOption): void {\n if (this.disabled() || option.disabled) {\n return;\n }\n this.value.set(option.value);\n }\n}\n","<div\n class=\"ap-segmented-control\"\n role=\"group\"\n [attr.aria-label]=\"ariaLabel() || null\">\n @for (option of options(); track option.value) {\n <button\n type=\"button\"\n class=\"ap-segmented-control__segment\"\n [class.ap-segmented-control__segment--selected]=\"value() === option.value\"\n [attr.aria-pressed]=\"value() === option.value\"\n [disabled]=\"disabled() || (option.disabled ?? false)\"\n (click)=\"select(option)\">\n @if (option.symbolId) {\n <ap-symbol\n class=\"ap-segmented-control__icon\"\n [symbolId]=\"option.symbolId\"\n [size]=\"16\"\n [color]=\"value() === option.value ? 'blue' : 'grey-blue'\" />\n }\n <span class=\"ap-segmented-control__label\">{{ option.label }}</span>\n </button>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;AAeA;;;;;;;;;;;AAWG;MAcU,yBAAyB,C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AAuB,CAAC,MAAM,EAAA,QAAA,EACrC,sBAAsB,WAGvB,CAAC,eAAe,CAAC,EAAA,IAAA,EACpB;AACF,wBAAA,0CAA0C,EAAE,aAAa;qBAC5D,EAAA,aAAA,EAGc,iBAAiB,CAAC,IAAI,EAAA,QAAA,EAAA,y7BAAA,EAAA,MAAA,EAAA,CAAA,quEAAA,CAAA,EAAA;;;AEtCzC;;AAEG;;;;"}
1
+ {"version":3,"file":"agorapulse-ui-components-segmented-control.mjs","sources":["../../../libs/ui-components/segmented-control/src/segmented-control.component.ts","../../../libs/ui-components/segmented-control/src/segmented-control.component.html","../../../libs/ui-components/segmented-control/src/agorapulse-ui-components-segmented-control.ts"],"sourcesContent":["import { FormFieldControlDirective } from '@agorapulse/ui-components/form-field';\nimport { UI_COMPONENTS_SYMBOLS } from '@agorapulse/ui-components/providers';\nimport { agorapulseSymbol, SymbolComponent, SymbolRegistry } from '@agorapulse/ui-symbol';\nimport { ChangeDetectionStrategy, Component, effect, inject, input, model, untracked, ViewEncapsulation } from '@angular/core';\n\nexport interface SegmentedControlOption {\n /** The value bound to the control when this option is selected. */\n value: string;\n /** The text shown on the segment. */\n label: string;\n /** Optional leading icon symbol id. */\n symbolId?: agorapulseSymbol;\n /** Disables this segment only. */\n disabled?: boolean;\n}\n\n/**\n * A single-select control for switching between a small set (2–4) of mutually\n * exclusive options laid out side by side.\n *\n * @example\n * ```html\n * <ap-segmented-control\n * [options]=\"[{ value: 'list', label: 'List' }, { value: 'board', label: 'Board' }]\"\n * [(value)]=\"view\"\n * ariaLabel=\"Choose a view\" />\n * ```\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'ap-segmented-control',\n templateUrl: './segmented-control.component.html',\n styleUrls: ['./segmented-control.component.scss'],\n imports: [FormFieldControlDirective, SymbolComponent],\n host: {\n '[class.ap-segmented-control--full-width]': 'fullWidth()',\n },\n // Emit plain, global `.ap-segmented-control*` classes (no Angular scoping) so the\n // styling stays framework-agnostic and readable/reusable outside Angular.\n encapsulation: ViewEncapsulation.None,\n})\nexport class SegmentedControlComponent {\n private readonly symbolRegistry = inject(SymbolRegistry);\n\n readonly options = input.required<SegmentedControlOption[]>();\n /** The currently selected value. Supports two-way binding via `[(value)]`. Defaults to the first option's value when unset. */\n readonly value = model<string>('');\n /** Disables the whole control. */\n readonly disabled = input(false);\n /** When true, the control fills its container width and segments share it equally instead of fitting their text. */\n readonly fullWidth = input(false);\n /** Accessible name for the group of segments. */\n readonly ariaLabel = input('');\n\n // Keep `value` defined: fall back to the first option whenever it is unset.\n private readonly defaultValueEffect = effect(() => {\n const [firstOption] = this.options();\n if (!this.value() && firstOption) {\n untracked(() => this.value.set(firstOption.value));\n }\n });\n\n constructor() {\n this.symbolRegistry.withSymbols(...(inject(UI_COMPONENTS_SYMBOLS, { optional: true })?.flat() ?? []));\n }\n\n protected select(option: SegmentedControlOption): void {\n if (this.disabled() || option.disabled) {\n return;\n }\n this.value.set(option.value);\n }\n}\n","<div\n class=\"ap-segmented-control\"\n role=\"group\"\n [apFormFieldControl]=\"ariaLabel() || undefined\"\n [disabled]=\"disabled()\">\n @for (option of options(); track option.value) {\n <button\n type=\"button\"\n class=\"ap-segmented-control__segment\"\n [class.ap-segmented-control__segment--selected]=\"value() === option.value\"\n [attr.aria-pressed]=\"value() === option.value\"\n [disabled]=\"disabled() || (option.disabled ?? false)\"\n (click)=\"select(option)\">\n @if (option.symbolId) {\n <ap-symbol\n class=\"ap-segmented-control__icon\"\n [symbolId]=\"option.symbolId\"\n [size]=\"16\"\n [color]=\"value() === option.value ? 'blue' : 'grey-blue'\" />\n }\n <span class=\"ap-segmented-control__label\">{{ option.label }}</span>\n </button>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;AAgBA;;;;;;;;;;;AAWG;MAcU,yBAAyB,CAAA;AACjB,IAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAE/C,OAAO,GAAG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3C,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBAbrC,SAAS;sCACW,uBAAuB,CAAC,MAAM,EAAA,QAAA,EACrC,sBAAsB,EAAA,OAAA,EAGvB,CAAC,yBAAyB,EAAE,eAAe,CAAC,EAAA,IAAA,EAC/C;AACF,wBAAA,0CAA0C,EAAE,aAAa;qBAC5D,EAAA,aAAA,EAGc,iBAAiB,CAAC,IAAI,EAAA,QAAA,EAAA,g+BAAA,EAAA,MAAA,EAAA,CAAA,quEAAA,CAAA,EAAA;;;AEvCzC;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, input, output, ViewEncapsulation, ChangeDetectionStrategy, Component, Input, ElementRef, Renderer2, ViewContainerRef, effect, Directive, booleanAttribute, HostListener, ViewChild, EventEmitter, Output, signal, computed, afterNextRender, NgModule } from '@angular/core';
2
+ import { inject, input, output, ViewEncapsulation, ChangeDetectionStrategy, Component, Input, ElementRef, Renderer2, ViewContainerRef, DestroyRef, effect, Directive, booleanAttribute, HostListener, ViewChild, EventEmitter, Output, signal, computed, afterNextRender, NgModule } from '@angular/core';
3
3
  import { NgSelectComponent, NgSelectModule } from '@ng-select/ng-select';
4
4
  import { SymbolRegistry, apPlus, SymbolComponent, apCheck } from '@agorapulse/ui-symbol';
5
5
  import { BadgeComponent } from '@agorapulse/ui-components/badge';
@@ -9,6 +9,7 @@ import { AvatarComponent } from '@agorapulse/ui-components/avatar';
9
9
  import { StopPropagationDirective } from '@agorapulse/ui-components/directives';
10
10
  import { UI_COMPONENTS_SYMBOLS } from '@agorapulse/ui-components/providers';
11
11
  import { Subscription, BehaviorSubject, filter } from 'rxjs';
12
+ import { FormFieldComponent } from '@agorapulse/ui-components/form-field';
12
13
  import { InputSearchComponent } from '@agorapulse/ui-components/input-search';
13
14
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
14
15
  import * as i1 from '@angular/forms';
@@ -134,6 +135,10 @@ class SelectBaseDirective {
134
135
  this.selectComponent.tabIndex.set(0);
135
136
  this.symbolRegistry.registerSymbols([apCheck, apPlus]);
136
137
  this.symbolRegistry.withSymbols(...(inject(UI_COMPONENTS_SYMBOLS, { optional: true })?.flat() ?? []));
138
+ // ng-select's focusable element is its inner input, beyond a directive on the host — hence this adapter over apFormFieldControl.
139
+ const formField = inject(FormFieldComponent, { optional: true });
140
+ formField?.registerControl(this);
141
+ inject(DestroyRef).onDestroy(() => formField?.unregisterControl(this));
137
142
  // Off by default (opt-in via the `clearable` input); enables ng-select's native clear (X).
138
143
  effect(() => this.selectComponent.clearable.set(this.clearable()));
139
144
  // Handle symbolId changes
@@ -179,6 +184,15 @@ class SelectBaseDirective {
179
184
  this.subs.unsubscribe();
180
185
  this.selectComponent.onItemHover = this.originalOnItemHover;
181
186
  }
187
+ /** ng-select's `labelForId` carries the id on its inner input — the one element here a `<label for>` can reach. */
188
+ labelTarget(fallbackId) {
189
+ const id = this.selectComponent.labelForId() ?? fallbackId;
190
+ this.selectComponent.labelForId.set(id);
191
+ return id;
192
+ }
193
+ focus() {
194
+ this.selectComponent.focus();
195
+ }
182
196
  listenToPanel() {
183
197
  // `openEvent` fires before ng-select renders the panel, hence the microtask (cf. `pinSelectedAtTop`).
184
198
  queueMicrotask(() => {