@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.
- package/README.md +112 -1
- package/a11y/README.md +87 -0
- package/accordion/README.md +4 -2
- package/breadcrumb/README.md +262 -0
- package/collection/README.md +6 -0
- package/command-palette/README.md +224 -0
- package/context-menu/README.md +98 -0
- package/data-grid-accordion/README.md +103 -2
- package/feedback/README.md +42 -0
- package/fesm2022/cngx-ui-a11y.mjs +452 -0
- package/fesm2022/cngx-ui-a11y.mjs.map +1 -0
- package/fesm2022/cngx-ui-accordion.mjs +116 -38
- package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-action-button.mjs +115 -50
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-breadcrumb.mjs +181 -96
- package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/cngx-ui-chart-panel.mjs +586 -0
- package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -0
- package/fesm2022/cngx-ui-collection.mjs +207 -66
- package/fesm2022/cngx-ui-collection.mjs.map +1 -1
- package/fesm2022/cngx-ui-command-palette.mjs +1281 -0
- package/fesm2022/cngx-ui-command-palette.mjs.map +1 -0
- package/fesm2022/cngx-ui-context-menu.mjs +857 -0
- package/fesm2022/cngx-ui-context-menu.mjs.map +1 -0
- package/fesm2022/cngx-ui-data-grid-accordion.mjs +498 -111
- package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-empty-state.mjs +16 -6
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +1095 -521
- 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 +84 -16
- package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-paginator.mjs +67 -24
- package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-stepper.mjs +72 -47
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +370 -203
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-overlay.mjs +69 -13
- package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
- package/fesm2022/cngx-ui-paginator.mjs +501 -182
- package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +327 -106
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +22 -21
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +107 -8
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stat-card.mjs +718 -0
- package/fesm2022/cngx-ui-stat-card.mjs.map +1 -0
- package/fesm2022/cngx-ui-stepper.mjs +217 -76
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +40 -19
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-timeline.mjs +548 -0
- package/fesm2022/cngx-ui-timeline.mjs.map +1 -0
- package/fesm2022/cngx-ui-toc.mjs +748 -0
- package/fesm2022/cngx-ui-toc.mjs.map +1 -0
- package/fesm2022/cngx-ui.mjs +16 -21
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/mat-accordion/README.md +1 -1
- package/mat-paginator/README.md +9 -2
- package/mat-tabs/styles/mat-tabs.css +29 -27
- package/overlay/README.md +9 -4
- package/package.json +32 -1
- package/paginator/README.md +8 -4
- package/sidenav/README.md +33 -11
- package/skeleton/README.md +2 -0
- package/speak/README.md +3 -2
- package/stepper/README.md +15 -3
- package/timeline/README.md +350 -0
- package/toc/README.md +186 -0
- package/types/cngx-ui-a11y.d.ts +394 -0
- package/types/cngx-ui-accordion.d.ts +100 -30
- package/types/cngx-ui-action-button.d.ts +47 -3
- package/types/cngx-ui-breadcrumb.d.ts +159 -58
- package/types/cngx-ui-chart-panel.d.ts +382 -0
- package/types/cngx-ui-collection.d.ts +159 -58
- package/types/cngx-ui-command-palette.d.ts +565 -0
- package/types/cngx-ui-context-menu.d.ts +559 -0
- package/types/cngx-ui-data-grid-accordion.d.ts +344 -51
- package/types/cngx-ui-empty-state.d.ts +9 -2
- package/types/cngx-ui-feedback.d.ts +664 -73
- package/types/cngx-ui-layout.d.ts +8 -3
- package/types/cngx-ui-mat-accordion.d.ts +32 -4
- package/types/cngx-ui-mat-paginator.d.ts +37 -8
- package/types/cngx-ui-mat-stepper.d.ts +23 -11
- package/types/cngx-ui-mat-tabs.d.ts +218 -23
- package/types/cngx-ui-overlay.d.ts +56 -10
- package/types/cngx-ui-paginator.d.ts +416 -132
- package/types/cngx-ui-sidenav.d.ts +248 -74
- package/types/cngx-ui-skeleton.d.ts +18 -7
- package/types/cngx-ui-speak.d.ts +118 -5
- package/types/cngx-ui-stat-card.d.ts +411 -0
- package/types/cngx-ui-stepper.d.ts +81 -29
- package/types/cngx-ui-tabs.d.ts +22 -6
- package/types/cngx-ui-timeline.d.ts +495 -0
- package/types/cngx-ui-toc.d.ts +581 -0
- package/types/cngx-ui.d.ts +8 -5
package/README.md
CHANGED
|
@@ -78,6 +78,87 @@ need `@if`/`@for` boilerplate.
|
|
|
78
78
|
|
|
79
79
|
**Selector:** `cngx-skeleton` -- exportAs `"cngxSkeletonContainer"`
|
|
80
80
|
|
|
81
|
+
### CngxStatCard
|
|
82
|
+
|
|
83
|
+
Card-framed KPI tile. One `<cngx-stat-card [state]="s">` renders the whole
|
|
84
|
+
dashboard metric: card surface, the four coordinated stat slots, an inline
|
|
85
|
+
visualisation and a footer, with the async view switch derived from `[state]`.
|
|
86
|
+
|
|
87
|
+
The stat slots are the existing `cngxStat*` atoms from `@cngx/common/data`, not
|
|
88
|
+
copies. They resolve `CNGX_STAT` at their declaration site, so the card hosts
|
|
89
|
+
the shared `CngxStatCoordinator` brain and re-points the token at it - the same
|
|
90
|
+
shape `CngxIncrementalList` uses for `CNGX_PAGINATOR_HOST`. The tile therefore
|
|
91
|
+
carries one accessible name in reading order instead of four fragments.
|
|
92
|
+
|
|
93
|
+
```html
|
|
94
|
+
<cngx-stat-card [state]="revenue" live="polite">
|
|
95
|
+
<span cngxStatLabel>Revenue</span>
|
|
96
|
+
<cngx-metric cngxStatValue [value]="1.2" unit="M EUR" />
|
|
97
|
+
<cngx-delta cngxStatDelta [value]="5.3" />
|
|
98
|
+
<span cngxStatCaption>vs. last quarter</span>
|
|
99
|
+
<cngx-sparkline cngxStatCardViz [data]="trend()" />
|
|
100
|
+
</cngx-stat-card>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Inputs:** `state` (`CngxAsyncState<unknown>`), `loadingTreatment`
|
|
104
|
+
(`'auto' | 'spinner' | 'skeleton'`), `live` (`'off' | 'polite' | 'assertive'`),
|
|
105
|
+
`busyLabel`, `errorText`, `staleText`
|
|
106
|
+
|
|
107
|
+
**Slots:** `cngxStatLabel` / `cngxStatValue` / `cngxStatDelta` /
|
|
108
|
+
`cngxStatCaption` (re-exported), plus `cngxStatCardViz` and `cngxStatCardFooter`
|
|
109
|
+
|
|
110
|
+
With `loadingTreatment="auto"` the tile picks spinner vs skeleton from the
|
|
111
|
+
latency it observed. The threshold is never hardcoded - it comes from
|
|
112
|
+
`CNGX_LOADING_CONFIG`, so one `provideLoadingConfig(...)` retunes every tile.
|
|
113
|
+
|
|
114
|
+
**Config:** `provideStatCardConfig` / `provideStatCardConfigAt` /
|
|
115
|
+
`injectStatCardConfig`, features `withStatCardAriaLabels` and
|
|
116
|
+
`withStatCardLoadingTreatment`
|
|
117
|
+
|
|
118
|
+
**Selector:** `cngx-stat-card` -- entry `@cngx/ui/stat-card`
|
|
119
|
+
|
|
120
|
+
### CngxChartPanel
|
|
121
|
+
|
|
122
|
+
Dashboard housing for a chart: title, subtitle, header actions, legend
|
|
123
|
+
placement and footer. `role="group"` plus an `aria-labelledby` pointing at the
|
|
124
|
+
projected title makes the region announce as one named unit rather than
|
|
125
|
+
dropping the user into an unlabelled SVG.
|
|
126
|
+
|
|
127
|
+
The panel frames a projected `cngx-chart` and never duplicates its machine. The
|
|
128
|
+
chart keeps owning its data async envelope, its view switch and its SR data
|
|
129
|
+
table; panel-level `[state]` drives header chrome only. `aria-busy` sits on the
|
|
130
|
+
header, not on the group - on the region it would hold back the chart's own live
|
|
131
|
+
announcements and claim a stable chart is updating.
|
|
132
|
+
|
|
133
|
+
```html
|
|
134
|
+
<cngx-chart-panel [state]="rangeSwitch" legendPosition="bottom">
|
|
135
|
+
<h3 cngxChartPanelTitle>Revenue by quarter</h3>
|
|
136
|
+
<span cngxChartPanelSubtitle>EUR, net</span>
|
|
137
|
+
<button cngxChartPanelActions type="button">Change range</button>
|
|
138
|
+
|
|
139
|
+
<cngx-chart [data]="series" [state]="chartState">
|
|
140
|
+
<svg:g cngxLine [data]="series"></svg:g>
|
|
141
|
+
</cngx-chart>
|
|
142
|
+
|
|
143
|
+
<cngx-chart-legend [items]="legend" />
|
|
144
|
+
</cngx-chart-panel>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Inputs:** `state` (`CngxAsyncState<unknown>`), `legendPosition`
|
|
148
|
+
(`'top' | 'bottom' | 'none'`)
|
|
149
|
+
|
|
150
|
+
**Slots:** `cngxChartPanelTitle`, `cngxChartPanelSubtitle`,
|
|
151
|
+
`cngxChartPanelActions`, `cngxChartPanelFooter`
|
|
152
|
+
|
|
153
|
+
The legend slot matches the bare `cngx-chart-legend` tag; a legend wrapped in an
|
|
154
|
+
element of your own lands in the body instead.
|
|
155
|
+
|
|
156
|
+
**Config:** `provideChartPanelConfig` / `provideChartPanelConfigAt` /
|
|
157
|
+
`injectChartPanelConfig`, features `withChartPanelAriaLabels` and
|
|
158
|
+
`withChartPanelLegendPosition`
|
|
159
|
+
|
|
160
|
+
**Selector:** `cngx-chart-panel` -- entry `@cngx/ui/chart-panel`
|
|
161
|
+
|
|
81
162
|
### CngxActionButton
|
|
82
163
|
|
|
83
164
|
Action button molecule with built-in async status communication. Composes
|
|
@@ -235,6 +316,37 @@ via the CSS `grid-template-rows: 0fr/1fr` trick (no `@angular/animations` needed
|
|
|
235
316
|
|
|
236
317
|
**Material theme:** `@use '@cngx/themes/material/sidenav-theme'` - includes nav-link theme automatically
|
|
237
318
|
|
|
319
|
+
### CngxToc (`@cngx/ui/toc`)
|
|
320
|
+
|
|
321
|
+
"On this page" navigation rail. Renders a `<nav>` of anchor links from a
|
|
322
|
+
`CngxTocItem[]` outline, tracks the most-visible section through an internal
|
|
323
|
+
`CngxScrollSpy`, and reflects it on `aria-current` inside the `computed()`
|
|
324
|
+
graph. Activating a link scrolls the section into view (honouring
|
|
325
|
+
`prefers-reduced-motion`) and moves focus to it.
|
|
326
|
+
|
|
327
|
+
```html
|
|
328
|
+
<cngx-toc [items]="toc" contentRoot="#article"></cngx-toc>
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
**Inputs:** `items` (required, `CngxTocItem[]`), `contentRoot` (scroll-container
|
|
332
|
+
selector, default viewport), `rootMargin`, `threshold` (forwarded to the spy).
|
|
333
|
+
**Output:** `activated` (the item whose link was clicked).
|
|
334
|
+
**Slot:** `*cngxTocItem` (context `$implicit` / `active` / `depth`).
|
|
335
|
+
**Router sync:** add `[cngxTocRouterSync]` on the same host to deep-link the
|
|
336
|
+
active section into the URL fragment (opt-in, `CNGX_TOC` contract token).
|
|
337
|
+
|
|
338
|
+
A toc is a **navigation landmark of links, not a tree**. Nesting is communicated
|
|
339
|
+
structurally (nested `<ul>`, indentation) so native tab order and link semantics
|
|
340
|
+
stay intact - the APG treeview pattern is deliberately not applied. Reach for
|
|
341
|
+
`CngxSidenav` instead when you need a collapsible primary-navigation rail with a
|
|
342
|
+
selection model; `CngxToc` is a passive reflection of scroll position.
|
|
343
|
+
|
|
344
|
+
**Focus contract:** to move focus to a scrolled-to section, `CngxToc` sets
|
|
345
|
+
`tabindex="-1"` on the target element only when it is not focusable by default
|
|
346
|
+
and carries no author-set `tabindex`; an author value is never overwritten.
|
|
347
|
+
|
|
348
|
+
**Material theme:** `@use '@cngx/themes/material/toc-theme'`
|
|
349
|
+
|
|
238
350
|
### CngxToaster - Toast API (`@cngx/ui/feedback`)
|
|
239
351
|
|
|
240
352
|
Programmatic toast service. Not `providedIn: 'root'` - provide via
|
|
@@ -523,7 +635,6 @@ Shows banner on `error` transition, auto-dismisses on `success`/`idle`.
|
|
|
523
635
|
| `--cngx-banner-gap` | `12px` | Gap between elements |
|
|
524
636
|
| `--cngx-banner-padding` | `10px 16px` | Banner padding |
|
|
525
637
|
| `--cngx-banner-font-size` | `0.9375rem` | Message font size |
|
|
526
|
-
| `--cngx-banner-action-min-size` | `44px` | Min touch target for action button |
|
|
527
638
|
| `--cngx-banner-pending-opacity` | `0.85` | Opacity during async action |
|
|
528
639
|
| `--cngx-banner-{severity}-bg` | per severity | Background |
|
|
529
640
|
| `--cngx-banner-{severity}-border` | per severity | Border |
|
package/a11y/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# @cngx/ui/a11y
|
|
2
|
+
|
|
3
|
+
Batteries-included accessibility preferences UI. Ships `CngxA11yPanel`: a plain
|
|
4
|
+
in-flow card that renders one labelled control group per accessibility axis
|
|
5
|
+
(spacing/density, text size, motion, contrast) bound to the app-wide preference
|
|
6
|
+
signals, plus a Reset.
|
|
7
|
+
|
|
8
|
+
The panel ships no trigger, no overlay, and no placement of its own. Drop
|
|
9
|
+
`<cngx-a11y-panel>` wherever it belongs - inline on a settings page, inside a
|
|
10
|
+
`CngxDrawer`, inside a `CngxDialog`, or behind your own popover trigger. It is
|
|
11
|
+
the same split as `CngxListbox` under `CngxSelect`: the panel owns the axis
|
|
12
|
+
controls, the consumer owns where it appears.
|
|
13
|
+
|
|
14
|
+
## Prerequisite
|
|
15
|
+
|
|
16
|
+
Install the axis reflectors + preference signals at app root via the
|
|
17
|
+
`@cngx/core` aggregator. The panel reads and writes those signals; it installs
|
|
18
|
+
nothing itself.
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { provideA11yPreferences, withPersistence } from '@cngx/core';
|
|
22
|
+
|
|
23
|
+
bootstrapApplication(AppComponent, {
|
|
24
|
+
providers: [provideA11yPreferences(withPersistence())],
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { CngxA11yPanel } from '@cngx/ui/a11y';
|
|
32
|
+
|
|
33
|
+
@Component({
|
|
34
|
+
imports: [CngxA11yPanel],
|
|
35
|
+
template: `<cngx-a11y-panel />`,
|
|
36
|
+
})
|
|
37
|
+
export class SettingsPage {}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Toggling a group writes the matching axis signal, which reflects onto the root
|
|
41
|
+
`<html data-*>` attribute live. Reset restores every axis to its library
|
|
42
|
+
default and announces the change through the shared live region.
|
|
43
|
+
|
|
44
|
+
## Configuration
|
|
45
|
+
|
|
46
|
+
The rendered axis list comes from `CNGX_A11Y_PANEL_CONFIG`; the text and the
|
|
47
|
+
option labels come from the `a11yPanel` section of the language pack (English
|
|
48
|
+
without one, `CNGX_A11Y_PANEL_LANGUAGE_EN`). An option without a `label` reads
|
|
49
|
+
it from the section by value, so a custom axis list translates with the pack.
|
|
50
|
+
The `with*` features override single keys.
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import {
|
|
54
|
+
provideA11yPanelConfig,
|
|
55
|
+
withA11yPanelLabels,
|
|
56
|
+
withA11yPanelAxes,
|
|
57
|
+
} from '@cngx/ui/a11y';
|
|
58
|
+
|
|
59
|
+
provideA11yPanelConfig(
|
|
60
|
+
withA11yPanelLabels({ heading: 'Barrierefreiheit', axes: { motion: 'Bewegung' } }),
|
|
61
|
+
withA11yPanelAxes([
|
|
62
|
+
{ axis: 'textScale', reset: 'md', options: [
|
|
63
|
+
{ value: 'md' },
|
|
64
|
+
{ value: 'lg', label: 'Bigger' },
|
|
65
|
+
] },
|
|
66
|
+
]),
|
|
67
|
+
);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Header slot
|
|
71
|
+
|
|
72
|
+
Project `[cngxA11yPanelHeader]` to replace the default heading:
|
|
73
|
+
|
|
74
|
+
```html
|
|
75
|
+
<cngx-a11y-panel>
|
|
76
|
+
<h2 cngxA11yPanelHeader>Display & motion</h2>
|
|
77
|
+
</cngx-a11y-panel>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Public API
|
|
81
|
+
|
|
82
|
+
- `CngxA11yPanel` - the placeable card.
|
|
83
|
+
- `CNGX_A11Y_PANEL_CONFIG` / `provideA11yPanelConfig` / `withA11yPanelLabels` /
|
|
84
|
+
`withA11yPanelAxes` / `injectA11yPanelConfig` - the config cascade. Both
|
|
85
|
+
features also take a `Signal`, so the panel follows a runtime language switch.
|
|
86
|
+
- `injectA11yPanelLabels` / `injectA11yPanelAxes` - the resolved labels and axis
|
|
87
|
+
list as Signals.
|
package/accordion/README.md
CHANGED
|
@@ -40,8 +40,10 @@ collapsed item un-hides its region so the alert is announced.
|
|
|
40
40
|
`provideAccordionConfig(...)` / `provideAccordionConfigAt(...)` with
|
|
41
41
|
`withAccordionLabels({ disabledReason, errorMessage })`,
|
|
42
42
|
`withDefaultHeadingLevel(n)`, `withAccordionSkin(name)`, and
|
|
43
|
-
`withAccordionTemplates({ icon, busySpinner, error })`.
|
|
44
|
-
English
|
|
43
|
+
`withAccordionTemplates({ icon, busySpinner, error })`. The label defaults
|
|
44
|
+
come from the `accordion` section of the language pack (English without one,
|
|
45
|
+
`CNGX_ACCORDION_LANGUAGE_EN`). Both label keys accept a `Signal<string>`, so
|
|
46
|
+
the accordion follows a runtime language switch.
|
|
45
47
|
|
|
46
48
|
## Skins
|
|
47
49
|
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# CngxBreadcrumbBar
|
|
2
|
+
|
|
3
|
+
Breadcrumb bar organism. `<cngx-breadcrumb [items]="...">` renders a trail
|
|
4
|
+
through the headless `@cngx/common/interactive` trio (`CngxBreadcrumb` /
|
|
5
|
+
`CngxBreadcrumbItem` / `CngxBreadcrumbSeparator`): the bar forwards inputs and
|
|
6
|
+
owns the skin, the trio owns collapse, terminal marking and the landmark a11y.
|
|
7
|
+
Collapsed crumbs surface in a `CngxBreadcrumbOverflow` dropdown; lateral
|
|
8
|
+
navigation per crumb is a `CngxBreadcrumbSiblings` dropdown. Router integration
|
|
9
|
+
is opt-in via two sync directives - the base components never import
|
|
10
|
+
`@angular/router`.
|
|
11
|
+
|
|
12
|
+
## Import
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import { CngxBreadcrumbBar, CngxBreadcrumbRouterSync, type CngxBreadcrumbCrumb } from '@cngx/ui/breadcrumb';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { Component } from '@angular/core';
|
|
22
|
+
import { CngxBreadcrumbBar, type CngxBreadcrumbCrumb } from '@cngx/ui/breadcrumb';
|
|
23
|
+
|
|
24
|
+
@Component({
|
|
25
|
+
selector: 'app-example',
|
|
26
|
+
template: `<cngx-breadcrumb [items]="crumbs" />`,
|
|
27
|
+
imports: [CngxBreadcrumbBar],
|
|
28
|
+
})
|
|
29
|
+
export class ExampleComponent {
|
|
30
|
+
protected readonly crumbs: CngxBreadcrumbCrumb[] = [
|
|
31
|
+
{ label: 'Home', href: '/' },
|
|
32
|
+
{ label: 'Catalog', href: '/catalog' },
|
|
33
|
+
{ label: 'Books' },
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The last crumb is the current page: it renders without `href` and carries
|
|
39
|
+
`aria-current="page"`, derived from position. Keep `href` unique across the
|
|
40
|
+
trail - the bar tracks crumbs by `href ?? label`; a duplicate collides on the
|
|
41
|
+
track key (NG0955).
|
|
42
|
+
|
|
43
|
+
## Collapse and overflow
|
|
44
|
+
|
|
45
|
+
Set `[maxVisible]` and the trail collapses its middle, keeping the first crumb
|
|
46
|
+
and the last `maxVisible - 1`. When anything is collapsed the bar auto-renders
|
|
47
|
+
a `<cngx-breadcrumb-overflow>` after the first crumb: an ellipsis trigger plus
|
|
48
|
+
a `CngxPopoverPanel` hosting a `CngxMenu` of the collapsed crumbs. It reads the
|
|
49
|
+
collapse set through the `CNGX_BREADCRUMB` DI contract and self-hides when
|
|
50
|
+
nothing is collapsed.
|
|
51
|
+
|
|
52
|
+
The default overflow row lists the label and does not navigate. Project
|
|
53
|
+
`*cngxBreadcrumbOverflowItem` on the bar to render a navigable row; the
|
|
54
|
+
`<li cngxMenuItem>` shell stays library-owned:
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<cngx-breadcrumb [items]="crumbs" [maxVisible]="3">
|
|
58
|
+
<ng-template cngxBreadcrumbOverflowItem let-crumb>
|
|
59
|
+
<a [href]="hrefFor(crumb)">{{ crumb.resolvedLabel() }}</a>
|
|
60
|
+
</ng-template>
|
|
61
|
+
</cngx-breadcrumb>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Width-driven collapse
|
|
65
|
+
|
|
66
|
+
On by default, nothing to bind: the bar derives `maxVisible` from **its own
|
|
67
|
+
container width**, not the viewport, so it behaves identically in a drawer on a
|
|
68
|
+
desktop and on a phone.
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<cngx-breadcrumb [items]="crumbs" />
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The cap lives in CSS, once. `breadcrumb-bar.component.css` declares the bar as
|
|
75
|
+
the query container `cngx-breadcrumb` and writes
|
|
76
|
+
`--cngx-breadcrumb-max-visible` on `.cngx-breadcrumb::after`: `2` below `30rem`,
|
|
77
|
+
`4` below `48rem`, `6` above. The component reads the resolved value and never
|
|
78
|
+
evaluates a width itself.
|
|
79
|
+
|
|
80
|
+
Re-aim the rungs with your own rule on the same pseudo-element:
|
|
81
|
+
|
|
82
|
+
```css
|
|
83
|
+
.my-nav .cngx-breadcrumb::after {
|
|
84
|
+
--cngx-breadcrumb-max-visible: 8;
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Two details decide whether that rule works:
|
|
89
|
+
|
|
90
|
+
- **It has to target `::after`.** The property is registered `inherits: false`,
|
|
91
|
+
so setting it on the bar itself or on an ancestor never reaches the
|
|
92
|
+
pseudo-element the component reads. That is deliberate - the property is a
|
|
93
|
+
channel between the `@container` rule and the component, not a theme token
|
|
94
|
+
the crumbs should inherit.
|
|
95
|
+
- **No `!important` needed.** An unlayered author rule beats the library rule in
|
|
96
|
+
`@layer cngx.components`, whatever the specificity.
|
|
97
|
+
|
|
98
|
+
The property is registered `<integer>`: a non-integer value falls back to the
|
|
99
|
+
registered initial and is never read as a cap.
|
|
100
|
+
|
|
101
|
+
To pin the count instead - the opt-out - bind `[maxVisible]`; an explicit value
|
|
102
|
+
always wins over the derived one:
|
|
103
|
+
|
|
104
|
+
```html
|
|
105
|
+
<!-- always six crumbs, whatever the width -->
|
|
106
|
+
<cngx-breadcrumb [items]="crumbs" [maxVisible]="6" />
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Until the container's first observation the cap stays `undefined`, so the bar
|
|
110
|
+
renders the full trail rather than mis-collapsing on a zero-width first read.
|
|
111
|
+
|
|
112
|
+
## Router-driven trail
|
|
113
|
+
|
|
114
|
+
Add `cngxRouterSync` and the trail derives from the activated route tree -
|
|
115
|
+
every route whose `data['breadcrumb']` is a non-empty string contributes a
|
|
116
|
+
crumb:
|
|
117
|
+
|
|
118
|
+
```html
|
|
119
|
+
<cngx-breadcrumb cngxRouterSync />
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
{ path: 'catalog', data: { breadcrumb: 'Catalog' }, children: [
|
|
124
|
+
{ path: 'books', data: { breadcrumb: 'Books', icon: 'book' } },
|
|
125
|
+
] }
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The directive provides `CNGX_BREADCRUMB_ITEMS_SOURCE` (via `useExisting`), and
|
|
129
|
+
the bar's `computed` lets the source win over `[items]` - it never writes the
|
|
130
|
+
bar's input. `[dataKey]` and `[iconKey]` override the route-data keys per
|
|
131
|
+
instance (`data[iconKey]` rides onto `crumb.icon`). A componentless route
|
|
132
|
+
reusing the parent URL collapses into one crumb, deepest label wins. Without
|
|
133
|
+
`@angular/router` the directive dev-warns once and stays an empty source.
|
|
134
|
+
|
|
135
|
+
To translate a crumb, pass a `Signal` of its label from your app's i18n:
|
|
136
|
+
`data: { breadcrumb: computed(() => t('nav.orders')) }`. The trail reads it
|
|
137
|
+
inside its `computed()`, so a language switch relabels the crumb. The sibling
|
|
138
|
+
sync reads route data the same way. Route labels are app copy; the cngx
|
|
139
|
+
language pack only carries the breadcrumb's own accessible names.
|
|
140
|
+
|
|
141
|
+
## Sibling dropdowns
|
|
142
|
+
|
|
143
|
+
`CngxBreadcrumbSiblings` lists the alternatives at one trail level - a chevron
|
|
144
|
+
trigger revealing a `role="list"` of native `<a href>` anchors, self-hiding
|
|
145
|
+
when there are no rows. The active level renders `aria-current="page"` and no
|
|
146
|
+
link. Three ways to feed it:
|
|
147
|
+
|
|
148
|
+
- **Declarative**: a non-empty `crumb.siblings` array makes the bar auto-render
|
|
149
|
+
the dropdown for that crumb. No wiring.
|
|
150
|
+
- **Accessory slot**: project `*cngxBreadcrumbItemAccessory` on the bar; it
|
|
151
|
+
renders after every crumb's link and wins over the declarative auto-render
|
|
152
|
+
for all crumbs.
|
|
153
|
+
- **Router-driven**: `<cngx-breadcrumb-siblings cngxRouterSync [depth]="1" />`
|
|
154
|
+
enumerates the sibling routes at `depth` from the static route config,
|
|
155
|
+
marking the active child `current`. Parameterized siblings (`:id`) emit their
|
|
156
|
+
path pattern verbatim - supply `[siblings]` directly when links need resolved
|
|
157
|
+
params.
|
|
158
|
+
|
|
159
|
+
Project `*cngxBreadcrumbSiblingItem` to replace the default sibling row.
|
|
160
|
+
|
|
161
|
+
## Icons
|
|
162
|
+
|
|
163
|
+
`*cngxBreadcrumbIcon` renders inside every crumb link, before the label. The
|
|
164
|
+
crumb's `icon` is an opaque token - cngx ships no icon set and resolves no
|
|
165
|
+
names; the slot renders it with any icon system:
|
|
166
|
+
|
|
167
|
+
```html
|
|
168
|
+
<cngx-breadcrumb [items]="crumbs" skin="iconlabel">
|
|
169
|
+
<ng-template cngxBreadcrumbIcon let-crumb>
|
|
170
|
+
<mat-icon aria-hidden="true">{{ crumb.icon }}</mat-icon>
|
|
171
|
+
</ng-template>
|
|
172
|
+
</cngx-breadcrumb>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Skins
|
|
176
|
+
|
|
177
|
+
`skin` reflects onto `[data-skin]`; each look is an independent `@scope` paint
|
|
178
|
+
block over identical DOM, ARIA and collapse behaviour. Pure paint skins:
|
|
179
|
+
`classic` (default), `plain`, `contained`, `pill`, `ribbon`, `editorial`,
|
|
180
|
+
`header`, `metro`, `toolbar`, `chips`. Content skins additionally consume the
|
|
181
|
+
projected icon slot (`iconlabel`, `path`, `icononly`, `shell`) - `record` also
|
|
182
|
+
the accessory slot. Cascade: `[skin]` input, then `config.skin`, then `'classic'`.
|
|
183
|
+
|
|
184
|
+
## Configuration
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
provideBreadcrumbConfig(
|
|
188
|
+
withBreadcrumbAriaLabels({ bar: 'Navigation trail' }),
|
|
189
|
+
withBreadcrumbDataKey('crumb'),
|
|
190
|
+
withBreadcrumbIconKey('glyph'),
|
|
191
|
+
withBreadcrumbSkin('pill'),
|
|
192
|
+
);
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Root, or scoped to a subtree with `provideBreadcrumbConfigAt` in
|
|
196
|
+
`viewProviders`, where features deep-merge onto the parent config. Resolution:
|
|
197
|
+
per-instance input, then the scoped provider, then root, then the library
|
|
198
|
+
defaults; the accessible names come from the `breadcrumb` section of the
|
|
199
|
+
language pack (English without one). Read the resolved
|
|
200
|
+
config with `injectBreadcrumbConfig()` and the resolved labels with
|
|
201
|
+
`injectBreadcrumbAriaLabels()`. `withBreadcrumbAriaLabels` also takes a
|
|
202
|
+
`Signal`, so the labels follow a runtime language switch.
|
|
203
|
+
|
|
204
|
+
## Accessibility
|
|
205
|
+
|
|
206
|
+
- The bar is a `<nav>` landmark; `[label]` names it (default "Breadcrumb").
|
|
207
|
+
- Terminal crumb: `aria-current="page"`, no `href` - derived from position.
|
|
208
|
+
- Separators are `aria-hidden="true"`, so AT reads a clean list of crumbs.
|
|
209
|
+
- Overflow and siblings triggers carry configurable `aria-label`s
|
|
210
|
+
(`[triggerLabel]`, `[menuLabel]`); the siblings trigger reflects open state
|
|
211
|
+
on `aria-expanded`.
|
|
212
|
+
- Sibling rows are native anchors - keyboard activation, screen-reader link
|
|
213
|
+
roles and middle-click work without a command-menu layer.
|
|
214
|
+
- Touch targets floor to `--cngx-target-min` on coarse pointers.
|
|
215
|
+
|
|
216
|
+
## CSS custom properties
|
|
217
|
+
|
|
218
|
+
| Property | Default | Description |
|
|
219
|
+
|-|-|-|
|
|
220
|
+
| `--cngx-breadcrumb-gap` | `var(--cngx-space-sm, 0.5rem)` | Gap between crumbs, density-tracking |
|
|
221
|
+
| `--cngx-breadcrumb-link-color` | `inherit` | Crumb link color |
|
|
222
|
+
| `--cngx-breadcrumb-link-decoration` | `underline` | Crumb link text-decoration |
|
|
223
|
+
| `--cngx-breadcrumb-current-color` | `inherit` | Terminal crumb color |
|
|
224
|
+
| `--cngx-breadcrumb-current-weight` | `600` | Terminal crumb font-weight |
|
|
225
|
+
| `--cngx-breadcrumb-separator` | `'\203A'` (`'\2039'` under RTL) | Separator glyph in skin paint |
|
|
226
|
+
| `--cngx-breadcrumb-separator-color` | `inherit` | Separator color |
|
|
227
|
+
| `--cngx-breadcrumb-overflow-trigger-width` | `32px` | Ellipsis trigger width |
|
|
228
|
+
| `--cngx-breadcrumb-overflow-trigger-height` | `26px` | Ellipsis trigger height |
|
|
229
|
+
| `--cngx-breadcrumb-overflow-menu-min-width` | `11.875rem` | Collapsed-crumb menu min width |
|
|
230
|
+
| `--cngx-breadcrumb-siblings-trigger-size` | `22px` | Chevron trigger box |
|
|
231
|
+
| `--cngx-breadcrumb-siblings-menu-min-width` | `11.25rem` | Sibling list min width |
|
|
232
|
+
| `--cngx-breadcrumb-siblings-item-current-color` | `var(--cngx-color-primary, ...)` | Active sibling row color |
|
|
233
|
+
|
|
234
|
+
Beyond these, `--cngx-breadcrumb-overflow-*` and `--cngx-breadcrumb-siblings-*`
|
|
235
|
+
cover the trigger/row colors, hover/open states, paddings and radii; each skin
|
|
236
|
+
owns a `--cngx-breadcrumb-<skin>-*` family (bg, color, hover, active, radius,
|
|
237
|
+
font-size), registered via `@property` and assigned adaptively from
|
|
238
|
+
`--cngx-color-*` inside its `@scope`. Full list on the compodocx Theming tab.
|
|
239
|
+
|
|
240
|
+
## Material Theme
|
|
241
|
+
|
|
242
|
+
```scss
|
|
243
|
+
@use '@angular/material' as mat;
|
|
244
|
+
@use '@cngx/themes/material/breadcrumb-theme' as breadcrumb;
|
|
245
|
+
|
|
246
|
+
html {
|
|
247
|
+
@include breadcrumb.theme($theme);
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
One include aligns the base bar (link, current, separator, gap) plus the
|
|
252
|
+
overflow and siblings triggers and rows with `--mat-sys-*`. The dropdown
|
|
253
|
+
surfaces are `CngxPopoverPanel` chrome (popover-panel bridge), and the skins
|
|
254
|
+
self-assign from `--cngx-color-*` in their own `@scope` - neither is
|
|
255
|
+
re-declared here.
|
|
256
|
+
|
|
257
|
+
## See Also
|
|
258
|
+
|
|
259
|
+
- [CngxBreadcrumb / CngxBreadcrumbItem / CngxBreadcrumbSeparator](../../common/interactive/) - the headless trio for hand-composed trails
|
|
260
|
+
- [CngxPopoverPanel](../../common/popover/) - the dropdown surface both menus render into
|
|
261
|
+
- [API on compodocx](https://cngxjs.github.io/cngx/)
|
|
262
|
+
- Tests: `projects/ui/breadcrumb/breadcrumb-bar.component.spec.ts`, `breadcrumb-router-sync.directive.spec.ts`
|
package/collection/README.md
CHANGED
|
@@ -125,6 +125,12 @@ focus is never silently dropped.
|
|
|
125
125
|
`isBusy()` signal - never a one-time setting.
|
|
126
126
|
- State changes (empty, end-reached, error) surface through a polite live region
|
|
127
127
|
so assistive technology is told when the collection settles.
|
|
128
|
+
- The labels come from the `collection` section of the language pack
|
|
129
|
+
(`CNGX_COLLECTION_LANGUAGE_EN` in English); `withIncrementalListAriaLabels`
|
|
130
|
+
overrides single keys and also takes a `Signal`. The live region keeps its
|
|
131
|
+
current message on a language switch and speaks the new language with the
|
|
132
|
+
next settle.
|
|
133
|
+
- Without an item slot, a number or `Date` row is formatted for the locale.
|
|
128
134
|
|
|
129
135
|
## Composition
|
|
130
136
|
|