@cngx/ui 0.1.0-rc.2 → 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 (48) hide show
  1. package/README.md +15 -7
  2. package/accordion/README.md +86 -0
  3. package/collection/README.md +167 -0
  4. package/data-grid-accordion/README.md +137 -0
  5. package/fesm2022/cngx-ui-accordion.mjs +853 -0
  6. package/fesm2022/cngx-ui-accordion.mjs.map +1 -0
  7. package/fesm2022/cngx-ui-action-button.mjs +2 -2
  8. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  9. package/fesm2022/cngx-ui-breadcrumb.mjs +1044 -0
  10. package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -0
  11. package/fesm2022/cngx-ui-collection.mjs +645 -0
  12. package/fesm2022/cngx-ui-collection.mjs.map +1 -0
  13. package/fesm2022/cngx-ui-data-grid-accordion.mjs +1135 -0
  14. package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -0
  15. package/fesm2022/cngx-ui-empty-state.mjs +2 -2
  16. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
  17. package/fesm2022/cngx-ui-feedback.mjs +10 -10
  18. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  19. package/fesm2022/cngx-ui-mat-accordion.mjs +229 -0
  20. package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -0
  21. package/fesm2022/cngx-ui-mat-paginator.mjs +215 -0
  22. package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -0
  23. package/fesm2022/cngx-ui-paginator.mjs +1937 -0
  24. package/fesm2022/cngx-ui-paginator.mjs.map +1 -0
  25. package/fesm2022/cngx-ui-sidenav.mjs +547 -65
  26. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  27. package/fesm2022/cngx-ui-tabs.mjs +8 -6
  28. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  29. package/fesm2022/cngx-ui.mjs +2 -2
  30. package/fesm2022/cngx-ui.mjs.map +1 -1
  31. package/mat-accordion/README.md +48 -0
  32. package/mat-paginator/README.md +135 -0
  33. package/package.json +29 -5
  34. package/paginator/README.md +134 -0
  35. package/sidenav/README.md +89 -3
  36. package/types/cngx-ui-accordion.d.ts +801 -0
  37. package/types/cngx-ui-breadcrumb.d.ts +890 -0
  38. package/types/cngx-ui-collection.d.ts +396 -0
  39. package/types/cngx-ui-data-grid-accordion.d.ts +912 -0
  40. package/types/cngx-ui-mat-accordion.d.ts +63 -0
  41. package/types/cngx-ui-mat-paginator.d.ts +108 -0
  42. package/types/cngx-ui-paginator.d.ts +1147 -0
  43. package/types/cngx-ui-sidenav.d.ts +429 -21
  44. package/types/cngx-ui-tabs.d.ts +2 -0
  45. package/fesm2022/cngx-ui-material.mjs +0 -90
  46. package/fesm2022/cngx-ui-material.mjs.map +0 -1
  47. package/material/README.md +0 -90
  48. package/types/cngx-ui-material.d.ts +0 -47
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cngx/ui",
3
- "version": "0.1.0-rc.2",
3
+ "version": "0.1.0-rc.4",
4
4
  "description": "Organism layer (layout, overlay, feedback, stepper, tabs) for the CNGX Angular component library. Material opt-in (mat-stepper, mat-tabs, material).",
5
5
  "keywords": [
6
6
  "cngx",
@@ -41,10 +41,26 @@
41
41
  "types": "./types/cngx-ui.d.ts",
42
42
  "default": "./fesm2022/cngx-ui.mjs"
43
43
  },
44
+ "./accordion": {
45
+ "types": "./types/cngx-ui-accordion.d.ts",
46
+ "default": "./fesm2022/cngx-ui-accordion.mjs"
47
+ },
44
48
  "./action-button": {
45
49
  "types": "./types/cngx-ui-action-button.d.ts",
46
50
  "default": "./fesm2022/cngx-ui-action-button.mjs"
47
51
  },
52
+ "./breadcrumb": {
53
+ "types": "./types/cngx-ui-breadcrumb.d.ts",
54
+ "default": "./fesm2022/cngx-ui-breadcrumb.mjs"
55
+ },
56
+ "./collection": {
57
+ "types": "./types/cngx-ui-collection.d.ts",
58
+ "default": "./fesm2022/cngx-ui-collection.mjs"
59
+ },
60
+ "./data-grid-accordion": {
61
+ "types": "./types/cngx-ui-data-grid-accordion.d.ts",
62
+ "default": "./fesm2022/cngx-ui-data-grid-accordion.mjs"
63
+ },
48
64
  "./empty-state": {
49
65
  "types": "./types/cngx-ui-empty-state.d.ts",
50
66
  "default": "./fesm2022/cngx-ui-empty-state.mjs"
@@ -57,6 +73,14 @@
57
73
  "types": "./types/cngx-ui-layout.d.ts",
58
74
  "default": "./fesm2022/cngx-ui-layout.mjs"
59
75
  },
76
+ "./mat-accordion": {
77
+ "types": "./types/cngx-ui-mat-accordion.d.ts",
78
+ "default": "./fesm2022/cngx-ui-mat-accordion.mjs"
79
+ },
80
+ "./mat-paginator": {
81
+ "types": "./types/cngx-ui-mat-paginator.d.ts",
82
+ "default": "./fesm2022/cngx-ui-mat-paginator.mjs"
83
+ },
60
84
  "./mat-stepper": {
61
85
  "types": "./types/cngx-ui-mat-stepper.d.ts",
62
86
  "default": "./fesm2022/cngx-ui-mat-stepper.mjs"
@@ -65,14 +89,14 @@
65
89
  "types": "./types/cngx-ui-mat-tabs.d.ts",
66
90
  "default": "./fesm2022/cngx-ui-mat-tabs.mjs"
67
91
  },
68
- "./material": {
69
- "types": "./types/cngx-ui-material.d.ts",
70
- "default": "./fesm2022/cngx-ui-material.mjs"
71
- },
72
92
  "./overlay": {
73
93
  "types": "./types/cngx-ui-overlay.d.ts",
74
94
  "default": "./fesm2022/cngx-ui-overlay.mjs"
75
95
  },
96
+ "./paginator": {
97
+ "types": "./types/cngx-ui-paginator.d.ts",
98
+ "default": "./fesm2022/cngx-ui-paginator.mjs"
99
+ },
76
100
  "./sidenav": {
77
101
  "types": "./types/cngx-ui-sidenav.d.ts",
78
102
  "default": "./fesm2022/cngx-ui-sidenav.mjs"
@@ -0,0 +1,134 @@
1
+ # @cngx/ui/paginator
2
+
3
+ Default-theme, skinnable, framework-neutral pagination organism. A declarative
4
+ `<cngx-paginator>` shell over the `CngxPaginate` brain from `@cngx/common/data`,
5
+ assembled from projected segment parts in DOM order - no `show*` config inputs.
6
+
7
+ ## When you reach for it
8
+
9
+ You want a paginator that:
10
+
11
+ - Composes from child parts (`cngx-pgn-prev`, `cngx-pgn-pages`,
12
+ `cngx-pgn-page-size`, `cngx-pgn-range`, `cngx-pgn-goto`, ...) instead of a pile
13
+ of boolean inputs.
14
+ - Repaints across seven skins via a single `[skin]` attribute, with identical
15
+ DOM, ARIA, and keyboard behaviour across all of them.
16
+ - Carries async-aware navigation gating, a roving-keyboard page row, and
17
+ live-region announcements out of the box.
18
+ - Ships no Material runtime.
19
+
20
+ If you already render a Material `<mat-paginator>`, reach for `[cngxMatPaginator]`
21
+ in `@cngx/ui/mat-paginator` instead. The `CngxPaginate` brain is shared.
22
+
23
+ ## Usage
24
+
25
+ The shell exposes only `total`, `[(pageIndex)]`, `[(pageSize)]`, `[state]`,
26
+ `skin`, `density`, and `resetOn`. Everything else is a projected segment in DOM
27
+ order. The brain owns no data: bind `[total]`, read the active page back through
28
+ the two-way bindings, and slice your own array.
29
+
30
+ ```html
31
+ <cngx-paginator skin="numbered" [total]="items().length" [(pageIndex)]="pageIndex">
32
+ <cngx-pgn-prev />
33
+ <cngx-pgn-pages />
34
+ <cngx-pgn-next />
35
+ <cngx-pgn-range />
36
+ </cngx-paginator>
37
+ ```
38
+
39
+ ```ts
40
+ protected readonly pageIndex = signal(0);
41
+ protected readonly pageSize = signal(10);
42
+ protected readonly pageItems = computed(() => {
43
+ const start = this.pageIndex() * this.pageSize();
44
+ return this.items().slice(start, start + this.pageSize());
45
+ });
46
+ ```
47
+
48
+ ## Segments
49
+
50
+ Each part injects `CNGX_PAGINATOR_HOST` and self-wires; drop in only what the
51
+ context needs.
52
+
53
+ |Segment|Selector|Role|
54
+ |-|-|-|
55
+ |First / last|`cngx-pgn-first` / `cngx-pgn-last`|Jump to the boundaries; `aria-disabled` at the bound|
56
+ |Previous / next|`cngx-pgn-prev` / `cngx-pgn-next`|Step one page; `aria-disabled` at the bound|
57
+ |Pages|`cngx-pgn-pages`|Roving numbered row with ellipsis overflow menu, `aria-current` on the active page|
58
+ |Range|`cngx-pgn-range`|`start-end of total` readout (format from config)|
59
+ |Page size|`cngx-pgn-page-size`|`CngxListbox` select; `[options]` is data (falls back to the `withPaginatorPageSizeOptions` cascade default); resets to the first page|
60
+ |Page of pages|`cngx-pgn-page-of-pages`|`current / total` jump dropdown|
61
+ |Go to|`cngx-pgn-goto`|Native number input; Enter or blur navigates|
62
+ |Dots|`cngx-pgn-dots`|One dot per page (organism-internal), for the `dots` skin|
63
+
64
+ ## Skins
65
+
66
+ `numbered`, `minimal`, `pill`, `segmented`, `rail`, `dots`, `bar`. Set via
67
+ `[skin]` -> `[data-skin]`. Skin is paint-only: DOM, ARIA, and keyboard behaviour
68
+ are identical across all seven. `density` (`compact` / `default` / `comfortable`)
69
+ is orthogonal.
70
+
71
+ ## Reset and deep-linking
72
+
73
+ `[resetOn]` jumps to the first page whenever its bound value changes - bind the
74
+ sort / filter / search value the result set depends on so a narrowed result never
75
+ strands the user on a now-empty page. Mounting does not reset; bind a primitive
76
+ or a `computed`, never an inline literal.
77
+
78
+ ```html
79
+ <cngx-paginator [total]="filtered().length" [resetOn]="search()">…</cngx-paginator>
80
+ ```
81
+
82
+ For deep-linkable, back-button-safe URLs add the brain-level
83
+ `[cngxPaginateRouting]` directive (from `@cngx/common/data`) on the same host - it
84
+ persists the page / size in the query string and needs `@angular/router`.
85
+
86
+ ```html
87
+ <cngx-paginator cngxPaginateRouting [total]="items().length">…</cngx-paginator>
88
+ ```
89
+
90
+ ## Async
91
+
92
+ `CngxPaginator` is an async-state consumer. Bind `[state]` and, while busy, it
93
+ gates navigation, renders an indeterminate `cngx-progress` bar, flips
94
+ `aria-busy`, and announces the transition.
95
+
96
+ ```html
97
+ <cngx-paginator [total]="total()" [state]="loading">…</cngx-paginator>
98
+ ```
99
+
100
+ ## Configuration
101
+
102
+ All accessible-name strings, announcement phrasing, the range format, and the
103
+ default page-size choices cascade through `CNGX_PAGINATOR_CONFIG` (English
104
+ defaults). Override at the app root with `provideCngxPaginatorConfig(...)`, or
105
+ per region with `provideCngxPaginatorConfigAt(...)` in `viewProviders`.
106
+
107
+ ```ts
108
+ provideCngxPaginatorConfig(
109
+ withPaginatorAriaLabels({ next: 'Nächste Seite', pageOfPages: 'Seite wählen' }),
110
+ withPaginatorAnnouncements({ pageChange: (p, t) => `Seite ${p} von ${t}` }),
111
+ withPaginatorRangeFormat((start, end, total) => `${start}-${end} von ${total}`),
112
+ withPaginatorPageSizeOptions([12, 24, 48]),
113
+ );
114
+ ```
115
+
116
+ `withPaginatorRangeFormat` localises the `cngx-pgn-range` text (including the
117
+ `of` connector); `ariaLabels.pageOfPages` is the dedicated label for the
118
+ page-of-pages selector. `withPaginatorPageSizeOptions` sets the default
119
+ `cngx-pgn-page-size` choices, so the dropdown needs no per-instance `[options]`;
120
+ a non-empty `[options]` binding still wins over the cascade default.
121
+
122
+ The live-region announcer is swappable. `CNGX_PAGINATOR_ANNOUNCER_FACTORY`
123
+ defaults to `createPaginatorAnnouncer`; override it to wrap the busy / settle /
124
+ page-change derivation (telemetry tap, politeness escalation, custom branching)
125
+ without forking the shell. It mirrors the select family's
126
+ `CNGX_COMMIT_ERROR_ANNOUNCER_FACTORY`.
127
+
128
+ ## Accessibility
129
+
130
+ `role="navigation"` landmark with a configurable `aria-label`; a single
131
+ roving tab stop on the page row (arrows / Home / End); `aria-current="page"` on
132
+ the active page; a single computed `aria-busy` owner; live-region page-change,
133
+ clamp, and async announcements. A `total`-shrink clamp is never silent - the
134
+ clamped page is both emitted back to the consumer and announced.
package/sidenav/README.md CHANGED
@@ -17,7 +17,8 @@ import {
17
17
  ## Quick Start
18
18
 
19
19
  ```typescript
20
- import { Component } from '@angular/core';
20
+ import { Component, signal } from '@angular/core';
21
+ import { CngxNavLink } from '@cngx/common';
21
22
  import {
22
23
  CngxSidenav,
23
24
  CngxSidenavLayout,
@@ -46,6 +47,7 @@ import {
46
47
  CngxSidenavContent,
47
48
  CngxSidenavHeader,
48
49
  CngxSidenavFooter,
50
+ CngxNavLink,
49
51
  ],
50
52
  })
51
53
  export class ExampleComponent {
@@ -59,12 +61,95 @@ export class ExampleComponent {
59
61
 
60
62
  Key features:
61
63
 
62
- - **Mode switching:** `over` (overlay), `push` (nudges content), `side` (permanent), `mini` (collapsed icon rail with hover expand)
64
+ - **Mode switching:** `over` (overlay), `push` (nudges content), `side` (permanent), `mini` (collapsed icon rail; hover expands after a tunable dwell via `[expandDelay]` / `[collapseDelay]`)
63
65
  - **Responsive:** Media query-driven mode override via `[responsive]` input
64
66
  - **Two-way binding:** `[(opened)]` synchronizes with external state
65
67
  - **Resize:** Optional drag handle with min/max constraints
66
68
  - **Keyboard:** Escape closes overlay, configurable global shortcut via `[shortcut]`
67
69
  - **RTL-aware:** `position="start"` / `"end"` flip logically in RTL
70
+ - **Deep-linking:** persist open state to a URL query param via `[cngxSidenavRouterSync]` (see [Deep-linking](#deep-linking-router-sync))
71
+ - **App-wide defaults:** `CNGX_SIDENAV_CONFIG` cascade for dimensions, responsive query, shortcut, hover dwell, and router-sync param (see [Configuration](#configuration))
72
+
73
+ ## Configuration
74
+
75
+ Every dimension default, the responsive query, the toggle shortcut, and the mini hover dwell resolve through a standard cascade. Per-instance bindings always win; unset keys fall back to the library defaults, so an unconfigured `<cngx-sidenav>` behaves exactly as before.
76
+
77
+ Resolution priority (high to low):
78
+
79
+ 1. Per-instance input (`[width]`, `[shortcut]`, `[expandDelay]`, ...)
80
+ 2. `provideSidenavConfigAt(...)` in a component's `viewProviders` (sub-tree scope)
81
+ 3. `provideSidenavConfig(...)` at the application root
82
+ 4. Library defaults
83
+
84
+ ```typescript
85
+ import {
86
+ provideSidenavConfig,
87
+ withSidenavDimensions,
88
+ withSidenavResponsive,
89
+ withSidenavShortcut,
90
+ withSidenavHoverDwell,
91
+ } from '@cngx/ui';
92
+
93
+ bootstrapApplication(AppComponent, {
94
+ providers: [
95
+ provideSidenavConfig(
96
+ withSidenavDimensions({ width: '320px', miniWidth: '64px' }),
97
+ withSidenavResponsive('(min-width: 1024px)'),
98
+ withSidenavShortcut('mod+b'),
99
+ withSidenavHoverDwell({ enterDelay: 200, leaveDelay: 150 }),
100
+ ),
101
+ ],
102
+ });
103
+ ```
104
+
105
+ | Feature | Overrides |
106
+ |-|-|
107
+ | `withSidenavDimensions({ width?, miniWidth?, minWidth?, maxWidth? })` | Panel dimensions |
108
+ | `withSidenavResponsive(query)` | Default responsive media query |
109
+ | `withSidenavShortcut(combo)` | Default toggle shortcut |
110
+ | `withSidenavHoverDwell({ enterDelay?, leaveDelay? })` | Mini expand/collapse dwell (ms) |
111
+ | `withSidenavRouterSync({ param })` | Default deep-link query-param key |
112
+
113
+ Read the resolved config in an injection context with `injectSidenavConfig()`. Scope overrides to a sub-tree with `provideSidenavConfigAt(...)` in a component's `viewProviders`.
114
+
115
+ ### Mini hover dwell
116
+
117
+ In `mini` mode the rail expands only after the pointer rests for `expandDelay` ms and collapses after `collapseDelay` ms, so a sweep across the rail never expands it. Both are tunable per instance and app-wide:
118
+
119
+ ```html
120
+ <cngx-sidenav mode="mini" [expandDelay]="250" [collapseDelay]="150">...</cngx-sidenav>
121
+ ```
122
+
123
+ Defaults are `expandDelay` 120ms and `collapseDelay` 0ms (instant collapse). The app-wide default is `withSidenavHoverDwell({ enterDelay, leaveDelay })`; per-instance `[expandDelay]` / `[collapseDelay]` win over it.
124
+
125
+ ## Deep-linking (router sync)
126
+
127
+ Add `[cngxSidenavRouterSync]` to a `<cngx-sidenav>` to persist its open state in a URL query param. Opening writes `?nav=open`, an initial `?nav=open` restores it open on load, closing removes the param, and browser back/forward re-hydrates it. The directive reaches the rail through the `CNGX_SIDENAV` contract token and delegates to `injectQueryParamSync` from `@cngx/common/layout`.
128
+
129
+ ```typescript
130
+ import {
131
+ CngxSidenav,
132
+ CngxSidenavLayout,
133
+ CngxSidenavContent,
134
+ CngxSidenavRouterSync,
135
+ } from '@cngx/ui';
136
+ ```
137
+
138
+ ```html
139
+ <cngx-sidenav cngxSidenavRouterSync position="start" mode="over" [(opened)]="navOpen">
140
+ ...
141
+ </cngx-sidenav>
142
+ ```
143
+
144
+ The query-param key defaults to `nav`. Override it per instance with `[param]`, or move the app-wide default through the config cascade:
145
+
146
+ ```typescript
147
+ import { provideSidenavConfig, withSidenavRouterSync } from '@cngx/ui';
148
+
149
+ provideSidenavConfig(withSidenavRouterSync({ param: 'menu' }));
150
+ ```
151
+
152
+ Resolution order for the key: per-instance `[param]` beats `withSidenavRouterSync({ param })`, which beats the `nav` literal. `router.navigate` rejections surface on the directive's `(syncError)` output. Without `@angular/router` the directive dev-warns once and no-ops.
68
153
 
69
154
  ## Accessibility
70
155
 
@@ -73,7 +158,7 @@ Key features:
73
158
  - `Escape` - Closes overlay mode sidenav
74
159
  - Custom shortcut (if configured) - Toggles opened state globally
75
160
  - **Screen reader:** Complementary landmark announces the sidebar label; scroll lock prevents reading body content when sidebar is open in overlay.
76
- - **Focus management:** On overlay close, focus is not automatically restored (consumer must manage).
161
+ - **Focus management:** In overlay (`over`) mode a CDK focus trap keeps Tab within the rail while open, moves focus into the rail on open, and restores focus to the element that opened it on close.
77
162
 
78
163
  ## Composition
79
164
 
@@ -83,6 +168,7 @@ Key features:
83
168
  - **Keyboard shortcut:** Global document listener via `effect(onCleanup)`
84
169
  - **Scroll lock:** Coordinate with `CngxSidenavLayout` via `hasOverlay` computed
85
170
  - **Resize:** Pointer-capture drag with RAFed position updates
171
+ - **Mini hover intent:** Debounced expand-on-hover via the composed `CngxHoverIntent` host directive (`@cngx/common/interactive`), reading `CNGX_HOVER_INTENT_DEFAULTS` from the resolved config
86
172
 
87
173
 
88
174
  ## Material Theme