@cngx/ui 0.1.0-rc.3 → 0.1.0-rc.5
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/accordion/README.md +86 -0
- package/collection/README.md +167 -0
- package/data-grid-accordion/README.md +137 -0
- package/fesm2022/cngx-ui-accordion.mjs +853 -0
- package/fesm2022/cngx-ui-accordion.mjs.map +1 -0
- package/fesm2022/cngx-ui-action-button.mjs +2 -2
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-breadcrumb.mjs +1044 -0
- package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/cngx-ui-collection.mjs +645 -0
- package/fesm2022/cngx-ui-collection.mjs.map +1 -0
- package/fesm2022/cngx-ui-data-grid-accordion.mjs +1135 -0
- package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -0
- package/fesm2022/cngx-ui-empty-state.mjs +2 -2
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +10 -10
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-accordion.mjs +229 -0
- package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -0
- package/fesm2022/cngx-ui-paginator.mjs +324 -255
- package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +547 -65
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +6 -6
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +1 -1
- package/mat-accordion/README.md +48 -0
- package/package.json +21 -1
- package/paginator/README.md +9 -6
- package/sidenav/README.md +89 -3
- package/types/cngx-ui-accordion.d.ts +801 -0
- package/types/cngx-ui-breadcrumb.d.ts +890 -0
- package/types/cngx-ui-collection.d.ts +396 -0
- package/types/cngx-ui-data-grid-accordion.d.ts +912 -0
- package/types/cngx-ui-mat-accordion.d.ts +63 -0
- package/types/cngx-ui-paginator.d.ts +258 -146
- package/types/cngx-ui-sidenav.d.ts +429 -21
|
@@ -0,0 +1,801 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { InjectionToken, Signal, TemplateRef, EnvironmentProviders, Provider } from '@angular/core';
|
|
3
|
+
import { AsyncStatus, CngxAsyncState } from '@cngx/core/utils';
|
|
4
|
+
import * as i1 from '@cngx/common/interactive';
|
|
5
|
+
import * as _cngx_ui_accordion from '@cngx/ui/accordion';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* UI-local context a {@link CngxAccordionGroup} exposes so each
|
|
9
|
+
* `CngxAccordionItem` reads the shared heading level without injecting the
|
|
10
|
+
* concrete group class (cyclic type, blocks Atomic Decompose). Kept separate
|
|
11
|
+
* from the headless `CNGX_ACCORDION` brain contract, which stays
|
|
12
|
+
* skin-agnostic - heading semantics are a skin concern.
|
|
13
|
+
*
|
|
14
|
+
* @category ui/accordion
|
|
15
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/accordion/accordion-group.token.ts
|
|
16
|
+
* @since 0.1.0
|
|
17
|
+
* @relatedTo CngxAccordionGroup, CngxAccordionItem
|
|
18
|
+
*/
|
|
19
|
+
interface CngxAccordionGroupContext {
|
|
20
|
+
/** Heading level (2-6) every item's `role="heading"` wrapper reflects via `aria-level`. */
|
|
21
|
+
readonly headingLevel: Signal<number>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* DI token for the {@link CngxAccordionGroupContext}. {@link CngxAccordionGroup}
|
|
25
|
+
* provides it via `useExisting`; each `CngxAccordionItem` injects it.
|
|
26
|
+
*
|
|
27
|
+
* @category ui/accordion
|
|
28
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/accordion/accordion-group.token.ts
|
|
29
|
+
* @since 0.1.0
|
|
30
|
+
* @relatedTo CngxAccordionGroup, CngxAccordionItem
|
|
31
|
+
*/
|
|
32
|
+
declare const CNGX_ACCORDION_GROUP: InjectionToken<CngxAccordionGroupContext>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Template context for {@link CngxAccordionItemIcon}: `$implicit` is the item's
|
|
36
|
+
* current expanded state, so the override can render an open/closed glyph.
|
|
37
|
+
*
|
|
38
|
+
* @category ui/accordion
|
|
39
|
+
*/
|
|
40
|
+
interface CngxAccordionItemIconContext {
|
|
41
|
+
readonly $implicit: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Structural slot overriding a {@link CngxAccordionItem}'s chevron. The item
|
|
45
|
+
* renders it in the header's icon position with the expanded state as
|
|
46
|
+
* `$implicit`; absent, the item falls back to its CSS chevron default (no hard
|
|
47
|
+
* `CngxIcon` dependency).
|
|
48
|
+
*
|
|
49
|
+
* ```html
|
|
50
|
+
* <cngx-accordion-item>
|
|
51
|
+
* <span cngxAccordionItemTitle>Filters</span>
|
|
52
|
+
* <ng-template cngxAccordionItemIcon let-expanded>
|
|
53
|
+
* <my-icon [name]="expanded ? 'minus' : 'plus'" />
|
|
54
|
+
* </ng-template>
|
|
55
|
+
* </cngx-accordion-item>
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @category ui/accordion
|
|
59
|
+
* @wcag AA
|
|
60
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/accordion/accordion-item-icon.directive.ts
|
|
61
|
+
* @since 0.1.0
|
|
62
|
+
* @relatedTo CngxAccordionItem, CngxAccordionItemContent
|
|
63
|
+
*/
|
|
64
|
+
declare class CngxAccordionItemIcon {
|
|
65
|
+
readonly templateRef: TemplateRef<any>;
|
|
66
|
+
static ngTemplateContextGuard(_dir: CngxAccordionItemIcon, ctx: unknown): ctx is CngxAccordionItemIconContext;
|
|
67
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAccordionItemIcon, never>;
|
|
68
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxAccordionItemIcon, "ng-template[cngxAccordionItemIcon]", ["cngxAccordionItemIcon"], {}, {}, never, never, true, never>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Template context handed to the busy (`*cngxAccordionItemBusy`) and error
|
|
73
|
+
* (`*cngxAccordionItemError`) slots so an override can read the item's live
|
|
74
|
+
* state without re-injecting it - parity with
|
|
75
|
+
* {@link CngxAccordionItemIconContext}.
|
|
76
|
+
*
|
|
77
|
+
* `$implicit` is the current {@link AsyncStatus} (`loading` / `refreshing` in
|
|
78
|
+
* the busy slot, `error` in the error slot). `message` carries the resolved
|
|
79
|
+
* error string in the error state and is empty in the busy state, so an error
|
|
80
|
+
* override can render the announced text (and a retry) without re-deriving it.
|
|
81
|
+
*
|
|
82
|
+
* @category ui/accordion
|
|
83
|
+
*/
|
|
84
|
+
interface CngxAccordionItemStateContext {
|
|
85
|
+
readonly $implicit: AsyncStatus;
|
|
86
|
+
readonly message: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Selectable visual skin for `<cngx-accordion-group>`. \
|
|
91
|
+
* The skin is a pure thematic concern - every value renders the identical
|
|
92
|
+
* heading / region / marker structure, slots, ARIA, and keyboard behaviour, and
|
|
93
|
+
* only redirects CSS via the `[data-skin]` host attribute. Typed class-sugar
|
|
94
|
+
* (mirrors {@link CngxTabsSkin}), not a behaviour-branching mode flag.
|
|
95
|
+
*
|
|
96
|
+
* `'editorial'` mono index + hairlines; `'categorized'` bordered surface cards;
|
|
97
|
+
* `'plus-minus'` one framed surface with a boxed +/- marker; `'lux'` generous
|
|
98
|
+
* whitespace, large type; `'bento'` container-query card grid; `'section-bands'`
|
|
99
|
+
* inverted full-width header bands; `'timeline'` a rail with per-item nodes;
|
|
100
|
+
* `'severity-spine'` a full-height priority spine; `'primary-frame'` a solid
|
|
101
|
+
* primary border + glow on open.
|
|
102
|
+
*
|
|
103
|
+
* @category ui/accordion
|
|
104
|
+
* @since 0.1.0
|
|
105
|
+
*/
|
|
106
|
+
type CngxAccordionSkin = 'editorial' | 'categorized' | 'plus-minus' | 'lux' | 'bento' | 'section-bands' | 'timeline' | 'severity-spine' | 'primary-frame';
|
|
107
|
+
/**
|
|
108
|
+
* Per-item semantic severity, reflected onto the `[data-severity]` host
|
|
109
|
+
* attribute for skins that visualise it (the `severity-spine` skin maps it to
|
|
110
|
+
* the `--cngx-color-danger` / `-warning` / `-info` tokens). Structural only - it
|
|
111
|
+
* changes no ARIA and no behaviour, and unset items simply carry no severity.
|
|
112
|
+
*
|
|
113
|
+
* @category ui/accordion
|
|
114
|
+
* @since 0.1.0
|
|
115
|
+
*/
|
|
116
|
+
type CngxAccordionSeverity = 'error' | 'warning' | 'info';
|
|
117
|
+
/**
|
|
118
|
+
* App-wide cascade for the accordion organism's locale-sensitive
|
|
119
|
+
* `disabledReason` string, the default heading level, and app-wide slot
|
|
120
|
+
* templates.
|
|
121
|
+
*
|
|
122
|
+
* Resolution priority (high -> low):
|
|
123
|
+
* 1. Per-instance Input binding (`[disabledReason]` / `[headingLevel]`).
|
|
124
|
+
* 2. `provideAccordionConfigAt(...)` in a parent component's `viewProviders`
|
|
125
|
+
* (component-scoped override).
|
|
126
|
+
* 3. `provideAccordionConfig(...)` at the application root.
|
|
127
|
+
* 4. Library defaults (English; `CNGX_ACCORDION_DEFAULTS`).
|
|
128
|
+
*
|
|
129
|
+
* Both keys are required on the resolved config - the token ships a complete
|
|
130
|
+
* default, and every `with*` feature overrides a whole key, so no consumer ever
|
|
131
|
+
* observes a partial shape.
|
|
132
|
+
*
|
|
133
|
+
* @category ui/accordion
|
|
134
|
+
* @since 0.1.0
|
|
135
|
+
*/
|
|
136
|
+
interface CngxAccordionConfig {
|
|
137
|
+
/**
|
|
138
|
+
* Reason announced to assistive tech when an item is disabled, bound through
|
|
139
|
+
* the item's always-present `aria-describedby` reason element. English
|
|
140
|
+
* default; a per-instance `[disabledReason]` still wins over the cascade.
|
|
141
|
+
*/
|
|
142
|
+
readonly disabledReason: string;
|
|
143
|
+
/**
|
|
144
|
+
* Message announced (via a `role="alert"`) when an item's `[state]` is error
|
|
145
|
+
* and no `*cngxAccordionItemError` slot is provided. English default; a
|
|
146
|
+
* per-instance `[errorMessage]` or the error slot still wins. Ships a spoken
|
|
147
|
+
* default so the error state is never silent to assistive tech (Pillar 2).
|
|
148
|
+
*/
|
|
149
|
+
readonly errorMessage: string;
|
|
150
|
+
/**
|
|
151
|
+
* Default `aria-level` (2-6) every `CngxAccordionGroup` heading wrapper
|
|
152
|
+
* reflects when `[headingLevel]` is not bound. Clamped into the ARIA range by
|
|
153
|
+
* the group.
|
|
154
|
+
*/
|
|
155
|
+
readonly headingLevel: number;
|
|
156
|
+
/**
|
|
157
|
+
* App-wide default visual skin reflected onto `[data-skin]`. Unset by default
|
|
158
|
+
* (the base flat look). A per-instance `[skin]` Input still wins; this only
|
|
159
|
+
* moves the cascade default. Override via {@link withAccordionSkin}.
|
|
160
|
+
*/
|
|
161
|
+
readonly skin?: CngxAccordionSkin;
|
|
162
|
+
/**
|
|
163
|
+
* App-wide slot templates - the third tier of the slot cascade
|
|
164
|
+
* (`*cngxAccordionItemXxx` per-instance -> this -> CSS default). Only slots
|
|
165
|
+
* with a plausible app-wide default carry a config tier: the chevron, the busy
|
|
166
|
+
* spinner, and the error affordance all have a design-system default; title
|
|
167
|
+
* and body are per-item content with no meaningful app-wide default, so they
|
|
168
|
+
* get no config tier.
|
|
169
|
+
*/
|
|
170
|
+
readonly templates?: {
|
|
171
|
+
/** App-wide chevron override; `$implicit` is the item's expanded state. */
|
|
172
|
+
readonly icon?: TemplateRef<CngxAccordionItemIconContext> | null;
|
|
173
|
+
/**
|
|
174
|
+
* App-wide busy visual, rendered while an item's `[state]` is
|
|
175
|
+
* loading/refreshing. Receives a {@link CngxAccordionItemStateContext}
|
|
176
|
+
* (`$implicit` is the status).
|
|
177
|
+
*/
|
|
178
|
+
readonly busySpinner?: TemplateRef<CngxAccordionItemStateContext> | null;
|
|
179
|
+
/**
|
|
180
|
+
* App-wide error affordance, rendered while an item's `[state]` is error.
|
|
181
|
+
* Receives a {@link CngxAccordionItemStateContext} (`message` is the
|
|
182
|
+
* resolved error string).
|
|
183
|
+
*/
|
|
184
|
+
readonly error?: TemplateRef<CngxAccordionItemStateContext> | null;
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Accordion organism shell. Hosts the headless {@link CngxAccordion} brain via
|
|
190
|
+
* `hostDirectives` - so `CNGX_ACCORDION` and the registration keyboard-nav come
|
|
191
|
+
* with it - forwards `[multi]` and the controlled `[(openIds)]` model, and adds
|
|
192
|
+
* `[headingLevel]`. Projects its
|
|
193
|
+
* `CngxAccordionItem` children through a single `<ng-content />`; the group
|
|
194
|
+
* owns no rendering beyond providing {@link CNGX_ACCORDION_GROUP} so items read
|
|
195
|
+
* the shared heading level.
|
|
196
|
+
*
|
|
197
|
+
* ```html
|
|
198
|
+
* <cngx-accordion-group [multi]="false" [headingLevel]="3">
|
|
199
|
+
* <cngx-accordion-item>
|
|
200
|
+
* <span cngxAccordionItemTitle>Section A</span>
|
|
201
|
+
* Body A
|
|
202
|
+
* </cngx-accordion-item>
|
|
203
|
+
* </cngx-accordion-group>
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @category ui/accordion
|
|
207
|
+
* @docsKind primary
|
|
208
|
+
* @wcag AA
|
|
209
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/accordion/accordion-group.component.ts
|
|
210
|
+
* @since 0.1.0
|
|
211
|
+
* @relatedTo CngxAccordionItem, CngxAccordion, createAccordionKeyboardNav
|
|
212
|
+
*
|
|
213
|
+
* <example-url>http://localhost:4200/#/ui/accordion/single-open/basic</example-url>
|
|
214
|
+
* <example-url>http://localhost:4200/#/ui/accordion/multi-open/independent</example-url>
|
|
215
|
+
* <example-url>http://localhost:4200/#/ui/accordion/controlled-open/initial-open</example-url>
|
|
216
|
+
* <example-url>http://localhost:4200/#/ui/accordion/config/app-wide-labels</example-url>
|
|
217
|
+
* <example-url>http://localhost:4200/#/ui/accordion/skins/editorial</example-url>
|
|
218
|
+
*/
|
|
219
|
+
declare class CngxAccordionGroup implements CngxAccordionGroupContext {
|
|
220
|
+
private readonly config;
|
|
221
|
+
/**
|
|
222
|
+
* Heading level (2-6) every item's `role="heading"` wrapper reflects via
|
|
223
|
+
* `aria-level`. Resolves `input ?? CNGX_ACCORDION_CONFIG.headingLevel ?? 3`:
|
|
224
|
+
* an unbound `[headingLevel]` falls back to the app-wide config default
|
|
225
|
+
* (overridden via `withDefaultHeadingLevel`). Clamped into the valid ARIA
|
|
226
|
+
* range so a stray `0`/`9` - from a binding OR the config default - can never
|
|
227
|
+
* emit an invalid `aria-level`. The default is clamped explicitly because
|
|
228
|
+
* Angular runs `transform` only on bound values, not the initial default.
|
|
229
|
+
* Coerced from string via `coerceNumberProperty` for template attribute binding.
|
|
230
|
+
*/
|
|
231
|
+
readonly headingLevel: _angular_core.InputSignalWithTransform<number, string | number>;
|
|
232
|
+
/**
|
|
233
|
+
* Visual skin reflected onto the `[data-skin]` host attribute. Resolves
|
|
234
|
+
* `input ?? CNGX_ACCORDION_CONFIG.skin`: an unbound `[skin]` falls back to the
|
|
235
|
+
* app-wide config default (`withAccordionSkin`); unset on both leaves the base
|
|
236
|
+
* flat look. The skin only redirects CSS - structure, slots, ARIA, and
|
|
237
|
+
* keyboard behaviour are identical across skins. Mirrors the tabs/stepper
|
|
238
|
+
* `[skin]` cascade.
|
|
239
|
+
*/
|
|
240
|
+
readonly skin: _angular_core.InputSignal<CngxAccordionSkin | undefined>;
|
|
241
|
+
/** `[skin]` input over the config default. `null` host binding when unset. */
|
|
242
|
+
protected readonly resolvedSkin: _angular_core.Signal<CngxAccordionSkin | undefined>;
|
|
243
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAccordionGroup, never>;
|
|
244
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxAccordionGroup, "cngx-accordion-group", ["cngxAccordionGroup"], { "headingLevel": { "alias": "headingLevel"; "required": false; "isSignal": true; }; "skin": { "alias": "skin"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, [{ directive: typeof i1.CngxAccordion; inputs: { "multi": "multi"; "openIds": "openIds"; }; outputs: { "openIdsChange": "openIdsChange"; }; }]>;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Structural slot for a {@link CngxAccordionItem}'s busy state. The item renders
|
|
249
|
+
* it inside the region while the item's `[state]` is `loading` (a first-load
|
|
250
|
+
* skeleton that replaces the body) or `refreshing` (a subtle overlay with the
|
|
251
|
+
* body kept mounted). Absent, the item falls back to its CSS skeleton default.
|
|
252
|
+
*
|
|
253
|
+
* The region already carries `aria-busy` as a `computed()`, so the busy visual
|
|
254
|
+
* is decorative (`aria-hidden`); assistive tech learns the busy state from
|
|
255
|
+
* `aria-busy`, not from this template. The template receives a
|
|
256
|
+
* {@link CngxAccordionItemStateContext} whose `$implicit` is the current status
|
|
257
|
+
* (`loading` / `refreshing`), so one override can distinguish the two.
|
|
258
|
+
*
|
|
259
|
+
* ```html
|
|
260
|
+
* <cngx-accordion-item [state]="report.status()">
|
|
261
|
+
* <span cngxAccordionItemTitle>Report</span>
|
|
262
|
+
* <ng-template cngxAccordionItemBusy let-status><my-skeleton [dim]="status === 'refreshing'" /></ng-template>
|
|
263
|
+
* <ng-template cngxAccordionItemContent>{{ report.data() }}</ng-template>
|
|
264
|
+
* </cngx-accordion-item>
|
|
265
|
+
* ```
|
|
266
|
+
*
|
|
267
|
+
* @category ui/accordion
|
|
268
|
+
* @wcag AA
|
|
269
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/accordion/accordion-item-busy.directive.ts
|
|
270
|
+
* @since 0.1.0
|
|
271
|
+
* @relatedTo CngxAccordionItem, CngxAccordionItemError
|
|
272
|
+
*/
|
|
273
|
+
declare class CngxAccordionItemBusy {
|
|
274
|
+
readonly templateRef: TemplateRef<any>;
|
|
275
|
+
static ngTemplateContextGuard(_dir: CngxAccordionItemBusy, ctx: unknown): ctx is CngxAccordionItemStateContext;
|
|
276
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAccordionItemBusy, never>;
|
|
277
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxAccordionItemBusy, "ng-template[cngxAccordionItemBusy]", ["cngxAccordionItemBusy"], {}, {}, never, never, true, never>;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Structural slot marking a {@link CngxAccordionItem}'s region body as lazy.
|
|
282
|
+
* The item renders it via `ngTemplateOutlet` only after the region has first
|
|
283
|
+
* opened (a `hasOpened` `linkedSignal`), then keeps it alive. Without this
|
|
284
|
+
* directive the item projects its body eagerly through the default slot; with
|
|
285
|
+
* it, the body is absent from the DOM until first expansion.
|
|
286
|
+
*
|
|
287
|
+
* ```html
|
|
288
|
+
* <cngx-accordion-item>
|
|
289
|
+
* <span cngxAccordionItemTitle>Report</span>
|
|
290
|
+
* <ng-template cngxAccordionItemContent>
|
|
291
|
+
* <expensive-report />
|
|
292
|
+
* </ng-template>
|
|
293
|
+
* </cngx-accordion-item>
|
|
294
|
+
* ```
|
|
295
|
+
*
|
|
296
|
+
* @category ui/accordion
|
|
297
|
+
* @wcag AA
|
|
298
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/accordion/accordion-item-content.directive.ts
|
|
299
|
+
* @since 0.1.0
|
|
300
|
+
* @relatedTo CngxAccordionItem, CngxAccordionItemTitle
|
|
301
|
+
*/
|
|
302
|
+
declare class CngxAccordionItemContent {
|
|
303
|
+
readonly templateRef: TemplateRef<any>;
|
|
304
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAccordionItemContent, never>;
|
|
305
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxAccordionItemContent, "ng-template[cngxAccordionItemContent]", ["cngxAccordionItemContent"], {}, {}, never, never, true, never>;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Structural slot for a {@link CngxAccordionItem}'s error state. The item renders
|
|
310
|
+
* it inside the region, in a `role="alert"` container, when the item's `[state]`
|
|
311
|
+
* is `error` - so the error body is announced to assistive tech the moment it
|
|
312
|
+
* appears. Absent, the item renders a minimal CSS error affordance; the
|
|
313
|
+
* announced message is this slot's responsibility (author it with the error
|
|
314
|
+
* text, e.g. a retry action).
|
|
315
|
+
*
|
|
316
|
+
* The template receives a {@link CngxAccordionItemStateContext} whose `message`
|
|
317
|
+
* is the resolved error string, so the override can render the announced text
|
|
318
|
+
* (and a retry) without re-deriving it.
|
|
319
|
+
*
|
|
320
|
+
* ```html
|
|
321
|
+
* <cngx-accordion-item [state]="report.status()">
|
|
322
|
+
* <span cngxAccordionItemTitle>Report</span>
|
|
323
|
+
* <ng-template cngxAccordionItemError let-message="message">
|
|
324
|
+
* {{ message }} <button type="button" (click)="retry()">Retry</button>
|
|
325
|
+
* </ng-template>
|
|
326
|
+
* </cngx-accordion-item>
|
|
327
|
+
* ```
|
|
328
|
+
*
|
|
329
|
+
* @category ui/accordion
|
|
330
|
+
* @wcag AA
|
|
331
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/accordion/accordion-item-error.directive.ts
|
|
332
|
+
* @since 0.1.0
|
|
333
|
+
* @relatedTo CngxAccordionItem, CngxAccordionItemBusy
|
|
334
|
+
*/
|
|
335
|
+
declare class CngxAccordionItemError {
|
|
336
|
+
readonly templateRef: TemplateRef<any>;
|
|
337
|
+
static ngTemplateContextGuard(_dir: CngxAccordionItemError, ctx: unknown): ctx is CngxAccordionItemStateContext;
|
|
338
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAccordionItemError, never>;
|
|
339
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxAccordionItemError, "ng-template[cngxAccordionItemError]", ["cngxAccordionItemError"], {}, {}, never, never, true, never>;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Projected-subtitle marker for a {@link CngxAccordionItem}. Put it on the
|
|
344
|
+
* secondary line that sits below the title inside the header button. The item
|
|
345
|
+
* projects it under the title but keeps it OUT of the button's accessible name
|
|
346
|
+
* (the name is pinned to the title via `aria-labelledby`); the subtitle is
|
|
347
|
+
* instead announced through the button's `aria-describedby`, so an informative
|
|
348
|
+
* subtitle is not lost to assistive tech while the name stays title-only.
|
|
349
|
+
*
|
|
350
|
+
* ```html
|
|
351
|
+
* <cngx-accordion-item>
|
|
352
|
+
* <span cngxAccordionItemTitle>Billing</span>
|
|
353
|
+
* <span cngxAccordionItemSubtitle>Invoices and payment methods</span>
|
|
354
|
+
* Body…
|
|
355
|
+
* </cngx-accordion-item>
|
|
356
|
+
* ```
|
|
357
|
+
*
|
|
358
|
+
* @category ui/accordion
|
|
359
|
+
* @wcag AA
|
|
360
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/accordion/accordion-item-subtitle.directive.ts
|
|
361
|
+
* @since 0.1.0
|
|
362
|
+
* @relatedTo CngxAccordionItem, CngxAccordionItemTitle
|
|
363
|
+
*/
|
|
364
|
+
declare class CngxAccordionItemSubtitle {
|
|
365
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAccordionItemSubtitle, never>;
|
|
366
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxAccordionItemSubtitle, "[cngxAccordionItemSubtitle]", ["cngxAccordionItemSubtitle"], {}, {}, never, never, true, never>;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Accordion item organism. Renders the APG-correct trio a headless consumer
|
|
371
|
+
* otherwise hand-wires: a `role="heading"` wrapper carrying the group's
|
|
372
|
+
* `aria-level`, a `cngxAccordionPanel` header `<button>`, and a
|
|
373
|
+
* `role="region"` named back at the header via `aria-labelledby`. Expansion is
|
|
374
|
+
* derived from the coordinator (Pillar 1); the header self-wires keyboard nav
|
|
375
|
+
* through the registration brain, so arrow keys rove across items even though
|
|
376
|
+
* each header lives in its own component view.
|
|
377
|
+
*
|
|
378
|
+
* A disabled item renders a visually-hidden reason element with a stable id
|
|
379
|
+
* that `aria-describedby` always points at (IDREF never dangles); only the
|
|
380
|
+
* element's `aria-hidden` and text toggle with `disabled()`.
|
|
381
|
+
*
|
|
382
|
+
* @category ui/accordion
|
|
383
|
+
* @docsKind primary
|
|
384
|
+
* @wcag AA
|
|
385
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/accordion/accordion-item.component.ts
|
|
386
|
+
* @since 0.1.0
|
|
387
|
+
* @relatedTo CngxAccordionGroup, CngxAccordionPanel
|
|
388
|
+
*
|
|
389
|
+
* <example-url>http://localhost:4200/#/ui/accordion/async-panel/lazy-fetch</example-url>
|
|
390
|
+
* <example-url>http://localhost:4200/#/ui/accordion/disabled-lazy/disabled-and-lazy</example-url>
|
|
391
|
+
* <example-url>http://localhost:4200/#/ui/accordion/custom-chevron/icon-slot</example-url>
|
|
392
|
+
* <example-url>http://localhost:4200/#/ui/accordion/panel-content/table</example-url>
|
|
393
|
+
*/
|
|
394
|
+
declare class CngxAccordionItem {
|
|
395
|
+
private readonly config;
|
|
396
|
+
/**
|
|
397
|
+
* Disabled item: the header reports `tabindex="-1"` + `aria-disabled="true"`,
|
|
398
|
+
* is skipped by roving, and its click never expands. The reason text is
|
|
399
|
+
* announced through {@link disabledReason} via `aria-describedby`.
|
|
400
|
+
*/
|
|
401
|
+
readonly disabled: _angular_core.InputSignal<boolean>;
|
|
402
|
+
/**
|
|
403
|
+
* Semantic severity reflected onto the `[data-severity]` host attribute for
|
|
404
|
+
* skins that render it (the `severity-spine` skin fills its colour column from
|
|
405
|
+
* the matching `--cngx-color-danger` / `-warning` / `-info` token). Mirrors the
|
|
406
|
+
* group's `[skin]` -> `[data-skin]` cascade; purely visual, no ARIA impact.
|
|
407
|
+
*/
|
|
408
|
+
readonly severity: _angular_core.InputSignal<CngxAccordionSeverity | undefined>;
|
|
409
|
+
/**
|
|
410
|
+
* Reason announced to assistive tech when the item is disabled, bound through
|
|
411
|
+
* the always-present `aria-describedby` reason element. Resolves
|
|
412
|
+
* `input ?? CNGX_ACCORDION_CONFIG.disabledReason ?? EN default`: an unbound
|
|
413
|
+
* input falls back to the app-wide config (English out of the box, overridden
|
|
414
|
+
* via `withAccordionLabels`).
|
|
415
|
+
*/
|
|
416
|
+
readonly disabledReason: _angular_core.InputSignal<string>;
|
|
417
|
+
/**
|
|
418
|
+
* Message announced through a `role="alert"` when `[state]` is error and no
|
|
419
|
+
* `*cngxAccordionItemError` slot is provided. Resolves
|
|
420
|
+
* `input ?? CNGX_ACCORDION_CONFIG.errorMessage ?? EN default`, mirroring
|
|
421
|
+
* {@link disabledReason}: a spoken default so the error state is never silent
|
|
422
|
+
* to assistive tech. The error slot, when present, wins over this string.
|
|
423
|
+
*/
|
|
424
|
+
readonly errorMessage: _angular_core.InputSignal<string>;
|
|
425
|
+
/**
|
|
426
|
+
* Stable id this item registers under in the coordinator's open-set. Defaults
|
|
427
|
+
* to a generated id; bind `[panelId]` to a stable consumer value to address
|
|
428
|
+
* the panel through the group's `[(openIds)]` model - seed it open on load or
|
|
429
|
+
* drive expansion from router/SSR state. Mirrors `CngxTab.id` / `CngxStep.id`.
|
|
430
|
+
*/
|
|
431
|
+
readonly panelId: _angular_core.InputSignal<string>;
|
|
432
|
+
/**
|
|
433
|
+
* The panel's async lifecycle, communicated to assistive tech. Accepts a raw
|
|
434
|
+
* {@link AsyncStatus} or a {@link CngxAsyncState} the consumer already owns -
|
|
435
|
+
* the item reads only the status discriminator, never the payload, so it stays
|
|
436
|
+
* non-generic. A pure data input (the item injects no `CNGX_STATEFUL`), so no
|
|
437
|
+
* empty-string transform: a bare string status must survive untouched. The
|
|
438
|
+
* consumer wires the fetch; the item only communicates the state it is handed.
|
|
439
|
+
*/
|
|
440
|
+
readonly state: _angular_core.InputSignal<AsyncStatus | CngxAsyncState<unknown> | undefined>;
|
|
441
|
+
private readonly accordion;
|
|
442
|
+
protected readonly group: _cngx_ui_accordion.CngxAccordionGroupContext;
|
|
443
|
+
protected readonly regionId: string;
|
|
444
|
+
protected readonly headerId: string;
|
|
445
|
+
protected readonly titleId: string;
|
|
446
|
+
protected readonly subtitleId: string;
|
|
447
|
+
protected readonly reasonId: string;
|
|
448
|
+
/**
|
|
449
|
+
* The button's `aria-describedby`: subtitle first (an informative secondary
|
|
450
|
+
* line the title-only name-pin would otherwise hide from AT), then the
|
|
451
|
+
* disabled-reason element. Both IDREFs are always present in the DOM - the
|
|
452
|
+
* subtitle span toggles `aria-hidden` by presence, the reason span toggles by
|
|
453
|
+
* `disabled()`. Constant string: the ids never change, so no `computed()`.
|
|
454
|
+
*/
|
|
455
|
+
protected readonly describedBy: string;
|
|
456
|
+
/** Lazy region-body slot; absent means the body projects eagerly through the default slot. */
|
|
457
|
+
protected readonly contentSlot: _angular_core.Signal<CngxAccordionItemContent | undefined>;
|
|
458
|
+
/**
|
|
459
|
+
* Subtitle presence, so the always-present subtitle IDREF wrapper toggles its
|
|
460
|
+
* `aria-hidden` by projection: hidden (empty) when unbound, announced through
|
|
461
|
+
* `aria-describedby` when a subtitle is projected.
|
|
462
|
+
*/
|
|
463
|
+
protected readonly subtitleSlot: _angular_core.Signal<CngxAccordionItemSubtitle | undefined>;
|
|
464
|
+
/** Chevron override slot; absent means the CSS chevron default renders. */
|
|
465
|
+
protected readonly iconSlot: _angular_core.Signal<CngxAccordionItemIcon | undefined>;
|
|
466
|
+
/** Busy-state slot; absent means the CSS skeleton default renders. */
|
|
467
|
+
protected readonly busySlot: _angular_core.Signal<CngxAccordionItemBusy | undefined>;
|
|
468
|
+
/** Error-state slot; absent means the CSS error affordance default renders. */
|
|
469
|
+
protected readonly errorSlot: _angular_core.Signal<CngxAccordionItemError | undefined>;
|
|
470
|
+
/**
|
|
471
|
+
* Resolved chevron template through the three-stage slot cascade: per-instance
|
|
472
|
+
* `*cngxAccordionItemIcon` -> app-wide `CNGX_ACCORDION_CONFIG.templates.icon`
|
|
473
|
+
* -> `null` (the CSS chevron default renders).
|
|
474
|
+
*/
|
|
475
|
+
protected readonly iconTemplate: _angular_core.Signal<_angular_core.TemplateRef<any> | null>;
|
|
476
|
+
/**
|
|
477
|
+
* Resolved busy template through the three-stage slot cascade: per-instance
|
|
478
|
+
* `*cngxAccordionItemBusy` -> `CNGX_ACCORDION_CONFIG.templates.busySpinner` ->
|
|
479
|
+
* `null` (the CSS skeleton default renders).
|
|
480
|
+
*/
|
|
481
|
+
protected readonly busyTemplate: _angular_core.Signal<_angular_core.TemplateRef<any> | null>;
|
|
482
|
+
/**
|
|
483
|
+
* Resolved error template through the three-stage slot cascade: per-instance
|
|
484
|
+
* `*cngxAccordionItemError` -> `CNGX_ACCORDION_CONFIG.templates.error` ->
|
|
485
|
+
* `null` (the CSS error affordance default renders).
|
|
486
|
+
*/
|
|
487
|
+
protected readonly errorTemplate: _angular_core.Signal<_angular_core.TemplateRef<any> | null>;
|
|
488
|
+
/**
|
|
489
|
+
* Panel async status, normalised to an {@link AsyncStatus} from either the raw
|
|
490
|
+
* enum or a {@link CngxAsyncState} object form (reads its `status()` signal).
|
|
491
|
+
* A primitive, so `Object.is` dedupes - no `equal` needed. The object form's
|
|
492
|
+
* status signal IS tracked, so a consumer state machine drives this directly.
|
|
493
|
+
*/
|
|
494
|
+
protected readonly status: _angular_core.Signal<AsyncStatus | undefined>;
|
|
495
|
+
/**
|
|
496
|
+
* `aria-busy` driver. Mirrors `CngxAsyncState.isBusy` (loading|refreshing|
|
|
497
|
+
* pending) so the string and object input forms agree. Boolean, no `equal`.
|
|
498
|
+
*/
|
|
499
|
+
protected readonly busy: _angular_core.Signal<boolean>;
|
|
500
|
+
/** Whether this item's region is open, derived from the coordinator's open-set. */
|
|
501
|
+
protected readonly expanded: _angular_core.Signal<boolean>;
|
|
502
|
+
/**
|
|
503
|
+
* Region visibility. Hidden while collapsed, EXCEPT in the error state: an
|
|
504
|
+
* errored item un-hides its region so the `role="alert"` mounts into the live
|
|
505
|
+
* a11y tree and is announced even when the item was never opened (Pillar 2 -
|
|
506
|
+
* an error is never silenced by a collapsed panel).
|
|
507
|
+
*/
|
|
508
|
+
protected readonly regionHidden: _angular_core.Signal<boolean>;
|
|
509
|
+
/**
|
|
510
|
+
* Keep-alive latch for lazy content: `false` until the region first opens,
|
|
511
|
+
* then `true` forever. Derived history (Pillar 1) - a `linkedSignal`
|
|
512
|
+
* accumulating onto its own previous value, never an effect that writes a
|
|
513
|
+
* signal. Boolean, so `Object.is` keeps a stable reference once latched.
|
|
514
|
+
*/
|
|
515
|
+
protected readonly hasOpened: _angular_core.WritableSignal<boolean>;
|
|
516
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAccordionItem, never>;
|
|
517
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxAccordionItem, "cngx-accordion-item", ["cngxAccordionItem"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "severity": { "alias": "severity"; "required": false; "isSignal": true; }; "disabledReason": { "alias": "disabledReason"; "required": false; "isSignal": true; }; "errorMessage": { "alias": "errorMessage"; "required": false; "isSignal": true; }; "panelId": { "alias": "panelId"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; }, {}, ["contentSlot", "subtitleSlot", "iconSlot", "busySlot", "errorSlot"], ["[cngxAccordionItemLeading]", "[cngxAccordionItemTitle]", "[cngxAccordionItemSubtitle]", "[cngxAccordionItemMeta]", "*"], true, never>;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Projected-title marker for a {@link CngxAccordionItem}. Put it on the element
|
|
522
|
+
* that names the section; the item projects it into the header button via
|
|
523
|
+
* `<ng-content select="[cngxAccordionItemTitle]">`, so the title becomes the
|
|
524
|
+
* header's accessible name.
|
|
525
|
+
*
|
|
526
|
+
* ```html
|
|
527
|
+
* <cngx-accordion-item>
|
|
528
|
+
* <span cngxAccordionItemTitle>Billing</span>
|
|
529
|
+
* Body…
|
|
530
|
+
* </cngx-accordion-item>
|
|
531
|
+
* ```
|
|
532
|
+
*
|
|
533
|
+
* @category ui/accordion
|
|
534
|
+
* @wcag AA
|
|
535
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/accordion/accordion-item-title.directive.ts
|
|
536
|
+
* @since 0.1.0
|
|
537
|
+
* @relatedTo CngxAccordionItem
|
|
538
|
+
*/
|
|
539
|
+
declare class CngxAccordionItemTitle {
|
|
540
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAccordionItemTitle, never>;
|
|
541
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxAccordionItemTitle, "[cngxAccordionItemTitle]", ["cngxAccordionItemTitle"], {}, {}, never, never, true, never>;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Projected-leading marker for a {@link CngxAccordionItem}. Put it on the
|
|
546
|
+
* decorative cell that opens the heading row - an index number, an icon tile, a
|
|
547
|
+
* category tag, a timeline rail-node, a severity spine. The item renders it as a
|
|
548
|
+
* sibling of the header button (not inside it) and wraps it `aria-hidden`, since
|
|
549
|
+
* leading content is presentational: it never names the section and must not
|
|
550
|
+
* leak into the button's accessible name.
|
|
551
|
+
*
|
|
552
|
+
* ```html
|
|
553
|
+
* <cngx-accordion-item>
|
|
554
|
+
* <span cngxAccordionItemLeading>01</span>
|
|
555
|
+
* <span cngxAccordionItemTitle>Overview</span>
|
|
556
|
+
* Body…
|
|
557
|
+
* </cngx-accordion-item>
|
|
558
|
+
* ```
|
|
559
|
+
*
|
|
560
|
+
* @category ui/accordion
|
|
561
|
+
* @wcag AA
|
|
562
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/accordion/accordion-item-leading.directive.ts
|
|
563
|
+
* @since 0.1.0
|
|
564
|
+
* @relatedTo CngxAccordionItem, CngxAccordionItemMeta
|
|
565
|
+
*/
|
|
566
|
+
declare class CngxAccordionItemLeading {
|
|
567
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAccordionItemLeading, never>;
|
|
568
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxAccordionItemLeading, "[cngxAccordionItemLeading]", ["cngxAccordionItemLeading"], {}, {}, never, never, true, never>;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Projected trailing-meta marker for a {@link CngxAccordionItem}. Put it on the
|
|
573
|
+
* facts that trail the title - a timestamp, a status badge, an SLA chip, an
|
|
574
|
+
* amount. The item renders it as a sibling of the header button (not inside it),
|
|
575
|
+
* so interactive meta content (a link, a remove-button) stays valid HTML instead
|
|
576
|
+
* of nesting a control inside a button. Meta is real content, not `aria-hidden`:
|
|
577
|
+
* it is excluded from the button's accessible name only by the name-pin to the
|
|
578
|
+
* title, so screen-reader users still reach it in reading order.
|
|
579
|
+
*
|
|
580
|
+
* ```html
|
|
581
|
+
* <cngx-accordion-item>
|
|
582
|
+
* <span cngxAccordionItemTitle>Deployment</span>
|
|
583
|
+
* <span cngxAccordionItemMeta><cngx-badge>Failed</cngx-badge></span>
|
|
584
|
+
* Body…
|
|
585
|
+
* </cngx-accordion-item>
|
|
586
|
+
* ```
|
|
587
|
+
*
|
|
588
|
+
* @category ui/accordion
|
|
589
|
+
* @wcag AA
|
|
590
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/accordion/accordion-item-meta.directive.ts
|
|
591
|
+
* @since 0.1.0
|
|
592
|
+
* @relatedTo CngxAccordionItem, CngxAccordionItemLeading
|
|
593
|
+
*/
|
|
594
|
+
declare class CngxAccordionItemMeta {
|
|
595
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAccordionItemMeta, never>;
|
|
596
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxAccordionItemMeta, "[cngxAccordionItemMeta]", ["cngxAccordionItemMeta"], {}, {}, never, never, true, never>;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* App-wide configuration cascade for the accordion organism. Resolves in
|
|
601
|
+
* priority order:
|
|
602
|
+
*
|
|
603
|
+
* 1. Per-instance Input binding.
|
|
604
|
+
* 2. `provideAccordionConfigAt(...)` in a parent component's `viewProviders`.
|
|
605
|
+
* 3. `provideAccordionConfig(...)` at the application root.
|
|
606
|
+
* 4. Library defaults (this token's `factory`).
|
|
607
|
+
*
|
|
608
|
+
* `providedIn: 'root'` with a default factory means consumers never need to
|
|
609
|
+
* provide the token explicitly - `inject(CNGX_ACCORDION_CONFIG)` always
|
|
610
|
+
* resolves. Consumers who want overrides call `provideAccordionConfig(...)` in
|
|
611
|
+
* `bootstrapApplication` providers (root cascade) or
|
|
612
|
+
* `provideAccordionConfigAt(...)` in a component's `viewProviders` (sub-tree
|
|
613
|
+
* cascade).
|
|
614
|
+
*
|
|
615
|
+
* @category ui/accordion
|
|
616
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/accordion/config/accordion.config.defaults.ts
|
|
617
|
+
* @since 0.1.0
|
|
618
|
+
*/
|
|
619
|
+
declare const CNGX_ACCORDION_CONFIG: InjectionToken<CngxAccordionConfig>;
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Discriminated-union shape returned by `withAccordionLabels` /
|
|
623
|
+
* `withDefaultHeadingLevel`. The reducer in `provideAccordionConfig` /
|
|
624
|
+
* `provideAccordionConfigAt` matches on `kind` and writes `payload` onto the
|
|
625
|
+
* corresponding config key. Mirrors `CngxBreadcrumbConfigFeature` from
|
|
626
|
+
* `@cngx/ui/breadcrumb` so the consumer's mental model is one across feature
|
|
627
|
+
* areas.
|
|
628
|
+
*
|
|
629
|
+
* @category ui/accordion
|
|
630
|
+
* @since 0.1.0
|
|
631
|
+
*/
|
|
632
|
+
type CngxAccordionConfigFeature = {
|
|
633
|
+
readonly kind: 'labels';
|
|
634
|
+
readonly payload: {
|
|
635
|
+
readonly disabledReason?: string;
|
|
636
|
+
readonly errorMessage?: string;
|
|
637
|
+
};
|
|
638
|
+
} | {
|
|
639
|
+
readonly kind: 'headingLevel';
|
|
640
|
+
readonly payload: {
|
|
641
|
+
readonly headingLevel: number;
|
|
642
|
+
};
|
|
643
|
+
} | {
|
|
644
|
+
readonly kind: 'skin';
|
|
645
|
+
readonly payload: {
|
|
646
|
+
readonly skin: CngxAccordionSkin;
|
|
647
|
+
};
|
|
648
|
+
} | {
|
|
649
|
+
readonly kind: 'templates';
|
|
650
|
+
readonly payload: NonNullable<CngxAccordionConfig['templates']>;
|
|
651
|
+
};
|
|
652
|
+
/**
|
|
653
|
+
* Application-root configuration cascade for the accordion. Pass any
|
|
654
|
+
* combination of `withAccordionLabels` / `withDefaultHeadingLevel` features in
|
|
655
|
+
* `bootstrapApplication`'s providers array.
|
|
656
|
+
*
|
|
657
|
+
* Resolution priority (high -> low):
|
|
658
|
+
* 1. Per-instance Input binding.
|
|
659
|
+
* 2. `provideAccordionConfigAt(...)` in a parent component's `viewProviders`.
|
|
660
|
+
* 3. `provideAccordionConfig(...)` at the application root.
|
|
661
|
+
* 4. Library defaults (`CNGX_ACCORDION_DEFAULTS`).
|
|
662
|
+
*
|
|
663
|
+
* The provider merges supplied features with the library defaults so consumers
|
|
664
|
+
* only declare keys they want to override.
|
|
665
|
+
*
|
|
666
|
+
* ```ts
|
|
667
|
+
* bootstrapApplication(AppComponent, {
|
|
668
|
+
* providers: [
|
|
669
|
+
* provideAccordionConfig(
|
|
670
|
+
* withAccordionLabels({ disabledReason: 'Dieser Abschnitt ist gesperrt.' }),
|
|
671
|
+
* withDefaultHeadingLevel(2),
|
|
672
|
+
* withAccordionSkin('categorized'),
|
|
673
|
+
* ),
|
|
674
|
+
* ],
|
|
675
|
+
* });
|
|
676
|
+
* ```
|
|
677
|
+
*
|
|
678
|
+
* @category ui/accordion
|
|
679
|
+
* @since 0.1.0
|
|
680
|
+
*/
|
|
681
|
+
declare function provideAccordionConfig(...features: CngxAccordionConfigFeature[]): EnvironmentProviders;
|
|
682
|
+
/**
|
|
683
|
+
* Component-scoped configuration cascade for the accordion. Pass any
|
|
684
|
+
* combination of feature factories in a parent component's `viewProviders`
|
|
685
|
+
* array.
|
|
686
|
+
*
|
|
687
|
+
* Unlike `provideAccordionConfig` (root-only), `provideAccordionConfigAt`
|
|
688
|
+
* injects the parent injector's `CNGX_ACCORDION_CONFIG` value (resolves through
|
|
689
|
+
* the priority chain - root provider, library defaults, or another
|
|
690
|
+
* `provideAccordionConfigAt` further up) and merges the supplied features on
|
|
691
|
+
* top. Descendant accordion instances see the merged config; sibling sub-trees
|
|
692
|
+
* keep the inherited value untouched.
|
|
693
|
+
*
|
|
694
|
+
* ```ts
|
|
695
|
+
* @Component({
|
|
696
|
+
* viewProviders: [
|
|
697
|
+
* provideAccordionConfigAt(withAccordionLabels({ disabledReason: 'Locked.' })),
|
|
698
|
+
* ],
|
|
699
|
+
* template: '<cngx-accordion-group>...</cngx-accordion-group>',
|
|
700
|
+
* })
|
|
701
|
+
* class Section {}
|
|
702
|
+
* ```
|
|
703
|
+
*
|
|
704
|
+
* @category ui/accordion
|
|
705
|
+
* @since 0.1.0
|
|
706
|
+
*/
|
|
707
|
+
declare function provideAccordionConfigAt(...features: CngxAccordionConfigFeature[]): Provider[];
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Override the accordion's locale-sensitive announced strings - `disabledReason`
|
|
711
|
+
* (spoken when an item is disabled) and `errorMessage` (spoken via `role="alert"`
|
|
712
|
+
* when an item's `[state]` is error and no error slot is given). Pass either or
|
|
713
|
+
* both. Per-instance `[disabledReason]` / `[errorMessage]` still win over the
|
|
714
|
+
* cascade; this only sets the fallback.
|
|
715
|
+
*
|
|
716
|
+
* ```ts
|
|
717
|
+
* provideAccordionConfig(
|
|
718
|
+
* withAccordionLabels({
|
|
719
|
+
* disabledReason: 'This section is locked.',
|
|
720
|
+
* errorMessage: 'This section failed to load.',
|
|
721
|
+
* }),
|
|
722
|
+
* );
|
|
723
|
+
* ```
|
|
724
|
+
*
|
|
725
|
+
* @category ui/accordion
|
|
726
|
+
* @since 0.1.0
|
|
727
|
+
*/
|
|
728
|
+
declare function withAccordionLabels(payload: {
|
|
729
|
+
disabledReason?: string;
|
|
730
|
+
errorMessage?: string;
|
|
731
|
+
}): CngxAccordionConfigFeature;
|
|
732
|
+
/**
|
|
733
|
+
* Override the default heading level (`aria-level`) a `CngxAccordionGroup`
|
|
734
|
+
* applies when `[headingLevel]` is not bound. Per-instance `[headingLevel]`
|
|
735
|
+
* still wins; the group clamps the resolved value into the ARIA 2-6 range.
|
|
736
|
+
*
|
|
737
|
+
* ```ts
|
|
738
|
+
* provideAccordionConfig(withDefaultHeadingLevel(2));
|
|
739
|
+
* ```
|
|
740
|
+
*
|
|
741
|
+
* @category ui/accordion
|
|
742
|
+
* @since 0.1.0
|
|
743
|
+
*/
|
|
744
|
+
declare function withDefaultHeadingLevel(headingLevel: number): CngxAccordionConfigFeature;
|
|
745
|
+
/**
|
|
746
|
+
* Set the app-wide default visual skin for `<cngx-accordion-group>`. Unset by
|
|
747
|
+
* default (the base flat look). Per-instance `[skin]` Input still wins; this
|
|
748
|
+
* moves the cascade default. Structure, slots, ARIA, and keyboard behaviour are
|
|
749
|
+
* identical across skins - only the `[data-skin]` host attribute changes the
|
|
750
|
+
* CSS. Typed class-sugar, not a mode flag.
|
|
751
|
+
*
|
|
752
|
+
* ```ts
|
|
753
|
+
* provideAccordionConfig(withAccordionSkin('categorized'));
|
|
754
|
+
* ```
|
|
755
|
+
*
|
|
756
|
+
* @category ui/accordion
|
|
757
|
+
* @since 0.1.0
|
|
758
|
+
*/
|
|
759
|
+
declare function withAccordionSkin(skin: CngxAccordionSkin): CngxAccordionConfigFeature;
|
|
760
|
+
/**
|
|
761
|
+
* Set app-wide slot templates - the config tier of the slot cascade
|
|
762
|
+
* (`*cngxAccordionItemXxx` per-instance -> this -> CSS default). Three slots
|
|
763
|
+
* carry a config tier: `icon` (chevron; `$implicit` is the item's expanded
|
|
764
|
+
* state), `busySpinner` (loading/refreshing visual), and `error` (error
|
|
765
|
+
* affordance). Hand a `TemplateRef` per key here and every item renders it
|
|
766
|
+
* unless a per-instance slot overrides it. Partial payloads compose - repeated
|
|
767
|
+
* calls merge per key.
|
|
768
|
+
*
|
|
769
|
+
* ```ts
|
|
770
|
+
* provideAccordionConfig(
|
|
771
|
+
* withAccordionTemplates({ icon: myChevronTpl, busySpinner: mySpinnerTpl }),
|
|
772
|
+
* );
|
|
773
|
+
* ```
|
|
774
|
+
*
|
|
775
|
+
* @category ui/accordion
|
|
776
|
+
* @since 0.1.0
|
|
777
|
+
*/
|
|
778
|
+
declare function withAccordionTemplates(payload: NonNullable<CngxAccordionConfig['templates']>): CngxAccordionConfigFeature;
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Convenience accessor for the accordion configuration cascade. Runs in
|
|
782
|
+
* injection context; resolves through the priority chain (per-instance Input
|
|
783
|
+
* -> `provideAccordionConfigAt` -> `provideAccordionConfig` -> library
|
|
784
|
+
* defaults). Equivalent to `inject(CNGX_ACCORDION_CONFIG)` - the helper exists
|
|
785
|
+
* so consumers don't import the token directly. Mirrors `injectBreadcrumbConfig`
|
|
786
|
+
* in `@cngx/ui/breadcrumb`.
|
|
787
|
+
*
|
|
788
|
+
* ```ts
|
|
789
|
+
* export class CngxAccordionItem {
|
|
790
|
+
* private readonly config = injectAccordionConfig();
|
|
791
|
+
* readonly disabledReason = input<string>(this.config.disabledReason);
|
|
792
|
+
* }
|
|
793
|
+
* ```
|
|
794
|
+
*
|
|
795
|
+
* @category ui/accordion
|
|
796
|
+
* @since 0.1.0
|
|
797
|
+
*/
|
|
798
|
+
declare function injectAccordionConfig(): CngxAccordionConfig;
|
|
799
|
+
|
|
800
|
+
export { CNGX_ACCORDION_CONFIG, CNGX_ACCORDION_GROUP, CngxAccordionGroup, CngxAccordionItem, CngxAccordionItemBusy, CngxAccordionItemContent, CngxAccordionItemError, CngxAccordionItemIcon, CngxAccordionItemLeading, CngxAccordionItemMeta, CngxAccordionItemSubtitle, CngxAccordionItemTitle, injectAccordionConfig, provideAccordionConfig, provideAccordionConfigAt, withAccordionLabels, withAccordionSkin, withAccordionTemplates, withDefaultHeadingLevel };
|
|
801
|
+
export type { CngxAccordionConfig, CngxAccordionConfigFeature, CngxAccordionGroupContext, CngxAccordionItemIconContext, CngxAccordionItemStateContext, CngxAccordionSeverity, CngxAccordionSkin };
|