@cngx/ui 0.1.0-rc.6 → 0.1.0-rc.8

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 (102) hide show
  1. package/README.md +112 -1
  2. package/a11y/README.md +87 -0
  3. package/accordion/README.md +4 -2
  4. package/breadcrumb/README.md +262 -0
  5. package/collection/README.md +6 -0
  6. package/command-palette/README.md +224 -0
  7. package/context-menu/README.md +98 -0
  8. package/data-grid-accordion/README.md +103 -2
  9. package/feedback/README.md +42 -0
  10. package/fesm2022/cngx-ui-a11y.mjs +452 -0
  11. package/fesm2022/cngx-ui-a11y.mjs.map +1 -0
  12. package/fesm2022/cngx-ui-accordion.mjs +116 -38
  13. package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
  14. package/fesm2022/cngx-ui-action-button.mjs +115 -50
  15. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  16. package/fesm2022/cngx-ui-breadcrumb.mjs +181 -96
  17. package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
  18. package/fesm2022/cngx-ui-chart-panel.mjs +586 -0
  19. package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -0
  20. package/fesm2022/cngx-ui-collection.mjs +207 -66
  21. package/fesm2022/cngx-ui-collection.mjs.map +1 -1
  22. package/fesm2022/cngx-ui-command-palette.mjs +1281 -0
  23. package/fesm2022/cngx-ui-command-palette.mjs.map +1 -0
  24. package/fesm2022/cngx-ui-context-menu.mjs +857 -0
  25. package/fesm2022/cngx-ui-context-menu.mjs.map +1 -0
  26. package/fesm2022/cngx-ui-data-grid-accordion.mjs +498 -111
  27. package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
  28. package/fesm2022/cngx-ui-empty-state.mjs +16 -6
  29. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
  30. package/fesm2022/cngx-ui-feedback.mjs +1095 -521
  31. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  32. package/fesm2022/cngx-ui-layout.mjs +18 -9
  33. package/fesm2022/cngx-ui-layout.mjs.map +1 -1
  34. package/fesm2022/cngx-ui-mat-accordion.mjs +84 -16
  35. package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
  36. package/fesm2022/cngx-ui-mat-paginator.mjs +67 -24
  37. package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -1
  38. package/fesm2022/cngx-ui-mat-stepper.mjs +72 -47
  39. package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
  40. package/fesm2022/cngx-ui-mat-tabs.mjs +370 -203
  41. package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
  42. package/fesm2022/cngx-ui-overlay.mjs +69 -13
  43. package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
  44. package/fesm2022/cngx-ui-paginator.mjs +501 -182
  45. package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
  46. package/fesm2022/cngx-ui-sidenav.mjs +327 -106
  47. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  48. package/fesm2022/cngx-ui-skeleton.mjs +22 -21
  49. package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
  50. package/fesm2022/cngx-ui-speak.mjs +107 -8
  51. package/fesm2022/cngx-ui-speak.mjs.map +1 -1
  52. package/fesm2022/cngx-ui-stat-card.mjs +718 -0
  53. package/fesm2022/cngx-ui-stat-card.mjs.map +1 -0
  54. package/fesm2022/cngx-ui-stepper.mjs +217 -76
  55. package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
  56. package/fesm2022/cngx-ui-tabs.mjs +40 -19
  57. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  58. package/fesm2022/cngx-ui-timeline.mjs +548 -0
  59. package/fesm2022/cngx-ui-timeline.mjs.map +1 -0
  60. package/fesm2022/cngx-ui-toc.mjs +748 -0
  61. package/fesm2022/cngx-ui-toc.mjs.map +1 -0
  62. package/fesm2022/cngx-ui.mjs +16 -21
  63. package/fesm2022/cngx-ui.mjs.map +1 -1
  64. package/mat-accordion/README.md +1 -1
  65. package/mat-paginator/README.md +9 -2
  66. package/mat-tabs/styles/mat-tabs.css +29 -27
  67. package/overlay/README.md +9 -4
  68. package/package.json +32 -1
  69. package/paginator/README.md +8 -4
  70. package/sidenav/README.md +33 -11
  71. package/skeleton/README.md +2 -0
  72. package/speak/README.md +3 -2
  73. package/stepper/README.md +15 -3
  74. package/timeline/README.md +350 -0
  75. package/toc/README.md +186 -0
  76. package/types/cngx-ui-a11y.d.ts +394 -0
  77. package/types/cngx-ui-accordion.d.ts +100 -30
  78. package/types/cngx-ui-action-button.d.ts +47 -3
  79. package/types/cngx-ui-breadcrumb.d.ts +159 -58
  80. package/types/cngx-ui-chart-panel.d.ts +382 -0
  81. package/types/cngx-ui-collection.d.ts +159 -58
  82. package/types/cngx-ui-command-palette.d.ts +565 -0
  83. package/types/cngx-ui-context-menu.d.ts +559 -0
  84. package/types/cngx-ui-data-grid-accordion.d.ts +344 -51
  85. package/types/cngx-ui-empty-state.d.ts +9 -2
  86. package/types/cngx-ui-feedback.d.ts +664 -73
  87. package/types/cngx-ui-layout.d.ts +8 -3
  88. package/types/cngx-ui-mat-accordion.d.ts +32 -4
  89. package/types/cngx-ui-mat-paginator.d.ts +37 -8
  90. package/types/cngx-ui-mat-stepper.d.ts +23 -11
  91. package/types/cngx-ui-mat-tabs.d.ts +218 -23
  92. package/types/cngx-ui-overlay.d.ts +56 -10
  93. package/types/cngx-ui-paginator.d.ts +416 -132
  94. package/types/cngx-ui-sidenav.d.ts +248 -74
  95. package/types/cngx-ui-skeleton.d.ts +18 -7
  96. package/types/cngx-ui-speak.d.ts +118 -5
  97. package/types/cngx-ui-stat-card.d.ts +411 -0
  98. package/types/cngx-ui-stepper.d.ts +81 -29
  99. package/types/cngx-ui-tabs.d.ts +22 -6
  100. package/types/cngx-ui-timeline.d.ts +495 -0
  101. package/types/cngx-ui-toc.d.ts +581 -0
  102. package/types/cngx-ui.d.ts +8 -5
@@ -0,0 +1,586 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, signal, input, computed, untracked, viewChild, effect, ViewEncapsulation, ChangeDetectionStrategy, Component, makeEnvironmentProviders, DestroyRef, Directive, HostAttributeToken, ElementRef } from '@angular/core';
3
+ import { CngxLiveRegion } from '@cngx/common/a11y';
4
+ import { createFilledOverrideMerge, nextUid, createOverrideMerge } from '@cngx/core/utils';
5
+ import { createLanguageSection } from '@cngx/core/i18n';
6
+
7
+ /**
8
+ * The English chart-panel section: the single source of the chart panel's
9
+ * English copy. The `CNGX_CHART_PANEL_CONFIG` labels default to it.
10
+ *
11
+ * @category ui/chart-panel/i18n
12
+ * @since 0.1.0
13
+ * @relatedTo CNGX_CHART_PANEL_CONFIG
14
+ */
15
+ const CNGX_CHART_PANEL_LANGUAGE_EN = {
16
+ busy: 'Updating',
17
+ };
18
+
19
+ /**
20
+ * @internal The chart-panel section of the active pack over the English section,
21
+ * shared app-wide. Consumers override copy through `withChartPanelAriaLabels`.
22
+ */
23
+ const injectChartPanelSiteCopy = createLanguageSection('chartPanel', CNGX_CHART_PANEL_LANGUAGE_EN);
24
+
25
+ /**
26
+ * Library defaults for the chart-panel configuration cascade. Carries no copy:
27
+ * the `ariaLabels` defaults are the `chartPanel` section of the language pack;
28
+ * single keys ride the `withChartPanelAriaLabels` feature.
29
+ *
30
+ * Exported for intra-lib consumers but **NOT** re-exported from
31
+ * `public-api.ts` - downstream consumers reach the defaults via
32
+ * `inject(CNGX_CHART_PANEL_CONFIG)`.
33
+ *
34
+ * @internal
35
+ */
36
+ const CNGX_CHART_PANEL_DEFAULTS = {
37
+ legendPosition: 'bottom',
38
+ };
39
+ /**
40
+ * App-wide configuration cascade for the chart-panel. `providedIn: 'root'`
41
+ * with a default factory, so `inject(CNGX_CHART_PANEL_CONFIG)` always
42
+ * resolves.
43
+ *
44
+ * @category ui/chart-panel
45
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/chart-panel/config/chart-panel.config.defaults.ts
46
+ * @since 0.1.0
47
+ * @relatedTo provideChartPanelConfig, provideChartPanelConfigAt, injectChartPanelConfig
48
+ */
49
+ const CNGX_CHART_PANEL_CONFIG = new InjectionToken('CNGX_CHART_PANEL_CONFIG', {
50
+ providedIn: 'root',
51
+ factory: () => CNGX_CHART_PANEL_DEFAULTS,
52
+ });
53
+
54
+ /**
55
+ * Convenience accessor for the chart-panel configuration cascade. Runs in
56
+ * injection context; resolves through the priority chain (per-instance Input
57
+ * -> `provideChartPanelConfigAt` -> `provideChartPanelConfig` -> library
58
+ * defaults). Equivalent to `inject(CNGX_CHART_PANEL_CONFIG)` - the helper
59
+ * exists so consumers don't import the token directly.
60
+ *
61
+ * @category ui/chart-panel
62
+ * @since 0.1.0
63
+ */
64
+ function injectChartPanelConfig() {
65
+ return inject(CNGX_CHART_PANEL_CONFIG);
66
+ }
67
+ /**
68
+ * The resolved strings of the chart-panel config in scope, every key the
69
+ * config leaves unset (also a key an override sets to `undefined`) filled from
70
+ * the `chartPanel` section of the active pack, as a Signal that follows a
71
+ * runtime language switch. Runs in injection context; read it inside a `computed()`, a
72
+ * template or a handler, and untracked where it builds live-region text.
73
+ *
74
+ * @category ui/chart-panel
75
+ * @since 0.1.0
76
+ */
77
+ function injectChartPanelAriaLabels() {
78
+ return createFilledOverrideMerge(injectChartPanelSiteCopy(), injectChartPanelConfig().ariaLabels);
79
+ }
80
+
81
+ /** DI token carrying the {@link CngxChartPanelRegistry} a `CngxChartPanel` provides. */
82
+ const CNGX_CHART_PANEL = new InjectionToken('CNGX_CHART_PANEL');
83
+
84
+ /**
85
+ * Dashboard housing for a chart: a titled, footer-capable region that frames
86
+ * whatever `cngx-chart` or preset the consumer projects into it.
87
+ *
88
+ * **What it deliberately does not do.** `cngx-chart` already owns the data-level
89
+ * async envelope - its own `[state]`, its skeleton / empty / error slots, its
90
+ * SR data table. The panel never duplicates that machine. Reproducing it here
91
+ * would put two managers on one state (Pillar 1) and turn the panel into a
92
+ * God-component (Pillar 3). The chart stays the authority on what the body
93
+ * shows; the panel only frames it.
94
+ *
95
+ * What the panel does own is the chrome a bare chart cannot express: a title
96
+ * that names the region for assistive tech, a subtitle, a header action
97
+ * cluster, and a footer. `role="group"` plus `aria-labelledby` pointing at the
98
+ * projected title means a screen reader announces "Revenue by quarter, group"
99
+ * instead of dropping the user into an unlabelled SVG (Pillar 2).
100
+ *
101
+ * Panel-level busy marks the **header**, never the group. An `aria-busy` on the
102
+ * region would hold back the projected chart's own live announcements and tell
103
+ * AT that a perfectly stable chart is updating - the same boundary violation in
104
+ * the a11y layer that duplicating its view switch would be in the state layer.
105
+ * A hidden status region (outside the busy header) announces the configured
106
+ * `ariaLabels.busy` string while the panel-level operation runs.
107
+ *
108
+ * ```html
109
+ * <cngx-chart-panel>
110
+ * <h3 cngxChartPanelTitle>Revenue by quarter</h3>
111
+ * <span cngxChartPanelSubtitle>EUR, net</span>
112
+ * <button cngxChartPanelActions type="button">Refresh</button>
113
+ *
114
+ * <cngx-chart [data]="series" [state]="revenue">
115
+ * <svg:g cngxLine [data]="series"></svg:g>
116
+ * </cngx-chart>
117
+ *
118
+ * <small cngxChartPanelFooter>Source: finance warehouse</small>
119
+ * </cngx-chart-panel>
120
+ * ```
121
+ *
122
+ * @category ui/chart-panel
123
+ * @docsKind primary
124
+ * @wcag AA
125
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/chart-panel/chart-panel.component.ts
126
+ * @since 0.1.0
127
+ * @relatedTo CngxChart, CngxChartLegend, CngxChartPanelTitle, CngxChartPanelActions
128
+ *
129
+ * <example-url>http://localhost:4200/#/ui/chart-panel/basic/titled-panel-with-legend</example-url>
130
+ * <example-url>http://localhost:4200/#/ui/chart-panel/async/panel-chrome-vs-chart-state</example-url>
131
+ * <example-url>http://localhost:4200/#/ui/chart-panel/slots/actions-and-footer</example-url>
132
+ */
133
+ class CngxChartPanel {
134
+ titleId = signal(undefined, ...(ngDevMode ? [{ debugName: "titleId" }] : /* istanbul ignore next */ []));
135
+ config = injectChartPanelConfig();
136
+ ariaLabels = injectChartPanelAriaLabels();
137
+ /**
138
+ * Panel-level async envelope - the one driving the header chrome, not the
139
+ * chart's data. Bind the chart's own `[state]` to the chart; bind a
140
+ * range-switch or export operation here. Optional per the bridge-input rule.
141
+ */
142
+ state = input(undefined, { ...(ngDevMode ? { debugName: "state" } : /* istanbul ignore next */ {}), transform: (v) => (typeof v === 'string' ? undefined : v) });
143
+ /**
144
+ * Where the projected `cngx-chart-legend` sits. `'none'` hides it. Matches
145
+ * the bare `cngx-chart-legend` tag; a legend wrapped in an element of your
146
+ * own lands in the body slot instead.
147
+ */
148
+ legendPosition = input(this.config.legendPosition ?? 'bottom', ...(ngDevMode ? [{ debugName: "legendPosition" }] : /* istanbul ignore next */ []));
149
+ /** @internal Panel-level busy, never the chart's data-loading state. */
150
+ panelBusy = computed(() => this.state()?.isBusy() ?? false, ...(ngDevMode ? [{ debugName: "panelBusy" }] : /* istanbul ignore next */ []));
151
+ /** {@inheritDoc CngxChartPanelRegistry.busy} */
152
+ busy = this.panelBusy;
153
+ /** @internal Names why the action cluster is disabled while busy; follows a language switch. */
154
+ busyLabel = computed(() => this.ariaLabels().busy, ...(ngDevMode ? [{ debugName: "busyLabel" }] : /* istanbul ignore next */ []));
155
+ /**
156
+ * @internal Text of the hidden status region. The label is read untracked, so
157
+ * a language switch does not re-announce a running busy phase; the next one
158
+ * speaks the new language.
159
+ */
160
+ busyStatus = computed(() => this.panelBusy() ? untracked(() => this.ariaLabels().busy) : '', ...(ngDevMode ? [{ debugName: "busyStatus" }] : /* istanbul ignore next */ []));
161
+ /** {@inheritDoc CngxChartPanelRegistry.busyDescriptionId} */
162
+ busyDescriptionId = `${nextUid('cngx-chart-panel')}-busy`;
163
+ actionSlot = viewChild.required('actionSlot');
164
+ constructor() {
165
+ // Keyboard guard for the aria-disabled action cluster. `pointer-events:
166
+ // none` stops clicks while busy, but a focused action still activates on
167
+ // Enter/Space. Capture phase, so the guard runs before any consumer key
168
+ // handler on the projected actions - a bubble listener would fire after
169
+ // them and hold back only the native activation. preventDefault on
170
+ // keydown stops the synthesized Enter click; keyup covers browsers that
171
+ // activate buttons on Space release.
172
+ effect((onCleanup) => {
173
+ const slot = this.actionSlot().nativeElement;
174
+ const guard = (event) => {
175
+ if (!this.panelBusy()) {
176
+ return;
177
+ }
178
+ if (event.key === 'Enter' || event.key === ' ') {
179
+ event.preventDefault();
180
+ event.stopPropagation();
181
+ }
182
+ };
183
+ slot.addEventListener('keydown', guard, true);
184
+ slot.addEventListener('keyup', guard, true);
185
+ onCleanup(() => {
186
+ slot.removeEventListener('keydown', guard, true);
187
+ slot.removeEventListener('keyup', guard, true);
188
+ });
189
+ });
190
+ }
191
+ /** {@inheritDoc CngxChartPanelRegistry.registerTitle} */
192
+ registerTitle(id) {
193
+ this.titleId.set(id);
194
+ }
195
+ /** {@inheritDoc CngxChartPanelRegistry.unregisterTitle} */
196
+ unregisterTitle(id) {
197
+ this.titleId.update((current) => (current === id ? undefined : current));
198
+ }
199
+ /**
200
+ * @internal Accessible name of the region, from the projected title slot.
201
+ * `null` when no title was projected - an unnamed group is better than one
202
+ * pointing at an id that does not exist.
203
+ */
204
+ labelledBy = computed(() => this.titleId() ?? null, ...(ngDevMode ? [{ debugName: "labelledBy" }] : /* istanbul ignore next */ []));
205
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
206
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.4", type: CngxChartPanel, isStandalone: true, selector: "cngx-chart-panel", inputs: { state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, legendPosition: { classPropertyName: "legendPosition", publicName: "legendPosition", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "attr.aria-labelledby": "labelledBy()", "attr.data-legend": "legendPosition()", "class.cngx-chart-panel--busy": "panelBusy()" }, classAttribute: "cngx-chart-panel" }, providers: [{ provide: CNGX_CHART_PANEL, useExisting: CngxChartPanel }], viewQueries: [{ propertyName: "actionSlot", first: true, predicate: ["actionSlot"], descendants: true, isSignal: true }], ngImport: i0, template: `
207
+ <header class="cngx-chart-panel__header" [attr.aria-busy]="panelBusy() || null">
208
+ <div class="cngx-chart-panel__heading">
209
+ <ng-content select="[cngxChartPanelTitle]" />
210
+ <ng-content select="[cngxChartPanelSubtitle]" />
211
+ </div>
212
+
213
+ <!-- Dimmed and aria-disabled while a panel-level operation runs, so a
214
+ second range change is not invited into an in-flight one. The cluster
215
+ stays in the DOM and in the a11y tree; only the state flips (Pillar
216
+ 2). Deliberately not inert: that would hide the actions from AT
217
+ entirely and the aria-disabled would never be announced. A group,
218
+ since aria-disabled is not allowed on a generic container; it
219
+ covers any projected content, while each [cngxChartPanelActions]
220
+ control also carries the state and the reason itself. -->
221
+ <div
222
+ #actionSlot
223
+ class="cngx-chart-panel__action-slot"
224
+ role="group"
225
+ [attr.aria-disabled]="panelBusy() || null"
226
+ [attr.aria-describedby]="panelBusy() ? busyDescriptionId : null"
227
+ >
228
+ <ng-content select="[cngxChartPanelActions]" />
229
+ </div>
230
+ </header>
231
+
232
+ <!-- Why the actions are disabled. Always in the DOM; only the
233
+ aria-describedby reference above is gated on the busy state. -->
234
+ <span
235
+ [id]="busyDescriptionId"
236
+ class="cngx-chart-panel__sr cngx-chart-panel__busy-description"
237
+ >{{ busyLabel() }}</span
238
+ >
239
+
240
+ <!-- One legend outlet, placed by the CSS order property. A duplicated
241
+ ng-content selector would leave the second outlet permanently empty,
242
+ and the legend carries no focusable content, so visual reordering
243
+ cannot desync from tab order. -->
244
+ <div class="cngx-chart-panel__legend">
245
+ <ng-content select="cngx-chart-legend" />
246
+ </div>
247
+
248
+ <div class="cngx-chart-panel__body">
249
+ <!-- No view switch here, and no panel-owned placeholder either: the
250
+ projected cngx-chart owns the data async envelope end to end. -->
251
+ <ng-content />
252
+ </div>
253
+
254
+ <ng-content select="[cngxChartPanelFooter]" />
255
+
256
+ <!-- Hidden status region for the panel-level busy phase. Outside the
257
+ aria-busy header on purpose: a live region inside a busy container
258
+ has its announcements suppressed. -->
259
+ <span cngxLiveRegion class="cngx-chart-panel__sr cngx-chart-panel__status">{{
260
+ busyStatus()
261
+ }}</span>
262
+ `, isInline: true, styles: ["@layer cngx.tokens{.cngx-chart-panel{display:flex;flex-direction:column;--cngx-chart-panel-gap: var(--cngx-space-md, 1rem);--cngx-chart-panel-header-gap: var(--cngx-space-sm, .5rem);--cngx-chart-panel-heading-gap: calc(var(--cngx-space-xs, .25rem) / 2);--cngx-chart-panel-padding: var(--cngx-space-md, 1rem);--cngx-chart-panel-footer-gap: var(--cngx-space-xs, .25rem);gap:var(--cngx-chart-panel-gap);padding:var(--cngx-chart-panel-padding);background:var(--cngx-chart-panel-surface, var(--cngx-color-surface, oklch(1 0 0)));border:1px solid var(--cngx-chart-panel-border, var(--cngx-color-border, oklch(.88 .005 250)));border-radius:var(--cngx-chart-panel-radius, var(--cngx-radius-md, 8px));color:var(--cngx-chart-panel-text, var(--cngx-color-text, oklch(.2 .01 250)))}}@layer cngx.components{@scope(.cngx-chart-panel){.cngx-chart-panel__header{order:1;display:flex;align-items:flex-start;justify-content:space-between;gap:var(--cngx-chart-panel-header-gap);flex-wrap:wrap}.cngx-chart-panel__heading{display:flex;flex-direction:column;gap:var(--cngx-chart-panel-heading-gap);min-inline-size:0}.cngx-chart-panel__title{margin:0;font-size:var(--cngx-chart-panel-title-size, 1rem);font-weight:var(--cngx-chart-panel-title-weight, 600)}.cngx-chart-panel__subtitle{font-size:var(--cngx-chart-panel-subtitle-size, .8125rem);color:var( --cngx-chart-panel-subtitle-color, var(--cngx-color-text-muted, oklch(.5 .01 250)) )}.cngx-chart-panel__actions,.cngx-chart-panel__action-slot{display:flex;align-items:center;gap:var(--cngx-chart-panel-footer-gap)}.cngx-chart-panel__action-slot[aria-disabled=true]{opacity:var(--cngx-chart-panel-busy-opacity, .5);pointer-events:none}.cngx-chart-panel__body{order:3;min-inline-size:0}.cngx-chart-panel__legend{order:4}.cngx-chart-panel__footer{order:5;display:flex;align-items:center;gap:var(--cngx-chart-panel-footer-gap);font-size:var(--cngx-chart-panel-footer-size, .8125rem);color:var( --cngx-chart-panel-footer-color, var(--cngx-color-text-muted, oklch(.5 .01 250)) )}.cngx-chart-panel__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}}@scope(.cngx-chart-panel[data-legend=top]){.cngx-chart-panel__legend{order:2}}@scope(.cngx-chart-panel[data-legend=none]){.cngx-chart-panel__legend{display:none}}}\n"], dependencies: [{ kind: "directive", type: CngxLiveRegion, selector: "[cngxLiveRegion]", inputs: ["politeness", "atomic", "relevant"], exportAs: ["cngxLiveRegion"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
263
+ }
264
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartPanel, decorators: [{
265
+ type: Component,
266
+ args: [{ selector: 'cngx-chart-panel', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CngxLiveRegion], providers: [{ provide: CNGX_CHART_PANEL, useExisting: CngxChartPanel }], host: {
267
+ class: 'cngx-chart-panel',
268
+ role: 'group',
269
+ '[attr.aria-labelledby]': 'labelledBy()',
270
+ '[attr.data-legend]': 'legendPosition()',
271
+ '[class.cngx-chart-panel--busy]': 'panelBusy()',
272
+ }, template: `
273
+ <header class="cngx-chart-panel__header" [attr.aria-busy]="panelBusy() || null">
274
+ <div class="cngx-chart-panel__heading">
275
+ <ng-content select="[cngxChartPanelTitle]" />
276
+ <ng-content select="[cngxChartPanelSubtitle]" />
277
+ </div>
278
+
279
+ <!-- Dimmed and aria-disabled while a panel-level operation runs, so a
280
+ second range change is not invited into an in-flight one. The cluster
281
+ stays in the DOM and in the a11y tree; only the state flips (Pillar
282
+ 2). Deliberately not inert: that would hide the actions from AT
283
+ entirely and the aria-disabled would never be announced. A group,
284
+ since aria-disabled is not allowed on a generic container; it
285
+ covers any projected content, while each [cngxChartPanelActions]
286
+ control also carries the state and the reason itself. -->
287
+ <div
288
+ #actionSlot
289
+ class="cngx-chart-panel__action-slot"
290
+ role="group"
291
+ [attr.aria-disabled]="panelBusy() || null"
292
+ [attr.aria-describedby]="panelBusy() ? busyDescriptionId : null"
293
+ >
294
+ <ng-content select="[cngxChartPanelActions]" />
295
+ </div>
296
+ </header>
297
+
298
+ <!-- Why the actions are disabled. Always in the DOM; only the
299
+ aria-describedby reference above is gated on the busy state. -->
300
+ <span
301
+ [id]="busyDescriptionId"
302
+ class="cngx-chart-panel__sr cngx-chart-panel__busy-description"
303
+ >{{ busyLabel() }}</span
304
+ >
305
+
306
+ <!-- One legend outlet, placed by the CSS order property. A duplicated
307
+ ng-content selector would leave the second outlet permanently empty,
308
+ and the legend carries no focusable content, so visual reordering
309
+ cannot desync from tab order. -->
310
+ <div class="cngx-chart-panel__legend">
311
+ <ng-content select="cngx-chart-legend" />
312
+ </div>
313
+
314
+ <div class="cngx-chart-panel__body">
315
+ <!-- No view switch here, and no panel-owned placeholder either: the
316
+ projected cngx-chart owns the data async envelope end to end. -->
317
+ <ng-content />
318
+ </div>
319
+
320
+ <ng-content select="[cngxChartPanelFooter]" />
321
+
322
+ <!-- Hidden status region for the panel-level busy phase. Outside the
323
+ aria-busy header on purpose: a live region inside a busy container
324
+ has its announcements suppressed. -->
325
+ <span cngxLiveRegion class="cngx-chart-panel__sr cngx-chart-panel__status">{{
326
+ busyStatus()
327
+ }}</span>
328
+ `, styles: ["@layer cngx.tokens{.cngx-chart-panel{display:flex;flex-direction:column;--cngx-chart-panel-gap: var(--cngx-space-md, 1rem);--cngx-chart-panel-header-gap: var(--cngx-space-sm, .5rem);--cngx-chart-panel-heading-gap: calc(var(--cngx-space-xs, .25rem) / 2);--cngx-chart-panel-padding: var(--cngx-space-md, 1rem);--cngx-chart-panel-footer-gap: var(--cngx-space-xs, .25rem);gap:var(--cngx-chart-panel-gap);padding:var(--cngx-chart-panel-padding);background:var(--cngx-chart-panel-surface, var(--cngx-color-surface, oklch(1 0 0)));border:1px solid var(--cngx-chart-panel-border, var(--cngx-color-border, oklch(.88 .005 250)));border-radius:var(--cngx-chart-panel-radius, var(--cngx-radius-md, 8px));color:var(--cngx-chart-panel-text, var(--cngx-color-text, oklch(.2 .01 250)))}}@layer cngx.components{@scope(.cngx-chart-panel){.cngx-chart-panel__header{order:1;display:flex;align-items:flex-start;justify-content:space-between;gap:var(--cngx-chart-panel-header-gap);flex-wrap:wrap}.cngx-chart-panel__heading{display:flex;flex-direction:column;gap:var(--cngx-chart-panel-heading-gap);min-inline-size:0}.cngx-chart-panel__title{margin:0;font-size:var(--cngx-chart-panel-title-size, 1rem);font-weight:var(--cngx-chart-panel-title-weight, 600)}.cngx-chart-panel__subtitle{font-size:var(--cngx-chart-panel-subtitle-size, .8125rem);color:var( --cngx-chart-panel-subtitle-color, var(--cngx-color-text-muted, oklch(.5 .01 250)) )}.cngx-chart-panel__actions,.cngx-chart-panel__action-slot{display:flex;align-items:center;gap:var(--cngx-chart-panel-footer-gap)}.cngx-chart-panel__action-slot[aria-disabled=true]{opacity:var(--cngx-chart-panel-busy-opacity, .5);pointer-events:none}.cngx-chart-panel__body{order:3;min-inline-size:0}.cngx-chart-panel__legend{order:4}.cngx-chart-panel__footer{order:5;display:flex;align-items:center;gap:var(--cngx-chart-panel-footer-gap);font-size:var(--cngx-chart-panel-footer-size, .8125rem);color:var( --cngx-chart-panel-footer-color, var(--cngx-color-text-muted, oklch(.5 .01 250)) )}.cngx-chart-panel__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}}@scope(.cngx-chart-panel[data-legend=top]){.cngx-chart-panel__legend{order:2}}@scope(.cngx-chart-panel[data-legend=none]){.cngx-chart-panel__legend{display:none}}}\n"] }]
329
+ }], ctorParameters: () => [], propDecorators: { state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], legendPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "legendPosition", required: false }] }], actionSlot: [{ type: i0.ViewChild, args: ['actionSlot', { isSignal: true }] }] } });
330
+
331
+ const NO_ARIA_LABELS = {};
332
+ /**
333
+ * Reduces a list of feature objects into a partial config - last write wins
334
+ * per sub-tree.
335
+ *
336
+ * @internal
337
+ */
338
+ function reduceFeatures(features) {
339
+ const out = {};
340
+ for (const f of features) {
341
+ switch (f.kind) {
342
+ case 'ariaLabels':
343
+ out.ariaLabels = createOverrideMerge(out.ariaLabels ?? NO_ARIA_LABELS, f.payload);
344
+ break;
345
+ case 'legendPosition':
346
+ out.legendPosition = f.payload.legendPosition;
347
+ break;
348
+ }
349
+ }
350
+ return out;
351
+ }
352
+ /**
353
+ * Two-level deep merge: the nested `ariaLabels` sub-tree spread-merges; the
354
+ * flat top-level scalars take the partial when present, else the base.
355
+ *
356
+ * @internal
357
+ */
358
+ function mergeConfig(base, partial) {
359
+ return {
360
+ ariaLabels: createOverrideMerge(base.ariaLabels ?? NO_ARIA_LABELS, partial.ariaLabels),
361
+ legendPosition: partial.legendPosition ?? base.legendPosition,
362
+ };
363
+ }
364
+ /**
365
+ * Application-root configuration cascade for the chart-panel.
366
+ *
367
+ * ```ts
368
+ * bootstrapApplication(AppComponent, {
369
+ * providers: [provideChartPanelConfig(withChartPanelLegendPosition('top'))],
370
+ * });
371
+ * ```
372
+ *
373
+ * @category ui/chart-panel
374
+ * @since 0.1.0
375
+ */
376
+ function provideChartPanelConfig(...features) {
377
+ // Empty-features: skip the override so the root factory's defaults reference
378
+ // flows through untouched, preserving downstream identity comparisons.
379
+ if (features.length === 0) {
380
+ return makeEnvironmentProviders([]);
381
+ }
382
+ const partial = reduceFeatures(features);
383
+ return makeEnvironmentProviders([
384
+ {
385
+ provide: CNGX_CHART_PANEL_CONFIG,
386
+ useValue: mergeConfig(CNGX_CHART_PANEL_DEFAULTS, partial),
387
+ },
388
+ ]);
389
+ }
390
+ /**
391
+ * Component-scoped configuration cascade for the chart-panel. Injects the
392
+ * parent injector's value and deep-merges the supplied features on top.
393
+ *
394
+ * @category ui/chart-panel
395
+ * @since 0.1.0
396
+ */
397
+ function provideChartPanelConfigAt(...features) {
398
+ // Empty-features call: parent value flows through untouched.
399
+ if (features.length === 0) {
400
+ return [];
401
+ }
402
+ const partial = reduceFeatures(features);
403
+ return [
404
+ {
405
+ provide: CNGX_CHART_PANEL_CONFIG,
406
+ useFactory: () => {
407
+ const parent = inject(CNGX_CHART_PANEL_CONFIG, { skipSelf: true });
408
+ return mergeConfig(parent, partial);
409
+ },
410
+ },
411
+ ];
412
+ }
413
+
414
+ /**
415
+ * Override the chart-panel's string fallbacks. The defaults come from the
416
+ * `chartPanel` section of the language pack (English without one); this
417
+ * overrides single keys on top of it. Pass a `Signal` to switch the
418
+ * language at runtime; the busy status speaks the new language with the next
419
+ * busy phase.
420
+ *
421
+ * @category ui/chart-panel
422
+ * @since 0.1.0
423
+ */
424
+ function withChartPanelAriaLabels(labels) {
425
+ return { kind: 'ariaLabels', payload: labels };
426
+ }
427
+ /**
428
+ * Move the cascade default for where a projected `cngx-chart-legend` sits.
429
+ * Per-instance `[legendPosition]` still wins.
430
+ *
431
+ * @category ui/chart-panel
432
+ * @since 0.1.0
433
+ */
434
+ function withChartPanelLegendPosition(position) {
435
+ return { kind: 'legendPosition', payload: { legendPosition: position } };
436
+ }
437
+
438
+ // aria-disabled is allowed on controls and on explicit widget / group roles,
439
+ // not on a generic wrapper.
440
+ const CONTROL_SELECTOR = 'a[href], button, input, select, textarea, [role]';
441
+ /**
442
+ * Marks the panel's title. Its generated id becomes the panel's
443
+ * `aria-labelledby`, so the whole region reads as one named group instead of
444
+ * an unlabelled box wrapped around a chart.
445
+ *
446
+ * Registration runs against {@link CNGX_CHART_PANEL}, which the panel provides -
447
+ * the title resolves it from its declaration site in the consumer template.
448
+ *
449
+ * @category ui/chart-panel
450
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/chart-panel/chart-panel-slots.ts
451
+ * @since 0.1.0
452
+ * @relatedTo CngxChartPanel, CngxChartPanelSubtitle
453
+ */
454
+ class CngxChartPanelTitle {
455
+ /** Auto-generated id bound to the host `[id]`; consumed by the panel. */
456
+ id = nextUid('cngx-chart-panel-title');
457
+ constructor() {
458
+ const panel = inject(CNGX_CHART_PANEL, { optional: true });
459
+ panel?.registerTitle(this.id);
460
+ // Without the withdrawal the panel's aria-labelledby would keep pointing at
461
+ // a removed element - a dangling reference reads as an unnamed group to AT.
462
+ inject(DestroyRef).onDestroy(() => panel?.unregisterTitle(this.id));
463
+ }
464
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartPanelTitle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
465
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxChartPanelTitle, isStandalone: true, selector: "[cngxChartPanelTitle]", host: { properties: { "id": "id" }, classAttribute: "cngx-chart-panel__title" }, ngImport: i0 });
466
+ }
467
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartPanelTitle, decorators: [{
468
+ type: Directive,
469
+ args: [{
470
+ selector: '[cngxChartPanelTitle]',
471
+ standalone: true,
472
+ host: { class: 'cngx-chart-panel__title', '[id]': 'id' },
473
+ }]
474
+ }], ctorParameters: () => [] });
475
+ /**
476
+ * Marks the panel's secondary line under the title - a period, a unit, a
477
+ * comparison basis. Descriptive only; it does not join the accessible name.
478
+ *
479
+ * @category ui/chart-panel
480
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/chart-panel/chart-panel-slots.ts
481
+ * @since 0.1.0
482
+ * @relatedTo CngxChartPanel, CngxChartPanelTitle
483
+ */
484
+ class CngxChartPanelSubtitle {
485
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartPanelSubtitle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
486
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxChartPanelSubtitle, isStandalone: true, selector: "[cngxChartPanelSubtitle]", host: { classAttribute: "cngx-chart-panel__subtitle" }, ngImport: i0 });
487
+ }
488
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartPanelSubtitle, decorators: [{
489
+ type: Directive,
490
+ args: [{
491
+ selector: '[cngxChartPanelSubtitle]',
492
+ standalone: true,
493
+ host: { class: 'cngx-chart-panel__subtitle' },
494
+ }]
495
+ }] });
496
+ /**
497
+ * Marks the panel's header action cluster - a range picker, a refresh button,
498
+ * an overflow menu. The panel dims the cluster and marks it `aria-disabled`
499
+ * while a panel-level operation runs, so a user cannot fire a second range
500
+ * change into an in-flight one.
501
+ *
502
+ * On a control (a native button, link or form field, or any element with an
503
+ * explicit `role`) the marker also puts that state on the control itself:
504
+ * `aria-disabled="true"` plus an `aria-describedby` to the panel's busy reason
505
+ * ("Updating" by default, `ariaLabels.busy`), both only while the panel is
506
+ * busy, so focusing the action announces why it is unavailable. A static
507
+ * `aria-disabled` / `aria-describedby` the consumer wrote on the element is
508
+ * kept and merged. On a plain wrapper element the marker adds nothing (the
509
+ * attribute is not allowed on a generic); the slot group carries the state.
510
+ * Activation stays blocked by the slot (pointer and Enter/Space), so the
511
+ * control keeps its focusability instead of turning natively `disabled`.
512
+ *
513
+ * @category ui/chart-panel
514
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/chart-panel/chart-panel-slots.ts
515
+ * @since 0.1.0
516
+ * @relatedTo CngxChartPanel
517
+ */
518
+ class CngxChartPanelActions {
519
+ panel = inject(CNGX_CHART_PANEL, { optional: true });
520
+ ownDisabled = inject(new HostAttributeToken('aria-disabled'), {
521
+ optional: true,
522
+ });
523
+ ownDescribedBy = inject(new HostAttributeToken('aria-describedby'), {
524
+ optional: true,
525
+ });
526
+ carriesState = inject(ElementRef).nativeElement.matches(CONTROL_SELECTOR);
527
+ busy = computed(() => this.carriesState && (this.panel?.busy() ?? false), ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
528
+ /** @internal The panel busy state on the control, else the consumer's own value. */
529
+ ariaDisabled = computed(() => (this.busy() ? 'true' : this.ownDisabled), ...(ngDevMode ? [{ debugName: "ariaDisabled" }] : /* istanbul ignore next */ []));
530
+ /**
531
+ * @internal The busy reason, referenced only while busy (the node itself is
532
+ * always rendered), appended to the consumer's own description.
533
+ */
534
+ describedBy = computed(() => {
535
+ if (!this.busy() || !this.panel) {
536
+ return this.ownDescribedBy;
537
+ }
538
+ return [this.ownDescribedBy, this.panel.busyDescriptionId].filter(Boolean).join(' ');
539
+ }, ...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
540
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartPanelActions, deps: [], target: i0.ɵɵFactoryTarget.Directive });
541
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxChartPanelActions, isStandalone: true, selector: "[cngxChartPanelActions]", host: { properties: { "attr.aria-disabled": "ariaDisabled()", "attr.aria-describedby": "describedBy()" }, classAttribute: "cngx-chart-panel__actions" }, ngImport: i0 });
542
+ }
543
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartPanelActions, decorators: [{
544
+ type: Directive,
545
+ args: [{
546
+ selector: '[cngxChartPanelActions]',
547
+ standalone: true,
548
+ host: {
549
+ class: 'cngx-chart-panel__actions',
550
+ '[attr.aria-disabled]': 'ariaDisabled()',
551
+ '[attr.aria-describedby]': 'describedBy()',
552
+ },
553
+ }]
554
+ }] });
555
+ /**
556
+ * Marks the panel's footer row - a source note, a last-updated timestamp, a
557
+ * drill-down link. Sits below the chart body and the legend.
558
+ *
559
+ * @category ui/chart-panel
560
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/chart-panel/chart-panel-slots.ts
561
+ * @since 0.1.0
562
+ * @relatedTo CngxChartPanel
563
+ */
564
+ class CngxChartPanelFooter {
565
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartPanelFooter, deps: [], target: i0.ɵɵFactoryTarget.Directive });
566
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxChartPanelFooter, isStandalone: true, selector: "[cngxChartPanelFooter]", host: { classAttribute: "cngx-chart-panel__footer" }, ngImport: i0 });
567
+ }
568
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartPanelFooter, decorators: [{
569
+ type: Directive,
570
+ args: [{
571
+ selector: '[cngxChartPanelFooter]',
572
+ standalone: true,
573
+ host: { class: 'cngx-chart-panel__footer' },
574
+ }]
575
+ }] });
576
+
577
+ /**
578
+ * @module @cngx/ui/chart-panel
579
+ */
580
+
581
+ /**
582
+ * Generated bundle index. Do not edit.
583
+ */
584
+
585
+ export { CNGX_CHART_PANEL, CNGX_CHART_PANEL_CONFIG, CNGX_CHART_PANEL_LANGUAGE_EN, CngxChartPanel, CngxChartPanelActions, CngxChartPanelFooter, CngxChartPanelSubtitle, CngxChartPanelTitle, injectChartPanelAriaLabels, injectChartPanelConfig, provideChartPanelConfig, provideChartPanelConfigAt, withChartPanelAriaLabels, withChartPanelLegendPosition };
586
+ //# sourceMappingURL=cngx-ui-chart-panel.mjs.map