@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
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
|
|
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:**
|
|
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
|