@cngx/ui 0.1.0-rc.5 → 0.1.0-rc.7
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/README.md +112 -0
- package/a11y/README.md +81 -0
- package/context-menu/README.md +98 -0
- package/data-grid-accordion/README.md +27 -0
- package/feedback/README.md +2 -0
- package/fesm2022/cngx-ui-a11y.mjs +320 -0
- package/fesm2022/cngx-ui-a11y.mjs.map +1 -0
- package/fesm2022/cngx-ui-accordion.mjs +19 -8
- package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-action-button.mjs +5 -2
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-breadcrumb.mjs +11 -6
- package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/cngx-ui-chart-panel.mjs +429 -0
- package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -0
- package/fesm2022/cngx-ui-collection.mjs +15 -6
- package/fesm2022/cngx-ui-collection.mjs.map +1 -1
- package/fesm2022/cngx-ui-command-palette.mjs +1005 -0
- package/fesm2022/cngx-ui-command-palette.mjs.map +1 -0
- package/fesm2022/cngx-ui-context-menu.mjs +742 -0
- package/fesm2022/cngx-ui-context-menu.mjs.map +1 -0
- package/fesm2022/cngx-ui-data-grid-accordion.mjs +90 -20
- package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +97 -106
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-layout.mjs +18 -9
- package/fesm2022/cngx-ui-layout.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-accordion.mjs +9 -9
- package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +64 -70
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-paginator.mjs +18 -8
- package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +2 -2
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +20 -7
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +2 -2
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stat-card.mjs +618 -0
- package/fesm2022/cngx-ui-stat-card.mjs.map +1 -0
- package/fesm2022/cngx-ui-stepper.mjs +38 -19
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +36 -19
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-timeline.mjs +495 -0
- package/fesm2022/cngx-ui-timeline.mjs.map +1 -0
- package/fesm2022/cngx-ui-toc.mjs +704 -0
- package/fesm2022/cngx-ui-toc.mjs.map +1 -0
- package/fesm2022/cngx-ui.mjs +2 -2
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/mat-accordion/README.md +1 -1
- package/mat-tabs/styles/mat-tabs.css +20 -17
- package/package.json +32 -1
- package/skeleton/README.md +2 -0
- package/stepper/README.md +2 -2
- package/timeline/README.md +350 -0
- package/toc/README.md +183 -0
- package/types/cngx-ui-a11y.d.ts +303 -0
- package/types/cngx-ui-accordion.d.ts +9 -4
- package/types/cngx-ui-action-button.d.ts +3 -0
- package/types/cngx-ui-breadcrumb.d.ts +5 -0
- package/types/cngx-ui-chart-panel.d.ts +278 -0
- package/types/cngx-ui-collection.d.ts +12 -3
- package/types/cngx-ui-command-palette.d.ts +451 -0
- package/types/cngx-ui-context-menu.d.ts +467 -0
- package/types/cngx-ui-data-grid-accordion.d.ts +72 -15
- package/types/cngx-ui-feedback.d.ts +71 -18
- package/types/cngx-ui-layout.d.ts +8 -3
- package/types/cngx-ui-mat-accordion.d.ts +3 -3
- package/types/cngx-ui-mat-tabs.d.ts +11 -9
- package/types/cngx-ui-paginator.d.ts +13 -3
- package/types/cngx-ui-skeleton.d.ts +13 -1
- package/types/cngx-ui-stat-card.d.ts +327 -0
- package/types/cngx-ui-stepper.d.ts +18 -4
- package/types/cngx-ui-tabs.d.ts +20 -4
- package/types/cngx-ui-timeline.d.ts +479 -0
- package/types/cngx-ui-toc.d.ts +514 -0
- package/types/cngx-ui.d.ts +1 -1
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, makeEnvironmentProviders, SkipSelf, Optional, inject, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { CngxLiveAnnouncer } from '@cngx/common/a11y';
|
|
4
|
+
import { CngxButtonToggleGroup, CngxButtonToggle } from '@cngx/common/interactive';
|
|
5
|
+
import { CngxCard, CngxCardHeader, CngxCardBody, CngxCardFooter } from '@cngx/common/card';
|
|
6
|
+
import { injectA11yPreferences } from '@cngx/core';
|
|
7
|
+
import { nextUid } from '@cngx/core/utils';
|
|
8
|
+
|
|
9
|
+
/** Library defaults - English. Override via {@link provideA11yPanelConfig}. */
|
|
10
|
+
const CNGX_A11Y_PANEL_DEFAULTS = {
|
|
11
|
+
labels: {
|
|
12
|
+
axes: {
|
|
13
|
+
density: 'Spacing',
|
|
14
|
+
textScale: 'Text size',
|
|
15
|
+
motion: 'Motion',
|
|
16
|
+
contrast: 'Contrast',
|
|
17
|
+
},
|
|
18
|
+
reset: 'Reset to defaults',
|
|
19
|
+
heading: 'Accessibility',
|
|
20
|
+
resetMessage: 'Preferences reset to defaults',
|
|
21
|
+
},
|
|
22
|
+
axes: [
|
|
23
|
+
{
|
|
24
|
+
axis: 'density',
|
|
25
|
+
reset: 'comfortable',
|
|
26
|
+
options: [
|
|
27
|
+
{ value: 'compact', label: 'Compact' },
|
|
28
|
+
{ value: 'comfortable', label: 'Comfortable' },
|
|
29
|
+
{ value: 'spacious', label: 'Spacious' },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
axis: 'textScale',
|
|
34
|
+
reset: 'md',
|
|
35
|
+
options: [
|
|
36
|
+
{ value: 'sm', label: 'Small' },
|
|
37
|
+
{ value: 'md', label: 'Default' },
|
|
38
|
+
{ value: 'lg', label: 'Large' },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
axis: 'motion',
|
|
43
|
+
reset: 'auto',
|
|
44
|
+
options: [
|
|
45
|
+
{ value: 'full', label: 'Full' },
|
|
46
|
+
{ value: 'reduced', label: 'Reduced' },
|
|
47
|
+
{ value: 'auto', label: 'System' },
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
axis: 'contrast',
|
|
52
|
+
reset: 'auto',
|
|
53
|
+
options: [
|
|
54
|
+
{ value: 'normal', label: 'Normal' },
|
|
55
|
+
{ value: 'more', label: 'More' },
|
|
56
|
+
{ value: 'auto', label: 'System' },
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Configuration cascade token. Resolution priority (high to low):
|
|
63
|
+
* `provideA11yPanelConfigAt(...)` in a component's `viewProviders`, then
|
|
64
|
+
* `provideA11yPanelConfig(...)` at the application root, then the library
|
|
65
|
+
* defaults.
|
|
66
|
+
*
|
|
67
|
+
* @category ui/a11y
|
|
68
|
+
* @relatedTo provideA11yPanelConfig
|
|
69
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts
|
|
70
|
+
* @since 0.1.0
|
|
71
|
+
*/
|
|
72
|
+
const CNGX_A11Y_PANEL_CONFIG = new InjectionToken('CngxA11yPanelConfig', {
|
|
73
|
+
providedIn: 'root',
|
|
74
|
+
factory: () => CNGX_A11Y_PANEL_DEFAULTS,
|
|
75
|
+
});
|
|
76
|
+
/** Reduce a feature list onto a base config, merging text and axes in isolation. */
|
|
77
|
+
function applyFeatures(base, features) {
|
|
78
|
+
let labels = base.labels;
|
|
79
|
+
let axes = base.axes;
|
|
80
|
+
for (const feature of features) {
|
|
81
|
+
if (feature.kind === 'labels') {
|
|
82
|
+
labels = {
|
|
83
|
+
...labels,
|
|
84
|
+
...feature.payload,
|
|
85
|
+
axes: { ...labels.axes, ...feature.payload.axes },
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
axes = feature.payload;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return { labels, axes };
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Override any subset of the panel text - axis group labels, the Reset label,
|
|
96
|
+
* the default heading, or the Reset announcement. The `axes` record merges
|
|
97
|
+
* key-by-key, so a single axis can be relabelled in isolation.
|
|
98
|
+
*
|
|
99
|
+
* ```ts
|
|
100
|
+
* provideA11yPanelConfig(
|
|
101
|
+
* withA11yPanelLabels({
|
|
102
|
+
* heading: 'Barrierefreiheit',
|
|
103
|
+
* axes: { motion: 'Bewegung' },
|
|
104
|
+
* resetMessage: 'Einstellungen zurueckgesetzt',
|
|
105
|
+
* }),
|
|
106
|
+
* );
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @category ui/a11y
|
|
110
|
+
* @relatedTo provideA11yPanelConfig
|
|
111
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts
|
|
112
|
+
* @since 0.1.0
|
|
113
|
+
*/
|
|
114
|
+
function withA11yPanelLabels(payload) {
|
|
115
|
+
return { kind: 'labels', payload };
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Replace the rendered axis list - reorder groups, drop an axis, or restrict
|
|
119
|
+
* the options a group offers. Supplying a subset renders only those groups.
|
|
120
|
+
*
|
|
121
|
+
* ```ts
|
|
122
|
+
* provideA11yPanelConfig(
|
|
123
|
+
* withA11yPanelAxes([
|
|
124
|
+
* { axis: 'textScale', reset: 'md', options: [
|
|
125
|
+
* { value: 'md', label: 'Default' },
|
|
126
|
+
* { value: 'lg', label: 'Large' },
|
|
127
|
+
* ] },
|
|
128
|
+
* ]),
|
|
129
|
+
* );
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @category ui/a11y
|
|
133
|
+
* @relatedTo provideA11yPanelConfig
|
|
134
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts
|
|
135
|
+
* @since 0.1.0
|
|
136
|
+
*/
|
|
137
|
+
function withA11yPanelAxes(payload) {
|
|
138
|
+
return { kind: 'axes', payload };
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Application-root configuration cascade for the accessibility panel. Pass any
|
|
142
|
+
* combination of `with*` features in `bootstrapApplication`'s providers;
|
|
143
|
+
* supplied features merge with the library defaults, so consumers only declare
|
|
144
|
+
* what they override.
|
|
145
|
+
*
|
|
146
|
+
* @category ui/a11y
|
|
147
|
+
* @relatedTo withA11yPanelLabels
|
|
148
|
+
* @relatedTo withA11yPanelAxes
|
|
149
|
+
* @relatedTo injectA11yPanelConfig
|
|
150
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts
|
|
151
|
+
* @since 0.1.0
|
|
152
|
+
*/
|
|
153
|
+
function provideA11yPanelConfig(...features) {
|
|
154
|
+
// Empty-features: leave the root default reference untouched so downstream
|
|
155
|
+
// identity comparisons stay stable.
|
|
156
|
+
if (features.length === 0) {
|
|
157
|
+
return makeEnvironmentProviders([]);
|
|
158
|
+
}
|
|
159
|
+
return makeEnvironmentProviders([
|
|
160
|
+
{
|
|
161
|
+
provide: CNGX_A11Y_PANEL_CONFIG,
|
|
162
|
+
useValue: applyFeatures(CNGX_A11Y_PANEL_DEFAULTS, features),
|
|
163
|
+
},
|
|
164
|
+
]);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Component-scoped configuration override. Pass into a component's or
|
|
168
|
+
* directive's `viewProviders`; features merge on top of the parent config (an
|
|
169
|
+
* enclosing scope or the application root), so one panel can re-scope its axis
|
|
170
|
+
* subset or labels without disturbing the rest of the app. This is the
|
|
171
|
+
* component-scope tier of the resolution cascade: `provideA11yPanelConfigAt`
|
|
172
|
+
* (nearest) wins over `provideA11yPanelConfig` (root), which wins over the
|
|
173
|
+
* library defaults.
|
|
174
|
+
*
|
|
175
|
+
* ```ts
|
|
176
|
+
* @Component({
|
|
177
|
+
* viewProviders: [
|
|
178
|
+
* provideA11yPanelConfigAt(withA11yPanelAxes([
|
|
179
|
+
* { axis: 'textScale', reset: 'md', options: [
|
|
180
|
+
* { value: 'md', label: 'Default' },
|
|
181
|
+
* { value: 'lg', label: 'Large' },
|
|
182
|
+
* ] },
|
|
183
|
+
* ])),
|
|
184
|
+
* ],
|
|
185
|
+
* })
|
|
186
|
+
* ```
|
|
187
|
+
*
|
|
188
|
+
* @category ui/a11y
|
|
189
|
+
* @relatedTo provideA11yPanelConfig
|
|
190
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts
|
|
191
|
+
* @since 0.1.0
|
|
192
|
+
*/
|
|
193
|
+
function provideA11yPanelConfigAt(...features) {
|
|
194
|
+
return [
|
|
195
|
+
{
|
|
196
|
+
provide: CNGX_A11Y_PANEL_CONFIG,
|
|
197
|
+
useFactory: (parent) => applyFeatures(parent ?? CNGX_A11Y_PANEL_DEFAULTS, features),
|
|
198
|
+
deps: [[new SkipSelf(), new Optional(), CNGX_A11Y_PANEL_CONFIG]],
|
|
199
|
+
},
|
|
200
|
+
];
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Convenience accessor for the resolved panel configuration. Runs in an
|
|
204
|
+
* injection context; resolves through the cascade. Equivalent to
|
|
205
|
+
* `inject(CNGX_A11Y_PANEL_CONFIG)`.
|
|
206
|
+
*
|
|
207
|
+
* @category ui/a11y
|
|
208
|
+
* @relatedTo provideA11yPanelConfig
|
|
209
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts
|
|
210
|
+
* @since 0.1.0
|
|
211
|
+
*/
|
|
212
|
+
function injectA11yPanelConfig() {
|
|
213
|
+
return inject(CNGX_A11Y_PANEL_CONFIG);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Batteries-included accessibility preferences card. Renders one labelled
|
|
218
|
+
* `cngx-button-toggle-group` per configured axis (spacing/density, text size,
|
|
219
|
+
* motion, contrast), each split-bound to the app-wide preference signal from
|
|
220
|
+
* `injectA11yPreferences()`, plus a Reset that restores every axis to its
|
|
221
|
+
* library default and announces the change.
|
|
222
|
+
*
|
|
223
|
+
* It ships no trigger, no overlay, and no placement of its own - it is a plain
|
|
224
|
+
* in-flow `CngxCard`. The consumer decides where it appears: inline, inside a
|
|
225
|
+
* `CngxDrawer`, inside a `CngxDialog`, or behind their own popover trigger.
|
|
226
|
+
* This mirrors `CngxListbox` under `CngxSelect` - the panel owns the axis
|
|
227
|
+
* controls, the consumer owns the overlay.
|
|
228
|
+
*
|
|
229
|
+
* Composition over reinvention (Pillar 3): the shell is `CngxCard`, each
|
|
230
|
+
* control is `CngxButtonToggleGroup` (roving tabindex + `model` value), and the
|
|
231
|
+
* Reset announcement rides the shared root `CngxLiveAnnouncer` - no hand-rolled
|
|
232
|
+
* card, control, or live region. The axis ARIA is the toggle group's own
|
|
233
|
+
* reactive `computed()` output (Pillar 2).
|
|
234
|
+
*
|
|
235
|
+
* ```html
|
|
236
|
+
* <cngx-a11y-panel />
|
|
237
|
+
* ```
|
|
238
|
+
*
|
|
239
|
+
* @category ui/a11y
|
|
240
|
+
* @docsKind primary
|
|
241
|
+
* @wcag AA
|
|
242
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.component.ts
|
|
243
|
+
* @selector cngx-a11y-panel
|
|
244
|
+
* @since 0.1.0
|
|
245
|
+
* @relatedTo CngxCard, CngxButtonToggleGroup, CngxLiveAnnouncer, provideA11yPreferences, provideA11yPanelConfig
|
|
246
|
+
* <example-url>http://localhost:4200/#/ui/a11y/panel/inline</example-url>
|
|
247
|
+
*/
|
|
248
|
+
class CngxA11yPanel {
|
|
249
|
+
announcer = inject(CngxLiveAnnouncer);
|
|
250
|
+
prefs = injectA11yPreferences();
|
|
251
|
+
config = injectA11yPanelConfig();
|
|
252
|
+
uid = nextUid('cngx-a11y-panel');
|
|
253
|
+
/**
|
|
254
|
+
* The axis groups to render. Resolved once from the config: the axis list is
|
|
255
|
+
* static, so this is a plain field (no equality concern). Each view's `value`
|
|
256
|
+
* is its own one-axis `computed`, so a change to one axis re-renders only its
|
|
257
|
+
* group's bound value, not the whole list.
|
|
258
|
+
*/
|
|
259
|
+
axisViews = this.buildAxisViews();
|
|
260
|
+
// Kept as a method, not an inline `.map()` field initializer: compodocx's
|
|
261
|
+
// property-default serializer catastrophically backtracks on a `.map` that
|
|
262
|
+
// returns object literals with nested arrow functions, hanging docs:json.
|
|
263
|
+
buildAxisViews() {
|
|
264
|
+
return this.config.axes.map((spec) => {
|
|
265
|
+
// `CngxA11yPanelAxisSpec` is a discriminated union whose options/reset are
|
|
266
|
+
// typed to each axis' value union, so every value reaching this write is
|
|
267
|
+
// compile-checked valid. Erasing the invariant signal type to `string`
|
|
268
|
+
// here is then safe-by-construction - the union just can't be narrowed
|
|
269
|
+
// through a runtime `spec.axis` index without duplicating the map per axis.
|
|
270
|
+
const sig = this.prefs[spec.axis];
|
|
271
|
+
return {
|
|
272
|
+
axis: spec.axis,
|
|
273
|
+
label: this.config.labels.axes[spec.axis],
|
|
274
|
+
labelId: `${this.uid}-${spec.axis}`,
|
|
275
|
+
options: spec.options,
|
|
276
|
+
value: computed(() => sig()),
|
|
277
|
+
commit: (next) => {
|
|
278
|
+
// `CngxButtonToggleGroup.value` is `model<T | undefined>`; this group
|
|
279
|
+
// never deselects, so `undefined` is never emitted, but the guard
|
|
280
|
+
// keeps the non-undefined axis setter type-safe under strictTemplates.
|
|
281
|
+
if (next !== undefined) {
|
|
282
|
+
sig.set(next);
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
reset() {
|
|
289
|
+
for (const spec of this.config.axes) {
|
|
290
|
+
this.prefs[spec.axis].set(spec.reset);
|
|
291
|
+
}
|
|
292
|
+
// Bulk multi-axis change with focus staying on Reset: announce it (Pillar 2)
|
|
293
|
+
// through the shared root live region rather than a private one.
|
|
294
|
+
this.announcer.announce(this.config.labels.resetMessage);
|
|
295
|
+
}
|
|
296
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxA11yPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
297
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxA11yPanel, isStandalone: true, selector: "cngx-a11y-panel", host: { classAttribute: "cngx-a11y-panel-host" }, ngImport: i0, template: "<cngx-card class=\"cngx-a11y-panel\">\n <header cngxCardHeader class=\"cngx-a11y-panel__header\">\n <ng-content select=\"[cngxA11yPanelHeader]\">\n <h2 class=\"cngx-a11y-panel__heading\">{{ config.labels.heading }}</h2>\n </ng-content>\n </header>\n\n <div cngxCardBody class=\"cngx-a11y-panel__body\">\n @for (axis of axisViews; track axis.axis) {\n <div class=\"cngx-a11y-panel__axis\">\n <span class=\"cngx-a11y-panel__axis-label\" [id]=\"axis.labelId\">{{ axis.label }}</span>\n <cngx-button-toggle-group\n class=\"cngx-a11y-panel__group\"\n [attr.aria-labelledby]=\"axis.labelId\"\n [value]=\"axis.value()\"\n (valueChange)=\"axis.commit($event)\"\n >\n @for (option of axis.options; track option.value) {\n <button cngxButtonToggle [value]=\"option.value\">{{ option.label }}</button>\n }\n </cngx-button-toggle-group>\n </div>\n }\n </div>\n\n <footer cngxCardFooter class=\"cngx-a11y-panel__footer\">\n <button type=\"button\" class=\"cngx-a11y-panel__reset\" (click)=\"reset()\">\n {{ config.labels.reset }}\n </button>\n </footer>\n</cngx-card>\n", styles: ["@layer cngx.components{.cngx-a11y-panel-host{display:block}.cngx-a11y-panel{--cngx-a11y-panel-gap: var(--cngx-space-md, 1rem);--cngx-a11y-panel-axis-gap: var(--cngx-space-sm, .5rem);--cngx-a11y-panel-reset-pad-x: var(--cngx-space-md, 1rem);--cngx-a11y-panel-reset-pad-y: var(--cngx-space-sm, .5rem)}.cngx-a11y-panel__heading{margin:0;font-size:var(--cngx-a11y-panel-heading-size, 1.125rem);font-weight:var(--cngx-a11y-panel-heading-weight, 600);color:var(--cngx-a11y-panel-heading-color, inherit)}.cngx-a11y-panel__body{display:flex;flex-direction:column;gap:var(--cngx-a11y-panel-gap, 1rem)}.cngx-a11y-panel__axis{display:flex;flex-direction:column;gap:var(--cngx-a11y-panel-axis-gap, .5rem)}.cngx-a11y-panel__axis-label{font-weight:var(--cngx-a11y-panel-label-weight, 600);color:var(--cngx-a11y-panel-label-color, inherit)}.cngx-a11y-panel__footer{display:flex;justify-content:flex-end}.cngx-a11y-panel__reset{min-block-size:var(--cngx-target-min, 0px);padding-block:var(--cngx-a11y-panel-reset-pad-y, .5rem);padding-inline:var(--cngx-a11y-panel-reset-pad-x, 1rem);cursor:pointer;color:var(--cngx-a11y-panel-reset-color, inherit);background:var(--cngx-a11y-panel-reset-bg, transparent);border:var(--cngx-a11y-panel-reset-border-width, 1px) solid var(--cngx-a11y-panel-reset-border-color, currentColor);border-radius:var(--cngx-a11y-panel-reset-radius, .375rem)}}\n"], dependencies: [{ kind: "component", type: CngxCard, selector: "cngx-card", inputs: ["as", "href", "ariaLabel", "selected", "selectable", "loading", "disabled", "disabledReason"], outputs: ["selectedChange", "clicked"] }, { kind: "directive", type: CngxCardHeader, selector: "header[cngxCardHeader]" }, { kind: "directive", type: CngxCardBody, selector: "[cngxCardBody]" }, { kind: "directive", type: CngxCardFooter, selector: "footer[cngxCardFooter]" }, { kind: "component", type: CngxButtonToggleGroup, selector: "cngx-button-toggle-group, [cngxButtonToggleGroup]", inputs: ["value", "disabled", "required", "invalid", "errorMessageId", "orientation", "label", "state"], outputs: ["valueChange", "disabledChange", "requiredChange", "invalidChange"], exportAs: ["cngxButtonToggleGroup"] }, { kind: "directive", type: CngxButtonToggle, selector: "button[cngxButtonToggle]", inputs: ["value", "disabled", "cngxDescribedBy"], exportAs: ["cngxButtonToggle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
298
|
+
}
|
|
299
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxA11yPanel, decorators: [{
|
|
300
|
+
type: Component,
|
|
301
|
+
args: [{ selector: 'cngx-a11y-panel', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [
|
|
302
|
+
CngxCard,
|
|
303
|
+
CngxCardHeader,
|
|
304
|
+
CngxCardBody,
|
|
305
|
+
CngxCardFooter,
|
|
306
|
+
CngxButtonToggleGroup,
|
|
307
|
+
CngxButtonToggle,
|
|
308
|
+
], host: { class: 'cngx-a11y-panel-host' }, template: "<cngx-card class=\"cngx-a11y-panel\">\n <header cngxCardHeader class=\"cngx-a11y-panel__header\">\n <ng-content select=\"[cngxA11yPanelHeader]\">\n <h2 class=\"cngx-a11y-panel__heading\">{{ config.labels.heading }}</h2>\n </ng-content>\n </header>\n\n <div cngxCardBody class=\"cngx-a11y-panel__body\">\n @for (axis of axisViews; track axis.axis) {\n <div class=\"cngx-a11y-panel__axis\">\n <span class=\"cngx-a11y-panel__axis-label\" [id]=\"axis.labelId\">{{ axis.label }}</span>\n <cngx-button-toggle-group\n class=\"cngx-a11y-panel__group\"\n [attr.aria-labelledby]=\"axis.labelId\"\n [value]=\"axis.value()\"\n (valueChange)=\"axis.commit($event)\"\n >\n @for (option of axis.options; track option.value) {\n <button cngxButtonToggle [value]=\"option.value\">{{ option.label }}</button>\n }\n </cngx-button-toggle-group>\n </div>\n }\n </div>\n\n <footer cngxCardFooter class=\"cngx-a11y-panel__footer\">\n <button type=\"button\" class=\"cngx-a11y-panel__reset\" (click)=\"reset()\">\n {{ config.labels.reset }}\n </button>\n </footer>\n</cngx-card>\n", styles: ["@layer cngx.components{.cngx-a11y-panel-host{display:block}.cngx-a11y-panel{--cngx-a11y-panel-gap: var(--cngx-space-md, 1rem);--cngx-a11y-panel-axis-gap: var(--cngx-space-sm, .5rem);--cngx-a11y-panel-reset-pad-x: var(--cngx-space-md, 1rem);--cngx-a11y-panel-reset-pad-y: var(--cngx-space-sm, .5rem)}.cngx-a11y-panel__heading{margin:0;font-size:var(--cngx-a11y-panel-heading-size, 1.125rem);font-weight:var(--cngx-a11y-panel-heading-weight, 600);color:var(--cngx-a11y-panel-heading-color, inherit)}.cngx-a11y-panel__body{display:flex;flex-direction:column;gap:var(--cngx-a11y-panel-gap, 1rem)}.cngx-a11y-panel__axis{display:flex;flex-direction:column;gap:var(--cngx-a11y-panel-axis-gap, .5rem)}.cngx-a11y-panel__axis-label{font-weight:var(--cngx-a11y-panel-label-weight, 600);color:var(--cngx-a11y-panel-label-color, inherit)}.cngx-a11y-panel__footer{display:flex;justify-content:flex-end}.cngx-a11y-panel__reset{min-block-size:var(--cngx-target-min, 0px);padding-block:var(--cngx-a11y-panel-reset-pad-y, .5rem);padding-inline:var(--cngx-a11y-panel-reset-pad-x, 1rem);cursor:pointer;color:var(--cngx-a11y-panel-reset-color, inherit);background:var(--cngx-a11y-panel-reset-bg, transparent);border:var(--cngx-a11y-panel-reset-border-width, 1px) solid var(--cngx-a11y-panel-reset-border-color, currentColor);border-radius:var(--cngx-a11y-panel-reset-radius, .375rem)}}\n"] }]
|
|
309
|
+
}] });
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* @module @cngx/ui/a11y
|
|
313
|
+
*/
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Generated bundle index. Do not edit.
|
|
317
|
+
*/
|
|
318
|
+
|
|
319
|
+
export { CNGX_A11Y_PANEL_CONFIG, CNGX_A11Y_PANEL_DEFAULTS, CngxA11yPanel, injectA11yPanelConfig, provideA11yPanelConfig, provideA11yPanelConfigAt, withA11yPanelAxes, withA11yPanelLabels };
|
|
320
|
+
//# sourceMappingURL=cngx-ui-a11y.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cngx-ui-a11y.mjs","sources":["../../../projects/ui/a11y/a11y-panel.config.ts","../../../projects/ui/a11y/a11y-panel.component.ts","../../../projects/ui/a11y/a11y-panel.component.html","../../../projects/ui/a11y/public-api.ts","../../../projects/ui/a11y/cngx-ui-a11y.ts"],"sourcesContent":["import {\n inject,\n InjectionToken,\n makeEnvironmentProviders,\n Optional,\n SkipSelf,\n type EnvironmentProviders,\n type Provider,\n} from '@angular/core';\nimport type {\n CngxContrastPreference,\n CngxDensityValue,\n CngxMotionPreference,\n CngxTextScaleValue,\n} from '@cngx/core';\n\n/**\n * The four accessibility axes the panel can render a control group for.\n * Each maps 1:1 onto a writable signal returned by `injectA11yPreferences()`.\n *\n * @category ui/a11y\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts\n * @since 0.1.0\n */\nexport type CngxA11yPanelAxis = 'density' | 'textScale' | 'motion' | 'contrast';\n\n/**\n * One selectable option in an axis control group: the value written to the\n * axis signal plus the visible/toggle label. `V` is the axis' own value union\n * (e.g. `CngxDensityValue`), so a misspelled value fails to compile rather\n * than reaching the global preference signal. Library defaults are English;\n * consumers relabel via `withA11yPanelAxes`.\n *\n * @category ui/a11y\n * @relatedTo withA11yPanelAxes\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts\n * @since 0.1.0\n */\nexport interface CngxA11yPanelAxisOption<V extends string = string> {\n /** Value written to the axis signal - a valid member of that axis' union. */\n readonly value: V;\n /** Toggle-button label. */\n readonly label: string;\n}\n\n/**\n * A rendered axis control group: which axis, its ordered options, and the\n * value Reset restores (the axis' own library default). This is a\n * discriminated union on `axis`, so `options` and `reset` are typed to that\n * axis' value union - a `{ axis: 'density', reset: 'x' }` is a compile error,\n * not a garbage value written to `<html data-density>`. Reorder or drop axes\n * by supplying a subset via `withA11yPanelAxes`.\n *\n * @category ui/a11y\n * @relatedTo withA11yPanelAxes\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts\n * @since 0.1.0\n */\nexport type CngxA11yPanelAxisSpec =\n | {\n readonly axis: 'density';\n readonly options: readonly CngxA11yPanelAxisOption<CngxDensityValue>[];\n readonly reset: CngxDensityValue;\n }\n | {\n readonly axis: 'textScale';\n readonly options: readonly CngxA11yPanelAxisOption<CngxTextScaleValue>[];\n readonly reset: CngxTextScaleValue;\n }\n | {\n readonly axis: 'motion';\n readonly options: readonly CngxA11yPanelAxisOption<CngxMotionPreference>[];\n readonly reset: CngxMotionPreference;\n }\n | {\n readonly axis: 'contrast';\n readonly options: readonly CngxA11yPanelAxisOption<CngxContrastPreference>[];\n readonly reset: CngxContrastPreference;\n };\n\n/**\n * Panel text: per-axis group labels, the Reset control label, the default\n * heading (shown when no `[cngxA11yPanelHeader]` is projected), and the\n * live-region message announced on Reset. Library defaults are English;\n * consumers localise via {@link withA11yPanelLabels}.\n *\n * @category ui/a11y\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts\n * @since 0.1.0\n */\nexport interface CngxA11yPanelLabels {\n /** Group label (the accessible name) per axis. */\n readonly axes: Readonly<Record<CngxA11yPanelAxis, string>>;\n /** Reset control label. */\n readonly reset: string;\n /** Default heading, shown when no `[cngxA11yPanelHeader]` slot is projected. */\n readonly heading: string;\n /** Live-announced when Reset restores every axis. */\n readonly resetMessage: string;\n}\n\n/**\n * Resolved panel configuration - the text bundle plus the ordered axis list.\n * Merged from the library defaults and any `with*` features by the reducer in\n * {@link provideA11yPanelConfig}.\n *\n * @category ui/a11y\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts\n * @since 0.1.0\n */\nexport interface CngxA11yPanelConfig {\n readonly labels: CngxA11yPanelLabels;\n readonly axes: readonly CngxA11yPanelAxisSpec[];\n}\n\n/**\n * Partial text override accepted by `withA11yPanelLabels`. The `axes`\n * record merges key-by-key, so a consumer can relabel one axis group without\n * restating the rest.\n *\n * @category ui/a11y\n * @relatedTo withA11yPanelLabels\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts\n * @since 0.1.0\n */\nexport interface CngxA11yPanelLabelsOverride {\n readonly axes?: Partial<Record<CngxA11yPanelAxis, string>>;\n readonly reset?: string;\n readonly heading?: string;\n readonly resetMessage?: string;\n}\n\n/** Library defaults - English. Override via {@link provideA11yPanelConfig}. */\nexport const CNGX_A11Y_PANEL_DEFAULTS: CngxA11yPanelConfig = {\n labels: {\n axes: {\n density: 'Spacing',\n textScale: 'Text size',\n motion: 'Motion',\n contrast: 'Contrast',\n },\n reset: 'Reset to defaults',\n heading: 'Accessibility',\n resetMessage: 'Preferences reset to defaults',\n },\n axes: [\n {\n axis: 'density',\n reset: 'comfortable',\n options: [\n { value: 'compact', label: 'Compact' },\n { value: 'comfortable', label: 'Comfortable' },\n { value: 'spacious', label: 'Spacious' },\n ],\n },\n {\n axis: 'textScale',\n reset: 'md',\n options: [\n { value: 'sm', label: 'Small' },\n { value: 'md', label: 'Default' },\n { value: 'lg', label: 'Large' },\n ],\n },\n {\n axis: 'motion',\n reset: 'auto',\n options: [\n { value: 'full', label: 'Full' },\n { value: 'reduced', label: 'Reduced' },\n { value: 'auto', label: 'System' },\n ],\n },\n {\n axis: 'contrast',\n reset: 'auto',\n options: [\n { value: 'normal', label: 'Normal' },\n { value: 'more', label: 'More' },\n { value: 'auto', label: 'System' },\n ],\n },\n ],\n};\n\n/**\n * Configuration cascade token. Resolution priority (high to low):\n * `provideA11yPanelConfigAt(...)` in a component's `viewProviders`, then\n * `provideA11yPanelConfig(...)` at the application root, then the library\n * defaults.\n *\n * @category ui/a11y\n * @relatedTo provideA11yPanelConfig\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts\n * @since 0.1.0\n */\nexport const CNGX_A11Y_PANEL_CONFIG = new InjectionToken<CngxA11yPanelConfig>(\n 'CngxA11yPanelConfig',\n {\n providedIn: 'root',\n factory: () => CNGX_A11Y_PANEL_DEFAULTS,\n },\n);\n\n/**\n * A single configuration override produced by a `with*` feature factory. The\n * reducer in {@link provideA11yPanelConfig} matches on `kind`: `labels` deep-\n * merges the text bundle, `axes` replaces the axis list wholesale.\n *\n * @category ui/a11y\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts\n * @since 0.1.0\n */\nexport type CngxA11yPanelConfigFeature =\n | { readonly kind: 'labels'; readonly payload: CngxA11yPanelLabelsOverride }\n | { readonly kind: 'axes'; readonly payload: readonly CngxA11yPanelAxisSpec[] };\n\n/** Reduce a feature list onto a base config, merging text and axes in isolation. */\nfunction applyFeatures(\n base: CngxA11yPanelConfig,\n features: readonly CngxA11yPanelConfigFeature[],\n): CngxA11yPanelConfig {\n let labels = base.labels;\n let axes = base.axes;\n for (const feature of features) {\n if (feature.kind === 'labels') {\n labels = {\n ...labels,\n ...feature.payload,\n axes: { ...labels.axes, ...feature.payload.axes },\n };\n } else {\n axes = feature.payload;\n }\n }\n return { labels, axes };\n}\n\n/**\n * Override any subset of the panel text - axis group labels, the Reset label,\n * the default heading, or the Reset announcement. The `axes` record merges\n * key-by-key, so a single axis can be relabelled in isolation.\n *\n * ```ts\n * provideA11yPanelConfig(\n * withA11yPanelLabels({\n * heading: 'Barrierefreiheit',\n * axes: { motion: 'Bewegung' },\n * resetMessage: 'Einstellungen zurueckgesetzt',\n * }),\n * );\n * ```\n *\n * @category ui/a11y\n * @relatedTo provideA11yPanelConfig\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts\n * @since 0.1.0\n */\nexport function withA11yPanelLabels(\n payload: CngxA11yPanelLabelsOverride,\n): CngxA11yPanelConfigFeature {\n return { kind: 'labels', payload };\n}\n\n/**\n * Replace the rendered axis list - reorder groups, drop an axis, or restrict\n * the options a group offers. Supplying a subset renders only those groups.\n *\n * ```ts\n * provideA11yPanelConfig(\n * withA11yPanelAxes([\n * { axis: 'textScale', reset: 'md', options: [\n * { value: 'md', label: 'Default' },\n * { value: 'lg', label: 'Large' },\n * ] },\n * ]),\n * );\n * ```\n *\n * @category ui/a11y\n * @relatedTo provideA11yPanelConfig\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts\n * @since 0.1.0\n */\nexport function withA11yPanelAxes(\n payload: readonly CngxA11yPanelAxisSpec[],\n): CngxA11yPanelConfigFeature {\n return { kind: 'axes', payload };\n}\n\n/**\n * Application-root configuration cascade for the accessibility panel. Pass any\n * combination of `with*` features in `bootstrapApplication`'s providers;\n * supplied features merge with the library defaults, so consumers only declare\n * what they override.\n *\n * @category ui/a11y\n * @relatedTo withA11yPanelLabels\n * @relatedTo withA11yPanelAxes\n * @relatedTo injectA11yPanelConfig\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts\n * @since 0.1.0\n */\nexport function provideA11yPanelConfig(\n ...features: CngxA11yPanelConfigFeature[]\n): EnvironmentProviders {\n // Empty-features: leave the root default reference untouched so downstream\n // identity comparisons stay stable.\n if (features.length === 0) {\n return makeEnvironmentProviders([]);\n }\n return makeEnvironmentProviders([\n {\n provide: CNGX_A11Y_PANEL_CONFIG,\n useValue: applyFeatures(CNGX_A11Y_PANEL_DEFAULTS, features),\n },\n ]);\n}\n\n/**\n * Component-scoped configuration override. Pass into a component's or\n * directive's `viewProviders`; features merge on top of the parent config (an\n * enclosing scope or the application root), so one panel can re-scope its axis\n * subset or labels without disturbing the rest of the app. This is the\n * component-scope tier of the resolution cascade: `provideA11yPanelConfigAt`\n * (nearest) wins over `provideA11yPanelConfig` (root), which wins over the\n * library defaults.\n *\n * ```ts\n * @Component({\n * viewProviders: [\n * provideA11yPanelConfigAt(withA11yPanelAxes([\n * { axis: 'textScale', reset: 'md', options: [\n * { value: 'md', label: 'Default' },\n * { value: 'lg', label: 'Large' },\n * ] },\n * ])),\n * ],\n * })\n * ```\n *\n * @category ui/a11y\n * @relatedTo provideA11yPanelConfig\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts\n * @since 0.1.0\n */\nexport function provideA11yPanelConfigAt(\n ...features: CngxA11yPanelConfigFeature[]\n): Provider[] {\n return [\n {\n provide: CNGX_A11Y_PANEL_CONFIG,\n useFactory: (parent: CngxA11yPanelConfig | null) =>\n applyFeatures(parent ?? CNGX_A11Y_PANEL_DEFAULTS, features),\n deps: [[new SkipSelf(), new Optional(), CNGX_A11Y_PANEL_CONFIG]],\n },\n ];\n}\n\n/**\n * Convenience accessor for the resolved panel configuration. Runs in an\n * injection context; resolves through the cascade. Equivalent to\n * `inject(CNGX_A11Y_PANEL_CONFIG)`.\n *\n * @category ui/a11y\n * @relatedTo provideA11yPanelConfig\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.config.ts\n * @since 0.1.0\n */\nexport function injectA11yPanelConfig(): CngxA11yPanelConfig {\n return inject(CNGX_A11Y_PANEL_CONFIG);\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n ViewEncapsulation,\n type Signal,\n type WritableSignal,\n} from '@angular/core';\nimport { CngxLiveAnnouncer } from '@cngx/common/a11y';\nimport { CngxButtonToggle, CngxButtonToggleGroup } from '@cngx/common/interactive';\nimport { CngxCard, CngxCardBody, CngxCardFooter, CngxCardHeader } from '@cngx/common/card';\nimport { injectA11yPreferences } from '@cngx/core';\nimport { nextUid } from '@cngx/core/utils';\n\nimport {\n type CngxA11yPanelAxis,\n type CngxA11yPanelAxisOption,\n injectA11yPanelConfig,\n} from './a11y-panel.config';\n\n/**\n * One rendered axis group, resolved once from the config against the\n * matching preference signal. `value` reads the current axis value as a\n * string; `commit` writes a picked option back through the same signal.\n * @internal\n */\ninterface CngxA11yPanelAxisView {\n readonly axis: CngxA11yPanelAxis;\n readonly label: string;\n readonly labelId: string;\n readonly options: readonly CngxA11yPanelAxisOption[];\n readonly value: Signal<string>;\n readonly commit: (next: string | undefined) => void;\n}\n\n/**\n * Batteries-included accessibility preferences card. Renders one labelled\n * `cngx-button-toggle-group` per configured axis (spacing/density, text size,\n * motion, contrast), each split-bound to the app-wide preference signal from\n * `injectA11yPreferences()`, plus a Reset that restores every axis to its\n * library default and announces the change.\n *\n * It ships no trigger, no overlay, and no placement of its own - it is a plain\n * in-flow `CngxCard`. The consumer decides where it appears: inline, inside a\n * `CngxDrawer`, inside a `CngxDialog`, or behind their own popover trigger.\n * This mirrors `CngxListbox` under `CngxSelect` - the panel owns the axis\n * controls, the consumer owns the overlay.\n *\n * Composition over reinvention (Pillar 3): the shell is `CngxCard`, each\n * control is `CngxButtonToggleGroup` (roving tabindex + `model` value), and the\n * Reset announcement rides the shared root `CngxLiveAnnouncer` - no hand-rolled\n * card, control, or live region. The axis ARIA is the toggle group's own\n * reactive `computed()` output (Pillar 2).\n *\n * ```html\n * <cngx-a11y-panel />\n * ```\n *\n * @category ui/a11y\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/a11y/a11y-panel.component.ts\n * @selector cngx-a11y-panel\n * @since 0.1.0\n * @relatedTo CngxCard, CngxButtonToggleGroup, CngxLiveAnnouncer, provideA11yPreferences, provideA11yPanelConfig\n * <example-url>http://localhost:4200/#/ui/a11y/panel/inline</example-url>\n */\n@Component({\n selector: 'cngx-a11y-panel',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [\n CngxCard,\n CngxCardHeader,\n CngxCardBody,\n CngxCardFooter,\n CngxButtonToggleGroup,\n CngxButtonToggle,\n ],\n templateUrl: './a11y-panel.component.html',\n styleUrls: ['./a11y-panel.component.css'],\n host: { class: 'cngx-a11y-panel-host' },\n})\nexport class CngxA11yPanel {\n private readonly announcer = inject(CngxLiveAnnouncer);\n private readonly prefs = injectA11yPreferences();\n protected readonly config = injectA11yPanelConfig();\n private readonly uid = nextUid('cngx-a11y-panel');\n\n /**\n * The axis groups to render. Resolved once from the config: the axis list is\n * static, so this is a plain field (no equality concern). Each view's `value`\n * is its own one-axis `computed`, so a change to one axis re-renders only its\n * group's bound value, not the whole list.\n */\n protected readonly axisViews: readonly CngxA11yPanelAxisView[] = this.buildAxisViews();\n\n // Kept as a method, not an inline `.map()` field initializer: compodocx's\n // property-default serializer catastrophically backtracks on a `.map` that\n // returns object literals with nested arrow functions, hanging docs:json.\n private buildAxisViews(): readonly CngxA11yPanelAxisView[] {\n return this.config.axes.map((spec) => {\n // `CngxA11yPanelAxisSpec` is a discriminated union whose options/reset are\n // typed to each axis' value union, so every value reaching this write is\n // compile-checked valid. Erasing the invariant signal type to `string`\n // here is then safe-by-construction - the union just can't be narrowed\n // through a runtime `spec.axis` index without duplicating the map per axis.\n const sig = this.prefs[spec.axis] as unknown as WritableSignal<string>;\n return {\n axis: spec.axis,\n label: this.config.labels.axes[spec.axis],\n labelId: `${this.uid}-${spec.axis}`,\n options: spec.options,\n value: computed(() => sig()),\n commit: (next: string | undefined) => {\n // `CngxButtonToggleGroup.value` is `model<T | undefined>`; this group\n // never deselects, so `undefined` is never emitted, but the guard\n // keeps the non-undefined axis setter type-safe under strictTemplates.\n if (next !== undefined) {\n sig.set(next);\n }\n },\n };\n });\n }\n\n protected reset(): void {\n for (const spec of this.config.axes) {\n (this.prefs[spec.axis] as unknown as WritableSignal<string>).set(spec.reset);\n }\n // Bulk multi-axis change with focus staying on Reset: announce it (Pillar 2)\n // through the shared root live region rather than a private one.\n this.announcer.announce(this.config.labels.resetMessage);\n }\n}\n","<cngx-card class=\"cngx-a11y-panel\">\n <header cngxCardHeader class=\"cngx-a11y-panel__header\">\n <ng-content select=\"[cngxA11yPanelHeader]\">\n <h2 class=\"cngx-a11y-panel__heading\">{{ config.labels.heading }}</h2>\n </ng-content>\n </header>\n\n <div cngxCardBody class=\"cngx-a11y-panel__body\">\n @for (axis of axisViews; track axis.axis) {\n <div class=\"cngx-a11y-panel__axis\">\n <span class=\"cngx-a11y-panel__axis-label\" [id]=\"axis.labelId\">{{ axis.label }}</span>\n <cngx-button-toggle-group\n class=\"cngx-a11y-panel__group\"\n [attr.aria-labelledby]=\"axis.labelId\"\n [value]=\"axis.value()\"\n (valueChange)=\"axis.commit($event)\"\n >\n @for (option of axis.options; track option.value) {\n <button cngxButtonToggle [value]=\"option.value\">{{ option.label }}</button>\n }\n </cngx-button-toggle-group>\n </div>\n }\n </div>\n\n <footer cngxCardFooter class=\"cngx-a11y-panel__footer\">\n <button type=\"button\" class=\"cngx-a11y-panel__reset\" (click)=\"reset()\">\n {{ config.labels.reset }}\n </button>\n </footer>\n</cngx-card>\n","/**\n * @module @cngx/ui/a11y\n */\n\nexport { CngxA11yPanel } from './a11y-panel.component';\n\nexport {\n CNGX_A11Y_PANEL_CONFIG,\n CNGX_A11Y_PANEL_DEFAULTS,\n provideA11yPanelConfig,\n provideA11yPanelConfigAt,\n withA11yPanelLabels,\n withA11yPanelAxes,\n injectA11yPanelConfig,\n} from './a11y-panel.config';\nexport type {\n CngxA11yPanelConfig,\n CngxA11yPanelAxis,\n CngxA11yPanelAxisSpec,\n CngxA11yPanelAxisOption,\n CngxA11yPanelLabels,\n CngxA11yPanelLabelsOverride,\n CngxA11yPanelConfigFeature,\n} from './a11y-panel.config';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAoIA;AACO,MAAM,wBAAwB,GAAwB;AAC3D,IAAA,MAAM,EAAE;AACN,QAAA,IAAI,EAAE;AACJ,YAAA,OAAO,EAAE,SAAS;AAClB,YAAA,SAAS,EAAE,WAAW;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