@cngx/ui 0.1.0-rc.3 → 0.1.0-rc.4

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 (37) hide show
  1. package/accordion/README.md +86 -0
  2. package/collection/README.md +167 -0
  3. package/data-grid-accordion/README.md +137 -0
  4. package/fesm2022/cngx-ui-accordion.mjs +853 -0
  5. package/fesm2022/cngx-ui-accordion.mjs.map +1 -0
  6. package/fesm2022/cngx-ui-action-button.mjs +2 -2
  7. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  8. package/fesm2022/cngx-ui-breadcrumb.mjs +1044 -0
  9. package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -0
  10. package/fesm2022/cngx-ui-collection.mjs +645 -0
  11. package/fesm2022/cngx-ui-collection.mjs.map +1 -0
  12. package/fesm2022/cngx-ui-data-grid-accordion.mjs +1135 -0
  13. package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -0
  14. package/fesm2022/cngx-ui-empty-state.mjs +2 -2
  15. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
  16. package/fesm2022/cngx-ui-feedback.mjs +10 -10
  17. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  18. package/fesm2022/cngx-ui-mat-accordion.mjs +229 -0
  19. package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -0
  20. package/fesm2022/cngx-ui-paginator.mjs +324 -255
  21. package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
  22. package/fesm2022/cngx-ui-sidenav.mjs +547 -65
  23. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  24. package/fesm2022/cngx-ui-tabs.mjs +6 -6
  25. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  26. package/fesm2022/cngx-ui.mjs +1 -1
  27. package/mat-accordion/README.md +48 -0
  28. package/package.json +21 -1
  29. package/paginator/README.md +9 -6
  30. package/sidenav/README.md +89 -3
  31. package/types/cngx-ui-accordion.d.ts +801 -0
  32. package/types/cngx-ui-breadcrumb.d.ts +890 -0
  33. package/types/cngx-ui-collection.d.ts +396 -0
  34. package/types/cngx-ui-data-grid-accordion.d.ts +912 -0
  35. package/types/cngx-ui-mat-accordion.d.ts +63 -0
  36. package/types/cngx-ui-paginator.d.ts +258 -146
  37. package/types/cngx-ui-sidenav.d.ts +429 -21
@@ -0,0 +1,86 @@
1
+ # @cngx/ui/accordion
2
+
3
+ APG-correct disclosure organism over the headless `CngxAccordion` brain
4
+ (`@cngx/common/interactive`). Renders the heading / button / region trio, derives
5
+ expansion from an open-set coordinator, and ships a header slot family, async
6
+ status communication, and nine built-in visual skins.
7
+
8
+ ## Anatomy
9
+
10
+ ```html
11
+ <cngx-accordion-group [multi]="true" [(openIds)]="open">
12
+ <cngx-accordion-item panelId="billing" [state]="billing.status()">
13
+ <span cngxAccordionItemLeading>01</span>
14
+ <span cngxAccordionItemTitle>Billing</span>
15
+ <span cngxAccordionItemSubtitle>Invoices and payment methods</span>
16
+ <span cngxAccordionItemMeta><cngx-time [date]="billing.updated" mode="relative" /></span>
17
+
18
+ <ng-template cngxAccordionItemBusy><my-skeleton /></ng-template>
19
+ <ng-template cngxAccordionItemError>Could not load. <button type="button">Retry</button></ng-template>
20
+ <ng-template cngxAccordionItemContent>...</ng-template>
21
+ </cngx-accordion-item>
22
+ </cngx-accordion-group>
23
+ ```
24
+
25
+ The header row is `[leading] [button: title + subtitle + marker] [meta]`. Leading
26
+ and meta are siblings of the button (interactive meta stays valid HTML); the
27
+ button's accessible name is pinned to the title only. Subtitle is announced
28
+ through `aria-describedby`, never folded into the name.
29
+
30
+ ## Async status
31
+
32
+ `[state]` takes an `AsyncStatus` or a `CngxAsyncState<unknown>`. The region
33
+ carries a reactive `aria-busy`; `loading` shows a skeleton, `refreshing` keeps
34
+ the body mounted under a subtle overlay, `error` renders a `role="alert"` (an EN
35
+ default message when no `cngxAccordionItemError` slot is given). An errored
36
+ collapsed item un-hides its region so the alert is announced.
37
+
38
+ ## Config
39
+
40
+ `provideAccordionConfig(...)` / `provideAccordionConfigAt(...)` with
41
+ `withAccordionLabels({ disabledReason, errorMessage })`,
42
+ `withDefaultHeadingLevel(n)`, `withAccordionSkin(name)`, and
43
+ `withAccordionTemplates({ icon, busySpinner, error })`. Library defaults are
44
+ English.
45
+
46
+ ## Skins
47
+
48
+ Nine built-in visual skins select via the `[skin]` input, reflected onto a
49
+ `[data-skin]` host attribute (the same pattern as `<cngx-tab-group>`). The skin
50
+ CSS ships with the component - no theme import, no scope class. `[skin]` is typed
51
+ class-sugar (`CngxAccordionSkin`), not a mode flag: every skin renders the
52
+ identical structure, slots, ARIA, and keyboard model, only the paint changes.
53
+
54
+ ```html
55
+ <cngx-accordion-group [skin]="'editorial'">...</cngx-accordion-group>
56
+ ```
57
+
58
+ Set an app-wide default with `provideAccordionConfig(withAccordionSkin('editorial'))`;
59
+ a per-instance `[skin]` still wins.
60
+
61
+ | Skin | `[skin]` value | notes |
62
+ |-|-|-|
63
+ | Editorial | `editorial` | mono index leading, hairlines |
64
+ | Categorized | `categorized` | category-tag leading, elevate-on-open |
65
+ | Plus-Minus | `plus-minus` | boxed +/- marker |
66
+ | Lux | `lux` | whitespace, large type |
67
+ | Bento | `bento` | container-query card grid |
68
+ | Section-Bands | `section-bands` | inverted full-width band |
69
+ | Timeline | `timeline` | rail + node (see note) |
70
+ | Severity-Spine | `severity-spine` | full-height priority spine |
71
+ | Primary-Frame | `primary-frame` | solid primary border + glow on open |
72
+
73
+ Every skin drives the organism through its `--cngx-accordion-*` custom
74
+ properties; each colour maps to `--cngx-color-primary`, never a gradient. The
75
+ skin CSS lives unlayered in the component stylesheet, so a `[data-skin]` rule
76
+ overrides the flat base by specificity.
77
+
78
+ ### Timeline: exclusive mode
79
+
80
+ The timeline look is exclusive by convention. Bind `[multi]="false"` on the
81
+ group so one section opens at a time; the skin does not force it.
82
+
83
+ ```html
84
+ <cngx-accordion-group [skin]="'timeline'" [multi]="false">...</cngx-accordion-group>
85
+ ```
86
+
@@ -0,0 +1,167 @@
1
+ # CngxIncrementalList
2
+
3
+ Append-style collection organism for load-more and infinite-scroll surfaces.
4
+
5
+ ## Import
6
+
7
+ ```typescript
8
+ import { CngxIncrementalList } from '@cngx/ui/collection';
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { Component } from '@angular/core';
15
+ import { CngxIncrementalList } from '@cngx/ui/collection';
16
+
17
+ @Component({
18
+ selector: 'app-example',
19
+ template: `
20
+ <cngx-incremental-list [state]="state" [total]="total()">
21
+ <!-- projected trigger atom (e.g. cngx-pgn-load-more) goes here -->
22
+ </cngx-incremental-list>
23
+ `,
24
+ imports: [CngxIncrementalList],
25
+ })
26
+ export class ExampleComponent {
27
+ // state is a CngxAsyncState<Item> from createAsyncState / injectAsyncState
28
+ }
29
+ ```
30
+
31
+ ## Overview
32
+
33
+ `CngxIncrementalList` is a content organism for the append-don't-replace pattern:
34
+ it accumulates rows across pages instead of swapping them, and switches its view
35
+ by async status - loading, content, empty, error, and end-reached. It composes
36
+ shipped primitives rather than inventing a new state machine:
37
+
38
+ - the `CngxPaginate` brain (`@cngx/common/data`) via a host directive, read
39
+ through `cumulativeRange()` for the accumulated slice and `isLast()` for the
40
+ end-reached branch;
41
+ - `resolveAsyncView` (`@cngx/common/data`) for the loading / content / empty /
42
+ error switch, derived from the single `[state]` source;
43
+ - the `CNGX_PAGINATOR_HOST` contract, provided via the brain `useExisting`, so
44
+ existing trigger atoms (`cngx-pgn-load-more`, `cngx-pgn-infinite`) drop in as
45
+ swappable projected content.
46
+
47
+ The organism is a pure consumer: it owns no `[mode]` flag and introduces no new
48
+ `[state]` producer. Every visible region is a derivation of the bound state and
49
+ the brain signals.
50
+
51
+ Five view states render from the single `[state]` source: loading, content,
52
+ empty, error (first load), and end-reached. A subsequent-page failure
53
+ (`content+error`) keeps the accumulated rows visible and renders an inline retry
54
+ below them that fires the `(retry)` output - so a page-N error is never silently
55
+ swallowed. Supply `[trackBy]` when the bound data can be replaced or reordered so
56
+ projected item templates keep their per-row state.
57
+
58
+ ## Skins
59
+
60
+ `[skin]` is a paint-only attribute reflected onto `[data-skin]`; structure, ARIA,
61
+ and behaviour are identical across values.
62
+
63
+ - `plain` (default) - browser-native list, no chrome.
64
+ - `divided` - hairline separators between rows.
65
+ - `card` - the list sits on an elevated, rounded surface.
66
+
67
+ ```html
68
+ <cngx-incremental-list skin="card" [state]="state" [total]="total()">
69
+ <ng-template cngxIncrementalItem let-item>{{ item.name }}</ng-template>
70
+ </cngx-incremental-list>
71
+ ```
72
+
73
+ ## Virtualization
74
+
75
+ An append feed is exactly the surface that grows to thousands of rows, where the
76
+ unbounded DOM node count becomes the bottleneck. Opt into DOM recycling with
77
+ `[virtualize]`: the content branch then renders only the rows inside a bounded
78
+ scroll viewport (plus a small overscan), with every off-window row collapsed into
79
+ a pixel spacer, so the node count stays flat while the scrollbar still reflects
80
+ the full set. Unset (the default), the render-all path is byte-for-byte unchanged
81
+ and pays nothing - the recycler is never constructed.
82
+
83
+ ```html
84
+ <cngx-incremental-list
85
+ [state]="state"
86
+ [total]="total()"
87
+ [virtualize]="true"
88
+ [estimateSize]="36"
89
+ style="--cngx-incremental-list-viewport-height: 60vh"
90
+ >
91
+ <ng-template cngxIncrementalItem let-item>{{ item.name }}</ng-template>
92
+ <cngx-pgn-infinite cngxIncrementalTrigger />
93
+ </cngx-incremental-list>
94
+ ```
95
+
96
+ - `[virtualize]` - opt into recycling. Default `false`.
97
+ - `[estimateSize]` - initial per-row height in px, the first guess before a row
98
+ is measured (rows self-measure afterwards, so variable heights are fine).
99
+ Default `48`. Ignored unless `[virtualize]` is set.
100
+
101
+ **Bounded height is required.** Virtualization needs a bounded viewport to scroll
102
+ inside. Tune it with the `--cngx-incremental-list-viewport-height` custom property
103
+ on the organism host (default `60vh`); there is no `[viewportHeight]` input - a
104
+ CSS variable is the honest surface. The recycled body is the scroll node, so the
105
+ `card` skin's clipping does not interfere - the two are different elements by
106
+ design, and `card` + `[virtualize]` compose without an override.
107
+
108
+ The trigger still drives accumulation: `[virtualize]` virtualizes only
109
+ *rendering*, not the feed. A projected `cngx-pgn-load-more` / `cngx-pgn-infinite`
110
+ keeps calling `next()`, and the recycler windows whatever the accumulated slice
111
+ grows to.
112
+
113
+ Accessibility is preserved under recycling: each rendered row carries
114
+ `aria-setsize` (the accumulated total) and `aria-posinset` (its absolute index),
115
+ so a screen reader reports position against the whole set, not the window. A
116
+ polite live region announces the load-count when the accumulated total grows;
117
+ override its phrasing with `withIncrementalListAriaLabels({ loadedMore })`. When a
118
+ focused row recycles out of the window, focus moves to the nearest still-rendered
119
+ row, or back to the projected trigger when the window has none - a recycled-out
120
+ focus is never silently dropped.
121
+
122
+ ## Accessibility
123
+
124
+ - The content region carries a reactive `aria-busy`, bound to the async state's
125
+ `isBusy()` signal - never a one-time setting.
126
+ - State changes (empty, end-reached, error) surface through a polite live region
127
+ so assistive technology is told when the collection settles.
128
+
129
+ ## Composition
130
+
131
+ `CngxIncrementalList` composes:
132
+
133
+ - **Brain via host directive** - `CngxPaginate` supplies `cumulativeRange()` /
134
+ `isLast()` / `isBusy()`; the organism holds no accumulation state of its own.
135
+ - **Async view switch** - `resolveAsyncView(status, isFirstLoad, isEmpty)` maps
136
+ the single `[state]` source onto the rendered region.
137
+ - **Projected trigger** - a `<ng-content>` region backed by
138
+ `CNGX_PAGINATOR_HOST`, accepting the load-more / infinite atoms or a custom
139
+ trigger.
140
+
141
+ ## Material Theme
142
+
143
+ Include the theme SCSS in your global stylesheet so the organism's tokens adopt
144
+ the Material system palette:
145
+
146
+ ```scss
147
+ @use '@angular/material' as mat;
148
+ @use '@cngx/themes/material/incremental-list-theme' as incremental-list;
149
+
150
+ $theme: mat.define-theme((...));
151
+
152
+ html {
153
+ @include mat.all-component-themes($theme);
154
+ @include incremental-list.theme($theme);
155
+ }
156
+ ```
157
+
158
+ Without the bridge the organism uses the cngx foundation `--cngx-color-*` tokens
159
+ (light/dark aware) with a native look; the bridge maps text, dividers, surface,
160
+ error, and the retry button onto `--mat-sys-*`.
161
+
162
+ ## See Also
163
+
164
+ - [CngxAsyncState](../../core/utils/) - async state contract
165
+ - [CngxPaginate](../../common/data/paginate/) - the pagination brain
166
+ - [API on compodocx](https://cngxjs.github.io/cngx/)
167
+ - Tests: `projects/ui/collection/incremental-list.component.spec.ts`
@@ -0,0 +1,137 @@
1
+ # @cngx/ui/data-grid-accordion
2
+
3
+ A disclosure accordion whose header, every row, and footer share one column
4
+ contract, so N arbitrary cells align down the grid. Hosts the headless
5
+ `CngxAccordion` brain (`@cngx/common/interactive`) as a `hostDirective`, so the
6
+ open-set coordinator, roving keyboard nav, and disclosure ARIA come with it. It is
7
+ a table-shaped accordion, not a data grid: no `role="grid"`, no cell edit, no
8
+ selection model, no keyboard grid navigation.
9
+
10
+ ## Anatomy
11
+
12
+ ```html
13
+ <cngx-data-grid-accordion [multi]="true" [(openIds)]="open">
14
+ <cngx-dga-header>
15
+ <span cngxDgaCell col="sm">ID</span>
16
+ <span cngxDgaCell col="grow">Name</span>
17
+ <span cngxDgaCell col="md" align="end">Amount</span>
18
+ </cngx-dga-header>
19
+
20
+ <cngx-dga-row panelId="1">
21
+ <span cngxDgaCell>INV-1</span>
22
+ <span cngxDgaCell primary>Northwind Traders</span>
23
+ <span cngxDgaCell align="end">$1,280</span>
24
+ Net 30 terms. Two line items, no disputes.
25
+ </cngx-dga-row>
26
+
27
+ <cngx-dga-footer>
28
+ <span cngxDgaCell>1 invoice</span>
29
+ <span cngxDgaCell></span>
30
+ <span cngxDgaCell align="end">$1,280</span>
31
+ </cngx-dga-footer>
32
+ </cngx-data-grid-accordion>
33
+ ```
34
+
35
+ Each row is a `role="heading"` wrapping a `button[aria-expanded]` plus a labelled
36
+ `role="region"`. Mark one cell `primary` so the row's accessible name is that cell
37
+ alone; the disclosure chevron rides a leading gutter track, never a data column.
38
+
39
+ ## Columns
40
+
41
+ Declare widths on the header cells with `col`, and the group derives one shared
42
+ `grid-template-columns` from them - no hand-written string:
43
+
44
+ | `col` | Track |
45
+ |-|-|
46
+ | `grow` | `minmax(0, 1fr)` - fills remaining width |
47
+ | `fit` | `auto` - hugs its content, aligned across every row via subgrid |
48
+ | `sm` / `md` / `lg` | fixed `--cngx-dga-col-sm` / `-md` / `-lg` (5 / 7 / 10rem) |
49
+
50
+ Unset, the `primary` column grows and the rest fit. For track syntax the vocabulary
51
+ cannot express (`ch`, `minmax`, a synthesised gutter) set the raw `[columns]` escape
52
+ hatch instead; it holds content columns only, since the chevron rides its own gutter.
53
+
54
+ ## Overflow
55
+
56
+ Above `--cngx-dga-min-width` the grid fills 100%; below it the host scrolls sideways
57
+ (`overflow-x: auto`) with every column intact. No column is ever dropped - horizontal
58
+ scroll over silent information loss.
59
+
60
+ ## Skins
61
+
62
+ Six built-in skins select via the `[skin]` input, reflected onto a `[data-skin]` host
63
+ attribute (the same pattern as `<cngx-tab-group>`). The skin CSS ships with the
64
+ component - no theme import, no scope class. Every skin renders the identical
65
+ structure, cells, ARIA, and keyboard model; only the paint changes.
66
+
67
+ ```html
68
+ <cngx-data-grid-accordion [skin]="'ledger'">...</cngx-data-grid-accordion>
69
+ ```
70
+
71
+ | Skin | `[skin]` value | notes |
72
+ |-|-|-|
73
+ | Ledger | `ledger` | zebra rows, mono amounts, sum footer, inset accent detail |
74
+ | Spreadsheet | `spreadsheet` | cell hairlines, derived row-number gutter + column letters |
75
+ | Log-stream | `log-stream` | mono console, severity edge, level badge, stacktrace region |
76
+ | Master-detail | `master-detail` | primary-tinted open row, projected sub-table detail |
77
+ | Report | `report` | frameless, `3px double` head + foot rules, over-budget cells red |
78
+ | Density | `density` | row padding + type ride `--cngx-dga-row-py` / `-fs`, transitioned |
79
+
80
+ Set an app-wide default with `provideDataGridAccordionConfig(withDataGridSkin('ledger'))`;
81
+ a per-instance `[skin]` still wins. Columns are per-instance, so there is no
82
+ `withDataGridColumns` - `[columns]` / `col` stay on the element.
83
+
84
+ ## Config
85
+
86
+ `provideDataGridAccordionConfig(...)` / `provideDataGridAccordionConfigAt(...)` with the
87
+ single `withDataGridSkin(name)` feature; read it back with
88
+ `injectDataGridAccordionConfig()`.
89
+
90
+ ## Sort and filter
91
+
92
+ The group hosts `CngxSort` and `CngxFilter` (`@cngx/common/data`) as `hostDirectives` and
93
+ exposes them on the context as `sort` and `filter`. It only ever **publishes** state - it
94
+ never reorders projected DOM and never renders a data-bound `@for`. The consumer keeps the
95
+ `@for` and derives the visible, ordered rows in one `computed()` (Ableitung). Because the
96
+ open set is keyed by `[panelId]`, an expanded row stays open as it moves under a sort or
97
+ leaves and re-enters under a filter.
98
+
99
+ There are two supported paths over the same hosted atoms.
100
+
101
+ **Declarative** - sortable heads and a filter input, the group owns the state:
102
+
103
+ ```html
104
+ <cngx-data-grid-accordion [multiSort]="true" [(filterTerm)]="term" (sortChange)="sort.set($event)">
105
+ <input cngxDgaFilter cngxDgaFilterLabel="Filter invoices" />
106
+ <cngx-dga-header>
107
+ <span cngxDgaCell col="grow" cngxDgaSortHeader="customer">Customer</span>
108
+ <span cngxDgaCell col="md" align="end" cngxDgaSortHeader="amount">Amount</span>
109
+ </cngx-dga-header>
110
+ @for (row of rows(); track row.id) { <cngx-dga-row [panelId]="row.id">…</cngx-dga-row> }
111
+ <cngx-dga-footer><span [cngxDgaCount]="rows().length"></span></cngx-dga-footer>
112
+ </cngx-data-grid-accordion>
113
+ ```
114
+
115
+ `cngxDgaSortHeader="field"` makes a head sortable with no `[cngxSortRef]` - it reads the
116
+ group's hosted sort off the context. The head is an operable `role="button"`; the sort
117
+ state reaches assistive tech through an `aria-describedby` description (this is a disclosure
118
+ accordion, not a table, so there is no valid context for `aria-sort`). `cngxDgaFilter`
119
+ two-way-binds `[(filterTerm)]` with a debounce it owns; `cngxDgaCount` is a polite
120
+ `aria-live` region that announces the visible count.
121
+
122
+ **Binding** - the consumer already owns controlled state:
123
+
124
+ ```html
125
+ <cngx-data-grid-accordion
126
+ [sortActive]="field()" [sortDirection]="dir()" [filterPredicate]="predicate()">
127
+ …no header directives; the consumer derives rows() from its own signals…
128
+ </cngx-data-grid-accordion>
129
+ ```
130
+
131
+ `[filterPredicate]` feeds the hosted `CngxFilter` (and `filter.addPredicate(...)` on the
132
+ context adds facet filters); `[sortActive]` / `[sortDirection]` feed the hosted `CngxSort`.
133
+
134
+ Sort and filter are per-instance, so there is no `withDataGridSort` / `withDataGridFilter`
135
+ config feature - each grid sorts and filters its own data. No in-component sort/filter
136
+ engine: the `@cngx/common/data` atoms own comparison and predicate matching; the group only
137
+ coordinates and publishes state.