@cngx/common 0.1.0-rc.8 → 0.3.0

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 (90) hide show
  1. package/a11y/README.md +15 -2
  2. package/button/README.md +258 -0
  3. package/command/README.md +42 -2
  4. package/data/README.md +15 -12
  5. package/fesm2022/cngx-common-a11y.mjs +1076 -319
  6. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  7. package/fesm2022/cngx-common-audio.mjs +99 -77
  8. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  9. package/fesm2022/cngx-common-button.mjs +1084 -0
  10. package/fesm2022/cngx-common-button.mjs.map +1 -0
  11. package/fesm2022/cngx-common-card.mjs +138 -78
  12. package/fesm2022/cngx-common-card.mjs.map +1 -1
  13. package/fesm2022/cngx-common-chart.mjs +799 -327
  14. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  15. package/fesm2022/cngx-common-command.mjs +101 -25
  16. package/fesm2022/cngx-common-command.mjs.map +1 -1
  17. package/fesm2022/cngx-common-data.mjs +861 -423
  18. package/fesm2022/cngx-common-data.mjs.map +1 -1
  19. package/fesm2022/cngx-common-dialog.mjs +198 -160
  20. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  21. package/fesm2022/cngx-common-display.mjs +693 -329
  22. package/fesm2022/cngx-common-display.mjs.map +1 -1
  23. package/fesm2022/cngx-common-interactive.mjs +7303 -2774
  24. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  25. package/fesm2022/cngx-common-layout.mjs +2174 -442
  26. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  27. package/fesm2022/cngx-common-menu-button.mjs +557 -0
  28. package/fesm2022/cngx-common-menu-button.mjs.map +1 -0
  29. package/fesm2022/cngx-common-popover.mjs +2109 -557
  30. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  31. package/fesm2022/cngx-common-stepper.mjs +548 -419
  32. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  33. package/fesm2022/cngx-common-tabs.mjs +442 -331
  34. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  35. package/fesm2022/cngx-common-timeline.mjs +44 -71
  36. package/fesm2022/cngx-common-timeline.mjs.map +1 -1
  37. package/fesm2022/cngx-common.mjs +10 -10
  38. package/fesm2022/cngx-common.mjs.map +1 -1
  39. package/interactive/README.md +30 -19
  40. package/layout/README.md +17 -1
  41. package/menu-button/README.md +234 -0
  42. package/package.json +31 -8
  43. package/popover/README.md +81 -4
  44. package/popover/tooltip-indicator.scss +52 -0
  45. package/schematics/collection.json +9 -0
  46. package/schematics/ng-add/index.js +9 -0
  47. package/schematics/ng-add/schema.json +96 -0
  48. package/schematics/package.json +3 -0
  49. package/stepper/README.md +5 -5
  50. package/theming/components/cngx-accordion.css +36 -7
  51. package/theming/components/cngx-async.css +185 -37
  52. package/theming/components/cngx-backdrop.css +3 -1
  53. package/theming/components/cngx-badge.css +20 -5
  54. package/theming/components/cngx-bottom-sheet.css +2 -0
  55. package/theming/components/cngx-breadcrumb.css +3 -1
  56. package/theming/components/cngx-button-group.css +325 -0
  57. package/theming/components/cngx-button-toggle.css +55 -23
  58. package/theming/components/cngx-button.css +975 -0
  59. package/theming/components/cngx-data-grid.css +2 -0
  60. package/theming/components/cngx-dialog.css +3 -1
  61. package/theming/components/cngx-divider.css +24 -9
  62. package/theming/components/cngx-drawer.css +153 -0
  63. package/theming/components/cngx-icon-glyph.css +76 -0
  64. package/theming/components/cngx-listbox.css +79 -25
  65. package/theming/components/cngx-menu.css +112 -52
  66. package/theming/components/cngx-nav.css +1220 -0
  67. package/theming/components/cngx-popover-sheet.css +434 -0
  68. package/theming/components/cngx-popover.css +37 -9
  69. package/theming/components/cngx-recycler-placeholder.css +2 -0
  70. package/theming/components/cngx-ripple.css +74 -16
  71. package/theming/components/cngx-sidebar.css +71 -0
  72. package/theming/components/cngx-slider.css +3 -1
  73. package/theming/components/cngx-tooltip.css +2 -0
  74. package/timeline/README.md +2 -2
  75. package/types/cngx-common-a11y.d.ts +488 -112
  76. package/types/cngx-common-audio.d.ts +60 -88
  77. package/types/cngx-common-button.d.ts +698 -0
  78. package/types/cngx-common-card.d.ts +104 -78
  79. package/types/cngx-common-chart.d.ts +677 -389
  80. package/types/cngx-common-command.d.ts +55 -41
  81. package/types/cngx-common-data.d.ts +506 -360
  82. package/types/cngx-common-dialog.d.ts +94 -127
  83. package/types/cngx-common-display.d.ts +475 -300
  84. package/types/cngx-common-interactive.d.ts +4383 -1721
  85. package/types/cngx-common-layout.d.ts +1399 -288
  86. package/types/cngx-common-menu-button.d.ts +382 -0
  87. package/types/cngx-common-popover.d.ts +990 -268
  88. package/types/cngx-common-stepper.d.ts +374 -465
  89. package/types/cngx-common-tabs.d.ts +309 -403
  90. package/types/cngx-common-timeline.d.ts +50 -109
@@ -0,0 +1,1220 @@
1
+ /**
2
+ * @overview
3
+ * Skin of the `@cngx/common/interactive` nav atoms. A `<nav>` of
4
+ * `cngxNavLink` rows, `cngxNavGroup` heads, `cngxNavLabel` section labels and
5
+ * `cngxNavBadge` badges renders finished in any container: one row shape,
6
+ * graded state fills, an active indicator, a double focus ring, nested
7
+ * indentation and an animated group content. Imported by `cngx.css`, so the
8
+ * rows look the same inside `cngx-sidenav`, a `cngxSidebar` or a plain
9
+ * `<nav>`. Containers only SET tokens; no selector here carries a container
10
+ * prefix.
11
+ *
12
+ * **Selectors**
13
+ *
14
+ * - `.cngx-nav-link` (`CngxNavLink`), `.cngx-nav-group` (`CngxNavGroup`) -
15
+ * one row shape for links and group heads
16
+ * - `.cngx-nav-label` (`CngxNavLabel`) - section label
17
+ * - `.cngx-nav-badge` (`CngxNavBadge`) with `--count`, `--dot`, `--status`
18
+ * - `.cngx-nav-group-content` (`CngxNavGroupContent`) - grid-rows expand
19
+ * and collapse wrapper; it needs one child. Open as a popover on a
20
+ * collapsed rail (`:popover-open`) it is the group flyout
21
+ * - `.cngx-nav-icon` (`CngxNavIcon`) - icon slot of a row or group head
22
+ * - `.cngx-nav-header` (`CngxNavHeader`), `.cngx-nav-footer`
23
+ * (`CngxNavFooter`) - top and bottom regions of a nav container
24
+ * - `.cngx-nav-mark` (`CngxNavMark`) - logo or avatar in the icon box of a
25
+ * header or footer, at the row icon x; `.cngx-nav-name` (`CngxNavName`) -
26
+ * the name next to it, at the row label x, truncated with an ellipsis. A
27
+ * `cngx-avatar` as mark takes the icon box size whatever its `size`, with
28
+ * initials at `--cngx-nav-mark-font-size`. For larger marks raise
29
+ * `--cngx-nav-icon-size` on the container: rows and marks grow together
30
+ * and stay aligned
31
+ * - `.cngx-nav-rail-tooltip` - the label tooltip `injectNavRailTooltip`
32
+ * adds to a rail; with `data-cngx-rail-side="end"` it opens at the row's
33
+ * inline start, as the group flyout does
34
+ *
35
+ * **Row geometry**
36
+ *
37
+ * One flex row: inline-start padding, the icon box
38
+ * (`--cngx-nav-icon-size`), the gap (`--cngx-nav-icon-gap`), the label
39
+ * text, then a trailing badge or the group chevron. The icon box sits at the
40
+ * same x on every row. A row or group head without `.cngx-nav-icon` draws its
41
+ * first letter (`data-initial`, written by the directive) as a round filled
42
+ * badge in that box; `content: attr(data-initial) / ''` keeps the letter out
43
+ * of the accessible name. Icon and letter paint in `--cngx-nav-link-ink`.
44
+ *
45
+ * **State modifiers**
46
+ *
47
+ * - `.cngx-nav-link--active` - active fill, heavier weight, indicator bar on
48
+ * the inline-start edge (`::after`, so it coexists with the letter)
49
+ * - `.cngx-nav-group--open` - the group chevron turns to point down
50
+ * - `.cngx-nav-group-content--open` - grid rows `0fr -> 1fr`
51
+ * - `[data-nav-railed='true']` on the container (written by `CngxNavRailed`,
52
+ * `'false'` while expanded) - the rows are a crop of their expanded selves: each row and group head keeps
53
+ * its place and pushes its label, badge and chevron past the clipped row
54
+ * end, so the icon or letter stays in the icon box; section labels paint
55
+ * nothing; the header and footer name fades out. Rows inside a group
56
+ * content are left alone, so a flyout shows them at full width.
57
+ *
58
+ * **Nav row states**
59
+ *
60
+ * Rest (transparent), hover, pressed (`:active`), active and active+hover,
61
+ * each a stronger fill than the one before: hover < pressed < active <
62
+ * active+hover. Active beats hover and pressed; hovering or pressing the
63
+ * active row paints active+hover. Only background and colour transition (the
64
+ * global reduced-motion net collapses them).
65
+ *
66
+ * **Nesting**
67
+ *
68
+ * A row with `[depth]` indents its inline-start margin by
69
+ * `--cngx-nav-depth * --cngx-nav-indent` (12px unless
70
+ * `provideNavConfig(withNavIndent(...))` emits one), so the fill and the
71
+ * indicator move in with the row.
72
+ *
73
+ * **Inheritance**
74
+ *
75
+ * SET at the root from the foundation; a container (`cngx-sidenav`) SETs its
76
+ * own values on its host, and every token is read on the row:
77
+ *
78
+ * - `--cngx-nav-link-hover-bg` / `-pressed-bg` / `-active-bg` /
79
+ * `-active-hover-bg` -> `--cngx-color-primary` at 6 / 12 / 16 / 22 % over
80
+ * transparent
81
+ * - `--cngx-nav-link-focus-outline-color` -> `--cngx-color-text`
82
+ * - `--cngx-nav-link-focus-inner-color` -> `--cngx-color-surface`
83
+ * - `--cngx-nav-link-active-indicator-color` -> `--cngx-color-primary-text`
84
+ * - `--cngx-nav-link-inset` -> `--cngx-space-xs`
85
+ * - `--cngx-nav-link-padding` -> `--cngx-space-sm` `--cngx-nav-link-padding-inline`
86
+ * - `--cngx-nav-link-padding-inline` -> `--cngx-space-md` (read on the row,
87
+ * the header, the footer and the section label)
88
+ * - `--cngx-nav-label-color` -> `--cngx-color-text-muted`
89
+ * - `--cngx-nav-header-border-color` / `--cngx-nav-footer-border-color` ->
90
+ * `--cngx-color-border`
91
+ * - `--cngx-nav-badge-bg` / `-color` -> `--cngx-color-primary-strong` /
92
+ * `--cngx-color-on-primary-strong`
93
+ * - `--cngx-nav-railed-gap` -> `100vw`: the gap that pushes a railed row's
94
+ * label past the row end; anything wider than the rail works
95
+ * - `--cngx-nav-railed-size` -> SET on every `[data-nav-railed]` host to
96
+ * `2 * (--cngx-nav-link-inset + --cngx-nav-link-padding-inline) +
97
+ * --cngx-nav-icon-size`: the rail width, border not included, at which the
98
+ * icon box sits centred. Read from the host's own row tokens. A container
99
+ * sizes its rail from it (`cngx-sidenav` does; a `cngxSidebar` SETs
100
+ * `--cngx-sidebar-rail-size: calc(var(--cngx-nav-railed-size) + border)`)
101
+ *
102
+ * **Dark mode**
103
+ *
104
+ * No hook: the fills are one accent mixed over transparent, so they follow
105
+ * the scheme through the surface beneath; the other colours derive from
106
+ * scheme-aware foundation tokens.
107
+ *
108
+ * **Forced colors**
109
+ *
110
+ * The active row re-signals with Highlight / HighlightText (its fill alone
111
+ * would collapse to Canvas), with the bar and the ring kept off the row edge;
112
+ * badges get a CanvasText ring so a filled pill or dot does not vanish into
113
+ * Canvas.
114
+ *
115
+ * **Pair with**
116
+ *
117
+ * - `@cngx/themes/material/nav-link-theme` - Material 3 nav row palette
118
+ *
119
+ * @themes CngxNavLink, CngxNavGroup, CngxNavLabel, CngxNavBadge, CngxNavGroupContent, CngxNavIcon, CngxNavHeader, CngxNavFooter, CngxNavMark, CngxNavName
120
+ */
121
+
122
+ @layer cngx.tokens {
123
+ /**
124
+ * Padding shorthand of each nav link.
125
+ * @group Layout
126
+ */
127
+ @property --cngx-nav-link-padding {
128
+ syntax: '*';
129
+ /* Read on the row; inherits so a container SET reaches it. No initial
130
+ value: a registered pixel initial would defeat the use-site fallback, so
131
+ a row outside any container could not follow [data-density]. */
132
+ inherits: true;
133
+ }
134
+
135
+ /**
136
+ * Inline padding of a nav row, and the inline offset of the header, footer
137
+ * and section label past the row inset. One value, so a mark and a label
138
+ * stay at the row icon x and label x. The default row padding reads it;
139
+ * a container that SETs the `--cngx-nav-link-padding` shorthand builds it
140
+ * from this token to keep the slots aligned.
141
+ * @group Layout
142
+ * @see [[--cngx-space-md]]
143
+ */
144
+ @property --cngx-nav-link-padding-inline {
145
+ syntax: '*';
146
+ /* No initial value: the use-site fallback reads --cngx-space-md on the
147
+ row, so density reaches rows and slots alike. */
148
+ inherits: true;
149
+ }
150
+
151
+ /**
152
+ * Font-size of each nav link.
153
+ * @group Typography
154
+ */
155
+ @property --cngx-nav-link-font-size {
156
+ syntax: '*';
157
+ inherits: false;
158
+ initial-value: 0.875rem;
159
+ }
160
+
161
+ /**
162
+ * Line-height of each nav link. Unset by default (the row inherits it); a
163
+ * theme SETs it on the row together with the size, weight and tracking of
164
+ * its type role.
165
+ * @group Typography
166
+ */
167
+ @property --cngx-nav-link-line-height {
168
+ syntax: '*';
169
+ inherits: false;
170
+ }
171
+
172
+ /**
173
+ * Letter-spacing of each nav link. Unset by default (the row inherits it).
174
+ * @group Typography
175
+ */
176
+ @property --cngx-nav-link-letter-spacing {
177
+ syntax: '*';
178
+ inherits: false;
179
+ }
180
+
181
+ /**
182
+ * Font-weight of a nav link at rest. Unset by default (the row inherits
183
+ * it); the active row reads `--cngx-nav-link-active-font-weight`.
184
+ * @group Typography
185
+ * @see [[--cngx-nav-link-active-font-weight]]
186
+ */
187
+ @property --cngx-nav-link-font-weight {
188
+ syntax: '*';
189
+ inherits: false;
190
+ }
191
+
192
+ /**
193
+ * Text color of a resting nav link.
194
+ * @group Surface
195
+ */
196
+ @property --cngx-nav-link-color {
197
+ syntax: '*';
198
+ inherits: true;
199
+ initial-value: currentColor;
200
+ }
201
+
202
+ /**
203
+ * Inline inset of each nav row from the container edges.
204
+ * SET from `--cngx-space-xs` at the root; a container may SET its own.
205
+ * @group Layout
206
+ */
207
+ @property --cngx-nav-link-inset {
208
+ syntax: '<length>';
209
+ /* Read on the row; inherits so a container SET reaches it. */
210
+ inherits: true;
211
+ initial-value: 4px;
212
+ }
213
+
214
+ /**
215
+ * Corner radius of each nav link.
216
+ * @group Layout
217
+ */
218
+ @property --cngx-nav-link-radius {
219
+ syntax: '<length>';
220
+ inherits: false;
221
+ initial-value: 4px;
222
+ }
223
+
224
+ /**
225
+ * Text color on hover.
226
+ * @group State / Hover
227
+ */
228
+ @property --cngx-nav-link-hover-color {
229
+ syntax: '*';
230
+ inherits: true;
231
+ initial-value: currentColor;
232
+ }
233
+
234
+ /**
235
+ * Background tint on hover.
236
+ * @group State / Hover
237
+ */
238
+ @property --cngx-nav-link-hover-bg {
239
+ syntax: '<color>';
240
+ inherits: true;
241
+ initial-value: oklch(0 0 0 / 0.04);
242
+ }
243
+
244
+ /**
245
+ * Background while a nav row is pressed (`:active`). Sits between the hover
246
+ * and the active fill; a pressed active row keeps the active-hover fill.
247
+ * @group State / Pressed
248
+ */
249
+ @property --cngx-nav-link-pressed-bg {
250
+ syntax: '<color>';
251
+ inherits: true;
252
+ initial-value: oklch(0 0 0 / 0.06);
253
+ }
254
+
255
+ /**
256
+ * Text color of the active nav link.
257
+ * @group State / Active
258
+ */
259
+ @property --cngx-nav-link-active-color {
260
+ syntax: '*';
261
+ inherits: true;
262
+ initial-value: currentColor;
263
+ }
264
+
265
+ /**
266
+ * Background of the active nav link.
267
+ * @group State / Active
268
+ */
269
+ @property --cngx-nav-link-active-bg {
270
+ syntax: '<color>';
271
+ inherits: true;
272
+ initial-value: oklch(0 0 0 / 0.08);
273
+ }
274
+
275
+ /**
276
+ * Background of the active nav link under the pointer. The strongest fill,
277
+ * so hovering the active row still answers.
278
+ * @group State / Active
279
+ */
280
+ @property --cngx-nav-link-active-hover-bg {
281
+ syntax: '<color>';
282
+ inherits: true;
283
+ initial-value: oklch(0 0 0 / 0.1);
284
+ }
285
+
286
+ /**
287
+ * Colour of the bar on the inline-start edge of the active nav link. SET
288
+ * from `--cngx-color-primary-text` (the 4.5:1 text rung), so it holds 3:1
289
+ * on the active fills; `transparent` drops the bar for a fill-only look.
290
+ * @group State / Active
291
+ * @see [[--cngx-color-primary-text]]
292
+ */
293
+ @property --cngx-nav-link-active-indicator-color {
294
+ syntax: '<color>';
295
+ /* Read on the row's indicator; inherits so a container SET reaches it. */
296
+ inherits: true;
297
+ initial-value: oklch(0.54 0.19 50);
298
+ }
299
+
300
+ /**
301
+ * Inline size of the active indicator bar. SET from `--cngx-space-xs`, so
302
+ * it follows density; `0` drops the bar.
303
+ * @group State / Active
304
+ */
305
+ @property --cngx-nav-link-active-indicator-size {
306
+ syntax: '<length>';
307
+ inherits: true;
308
+ initial-value: 3px;
309
+ }
310
+
311
+ /**
312
+ * Block-axis inset of the active indicator bar from the row's top and
313
+ * bottom edges. SET from `--cngx-space-sm`.
314
+ * @group State / Active
315
+ */
316
+ @property --cngx-nav-link-active-indicator-inset {
317
+ syntax: '<length>';
318
+ inherits: true;
319
+ initial-value: 8px;
320
+ }
321
+
322
+ /**
323
+ * Font-weight of the active nav link.
324
+ * @group State / Active
325
+ */
326
+ @property --cngx-nav-link-active-font-weight {
327
+ syntax: '<number>';
328
+ inherits: false;
329
+ initial-value: 600;
330
+ }
331
+
332
+ /**
333
+ * Outer colour of the double keyboard focus ring on a nav row. SET from
334
+ * `--cngx-color-text`, so the ring stays apart
335
+ * from the active hue on every fill.
336
+ * @group State / Focus
337
+ * @see [[--cngx-color-text]]
338
+ */
339
+ @property --cngx-nav-link-focus-outline-color {
340
+ syntax: '<color>';
341
+ inherits: true;
342
+ initial-value: oklch(0.66 0.19 50);
343
+ }
344
+
345
+ /**
346
+ * Inner colour of the double keyboard focus ring, drawn inside the outer
347
+ * ring at the same width. SET from `--cngx-color-surface` (a sidenav SETs
348
+ * its own surface), so the outer ring reads against a band of the container
349
+ * surface on any fill.
350
+ * @group State / Focus
351
+ * @see [[--cngx-color-surface]]
352
+ */
353
+ @property --cngx-nav-link-focus-inner-color {
354
+ syntax: '<color>';
355
+ /* Read on the row; inherits so a container SET reaches it. */
356
+ inherits: true;
357
+ initial-value: oklch(0.97 0.005 250);
358
+ }
359
+
360
+ /**
361
+ * Stroke width of the keyboard focus ring.
362
+ * @group State / Focus
363
+ */
364
+ @property --cngx-nav-link-focus-outline-width {
365
+ syntax: '<length>';
366
+ inherits: false;
367
+ initial-value: 2px;
368
+ }
369
+
370
+ /**
371
+ * Distance from the link edge to the focus ring. Negative offsets
372
+ * pull the ring inside the link bounds so a fully-padded link
373
+ * doesn't shove its neighbours when focused.
374
+ * @group State / Focus
375
+ */
376
+ @property --cngx-nav-link-focus-outline-offset {
377
+ syntax: '<length>';
378
+ inherits: false;
379
+ initial-value: -2px;
380
+ }
381
+
382
+ /**
383
+ * Font-size of the first-letter fallback drawn in the icon box of a row
384
+ * without `[cngxNavIcon]`.
385
+ * @group Typography
386
+ */
387
+ @property --cngx-nav-link-initial-size {
388
+ syntax: '*';
389
+ inherits: false;
390
+ initial-value: 0.875rem;
391
+ }
392
+
393
+ /**
394
+ * Inline and block size of the icon box at the start of every row. Unset by
395
+ * default (falls back to `1.25rem`).
396
+ * @group Layout
397
+ */
398
+ @property --cngx-nav-icon-size {
399
+ syntax: '*';
400
+ inherits: true;
401
+ }
402
+
403
+ /**
404
+ * Rail width at which the icon box sits centred, border not included:
405
+ * `2 * (inset + inline padding) + icon size`. SET on every
406
+ * `[data-nav-railed]` host from that host's row tokens; read it, do not
407
+ * SET it. A container sizes its rail from it plus its own border.
408
+ * @group Layout
409
+ * @see [[--cngx-nav-link-inset]]
410
+ * @see [[--cngx-nav-link-padding-inline]]
411
+ * @see [[--cngx-nav-icon-size]]
412
+ */
413
+ @property --cngx-nav-railed-size {
414
+ syntax: '*';
415
+ inherits: true;
416
+ }
417
+
418
+ /**
419
+ * Gap between the icon box and the row label. Unset by default (falls back
420
+ * to `--cngx-space-sm`, so it follows `[data-density]`).
421
+ * @group Layout
422
+ */
423
+ @property --cngx-nav-icon-gap {
424
+ syntax: '*';
425
+ inherits: true;
426
+ }
427
+
428
+ /**
429
+ * Ink of the icon and of the letter fallback, independent of the label
430
+ * text colour. Unset by default (falls back to `currentColor`).
431
+ * @group Surface
432
+ */
433
+ @property --cngx-nav-link-ink {
434
+ syntax: '*';
435
+ inherits: true;
436
+ }
437
+
438
+ /**
439
+ * Font size of the initials of a `cngx-avatar` used as header or footer
440
+ * mark. Unset by default (falls back to `0.625rem`, which fits the
441
+ * default 1.25rem icon box).
442
+ * @group Typography
443
+ * @see [[--cngx-nav-icon-size]]
444
+ */
445
+ @property --cngx-nav-mark-font-size {
446
+ syntax: '*';
447
+ inherits: true;
448
+ }
449
+
450
+ /**
451
+ * Block padding of the header. Unset by default (falls back to
452
+ * `--cngx-space-md`). The inline padding is derived from the row geometry,
453
+ * so the mark lines up with the row icons.
454
+ * @group Layout
455
+ */
456
+ @property --cngx-nav-header-padding-block {
457
+ syntax: '*';
458
+ inherits: true;
459
+ }
460
+
461
+ /**
462
+ * Background of the header.
463
+ * @group Surface
464
+ */
465
+ @property --cngx-nav-header-bg {
466
+ syntax: '<color>';
467
+ inherits: false;
468
+ initial-value: transparent;
469
+ }
470
+
471
+ /**
472
+ * Colour of the divider under the header.
473
+ * @group Surface
474
+ * @see [[--cngx-color-border]]
475
+ */
476
+ @property --cngx-nav-header-border-color {
477
+ syntax: '<color>';
478
+ inherits: true;
479
+ initial-value: oklch(0.89 0 0);
480
+ }
481
+
482
+ /**
483
+ * Font-size of the header.
484
+ * @group Typography
485
+ */
486
+ @property --cngx-nav-header-font-size {
487
+ syntax: '*';
488
+ inherits: false;
489
+ initial-value: 0.875rem;
490
+ }
491
+
492
+ /**
493
+ * Block padding of the footer. Unset by default (falls back to
494
+ * `--cngx-space-md`).
495
+ * @group Layout
496
+ */
497
+ @property --cngx-nav-footer-padding-block {
498
+ syntax: '*';
499
+ inherits: true;
500
+ }
501
+
502
+ /**
503
+ * Background of the footer.
504
+ * @group Surface
505
+ */
506
+ @property --cngx-nav-footer-bg {
507
+ syntax: '<color>';
508
+ inherits: false;
509
+ initial-value: transparent;
510
+ }
511
+
512
+ /**
513
+ * Colour of the divider above the footer.
514
+ * @group Surface
515
+ * @see [[--cngx-color-border]]
516
+ */
517
+ @property --cngx-nav-footer-border-color {
518
+ syntax: '<color>';
519
+ inherits: true;
520
+ initial-value: oklch(0.89 0 0);
521
+ }
522
+
523
+ /**
524
+ * Font-size of the footer.
525
+ * @group Typography
526
+ */
527
+ @property --cngx-nav-footer-font-size {
528
+ syntax: '*';
529
+ inherits: false;
530
+ initial-value: 0.75rem;
531
+ }
532
+
533
+ /**
534
+ * Text colour of a section label.
535
+ * @group Typography
536
+ * @see [[--cngx-color-text-muted]]
537
+ */
538
+ @property --cngx-nav-label-color {
539
+ syntax: '*';
540
+ inherits: true;
541
+ initial-value: currentColor;
542
+ }
543
+
544
+ /**
545
+ * Font-size of a section label.
546
+ * @group Typography
547
+ */
548
+ @property --cngx-nav-label-font-size {
549
+ syntax: '*';
550
+ inherits: false;
551
+ initial-value: 0.75rem;
552
+ }
553
+
554
+ /**
555
+ * Padding shorthand of a section label. Unset by default: the label then
556
+ * aligns its text with the row text and follows `[data-density]`.
557
+ * @group Layout
558
+ */
559
+ @property --cngx-nav-label-padding {
560
+ syntax: '*';
561
+ inherits: true;
562
+ }
563
+
564
+ /**
565
+ * Fill of a count badge and of a dot badge.
566
+ * @group Surface
567
+ * @see [[--cngx-color-primary-strong]]
568
+ */
569
+ @property --cngx-nav-badge-bg {
570
+ syntax: '<color>';
571
+ inherits: true;
572
+ initial-value: oklch(0.58 0.19 50);
573
+ }
574
+
575
+ /**
576
+ * Text colour of a count badge.
577
+ * @group Surface
578
+ * @see [[--cngx-color-on-primary-strong]]
579
+ */
580
+ @property --cngx-nav-badge-color {
581
+ syntax: '<color>';
582
+ inherits: true;
583
+ initial-value: oklch(1 0 0);
584
+ }
585
+
586
+ /**
587
+ * Font-size of a count or status badge.
588
+ * @group Typography
589
+ */
590
+ @property --cngx-nav-badge-font-size {
591
+ syntax: '*';
592
+ inherits: false;
593
+ initial-value: 0.75rem;
594
+ }
595
+
596
+ /**
597
+ * Diameter of a dot badge.
598
+ * @group Layout
599
+ */
600
+ @property --cngx-nav-badge-dot-size {
601
+ syntax: '<length>';
602
+ inherits: false;
603
+ initial-value: 8px;
604
+ }
605
+
606
+ /**
607
+ * Arm length of the group head chevron.
608
+ * @group Layout
609
+ */
610
+ @property --cngx-nav-chevron-size {
611
+ syntax: '<length>';
612
+ inherits: false;
613
+ initial-value: 6px;
614
+ }
615
+
616
+ /**
617
+ * Background of a nav group flyout on a collapsed rail. Read on the open flyout; no initial value, so the
618
+ * use-site fallback follows the foundation.
619
+ * @group State / Flyout
620
+ * @see [[--cngx-color-surface]]
621
+ */
622
+ @property --cngx-nav-flyout-bg {
623
+ syntax: '*';
624
+ inherits: true;
625
+ }
626
+
627
+ /**
628
+ * Text colour of a nav group flyout. Read on the open flyout; no initial value, so the
629
+ * use-site fallback follows the foundation.
630
+ * @group State / Flyout
631
+ * @see [[--cngx-color-text]]
632
+ */
633
+ @property --cngx-nav-flyout-color {
634
+ syntax: '*';
635
+ inherits: true;
636
+ }
637
+
638
+ /**
639
+ * Border colour of a nav group flyout. Read on the open flyout; no initial value, so the
640
+ * use-site fallback follows the foundation.
641
+ * @group State / Flyout
642
+ * @see [[--cngx-color-border]]
643
+ */
644
+ @property --cngx-nav-flyout-border-color {
645
+ syntax: '*';
646
+ inherits: true;
647
+ }
648
+
649
+ /**
650
+ * Border width of a nav group flyout. Read on the open flyout; no initial value, so the
651
+ * use-site fallback (`1px`) applies.
652
+ * @group State / Flyout
653
+ */
654
+ @property --cngx-nav-flyout-border-width {
655
+ syntax: '*';
656
+ inherits: true;
657
+ }
658
+
659
+ /**
660
+ * Elevation of a nav group flyout. Read on the open flyout; no initial value, so the
661
+ * use-site fallback follows the foundation.
662
+ * @group State / Flyout
663
+ * @see [[--cngx-shadow-md]]
664
+ */
665
+ @property --cngx-nav-flyout-shadow {
666
+ syntax: '*';
667
+ inherits: true;
668
+ }
669
+
670
+ /**
671
+ * Corner radius of a nav group flyout. Read on the open flyout; no initial value, so the
672
+ * use-site fallback follows the foundation.
673
+ * @group Layout
674
+ * @see [[--cngx-radius-md]]
675
+ */
676
+ @property --cngx-nav-flyout-radius {
677
+ syntax: '*';
678
+ inherits: true;
679
+ }
680
+
681
+ /**
682
+ * Inner padding of a nav group flyout. Read on the open flyout; no initial value, so the
683
+ * use-site fallback follows the foundation.
684
+ * @group Layout
685
+ * @see [[--cngx-space-xs]]
686
+ */
687
+ @property --cngx-nav-flyout-padding {
688
+ syntax: '*';
689
+ inherits: true;
690
+ }
691
+
692
+ /**
693
+ * Minimum inline size of a nav group flyout. Read on the open flyout; no initial value, so the
694
+ * use-site fallback follows the foundation.
695
+ * @group Layout
696
+ */
697
+ @property --cngx-nav-flyout-min-inline-size {
698
+ syntax: '*';
699
+ inherits: true;
700
+ }
701
+
702
+ /**
703
+ * Gap between a group head and its flyout. Read on the open flyout; no initial value, so the
704
+ * use-site fallback follows the foundation.
705
+ * @group Layout
706
+ * @see [[--cngx-space-xs]]
707
+ */
708
+ @property --cngx-nav-flyout-offset {
709
+ syntax: '*';
710
+ inherits: true;
711
+ }
712
+
713
+ /*
714
+ * Default-theme palette pass. A registered `initial-value` shadows any
715
+ * `var(...)` fallback, so the colour tokens are SET here from the
716
+ * foundation. A container that scopes an accent (cngx-sidenav) SETs the
717
+ * same tokens on its own host, which wins for its rows.
718
+ */
719
+ :root {
720
+ --cngx-nav-link-hover-bg: color-mix(
721
+ in oklch,
722
+ var(--cngx-color-primary, oklch(0.66 0.19 50)) 6%,
723
+ transparent
724
+ );
725
+ --cngx-nav-link-pressed-bg: color-mix(
726
+ in oklch,
727
+ var(--cngx-color-primary, oklch(0.66 0.19 50)) 12%,
728
+ transparent
729
+ );
730
+ --cngx-nav-link-active-bg: color-mix(
731
+ in oklch,
732
+ var(--cngx-color-primary, oklch(0.66 0.19 50)) 16%,
733
+ transparent
734
+ );
735
+ --cngx-nav-link-active-hover-bg: color-mix(
736
+ in oklch,
737
+ var(--cngx-color-primary, oklch(0.66 0.19 50)) 22%,
738
+ transparent
739
+ );
740
+ --cngx-nav-link-focus-outline-color: var(--cngx-color-text, oklch(0.2 0.01 250));
741
+ --cngx-nav-link-focus-inner-color: var(--cngx-color-surface, oklch(0.97 0.005 250));
742
+ --cngx-nav-link-active-indicator-color: var(
743
+ --cngx-color-primary-text,
744
+ oklch(from var(--cngx-color-primary, oklch(0.66 0.19 50)) 0.54 c h)
745
+ );
746
+ --cngx-nav-label-color: var(--cngx-color-text-muted, oklch(0.5 0.01 250));
747
+ --cngx-nav-header-border-color: var(--cngx-color-border, oklch(0.89 0 0));
748
+ --cngx-nav-footer-border-color: var(--cngx-color-border, oklch(0.89 0 0));
749
+ --cngx-nav-badge-bg: var(
750
+ --cngx-color-primary-strong,
751
+ oklch(from var(--cngx-color-primary, oklch(0.66 0.19 50)) 0.58 c h)
752
+ );
753
+ --cngx-nav-badge-color: var(--cngx-color-on-primary-strong, oklch(1 0 0));
754
+ }
755
+
756
+ /* The spacing-derived tokens are typed lengths, so they resolve where they
757
+ are SET. Re-SET them on every density scope, or a [data-density] subtree
758
+ would inherit the root's pixels. */
759
+ :root,
760
+ [data-density],
761
+ .cngx-density-comfortable,
762
+ .cngx-density-compact,
763
+ .cngx-density-spacious {
764
+ --cngx-nav-link-inset: var(--cngx-space-xs, 4px);
765
+ --cngx-nav-link-active-indicator-size: calc(var(--cngx-space-xs, 4px) * 0.75);
766
+ --cngx-nav-link-active-indicator-inset: var(--cngx-space-sm, 8px);
767
+ }
768
+ }
769
+
770
+ @layer cngx.components {
771
+ /*
772
+ * One row shape for links and group heads. State ladder: rest (0,1,0),
773
+ * then hover, pressed, active, active+hover, all four at (0,2,0) in this
774
+ * source order, so the order is the precedence: active beats hover and
775
+ * pressed, active+hover beats active, a pressed active row stays
776
+ * active+hover. Only background and colour transition.
777
+ * `background: transparent` at rest beats the UA button face on group heads.
778
+ */
779
+ .cngx-nav-link,
780
+ .cngx-nav-group {
781
+ position: relative;
782
+ box-sizing: border-box;
783
+ /* The touch-target floor is a length (registered, 0px initial), which
784
+ drops the flex item's automatic minimum: in a column too short for the
785
+ rows they would squeeze below their content instead of scrolling. */
786
+ flex-shrink: 0;
787
+ min-block-size: var(--cngx-target-min, 0px);
788
+ margin-inline: var(--cngx-nav-link-inset, 4px);
789
+ margin-inline-start: calc(
790
+ var(--cngx-nav-link-inset, 4px) + var(--cngx-nav-depth, 0) * var(--cngx-nav-indent, 12px)
791
+ );
792
+ padding: var(
793
+ --cngx-nav-link-padding,
794
+ var(--cngx-space-sm, 8px) var(--cngx-nav-link-padding-inline, var(--cngx-space-md, 16px))
795
+ );
796
+ border-radius: var(--cngx-nav-link-radius, 4px);
797
+ background: transparent;
798
+ font-size: var(--cngx-nav-link-font-size, 0.875rem);
799
+ font-weight: var(--cngx-nav-link-font-weight, inherit);
800
+ line-height: var(--cngx-nav-link-line-height, inherit);
801
+ letter-spacing: var(--cngx-nav-link-letter-spacing, inherit);
802
+ color: var(--cngx-nav-link-color, currentColor);
803
+ text-decoration: none;
804
+ transition:
805
+ background-color var(--cngx-duration-fast, 150ms),
806
+ color var(--cngx-duration-fast, 150ms);
807
+ }
808
+
809
+ .cngx-nav-link {
810
+ display: flex;
811
+ align-items: center;
812
+ gap: var(--cngx-nav-icon-gap, var(--cngx-space-sm, 8px));
813
+ }
814
+
815
+ /* A group head is a <button>: drop the UA box and stretch it like a link. */
816
+ .cngx-nav-group {
817
+ display: flex;
818
+ align-items: center;
819
+ gap: var(--cngx-nav-icon-gap, var(--cngx-space-sm, 8px));
820
+ inline-size: -webkit-fill-available;
821
+ inline-size: stretch;
822
+ border: 0;
823
+ font-family: inherit;
824
+ text-align: start;
825
+ cursor: pointer;
826
+ }
827
+
828
+ .cngx-nav-link:hover,
829
+ .cngx-nav-group:hover {
830
+ color: var(--cngx-nav-link-hover-color, currentColor);
831
+ background: var(--cngx-nav-link-hover-bg, oklch(0 0 0 / 0.04));
832
+ }
833
+
834
+ .cngx-nav-link:active,
835
+ .cngx-nav-group:active {
836
+ background: var(--cngx-nav-link-pressed-bg, oklch(0 0 0 / 0.06));
837
+ }
838
+
839
+ .cngx-nav-link.cngx-nav-link--active {
840
+ color: var(--cngx-nav-link-active-color, currentColor);
841
+ background: var(--cngx-nav-link-active-bg, oklch(0 0 0 / 0.08));
842
+ font-weight: var(--cngx-nav-link-active-font-weight, 600);
843
+ }
844
+
845
+ .cngx-nav-link--active:hover {
846
+ color: var(--cngx-nav-link-active-color, currentColor);
847
+ background: var(--cngx-nav-link-active-hover-bg, oklch(0 0 0 / 0.1));
848
+ }
849
+
850
+ /* Icon box: the projected icon, or the first letter on a row without one. */
851
+ .cngx-nav-icon {
852
+ display: inline-flex;
853
+ flex: none;
854
+ align-items: center;
855
+ justify-content: center;
856
+ inline-size: var(--cngx-nav-icon-size, 1.25rem);
857
+ block-size: var(--cngx-nav-icon-size, 1.25rem);
858
+ color: var(--cngx-nav-link-ink, currentColor);
859
+ }
860
+
861
+ /* A cngx-icon in the slot fills the icon box. Its own rung is em-based and
862
+ would follow the row font (the stacked label is smaller), the box does
863
+ not. Two classes, so it beats the rung of the icon's @scope. */
864
+ .cngx-nav-icon.cngx-icon {
865
+ --cngx-icon-size: var(--cngx-nav-icon-size, 1.25rem);
866
+ }
867
+
868
+ :is(.cngx-nav-link, .cngx-nav-group)[data-initial]:not(:has(.cngx-nav-icon))::before {
869
+ content: attr(data-initial) / '';
870
+ display: inline-flex;
871
+ flex: none;
872
+ align-items: center;
873
+ justify-content: center;
874
+ box-sizing: border-box;
875
+ inline-size: var(--cngx-nav-icon-size, 1.25rem);
876
+ block-size: var(--cngx-nav-icon-size, 1.25rem);
877
+ border-radius: 50%;
878
+ background: color-mix(in oklch, var(--cngx-nav-link-ink, currentColor) 14%, transparent);
879
+ color: var(--cngx-nav-link-ink, currentColor);
880
+ font-size: var(--cngx-nav-link-initial-size, 0.875rem);
881
+ font-weight: 600;
882
+ line-height: 1;
883
+ }
884
+
885
+ /* Active indicator: a bar on the inline-start edge (logical, so RTL puts it
886
+ on the right). On ::after, so it coexists with the letter on ::before. */
887
+ .cngx-nav-link--active::after {
888
+ content: '';
889
+ position: absolute;
890
+ inset-inline-start: 0;
891
+ inset-block: var(--cngx-nav-link-active-indicator-inset, 8px);
892
+ inline-size: var(--cngx-nav-link-active-indicator-size, 3px);
893
+ border-radius: var(--cngx-nav-link-active-indicator-size, 3px);
894
+ background: var(--cngx-nav-link-active-indicator-color);
895
+ }
896
+
897
+ /*
898
+ * Double keyboard focus ring, inset so a focused row doesn't push its
899
+ * neighbours. Outer ring: the outline in the text colour. Inner ring: an
900
+ * inset box-shadow in the container surface, twice the outline width, whose
901
+ * outer half the outline covers. The pair reads on every fill and never
902
+ * depends on the active hue.
903
+ */
904
+ .cngx-nav-link:focus-visible,
905
+ .cngx-nav-group:focus-visible {
906
+ outline: var(--cngx-nav-link-focus-outline-width, 2px) solid
907
+ var(--cngx-nav-link-focus-outline-color);
908
+ outline-offset: var(--cngx-nav-link-focus-outline-offset, -2px);
909
+ box-shadow: inset 0 0 0 calc(2 * var(--cngx-nav-link-focus-outline-width, 2px))
910
+ var(--cngx-nav-link-focus-inner-color, oklch(0.97 0.005 250));
911
+ }
912
+
913
+ /* Group chevron: two borders of a square, turned to point inline-end while
914
+ closed and down while open. Drawn, not a text glyph, and aria-free. */
915
+ .cngx-nav-group::after {
916
+ content: '';
917
+ flex: none;
918
+ margin-inline-start: auto;
919
+ inline-size: var(--cngx-nav-chevron-size, 6px);
920
+ block-size: var(--cngx-nav-chevron-size, 6px);
921
+ border-block-end: 1.5px solid currentColor;
922
+ border-inline-end: 1.5px solid currentColor;
923
+ rotate: -45deg;
924
+ transition: rotate var(--cngx-duration-fast, 150ms);
925
+ }
926
+
927
+ .cngx-nav-group:dir(rtl)::after {
928
+ rotate: 135deg;
929
+ }
930
+
931
+ .cngx-nav-group.cngx-nav-group--open::after {
932
+ rotate: 45deg;
933
+ }
934
+
935
+ /* Section label: text aligned with the row text. */
936
+ .cngx-nav-label {
937
+ display: block;
938
+ padding: var(
939
+ --cngx-nav-label-padding,
940
+ var(--cngx-space-md, 16px)
941
+ calc(
942
+ var(--cngx-nav-link-inset, 4px) +
943
+ var(--cngx-nav-link-padding-inline, var(--cngx-space-md, 16px))
944
+ )
945
+ var(--cngx-space-xs, 4px)
946
+ );
947
+ font-size: var(--cngx-nav-label-font-size, 0.75rem);
948
+ font-weight: 600;
949
+ color: var(--cngx-nav-label-color, currentColor);
950
+ }
951
+
952
+ /* Badges sit at the row's inline end. */
953
+ .cngx-nav-badge {
954
+ display: inline-flex;
955
+ flex: none;
956
+ align-items: center;
957
+ justify-content: center;
958
+ box-sizing: border-box;
959
+ margin-inline-start: auto;
960
+ font-size: var(--cngx-nav-badge-font-size, 0.75rem);
961
+ font-weight: 600;
962
+ line-height: 1;
963
+ font-variant-numeric: tabular-nums;
964
+ }
965
+
966
+ /* The UA [hidden] rule loses to the display above. */
967
+ .cngx-nav-badge[hidden] {
968
+ display: none;
969
+ }
970
+
971
+ .cngx-nav-badge--count {
972
+ min-inline-size: 1.25rem;
973
+ block-size: 1.25rem;
974
+ padding-inline: var(--cngx-space-xs, 4px);
975
+ border-radius: 999px;
976
+ background: var(--cngx-nav-badge-bg, oklch(0.58 0.19 50));
977
+ color: var(--cngx-nav-badge-color, oklch(1 0 0));
978
+ }
979
+
980
+ .cngx-nav-badge--dot {
981
+ inline-size: var(--cngx-nav-badge-dot-size, 8px);
982
+ block-size: var(--cngx-nav-badge-dot-size, 8px);
983
+ border-radius: 50%;
984
+ background: var(--cngx-nav-badge-bg, oklch(0.58 0.19 50));
985
+ }
986
+
987
+ .cngx-nav-badge--status {
988
+ block-size: 1.25rem;
989
+ padding-inline: var(--cngx-space-sm, 8px);
990
+ border: 1px solid currentColor;
991
+ border-radius: 999px;
992
+ color: var(--cngx-nav-label-color, currentColor);
993
+ }
994
+
995
+ /* Header and footer: the inline padding is the row inset plus the row
996
+ padding, so a mark lands in the icon box at the row icon x. */
997
+ .cngx-nav-header,
998
+ .cngx-nav-footer {
999
+ display: flex;
1000
+ flex-shrink: 0;
1001
+ align-items: center;
1002
+ gap: var(--cngx-nav-icon-gap, var(--cngx-space-sm, 8px));
1003
+ box-sizing: border-box;
1004
+ padding-inline: calc(
1005
+ var(--cngx-nav-link-inset, 4px) +
1006
+ var(--cngx-nav-link-padding-inline, var(--cngx-space-md, 16px))
1007
+ );
1008
+ }
1009
+
1010
+ .cngx-nav-header {
1011
+ padding-block: var(--cngx-nav-header-padding-block, var(--cngx-space-md, 16px));
1012
+ border-block-end: 1px solid var(--cngx-nav-header-border-color, oklch(0.89 0 0));
1013
+ background: var(--cngx-nav-header-bg, transparent);
1014
+ font-size: var(--cngx-nav-header-font-size, 0.875rem);
1015
+ font-weight: 600;
1016
+ }
1017
+
1018
+ .cngx-nav-footer {
1019
+ margin-block-start: auto;
1020
+ padding-block: var(--cngx-nav-footer-padding-block, var(--cngx-space-md, 16px));
1021
+ border-block-start: 1px solid var(--cngx-nav-footer-border-color, oklch(0.89 0 0));
1022
+ background: var(--cngx-nav-footer-bg, transparent);
1023
+ font-size: var(--cngx-nav-footer-font-size, 0.75rem);
1024
+ /* De-emphasis by colour (muted text), never opacity. */
1025
+ color: var(--cngx-color-text-muted, oklch(0.5 0.01 250));
1026
+ }
1027
+
1028
+ .cngx-nav-mark {
1029
+ display: inline-flex;
1030
+ flex: none;
1031
+ align-items: center;
1032
+ justify-content: center;
1033
+ inline-size: var(--cngx-nav-icon-size, 1.25rem);
1034
+ block-size: var(--cngx-nav-icon-size, 1.25rem);
1035
+ overflow: hidden;
1036
+ color: var(--cngx-nav-link-ink, currentColor);
1037
+ }
1038
+
1039
+ /* A cngx-avatar as mark fills the icon box whatever its size rung, so it
1040
+ sits at the row icon x. Three classes, so it beats the size rung of the
1041
+ avatar's @scope. */
1042
+ :is(.cngx-nav-header, .cngx-nav-footer) .cngx-nav-mark.cngx-avatar {
1043
+ --cngx-avatar-size: var(--cngx-nav-icon-size, 1.25rem);
1044
+ --cngx-avatar-font-size: var(--cngx-nav-mark-font-size, 0.625rem);
1045
+ }
1046
+
1047
+ .cngx-nav-name {
1048
+ min-inline-size: 0;
1049
+ overflow: hidden;
1050
+ text-overflow: ellipsis;
1051
+ white-space: nowrap;
1052
+ }
1053
+
1054
+ /* Railed: a crop of the expanded rows, nothing moves. The gap only has to
1055
+ be wider than the rail; the viewport width always is, so the rows need
1056
+ no knowledge of the container. */
1057
+ /* The rail width that centres the icon box, border not included. SET on
1058
+ the host, so the inset and padding the host SETs count. */
1059
+ [data-nav-railed] {
1060
+ --cngx-nav-railed-size: calc(
1061
+ 2 *
1062
+ (
1063
+ var(--cngx-nav-link-inset, 4px) +
1064
+ var(--cngx-nav-link-padding-inline, var(--cngx-space-md, 16px))
1065
+ ) +
1066
+ var(--cngx-nav-icon-size, 1.25rem)
1067
+ );
1068
+ }
1069
+
1070
+ [data-nav-railed='true'] :is(.cngx-nav-link, .cngx-nav-group):not(.cngx-nav-group-content *) {
1071
+ overflow: clip;
1072
+ white-space: nowrap;
1073
+ gap: var(--cngx-nav-railed-gap, 100vw);
1074
+ }
1075
+
1076
+ /* Section labels keep their box and their text for assistive technology
1077
+ but paint none, in every colour mode. */
1078
+ [data-nav-railed='true'] .cngx-nav-label:not(.cngx-nav-group-content *) {
1079
+ overflow: clip;
1080
+ white-space: nowrap;
1081
+ clip-path: inset(100%);
1082
+ }
1083
+
1084
+ [data-nav-railed='true'] :is(.cngx-nav-header, .cngx-nav-footer) {
1085
+ overflow: clip;
1086
+ white-space: nowrap;
1087
+ }
1088
+
1089
+ /* Opacity, so the name stays in the accessibility tree. */
1090
+ [data-nav-railed='true'] :is(.cngx-nav-header, .cngx-nav-footer) .cngx-nav-name {
1091
+ opacity: 0;
1092
+ }
1093
+
1094
+ /* Group content: grid-rows 0fr -> 1fr; one wrapper child required. */
1095
+ .cngx-nav-group-content {
1096
+ display: grid;
1097
+ grid-template-rows: 0fr;
1098
+ transition: grid-template-rows var(--cngx-nav-transition, var(--cngx-duration-base, 0.2s)) ease;
1099
+ }
1100
+
1101
+ .cngx-nav-group-content > * {
1102
+ overflow: hidden;
1103
+ min-height: 0;
1104
+ }
1105
+
1106
+ .cngx-nav-group-content--open {
1107
+ grid-template-rows: 1fr;
1108
+ }
1109
+
1110
+ /* A closed flyout stays out of the layout: the group content's own display
1111
+ would otherwise beat the UA [popover]:not(:popover-open) rule and paint
1112
+ the UA popover box. */
1113
+ .cngx-nav-group-content[popover]:not(:popover-open) {
1114
+ display: none;
1115
+ }
1116
+
1117
+ /* Group flyout on a collapsed rail: the group content as a top-layer
1118
+ popover at the inline end of its head, or at its inline start for a rail
1119
+ at the inline end (data-cngx-rail-side, written by injectNavRailFlyout,
1120
+ which also wires the anchor). Logical area, so it mirrors under
1121
+ dir="rtl"; it flips when the viewport has no room. */
1122
+ .cngx-nav-group-content:popover-open {
1123
+ inset: auto;
1124
+ margin: 0;
1125
+ margin-inline-start: var(--cngx-nav-flyout-offset, var(--cngx-space-xs, 4px));
1126
+ position-area: inline-end span-block-end;
1127
+ position-try-fallbacks: flip-block, flip-inline;
1128
+ box-sizing: border-box;
1129
+ min-inline-size: var(--cngx-nav-flyout-min-inline-size, 12rem);
1130
+ padding: var(--cngx-nav-flyout-padding, var(--cngx-space-xs, 4px));
1131
+ border: var(--cngx-nav-flyout-border-width, 1px) solid
1132
+ var(--cngx-nav-flyout-border-color, var(--cngx-color-border, oklch(0.89 0 0)));
1133
+ border-radius: var(--cngx-nav-flyout-radius, var(--cngx-radius-md, 8px));
1134
+ background: var(--cngx-nav-flyout-bg, var(--cngx-color-surface, oklch(1 0 0)));
1135
+ color: var(--cngx-nav-flyout-color, var(--cngx-color-text, oklch(0.2 0.01 250)));
1136
+ box-shadow: var(
1137
+ --cngx-nav-flyout-shadow,
1138
+ var(--cngx-shadow-md, 0 4px 12px oklch(0 0 0 / 0.12))
1139
+ );
1140
+ }
1141
+
1142
+ /* The fallbacks of the base rule stay, so an end-side flyout still flips. */
1143
+ .cngx-nav-group-content[data-cngx-rail-side='end']:popover-open {
1144
+ margin-inline-start: 0;
1145
+ margin-inline-end: var(--cngx-nav-flyout-offset, var(--cngx-space-xs, 4px));
1146
+ position-area: inline-start span-block-end;
1147
+ }
1148
+
1149
+ /* Label tooltip of a railed row (injectNavRailTooltip appends it to the
1150
+ host and wires the anchor): at the row's inline end, or its inline start
1151
+ for an end-side rail (data-cngx-rail-side); flips when the viewport has
1152
+ no room, and the flip swaps the margins with it. Two classes, so it beats
1153
+ the margin reset of the tooltip skin's @scope. The gap token is
1154
+ documented with CngxNavRail (nav-rail.css). */
1155
+ .cngx-tooltip.cngx-nav-rail-tooltip {
1156
+ position-area: inline-end;
1157
+ position-try-fallbacks: flip-inline;
1158
+ margin-inline-start: var(--cngx-nav-tooltip-offset, var(--cngx-space-sm, 8px));
1159
+ }
1160
+
1161
+ .cngx-tooltip.cngx-nav-rail-tooltip[data-cngx-rail-side='end'] {
1162
+ position-area: inline-start;
1163
+ margin-inline-start: 0;
1164
+ margin-inline-end: var(--cngx-nav-tooltip-offset, var(--cngx-space-sm, 8px));
1165
+ }
1166
+
1167
+ /* The flyout already shows the nesting by sitting beside its head, so its
1168
+ rows drop the first indent level; deeper levels still indent. The inline
1169
+ padding steps down to --cngx-space-sm, a menu's density, so the content
1170
+ does not sit three insets deep. */
1171
+ .cngx-nav-group-content:popover-open :is(.cngx-nav-link, .cngx-nav-group) {
1172
+ --cngx-nav-link-padding-inline: var(--cngx-space-sm, 8px);
1173
+ margin-inline-start: calc(
1174
+ var(--cngx-nav-link-inset, 4px) + max(0, var(--cngx-nav-depth, 0) - 1) *
1175
+ var(--cngx-nav-indent, 12px)
1176
+ );
1177
+ }
1178
+ }
1179
+
1180
+ /* Forced colors (WHCM): the active row signals only with a fill (forced to
1181
+ Canvas) and a heavier weight, too weak a lone cue; re-signal it with
1182
+ Highlight. Unlayered so it beats the layered base rule;
1183
+ forced-color-adjust:none opts the row out of the UA background forcing in
1184
+ case it renders a <button>, so Highlight paints. The indicator inherits that
1185
+ opt-out, so it needs an explicit system colour: HighlightText on the
1186
+ Highlight row. The same opt-out leaves the active row's focus rings
1187
+ unforced, so it gets one HighlightText ring and no inner ring. */
1188
+ @media (forced-colors: active) {
1189
+ .cngx-nav-link--active {
1190
+ forced-color-adjust: none;
1191
+ background: Highlight;
1192
+ color: HighlightText;
1193
+ }
1194
+
1195
+ /* HighlightText next to Canvas does not read, so neither the bar nor the
1196
+ ring may touch the row edge: the ring sits one width inside the edge with
1197
+ a Highlight band around it, and the bar starts one more width further in,
1198
+ clear of the ring. */
1199
+ .cngx-nav-link--active::after {
1200
+ inset-inline-start: calc(3 * var(--cngx-nav-link-focus-outline-width, 2px));
1201
+ background: HighlightText;
1202
+ }
1203
+
1204
+ .cngx-nav-link--active:focus-visible {
1205
+ outline-color: HighlightText;
1206
+ outline-offset: calc(-2 * var(--cngx-nav-link-focus-outline-width, 2px));
1207
+ box-shadow: none;
1208
+ }
1209
+
1210
+ /* The flyout loses its shadow: keep its edge in the text colour. */
1211
+ .cngx-nav-group-content:popover-open {
1212
+ border-color: CanvasText;
1213
+ }
1214
+
1215
+ /* A filled pill or dot is forced to Canvas: ring it. */
1216
+ .cngx-nav-badge--count,
1217
+ .cngx-nav-badge--dot {
1218
+ border: 1px solid CanvasText;
1219
+ }
1220
+ }