@cngx/ui 0.1.0-rc.7 → 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.
Files changed (96) hide show
  1. package/README.md +0 -1
  2. package/a11y/README.md +11 -5
  3. package/accordion/README.md +4 -2
  4. package/breadcrumb/README.md +262 -0
  5. package/collection/README.md +6 -0
  6. package/command-palette/README.md +224 -0
  7. package/data-grid-accordion/README.md +76 -2
  8. package/feedback/README.md +40 -0
  9. package/fesm2022/cngx-ui-a11y.mjs +189 -57
  10. package/fesm2022/cngx-ui-a11y.mjs.map +1 -1
  11. package/fesm2022/cngx-ui-accordion.mjs +102 -35
  12. package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
  13. package/fesm2022/cngx-ui-action-button.mjs +112 -50
  14. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  15. package/fesm2022/cngx-ui-breadcrumb.mjs +176 -96
  16. package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
  17. package/fesm2022/cngx-ui-chart-panel.mjs +180 -23
  18. package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -1
  19. package/fesm2022/cngx-ui-collection.mjs +194 -62
  20. package/fesm2022/cngx-ui-collection.mjs.map +1 -1
  21. package/fesm2022/cngx-ui-command-palette.mjs +395 -119
  22. package/fesm2022/cngx-ui-command-palette.mjs.map +1 -1
  23. package/fesm2022/cngx-ui-context-menu.mjs +149 -34
  24. package/fesm2022/cngx-ui-context-menu.mjs.map +1 -1
  25. package/fesm2022/cngx-ui-data-grid-accordion.mjs +415 -98
  26. package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
  27. package/fesm2022/cngx-ui-empty-state.mjs +16 -6
  28. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
  29. package/fesm2022/cngx-ui-feedback.mjs +1022 -439
  30. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  31. package/fesm2022/cngx-ui-mat-accordion.mjs +75 -7
  32. package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
  33. package/fesm2022/cngx-ui-mat-paginator.mjs +67 -24
  34. package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -1
  35. package/fesm2022/cngx-ui-mat-stepper.mjs +72 -47
  36. package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
  37. package/fesm2022/cngx-ui-mat-tabs.mjs +314 -141
  38. package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
  39. package/fesm2022/cngx-ui-overlay.mjs +69 -13
  40. package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
  41. package/fesm2022/cngx-ui-paginator.mjs +487 -178
  42. package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
  43. package/fesm2022/cngx-ui-sidenav.mjs +327 -106
  44. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  45. package/fesm2022/cngx-ui-skeleton.mjs +4 -16
  46. package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
  47. package/fesm2022/cngx-ui-speak.mjs +107 -8
  48. package/fesm2022/cngx-ui-speak.mjs.map +1 -1
  49. package/fesm2022/cngx-ui-stat-card.mjs +146 -46
  50. package/fesm2022/cngx-ui-stat-card.mjs.map +1 -1
  51. package/fesm2022/cngx-ui-stepper.mjs +191 -68
  52. package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
  53. package/fesm2022/cngx-ui-tabs.mjs +10 -6
  54. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  55. package/fesm2022/cngx-ui-timeline.mjs +74 -21
  56. package/fesm2022/cngx-ui-timeline.mjs.map +1 -1
  57. package/fesm2022/cngx-ui-toc.mjs +70 -26
  58. package/fesm2022/cngx-ui-toc.mjs.map +1 -1
  59. package/fesm2022/cngx-ui.mjs +15 -20
  60. package/fesm2022/cngx-ui.mjs.map +1 -1
  61. package/mat-paginator/README.md +9 -2
  62. package/mat-tabs/styles/mat-tabs.css +9 -10
  63. package/overlay/README.md +9 -4
  64. package/package.json +4 -4
  65. package/paginator/README.md +8 -4
  66. package/sidenav/README.md +33 -11
  67. package/speak/README.md +3 -2
  68. package/stepper/README.md +13 -1
  69. package/timeline/README.md +1 -1
  70. package/toc/README.md +4 -1
  71. package/types/cngx-ui-a11y.d.ts +121 -30
  72. package/types/cngx-ui-accordion.d.ts +91 -26
  73. package/types/cngx-ui-action-button.d.ts +44 -3
  74. package/types/cngx-ui-breadcrumb.d.ts +154 -58
  75. package/types/cngx-ui-chart-panel.d.ts +122 -18
  76. package/types/cngx-ui-collection.d.ts +147 -55
  77. package/types/cngx-ui-command-palette.d.ts +297 -183
  78. package/types/cngx-ui-context-menu.d.ts +98 -6
  79. package/types/cngx-ui-data-grid-accordion.d.ts +274 -38
  80. package/types/cngx-ui-empty-state.d.ts +9 -2
  81. package/types/cngx-ui-feedback.d.ts +594 -56
  82. package/types/cngx-ui-mat-accordion.d.ts +29 -1
  83. package/types/cngx-ui-mat-paginator.d.ts +37 -8
  84. package/types/cngx-ui-mat-stepper.d.ts +23 -11
  85. package/types/cngx-ui-mat-tabs.d.ts +207 -14
  86. package/types/cngx-ui-overlay.d.ts +56 -10
  87. package/types/cngx-ui-paginator.d.ts +403 -129
  88. package/types/cngx-ui-sidenav.d.ts +248 -74
  89. package/types/cngx-ui-skeleton.d.ts +6 -7
  90. package/types/cngx-ui-speak.d.ts +118 -5
  91. package/types/cngx-ui-stat-card.d.ts +117 -33
  92. package/types/cngx-ui-stepper.d.ts +66 -27
  93. package/types/cngx-ui-tabs.d.ts +2 -2
  94. package/types/cngx-ui-timeline.d.ts +23 -7
  95. package/types/cngx-ui-toc.d.ts +80 -13
  96. package/types/cngx-ui.d.ts +7 -4
package/README.md CHANGED
@@ -635,7 +635,6 @@ Shows banner on `error` transition, auto-dismisses on `success`/`idle`.
635
635
  | `--cngx-banner-gap` | `12px` | Gap between elements |
636
636
  | `--cngx-banner-padding` | `10px 16px` | Banner padding |
637
637
  | `--cngx-banner-font-size` | `0.9375rem` | Message font size |
638
- | `--cngx-banner-action-min-size` | `44px` | Min touch target for action button |
639
638
  | `--cngx-banner-pending-opacity` | `0.85` | Opacity during async action |
640
639
  | `--cngx-banner-{severity}-bg` | per severity | Background |
641
640
  | `--cngx-banner-{severity}-border` | per severity | Border |
package/a11y/README.md CHANGED
@@ -43,8 +43,11 @@ default and announces the change through the shared live region.
43
43
 
44
44
  ## Configuration
45
45
 
46
- Labels and the rendered axis list come from `CNGX_A11Y_PANEL_CONFIG`. Defaults
47
- are English; override via the cascade.
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.
48
51
 
49
52
  ```ts
50
53
  import {
@@ -57,8 +60,8 @@ provideA11yPanelConfig(
57
60
  withA11yPanelLabels({ heading: 'Barrierefreiheit', axes: { motion: 'Bewegung' } }),
58
61
  withA11yPanelAxes([
59
62
  { axis: 'textScale', reset: 'md', options: [
60
- { value: 'md', label: 'Default' },
61
- { value: 'lg', label: 'Large' },
63
+ { value: 'md' },
64
+ { value: 'lg', label: 'Bigger' },
62
65
  ] },
63
66
  ]),
64
67
  );
@@ -78,4 +81,7 @@ Project `[cngxA11yPanelHeader]` to replace the default heading:
78
81
 
79
82
  - `CngxA11yPanel` - the placeable card.
80
83
  - `CNGX_A11Y_PANEL_CONFIG` / `provideA11yPanelConfig` / `withA11yPanelLabels` /
81
- `withA11yPanelAxes` / `injectA11yPanelConfig` - the config cascade.
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.
@@ -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 })`. Library defaults are
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`
@@ -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
 
@@ -0,0 +1,224 @@
1
+ # CngxCommandPalette
2
+
3
+ The opinionated Cmd/Ctrl+K palette preset. Renders a search-driven command list
4
+ inside a native modal `<dialog cngxDialog>`, so focus trapping, trigger storage
5
+ at open and focus restore after the close transition come from `CngxDialog` and
6
+ the platform - no hand-rolled focus machinery. The body composes existing
7
+ atoms: `CngxSearch` (debounced term), `CngxListbox` + `CngxOption`
8
+ (active-descendant navigation), `CngxHighlight` (match marking). Commands are
9
+ data from `@cngx/common/command` (`provideCommands`); the palette commits no
10
+ form value - it fires `command.run()`, the locked demarcation from `CngxCombobox`.
11
+
12
+ ## Import
13
+
14
+ ```typescript
15
+ import { CngxCommandPalette, CngxCommandPaletteTrigger } from '@cngx/ui/command-palette';
16
+ import { provideCommands } from '@cngx/common/command';
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ```typescript
22
+ import { Component } from '@angular/core';
23
+ import { provideCommands } from '@cngx/common/command';
24
+ import { CngxCommandPalette, CngxCommandPaletteTrigger } from '@cngx/ui/command-palette';
25
+
26
+ @Component({
27
+ selector: 'app-example',
28
+ providers: [
29
+ provideCommands([
30
+ { id: 'new-file', label: 'New file', run: () => void 0 },
31
+ { id: 'toggle-theme', label: 'Toggle theme', group: 'View', run: () => void 0 },
32
+ ]),
33
+ ],
34
+ template: `
35
+ <button [cngxCommandPaletteTrigger]="palette">Search <kbd>Cmd K</kbd></button>
36
+ <cngx-command-palette #palette />
37
+ `,
38
+ imports: [CngxCommandPalette, CngxCommandPaletteTrigger],
39
+ })
40
+ export class ExampleComponent {}
41
+ ```
42
+
43
+ Pressing Cmd/Ctrl+K anywhere opens the palette. Type to filter, arrows to
44
+ navigate, Enter runs the highlighted command and dismisses.
45
+
46
+ ## Opening
47
+
48
+ The open combo resolves per instance `[openShortcut]` (parsed via
49
+ `parseKeyCombo`, e.g. `'mod+shift+p'`; changing it live re-installs the
50
+ listener), then `withPaletteShortcut(...)` from the config cascade, then the
51
+ `'mod+k'` default.
52
+
53
+ The global keydown listener is installed by a swappable factory,
54
+ `CNGX_PALETTE_KEYBINDING_FACTORY` (default `createPaletteKeybinding`). Override
55
+ the token to replace the whole listener - an enterprise key-capture policy, a
56
+ test double - without touching the palette. To only change the combo, use the
57
+ input or the config feature. On SSR the default factory is an inert no-op.
58
+
59
+ `[cngxCommandPaletteTrigger]` is the optional explicit trigger: opens on click,
60
+ sets `aria-haspopup="dialog"` and derives `aria-expanded` from the palette's
61
+ `isOpen()` signal. The palette is passed by template reference - orthogonal
62
+ composition, no ancestor injection. `open()` and `dismiss()` are public methods
63
+ for programmatic control.
64
+
65
+ ## Commands and matching
66
+
67
+ The static registry is `provideCommands(...sources)` - each source an array or
68
+ a `Signal<readonly CngxCommand[]>`, merged reactively. A `CngxCommand` is pure
69
+ data plus `run()`: `id`, `label`, optional `keywords`, `group`, `icon`,
70
+ `disabled` (a `Signal<boolean>`), `disabledReason`, and an `unknown` `data`
71
+ payload the row slot narrows.
72
+
73
+ Ranking runs through the swappable `CNGX_COMMAND_MATCH_FACTORY`
74
+ (`@cngx/common/command`); results group by `command.group`, rank order
75
+ preserved. The two-way `[(scope)]` model feeds the matcher's scope filter and
76
+ renders as a chip in the input row.
77
+
78
+ A disabled command stays in the list and communicates its why: the default row
79
+ wires `aria-describedby` to a visually hidden node carrying `disabledReason`,
80
+ with the reference gated on the disabled state while the node itself stays in
81
+ the DOM.
82
+
83
+ ## Async results
84
+
85
+ Bind `[results]` to a `CngxAsyncState<CngxCommandGroup[]>` (from
86
+ `createAsyncState`/`injectAsyncState`) and the palette merges consumer groups
87
+ above the ranked static registry. An internal shell maps the state through
88
+ `resolveAsyncView()`:
89
+
90
+ - first load renders the loading state; a first-load failure the error state
91
+ with a Retry button that emits `(retry)`;
92
+ - a re-query failure keeps stale results visible under an error banner;
93
+ - an empty success keeps the input mounted - the panel renders the empty slot
94
+ off its own result count, so typing to refine the term keeps working.
95
+
96
+ When async groups arrive mid-navigation, the highlight is re-resolved by
97
+ command id, not index - Enter always runs the row the user saw.
98
+
99
+ ## Template slots
100
+
101
+ Six structural directives, projected as palette content. Resolution per slot:
102
+ instance directive, then `config.templates`, then the built-in default.
103
+
104
+ | Slot | Context |
105
+ |-|-|
106
+ | `*cngxCommandRow` | `$implicit: CngxRankedCommand`, `term`, `data`, `active` |
107
+ | `*cngxCommandGroupHeader` | `$implicit: CngxCommandGroup` |
108
+ | `*cngxCommandPaletteEmpty` | `term` |
109
+ | `*cngxCommandPaletteLoading` | none |
110
+ | `*cngxCommandPaletteError` | `error`, `retry: () => void` |
111
+ | `*cngxCommandPaletteFooter` | none |
112
+
113
+ The row is one slot on purpose - icon, label and shortcut hint are laid out in
114
+ the consumer's template:
115
+
116
+ ```html
117
+ <cngx-command-palette #palette [results]="results()">
118
+ <ng-template cngxCommandRow let-entry let-active="active">
119
+ <my-icon [name]="entry.command.icon" />
120
+ <span>{{ entry.command.label }}</span>
121
+ </ng-template>
122
+ </cngx-command-palette>
123
+ ```
124
+
125
+ The default footer renders the configured keyboard legend as `<kbd>` rows.
126
+
127
+ ## Host contract
128
+
129
+ The palette provides `CNGX_COMMAND_PALETTE_HOST` (`CngxCommandPaletteHost`):
130
+ `isOpen: Signal<boolean>` plus `dismiss()`. The panel uses it to dismiss after
131
+ a command runs and to reset term and highlight when the surface closes - the
132
+ dialog keeps its content mounted, so state must not leak into the next open.
133
+ The trigger binds `aria-expanded` to the same `isOpen()` seam.
134
+
135
+ ## Configuration
136
+
137
+ ```typescript
138
+ provideCommandPaletteConfig(
139
+ withCommandPaletteLabels({ searchPlaceholder: 'Befehl eingeben...', emptyLabel: 'Keine Treffer.' }),
140
+ withPaletteShortcut('mod+shift+p'),
141
+ withKeyboardLegend([{ keys: 'enter', label: 'Ausfuehren' }]),
142
+ withResultCountFormatter((n) => `${n} Ergebnisse`),
143
+ withCommandPaletteTemplates({ row: myRowTemplate }),
144
+ );
145
+ ```
146
+
147
+ Root, or scoped to a subtree with `provideCommandPaletteConfigAt` in
148
+ `viewProviders`, where features merge onto the enclosing scope. The copy
149
+ defaults are the `commandPalette` section of the language pack (English
150
+ without one), so the language file translates the palette; the features above
151
+ override single keys on top of it. Each footer legend entry is spoken once,
152
+ through the section's `legendEntry` message (`'{keys} {label}'`). The `<kbd>`
153
+ glyphs are hidden from screen readers; an entry's `spokenKeys` (the navigate
154
+ entry's `navigateKeysSpoken`, English `'Up and Down arrows'`) is what they hear.
155
+
156
+ ## Accessibility
157
+
158
+ - The surface is a native modal dialog: `showModal()` traps focus, Escape
159
+ closes, focus returns to the trigger after the close transition settles.
160
+ `[ariaLabel]` names the dialog (default `'Command palette'`).
161
+ - The input is `role="combobox"` with `aria-autocomplete="list"`,
162
+ `aria-controls` on the listbox and `aria-activedescendant` tracking the
163
+ highlighted row; focus never leaves the input while navigating.
164
+ - ArrowDown/ArrowUp move the highlight, Home/End jump, Enter activates.
165
+ Modified combos (Ctrl/Meta/Alt) pass through untouched so browser and app
166
+ shortcuts keep working; printable keys fall through to the search term.
167
+ - A polite `aria-live` region announces the result count on every re-rank,
168
+ formatted by `config.resultCount`.
169
+ - Groups render as `role="group"` with `aria-labelledby` pointing at minted,
170
+ panel-unique DOM ids - never raw consumer strings.
171
+ - Forced-colors mode re-signals the active row with the system Highlight pair
172
+ and pins the modal border to `CanvasText`.
173
+
174
+ ## CSS custom properties
175
+
176
+ All spacing tokens are set from the global `--cngx-space-*` scale at the hosts,
177
+ so a root `[data-density]` swap re-scales the whole palette.
178
+
179
+ | Property | Default | Purpose |
180
+ |-|-|-|
181
+ | `--cngx-command-width` | `min(40rem, calc(100vw - 2rem))` | Dialog inline size |
182
+ | `--cngx-command-max-h` | `min(32rem, calc(100vh - 6rem))` | Dialog max block size |
183
+ | `--cngx-command-bg` / `--cngx-command-color` | surface / inherit | Dialog surface pair |
184
+ | `--cngx-command-border` / `--cngx-command-border-width` | `--cngx-color-border` / `1px` | Border, input row and footer separators |
185
+ | `--cngx-command-radius` | `--cngx-radius-lg` | Dialog corner radius |
186
+ | `--cngx-command-shadow` | elevation shadow | Dialog elevation |
187
+ | `--cngx-command-backdrop` | `rgb(0 0 0 / 0.4)` | `::backdrop` scrim |
188
+ | `--cngx-command-input-color` / `--cngx-command-placeholder-color` | inherit / muted | Search input text |
189
+ | `--cngx-command-input-gap` / `--cngx-command-input-pad` | `sm` / `md` space | Input row layout |
190
+ | `--cngx-command-chip-bg` / `--cngx-command-chip-color` / `--cngx-command-chip-size` / `--cngx-command-chip-radius` / `--cngx-command-chip-pad` | muted / inherit / `0.8125rem` / `--cngx-radius-sm` / `sm` space | Scope chip |
191
+ | `--cngx-command-listbox-max-h` / `--cngx-command-listbox-pad` | `22rem` / `xs` space | Results scroll area |
192
+ | `--cngx-command-header-color` / `--cngx-command-header-size` / `--cngx-command-header-weight` / `--cngx-command-header-pad-y` / `--cngx-command-header-pad-x` | muted / `0.75rem` / `600` / `xs` / `sm` space | Group headers |
193
+ | `--cngx-command-row-color` / `--cngx-command-row-radius` / `--cngx-command-row-gap` / `--cngx-command-row-pad` | inherit / `--cngx-radius-sm` / `sm` / `sm` space | Command rows |
194
+ | `--cngx-command-row-active-bg` / `--cngx-command-row-active-color` | accent / inherit | Highlighted row |
195
+ | `--cngx-command-mark-bg` | `--cngx-color-highlight` | Match `<mark>` |
196
+ | `--cngx-command-state-pad` / `--cngx-command-state-color` / `--cngx-command-error-color` / `--cngx-command-retry-bg` | `lg` space / muted / danger / transparent | Loading, empty and error chrome |
197
+ | `--cngx-command-footer-gap` / `--cngx-command-footer-pad-y` / `--cngx-command-footer-pad-x` / `--cngx-command-footer-size` / `--cngx-command-footer-color` | `md` / `sm` / `md` space / `0.75rem` / muted | Legend footer |
198
+ | `--cngx-command-kbd-bg` / `--cngx-command-kbd-color` | muted / inherit | `<kbd>` chips |
199
+ | `--cngx-command-focus-outline` / `--cngx-command-focus-offset` | `2px solid` focus color / `2px` | Focus ring |
200
+
201
+ ## Material Theme
202
+
203
+ ```scss
204
+ @use '@angular/material' as mat;
205
+ @use '@cngx/themes/material/command-palette-theme' as command-palette;
206
+
207
+ html {
208
+ @include command-palette.theme($theme);
209
+ }
210
+ ```
211
+
212
+ Without the bridge the palette uses the cngx foundation `--cngx-color-*`
213
+ tokens with a native look. The bridge paints an M3 dialog/menu hybrid:
214
+ surface-container-high modal on a scrim backdrop, secondary-container active
215
+ rows, container-tone chip and kbd sub-surfaces, error roles for the failure
216
+ chrome. Spacing stays on `--cngx-space-*` so density tracking keeps working.
217
+
218
+ ## See Also
219
+
220
+ - `@cngx/common/command` - the framework-level command registry and matcher
221
+ - [CngxDialog](../../common/dialog/) - the modal surface the palette composes
222
+ - [CngxListbox](../../common/interactive/) - the navigation atom under the rows
223
+ - [API on compodocx](https://cngxjs.github.io/cngx/)
224
+ - Tests: `projects/ui/command-palette/palette/command-palette.component.spec.ts`, `panel/command-panel.component.spec.ts`
@@ -57,6 +57,16 @@ Above `--cngx-dga-min-width` the grid fills 100%; below it the host scrolls side
57
57
  (`overflow-x: auto`) with every column intact. No column is ever dropped - horizontal
58
58
  scroll over silent information loss.
59
59
 
60
+ The host composes `CngxScrollEdges`, so it carries `data-scroll-inline-start` /
61
+ `data-scroll-inline-end` only while columns are really hidden toward that side, and
62
+ fades that edge with a mask. The fade width is `--cngx-dga-edge-fade-size` (24px) and it
63
+ never drops below `--cngx-dga-edge-fade-min` opacity (0.35), so edge content and overlay
64
+ scrollbars stay visible; the border ring (skin frame, classic scrollbars) is left
65
+ unmasked. The gradient flips under `dir="rtl"`. A focused cell scrolled in sideways
66
+ lands clear of the fade (`scroll-padding-inline` = fade width plus
67
+ `--cngx-dga-focus-clearance`), and while the grid host itself holds keyboard focus the
68
+ mask yields so its focus ring stays visible.
69
+
60
70
  ## Bounded height
61
71
 
62
72
  Bind `[maxBlockSize]` to cap the grid (a number is `px`, a string is any CSS length):
@@ -68,6 +78,65 @@ set directly. This is the only way to pin the head - `[cngxStickyHeader]` from
68
78
  and a content-height grid has nothing to stick to. Leave `[maxBlockSize]` unbound and
69
79
  the grid stays content-height and unchanged.
70
80
 
81
+ In bounded mode the pinned bands communicate hidden rows: the head casts a shadow only
82
+ while `data-scroll-block-start` is set (rows scrolled away above), the footer only while
83
+ `data-scroll-block-end` is set (rows remaining below). Tune them with
84
+ `--cngx-dga-head-shadow` / `--cngx-dga-foot-shadow`. Keyboard focus never lands under a
85
+ band: the host pads its scrollport (`scroll-padding-block`) by the measured head and
86
+ foot size plus `--cngx-dga-focus-clearance` (4px, the widest ring plus its offset);
87
+ `--cngx-dga-head-scroll-pad` / `--cngx-dga-foot-scroll-pad` override the measured
88
+ values.
89
+
90
+ ### Scroll-edge visuals are swappable defaults
91
+
92
+ The shadows and the inline fade are only the default look. The host attributes
93
+ `data-scroll-block-start`, `data-scroll-block-end`, `data-scroll-inline-start` and
94
+ `data-scroll-inline-end` are public: each is present (empty value) only while content is
95
+ hidden toward that edge, so you can key any visual on them.
96
+
97
+ Turn the default shadows off:
98
+
99
+ ```css
100
+ cngx-data-grid-accordion {
101
+ --cngx-dga-head-shadow: none;
102
+ --cngx-dga-foot-shadow: none;
103
+ }
104
+ ```
105
+
106
+ A line that appears under the pinned head instead. Use a background layer on the header
107
+ rather than a pseudo-element: some skins already use the header's pseudo-elements, and
108
+ a background layer stacks on top of the skin's own fill:
109
+
110
+ ```css
111
+ cngx-data-grid-accordion {
112
+ --cngx-dga-head-shadow: none;
113
+ }
114
+ cngx-data-grid-accordion[data-scroll-block-start] .cngx-dga-header {
115
+ background-image: linear-gradient(to top, var(--cngx-color-border, #d1d5db) 2px, transparent 0);
116
+ }
117
+ ```
118
+
119
+ A tonal head instead (the Material 3 top app bar pattern). Set the header's background
120
+ directly: the named skins paint the head fill themselves, so `--cngx-dga-head-bg` only
121
+ reaches the unskinned grid:
122
+
123
+ ```css
124
+ cngx-data-grid-accordion {
125
+ --cngx-dga-head-shadow: none;
126
+ }
127
+ cngx-data-grid-accordion[data-scroll-block-start] .cngx-dga-header {
128
+ background-color: color-mix(in oklab, var(--cngx-color-primary, #1d4ed8) 8%, var(--cngx-color-surface, #fff));
129
+ }
130
+ ```
131
+
132
+ Under forced colors the UA strips shadows, so a line or border is the cue that survives
133
+ there.
134
+
135
+ Motion and forced colors: the shadow and fade ease over `--cngx-dga-edge-duration`
136
+ (default `--cngx-duration-fast`), which the global reduced-motion net collapses to an
137
+ instant change. Under forced colors the UA drops the shadows and the fade is removed;
138
+ the system-coloured scrollbar and the 1px head / foot rules carry the cue.
139
+
71
140
  ## Skins
72
141
 
73
142
  Six built-in skins select via the `[skin]` input, reflected onto a `[data-skin]` host
@@ -95,8 +164,13 @@ a per-instance `[skin]` still wins. Columns are per-instance, so there is no
95
164
  ## Config
96
165
 
97
166
  `provideDataGridAccordionConfig(...)` / `provideDataGridAccordionConfigAt(...)` with the
98
- single `withDataGridSkin(name)` feature; read it back with
99
- `injectDataGridAccordionConfig()`.
167
+ `withDataGridSkin(name)` and `withDataGridAccordionLabels({...})` features; read it back
168
+ with `injectDataGridAccordionConfig()`. `withDataGridAccordionLabels` takes a partial
169
+ bundle (or a `Signal` of one) for the count, sort, filter, row-error and note copy;
170
+ unset keys read the `dataGridAccordion` section of the language pack (English without
171
+ one). `CngxDataGridAccordionConfigFeature` is a union
172
+ since the labels feature landed - see [the migration note](./config-feature-migration.md)
173
+ if you extended or merged the old interface.
100
174
 
101
175
  ## Sort and filter
102
176