@cngx/common 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 (63) hide show
  1. package/card/README.md +2 -1
  2. package/data/README.md +10 -1
  3. package/dialog/README.md +23 -1
  4. package/fesm2022/cngx-common-a11y.mjs +125 -111
  5. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  6. package/fesm2022/cngx-common-audio.mjs +47 -5
  7. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  8. package/fesm2022/cngx-common-card.mjs +300 -46
  9. package/fesm2022/cngx-common-card.mjs.map +1 -1
  10. package/fesm2022/cngx-common-chart.mjs +1176 -453
  11. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  12. package/fesm2022/cngx-common-command.mjs +37 -10
  13. package/fesm2022/cngx-common-command.mjs.map +1 -1
  14. package/fesm2022/cngx-common-data.mjs +1318 -469
  15. package/fesm2022/cngx-common-data.mjs.map +1 -1
  16. package/fesm2022/cngx-common-dialog.mjs +151 -14
  17. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  18. package/fesm2022/cngx-common-display.mjs +340 -73
  19. package/fesm2022/cngx-common-display.mjs.map +1 -1
  20. package/fesm2022/cngx-common-interactive.mjs +1744 -952
  21. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  22. package/fesm2022/cngx-common-layout.mjs +841 -114
  23. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  24. package/fesm2022/cngx-common-popover.mjs +350 -60
  25. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  26. package/fesm2022/cngx-common-stepper.mjs +727 -317
  27. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  28. package/fesm2022/cngx-common-tabs.mjs +1601 -1243
  29. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  30. package/fesm2022/cngx-common-timeline.mjs +137 -53
  31. package/fesm2022/cngx-common-timeline.mjs.map +1 -1
  32. package/fesm2022/cngx-common.mjs +1 -1
  33. package/interactive/README.md +15 -4
  34. package/layout/README.md +21 -1
  35. package/package.json +3 -3
  36. package/popover/README.md +18 -2
  37. package/stepper/README.md +6 -4
  38. package/theming/components/cngx-accordion.css +1 -1
  39. package/theming/components/cngx-backdrop.css +12 -0
  40. package/theming/components/cngx-button-toggle.css +29 -3
  41. package/theming/components/cngx-data-grid.css +168 -1
  42. package/theming/components/cngx-dialog.css +13 -0
  43. package/theming/components/cngx-listbox.css +21 -12
  44. package/theming/components/cngx-menu.css +56 -16
  45. package/theming/components/cngx-popover.css +24 -0
  46. package/theming/components/cngx-recycler-placeholder.css +196 -0
  47. package/theming/components/cngx-ripple.css +1 -1
  48. package/theming/components/cngx-slider.css +32 -1
  49. package/theming/components/cngx-tooltip.css +12 -0
  50. package/timeline/README.md +155 -0
  51. package/types/cngx-common-a11y.d.ts +42 -18
  52. package/types/cngx-common-card.d.ts +201 -17
  53. package/types/cngx-common-chart.d.ts +343 -47
  54. package/types/cngx-common-command.d.ts +31 -8
  55. package/types/cngx-common-data.d.ts +581 -68
  56. package/types/cngx-common-dialog.d.ts +158 -3
  57. package/types/cngx-common-display.d.ts +356 -142
  58. package/types/cngx-common-interactive.d.ts +859 -210
  59. package/types/cngx-common-layout.d.ts +567 -28
  60. package/types/cngx-common-popover.d.ts +262 -39
  61. package/types/cngx-common-stepper.d.ts +366 -116
  62. package/types/cngx-common-tabs.d.ts +214 -50
  63. package/types/cngx-common-timeline.d.ts +82 -16
package/stepper/README.md CHANGED
@@ -29,7 +29,7 @@ The presenter is a pure-derivation host directive - every visible piece of state
29
29
  | `CNGX_STEP_GROUP_HOST` | Group-scoped variant of the host contract. `CngxStep` injects this with optional fallback to `CNGX_STEPPER_HOST` so steps can register against a parent group OR the root presenter. |
30
30
  | `CNGX_STEP_PANEL_HOST` | Rendering-surface contract for organisms. Provides `flatSteps` / `activeStepIndex` / `activeStepId` Signals plus `labelTemplateFor(id)` / `contentTemplateFor(id)` template lookups. |
31
31
  | `CNGX_STEPPER_CONFIG` | App-wide stepper configuration token (defaults, ARIA labels, fallback labels, router-sync mode). |
32
- | `CNGX_STEPPER_I18N` | I18n bundle token (default English; consumers override via `provideStepperI18n`). |
32
+ | `CNGX_STEPPER_I18N` | I18n bundle token, a `Signal` (default English; consumers override via `provideStepperI18n`). |
33
33
  | `CNGX_STEPPER_COMMIT_HANDLER_FACTORY` | Pluggable async-commit handler factory. Default: `createStepperCommitHandler`. Override for telemetry / retry / offline-queue without forking. |
34
34
 
35
35
  ### Configuration cascade
@@ -50,11 +50,13 @@ Resolution priority: per-instance Input → `viewProviders` → root provider
50
50
 
51
51
  ### I18n
52
52
 
53
+ To translate the whole app, set a language pack with `provideCngxI18n(withPack(...))` from `@cngx/core/i18n` (see the localisation guide); the exports below override single keys on top of the `stepper` section.
54
+
53
55
  | Export | Description |
54
56
  |-|-|
55
57
  | `provideStepperI18n(bundle)` | Provide a localised i18n bundle (defaults are English). |
56
- | `injectStepperI18n()` | Read the resolved i18n bundle in directives / components. |
57
- | `CngxStepperI18n` | The bundle interface (`stepperLabel`, `selectedStep(label, idx, count)`, `stepCompleted`, `stepErrored`, …). |
58
+ | `injectStepperI18n()` | Read the resolved i18n bundle as a `Signal` in directives / components; call it inside a `computed()` or template so a language switch reaches the label. |
59
+ | `CngxStepperI18n` | The bundle interface (`stepperLabel`, `selectedStep(label, idx, count)`, `statusLabels`, …). |
58
60
 
59
61
  ### Utilities
60
62
 
@@ -93,7 +95,7 @@ class WizardCmp {
93
95
  | Feature | Purpose |
94
96
  |-|-|
95
97
  | `withStepperSkin(name)` | Select the visual skin for `<cngx-stepper>`: `'classic'` (default) / `'linear-minimal'` / `'stripe-status-rich'` / `'path-chevron'` / `'pill-segment'`. Thematic only - structure, slots, ARIA, and keyboard behaviour are identical across skins. The Material twin `<cngx-mat-stepper>` ignores this setting. |
96
- | `withStepperMobileCollapse(mode)` | Choose the auto-collapse target for narrow viewports (`max-width: 480px`): `'text'` (default, renders `<cngx-text-stepper>`) / `'dots'` (renders `<cngx-dot-stepper>`) / `'off'` (keep the classic strip on every viewport). The Material twin ignores this setting. |
98
+ | `withStepperMobileCollapse(mode)` | Choose the auto-collapse target for a narrow **container** (below `30rem` of the stepper's own width, not the viewport): `'text'` (default, renders `<cngx-text-stepper>`) / `'dots'` (renders `<cngx-dot-stepper>`) / `'off'` (keep the classic strip at every width). The threshold itself is a `@container` rule in `stepper-base.css`, overridable in consumer CSS - see the `@cngx/ui/stepper` README. The Material twin ignores this setting. |
97
99
  | `withStepperHeaderNavigation(mode)` | Set the header-navigation policy: `'none'` (inert label headers, footer-only navigation) / `'visited'` (default - focusable header buttons gated by `linear`). Per-instance `[headerNavigation]` wins. |
98
100
  | `withStepErrorTemplate(tpl)` | App-wide default for the `*cngxStepError` slot - the per-step validation message rendered in a row below the strip. Per-instance `*cngxStepError` directive wins. |
99
101
  | `withStepperI18nLabels({ statusLabels })` | Override the per-state pill labels surfaced by the `stripe-status-rich` skin: `{ done, inProgress, upNext, errored }`. Partial overrides keep unset keys at the English default. |
@@ -147,7 +147,7 @@
147
147
  border-inline-end: 2px solid currentcolor;
148
148
  border-block-end: 2px solid currentcolor;
149
149
  rotate: 45deg;
150
- transition: rotate 0.15s ease;
150
+ transition: rotate var(--cngx-duration-fast, 150ms) ease;
151
151
  }
152
152
 
153
153
  [cngxAccordionPanel][aria-expanded='true']::after {
@@ -37,13 +37,25 @@
37
37
  /**
38
38
  * Duration of the opacity fade between hidden and visible states.
39
39
  * Falls back to `--cngx-duration-base`.
40
+ *
41
+ * Derives from the `--cngx-duration-base` rung of the motion scale; a
42
+ * `--cngx-duration-*` brand override re-times it library-wide.
40
43
  * @group Motion
44
+ * @relatedTo provideMotion, CngxMotionScope, injectMotion
41
45
  */
42
46
  @property --cngx-backdrop-transition-duration {
43
47
  syntax: '<time>';
44
48
  inherits: false;
45
49
  initial-value: 200ms;
46
50
  }
51
+
52
+ /* Derive from the motion scale. The registered initial-value wins over the
53
+ * read-site var() fallback, so the token must be SET from the scale for a
54
+ * --cngx-duration-* brand override to reach the fade. Host SET (read is on
55
+ * :scope); layer cngx.tokens keeps the Material bridge winning. */
56
+ :where(.cngx-backdrop) {
57
+ --cngx-backdrop-transition-duration: var(--cngx-duration-base);
58
+ }
47
59
  }
48
60
 
49
61
  @layer cngx.components {
@@ -10,7 +10,9 @@
10
10
  * **State modifiers**
11
11
  *
12
12
  * - `--checked` - primary fill, on-primary text, primary border
13
- * - `--disabled` - opacity 0.5, `cursor: not-allowed`
13
+ * - `--disabled` - `cursor: not-allowed`; 38% text on a faint text tint,
14
+ * a checked segment fills with the disabled colour; GrayText under
15
+ * forced colors
14
16
  * - `:hover:not(--disabled):not(--checked)` - 8% primary tint over the surface
15
17
  * - `--checked:hover:not(--disabled)` - primary fill darkened for feedback,
16
18
  * keeping the on-primary text contrast (an unguarded plain hover would drop
@@ -75,7 +77,7 @@
75
77
  font: inherit;
76
78
  font-size: var(--cngx-font-size-sm, 0.8125rem);
77
79
  cursor: pointer;
78
- transition: background-color 0.12s, border-color 0.12s, color 0.12s;
80
+ transition: background-color var(--cngx-duration-fast, 150ms), border-color var(--cngx-duration-fast, 150ms), color var(--cngx-duration-fast, 150ms);
79
81
  }
80
82
 
81
83
  /* Segmented-control geometry: collapse adjacent borders inside the
@@ -119,10 +121,20 @@
119
121
  border-color: color-mix(in oklch, var(--cngx-color-primary, oklch(0.66 0.19 50)) 88%, black);
120
122
  }
121
123
 
124
+ /* Disabled by colour, never opacity (the field recipe): 38% text on a
125
+ * faint text tint; a checked segment fills with the disabled colour and
126
+ * keeps a surface label. */
122
127
  :scope.cngx-button-toggle--disabled {
123
- opacity: 0.5;
128
+ background: color-mix(in oklab, var(--cngx-color-text, oklch(0.2 0.01 250)) 4%, var(--cngx-color-surface, oklch(1 0 0)));
129
+ color: color-mix(in oklab, var(--cngx-color-text, oklch(0.2 0.01 250)) 38%, transparent);
124
130
  cursor: not-allowed;
125
131
  }
132
+
133
+ :scope.cngx-button-toggle--disabled.cngx-button-toggle--checked {
134
+ background: color-mix(in oklab, var(--cngx-color-text, oklch(0.2 0.01 250)) 38%, transparent);
135
+ color: var(--cngx-color-surface, oklch(1 0 0));
136
+ border-color: transparent;
137
+ }
126
138
  }
127
139
  }
128
140
 
@@ -144,4 +156,18 @@
144
156
  color: HighlightText !important;
145
157
  border-color: Highlight !important;
146
158
  }
159
+ /* Disabled is painted by colour. A native :disabled button gets GrayText from
160
+ * the UA, an aria-disabled one does not, so restate it; a checked disabled
161
+ * segment fills with GrayText (the repeated classes beat the Highlight rule). */
162
+ .cngx-button-toggle.cngx-button-toggle--disabled {
163
+ forced-color-adjust: none;
164
+ background: ButtonFace;
165
+ color: GrayText;
166
+ border-color: GrayText;
167
+ }
168
+ .cngx-button-toggle.cngx-button-toggle--disabled.cngx-button-toggle--checked {
169
+ background: GrayText !important;
170
+ color: ButtonFace !important;
171
+ border-color: GrayText !important;
172
+ }
147
173
  }
@@ -9,7 +9,10 @@
9
9
  * Registration matters because the column template, gaps, and paddings are set
10
10
  * on the group host and read by descendant summaries. `@property` with
11
11
  * `inherits: true` keeps that host -> descendant cascade alive; `inherits: false`
12
- * would silently pin descendants to the initial value. Every token here inherits.
12
+ * would silently pin descendants to the initial value. Every token here inherits,
13
+ * except the two measured band sizes (`--cngx-dga-head-block-size` /
14
+ * `--cngx-dga-foot-block-size`) and the private fade carriers, which only the host
15
+ * itself reads.
13
16
  *
14
17
  * Density: the pixel `initial-value` of each spacing token is only the un-set
15
18
  * fallback. The organism's default rule and each skin SET `--cngx-dga-row-py` /
@@ -216,4 +219,168 @@
216
219
  syntax: '*';
217
220
  inherits: true;
218
221
  }
222
+
223
+ /**
224
+ * Optional override for the block-start scroll padding that keeps keyboard focus
225
+ * below the pinned column head (WCAG 2.4.11). Unset, the host uses the measured
226
+ * `--cngx-dga-head-block-size`. Universal syntax with NO initial-value, so an unset
227
+ * override falls through to the measured value; a registered initial would never be
228
+ * "unset", so the use-site fallback would never fire.
229
+ * @group Grid
230
+ */
231
+ @property --cngx-dga-head-scroll-pad {
232
+ syntax: '*';
233
+ inherits: true;
234
+ }
235
+
236
+ /**
237
+ * Optional override for the block-end scroll padding that keeps keyboard focus above
238
+ * the pinned footer (WCAG 2.4.11). Unset, the host uses the measured
239
+ * `--cngx-dga-foot-block-size`. No initial-value, for the same reason as the head pad.
240
+ * @group Grid
241
+ */
242
+ @property --cngx-dga-foot-scroll-pad {
243
+ syntax: '*';
244
+ inherits: true;
245
+ }
246
+
247
+ /**
248
+ * Measured border-box block size of the projected column head, bound by the host from
249
+ * a resize observer. Host-only: `inherits: false`, so a nested headerless grid never
250
+ * picks up an outer grid's band and a head resize never restyles the subtree. Only the
251
+ * host's own `scroll-padding-block` reads it, never a descendant. No initial-value, so
252
+ * an unmeasured head falls back to `0px` at the use site.
253
+ * @group Grid
254
+ */
255
+ @property --cngx-dga-head-block-size {
256
+ syntax: '*';
257
+ inherits: false;
258
+ }
259
+
260
+ /**
261
+ * Measured border-box block size of the projected footer, the foot counterpart of
262
+ * `--cngx-dga-head-block-size` (host-only, no initial-value).
263
+ * @group Grid
264
+ */
265
+ @property --cngx-dga-foot-block-size {
266
+ syntax: '*';
267
+ inherits: false;
268
+ }
269
+
270
+ /**
271
+ * Extra room the scroll padding adds beyond the pinned bands so the focus ring, which
272
+ * paints outside the focused element, is never clipped by a band. The use-site default
273
+ * `4px` is the worst case: the 2px ring of `--cngx-dga-focus-ring` plus the 2px outward
274
+ * offset of the sort header. A consumer widening the ring raises this too.
275
+ * @group Grid
276
+ */
277
+ @property --cngx-dga-focus-clearance {
278
+ syntax: '*';
279
+ inherits: true;
280
+ }
281
+
282
+ /**
283
+ * Shadow cast by the pinned column head while rows are scrolled away above it
284
+ * (bounded mode only). This is only the default look: set it to `none` to turn
285
+ * it off, or key your own visual (a line that appears, a tonal head) on the
286
+ * public `data-scroll-block-start` host attribute. Universal syntax with NO
287
+ * initial-value, so the adaptive default at the use site (derived from
288
+ * `--cngx-color-text`) stays live; a fixed colour initial would defeat it.
289
+ * @group Surface
290
+ */
291
+ @property --cngx-dga-head-shadow {
292
+ syntax: '*';
293
+ inherits: true;
294
+ }
295
+
296
+ /**
297
+ * Shadow cast by the pinned footer while rows remain below it (bounded mode only).
298
+ * A swappable default like the head shadow: `none` turns it off, and the public
299
+ * `data-scroll-block-end` host attribute keys any replacement. No initial-value,
300
+ * for the same reason as the head shadow.
301
+ * @group Surface
302
+ */
303
+ @property --cngx-dga-foot-shadow {
304
+ syntax: '*';
305
+ inherits: true;
306
+ }
307
+
308
+ /**
309
+ * Width of the inline edge fade shown while columns are hidden sideways. Also sets
310
+ * how far the inline scroll padding keeps a focused cell away from the edge. The
311
+ * fade is a default look keyed on the public `data-scroll-inline-start` /
312
+ * `data-scroll-inline-end` host attributes.
313
+ * @group Grid
314
+ */
315
+ @property --cngx-dga-edge-fade-size {
316
+ syntax: '<length>';
317
+ inherits: true;
318
+ initial-value: 24px;
319
+ }
320
+
321
+ /**
322
+ * Mask opacity at the very edge of the inline fade. The fade never reaches full
323
+ * transparency, so overlay scrollbars and edge content stay visible.
324
+ * @group Grid
325
+ */
326
+ @property --cngx-dga-edge-fade-min {
327
+ syntax: '<number>';
328
+ inherits: true;
329
+ initial-value: 0.35;
330
+ }
331
+
332
+ /**
333
+ * Private transition carrier: the current inline-start fade width. Set and read on
334
+ * the host only; registered so the length eases instead of popping.
335
+ * @group Grid
336
+ */
337
+ @property --_cngx-dga-fade-inline-start {
338
+ syntax: '<length>';
339
+ inherits: false;
340
+ initial-value: 0px;
341
+ }
342
+
343
+ /**
344
+ * Private transition carrier: the current inline-end fade width (host only).
345
+ * @group Grid
346
+ */
347
+ @property --_cngx-dga-fade-inline-end {
348
+ syntax: '<length>';
349
+ inherits: false;
350
+ initial-value: 0px;
351
+ }
352
+
353
+ /**
354
+ * Private transition carrier: the mask opacity at the inline-start edge, `1` (no
355
+ * fade) until that side hides columns. Host only, so a nested grid never inherits
356
+ * an outer grid's fade state.
357
+ * @group Grid
358
+ */
359
+ @property --_cngx-dga-fade-alpha-start {
360
+ syntax: '<number>';
361
+ inherits: false;
362
+ initial-value: 1;
363
+ }
364
+
365
+ /**
366
+ * Private transition carrier: the mask opacity at the inline-end edge (host only).
367
+ * @group Grid
368
+ */
369
+ @property --_cngx-dga-fade-alpha-end {
370
+ syntax: '<number>';
371
+ inherits: false;
372
+ initial-value: 1;
373
+ }
374
+
375
+ /**
376
+ * Private carrier: the physical direction of the inline fade gradient, `to right`
377
+ * unless the host itself resolves to RTL. Host only, so an LTR grid nested in an
378
+ * RTL one keeps its own direction.
379
+ * @group Grid
380
+ */
381
+ @property --_cngx-dga-fade-dir {
382
+ syntax: '*';
383
+ inherits: false;
384
+ initial-value: to right;
385
+ }
219
386
  }
@@ -199,7 +199,11 @@
199
199
 
200
200
  /**
201
201
  * Duration of the open / close transition.
202
+ *
203
+ * Derives from the `--cngx-duration-base` rung of the motion scale; a
204
+ * `--cngx-duration-*` brand override re-times it library-wide.
202
205
  * @group Motion
206
+ * @relatedTo provideMotion, CngxMotionScope, injectMotion
203
207
  */
204
208
  @property --cngx-dialog-transition-duration {
205
209
  syntax: '<time>';
@@ -207,6 +211,15 @@
207
211
  initial-value: 200ms;
208
212
  }
209
213
 
214
+ /* Derive from the motion scale. The registered initial-value above wins
215
+ * over the read-site var() fallback, so a --cngx-duration-* brand override
216
+ * only reaches the transition once the token is SET from the scale here.
217
+ * Host SET (read is on :scope); layer cngx.tokens keeps the Material bridge
218
+ * (layer cngx.components) winning for the Material path. */
219
+ :where(dialog[cngxDialog]) {
220
+ --cngx-dialog-transition-duration: var(--cngx-duration-base);
221
+ }
222
+
210
223
  /**
211
224
  * Easing curve of the open / close transition.
212
225
  * @group Motion
@@ -21,7 +21,8 @@
21
21
  * `aria-activedescendant`)
22
22
  * - `--selected` - higher-alpha primary tint so committed state
23
23
  * reads stronger than the transient cursor
24
- * - `--disabled` - opacity 0.5, `cursor: not-allowed`
24
+ * - `--disabled` - 38% text (the disabled field recipe), never opacity;
25
+ * `cursor: not-allowed`; GrayText under forced colors
25
26
  * - `--hidden` - `display: none`
26
27
  *
27
28
  * Container `:focus-visible` paints a 2px ring (the container
@@ -106,16 +107,6 @@
106
107
  initial-value: oklch(0.66 0.19 50 / 0.18);
107
108
  }
108
109
 
109
- /**
110
- * Opacity multiplier applied to disabled options.
111
- * @group State / Disabled
112
- */
113
- @property --cngx-option-disabled-opacity {
114
- syntax: '<number>';
115
- inherits: false;
116
- initial-value: 0.5;
117
- }
118
-
119
110
  /**
120
111
  * Padding shorthand inside the listbox container.
121
112
  * @group Layout
@@ -220,8 +211,9 @@
220
211
  background: var(--cngx-option-selected-bg, oklch(0.66 0.19 50 / 0.18));
221
212
  }
222
213
 
214
+ /* Disabled by colour, never opacity (the field recipe). */
223
215
  .cngx-option--disabled {
224
- opacity: var(--cngx-option-disabled-opacity, 0.5);
216
+ color: color-mix(in oklab, var(--cngx-color-text, oklch(0.2 0.01 250)) 38%, transparent);
225
217
  cursor: not-allowed;
226
218
  }
227
219
 
@@ -245,9 +237,26 @@
245
237
  * without !important (unlayered beats layered). */
246
238
  background: Highlight;
247
239
  color: HighlightText;
240
+ /* Chromium paints a Canvas backplate behind the label text; without the
241
+ * opt-out the HighlightText label sits on that plate and vanishes. The
242
+ * opt-out is inherited, so the row declares its ink for nested indicators
243
+ * (checkbox, radio), which would otherwise paint unforced author colours. */
244
+ forced-color-adjust: none;
245
+ --_cngx-forced-ink: HighlightText;
248
246
  }
249
247
  .cngx-option--highlighted {
250
248
  outline: 2px solid CanvasText;
251
249
  outline-offset: -2px;
252
250
  }
251
+ /* Disabled is painted by colour, which the forced palette overrides;
252
+ * re-signal it with GrayText, as a GrayText fill when selected. */
253
+ .cngx-option--disabled {
254
+ color: GrayText;
255
+ --_cngx-forced-ink: GrayText;
256
+ }
257
+ .cngx-option--disabled.cngx-option--selected {
258
+ background: GrayText;
259
+ color: Canvas;
260
+ --_cngx-forced-ink: Canvas;
261
+ }
253
262
  }
@@ -21,7 +21,9 @@
21
21
  *
22
22
  * - `--highlighted` - tinted background (keyboard cursor via
23
23
  * `aria-activedescendant`)
24
- * - `--disabled` - opacity 0.5, `cursor: not-allowed`
24
+ * - `--disabled` - 38% text (the disabled field recipe), never opacity,
25
+ * shortcut and checked glyph included; `cursor: not-allowed`; GrayText
26
+ * under forced colors
25
27
  * - `--checked` - bolder font-weight plus a leading glyph drawn by
26
28
  * `::before` so the cue lands even without a projected icon:
27
29
  * `[cngxMenuItemCheckbox]` -> `&check;`, `[cngxMenuItemRadio]` ->
@@ -104,16 +106,6 @@
104
106
  initial-value: oklch(0.66 0.19 50 / 0.1);
105
107
  }
106
108
 
107
- /**
108
- * Opacity multiplier applied to disabled menu items.
109
- * @group State / Disabled
110
- */
111
- @property --cngx-menu-item-disabled-opacity {
112
- syntax: '<number>';
113
- inherits: false;
114
- initial-value: 0.5;
115
- }
116
-
117
109
  /**
118
110
  * Padding shorthand inside the menu container.
119
111
  * @group Layout
@@ -276,6 +268,24 @@
276
268
  margin: 0;
277
269
  padding: var(--cngx-menu-padding, 4px);
278
270
  outline: none;
271
+ /* Default floating surface so a bare menu (e.g. a headless context menu in
272
+ a raw [cngxPopover]) ships readable, not as the native popover UA box.
273
+ Delegates to the foundation so dark-mode swaps cascade; the panel and
274
+ the ui organisms paint their own surface and suppress this below. */
275
+ background: var(--cngx-menu-bg, var(--cngx-color-surface, oklch(1 0 0)));
276
+ color: var(--cngx-menu-color, var(--cngx-color-text, inherit));
277
+ border: var(--cngx-menu-border, 1px solid var(--cngx-color-border, oklch(0.85 0.01 250)));
278
+ border-radius: var(--cngx-menu-radius, var(--cngx-radius-md, 0.375rem));
279
+ box-shadow: var(--cngx-menu-shadow, var(--cngx-shadow-md, 0 4px 12px oklch(0 0 0 / 0.12)));
280
+ }
281
+
282
+ /* A menu placed inside a CngxPopoverPanel would double the surface; the panel
283
+ already paints one, so strip the menu's here. */
284
+ .cngx-popover-panel [cngxMenu] {
285
+ background: transparent;
286
+ border: 0;
287
+ border-radius: 0;
288
+ box-shadow: none;
279
289
  }
280
290
 
281
291
  [cngxMenu]:focus-visible {
@@ -320,10 +330,18 @@
320
330
  background: var(--cngx-menu-item-highlight-bg, oklch(0.66 0.19 50 / 0.1));
321
331
  }
322
332
 
333
+ /* Disabled by colour, never opacity (the field recipe). The shortcut and
334
+ * the checked glyph carry their own colours, so they follow explicitly; the
335
+ * glyph selector repeats the class to outrank the checked ::before rules
336
+ * below (0,3,1). */
323
337
  .cngx-menu-item--disabled {
324
- opacity: var(--cngx-menu-item-disabled-opacity, 0.5);
338
+ color: color-mix(in oklab, var(--cngx-color-text, oklch(0.2 0.01 250)) 38%, transparent);
325
339
  cursor: not-allowed;
326
340
  }
341
+ .cngx-menu-item--disabled .cngx-menu-item__kbd,
342
+ :is([cngxMenuItemCheckbox], [cngxMenuItemRadio]).cngx-menu-item--disabled.cngx-menu-item--disabled.cngx-menu-item--checked::before {
343
+ color: inherit;
344
+ }
327
345
 
328
346
  /*
329
347
  * Checked menu item gets a bolder label PLUS a leading indicator
@@ -333,13 +351,14 @@
333
351
  * get a filled dot (`●`) to mirror the standard form-control
334
352
  * vocabulary. The pseudo lives outside the slot grid so it doesn't
335
353
  * conflict with `[cngxMenuItemIcon]` content - `:has()` suppresses
336
- * the pseudo when a projected icon is present.
354
+ * the pseudo when a projected icon is present. The empty alt text keeps
355
+ * the glyph out of the accessible name; `aria-checked` carries the state.
337
356
  */
338
357
  .cngx-menu-item--checked {
339
358
  font-weight: var(--cngx-menu-item-checked-font-weight, 600);
340
359
  }
341
360
  [cngxMenuItemCheckbox].cngx-menu-item--checked:not(:has(.cngx-menu-item__icon))::before {
342
- content: '✓';
361
+ content: '✓' / '';
343
362
  display: inline-flex;
344
363
  align-items: center;
345
364
  justify-content: center;
@@ -348,7 +367,7 @@
348
367
  font-weight: 700;
349
368
  }
350
369
  [cngxMenuItemRadio].cngx-menu-item--checked:not(:has(.cngx-menu-item__icon))::before {
351
- content: '●';
370
+ content: '●' / '';
352
371
  display: inline-flex;
353
372
  align-items: center;
354
373
  justify-content: center;
@@ -396,7 +415,10 @@
396
415
  * Canvas, erasing the cursor and the dividers. Re-signal the active item with
397
416
  * the Highlight pair and re-draw the separator with CanvasText ink. The checked
398
417
  * item self-heals (its ::before glyph + bolder weight survive). Unlayered +
399
- * direct selectors (outside @layer) to beat the layered component rule. */
418
+ * direct selectors (outside @layer) to beat the layered component rule.
419
+ * The highlighted item opts out of forcing, so its children see the UNFORCED
420
+ * author colours: it declares `--_cngx-forced-ink` and the shortcut and the
421
+ * checked glyph (both carry their own colours) paint that ink. */
400
422
  @media (forced-colors: active) {
401
423
  .cngx-menu-item--highlighted {
402
424
  /* Menu items are typically <button>s; the UA forces a form-control
@@ -407,8 +429,26 @@
407
429
  forced-color-adjust: none;
408
430
  background: Highlight;
409
431
  color: HighlightText;
432
+ --_cngx-forced-ink: HighlightText;
433
+ }
434
+ .cngx-menu-item--highlighted .cngx-menu-item__kbd,
435
+ :is([cngxMenuItemCheckbox], [cngxMenuItemRadio]).cngx-menu-item--highlighted.cngx-menu-item--checked::before {
436
+ color: var(--_cngx-forced-ink, currentColor);
410
437
  }
411
438
  [cngxMenuSeparator] {
412
439
  background: CanvasText;
413
440
  }
441
+ /* Disabled is painted by colour, which the forced palette overrides;
442
+ * re-signal it with GrayText. The cursor on a disabled item stays visible
443
+ * as an inset Highlight outline instead of the Highlight fill. */
444
+ .cngx-menu-item--disabled {
445
+ color: GrayText;
446
+ }
447
+ .cngx-menu-item--disabled.cngx-menu-item--highlighted {
448
+ background: Canvas;
449
+ color: GrayText;
450
+ --_cngx-forced-ink: GrayText;
451
+ outline: 2px solid Highlight;
452
+ outline-offset: -2px;
453
+ }
414
454
  }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @overview
3
+ * Native `[popover]` UA-chrome reset for bare `[cngxPopover]` hosts.
4
+ *
5
+ * A `CngxPopover` host is a native popover element (`[attr.popover]`), so the
6
+ * browser paints its UA chrome - a `3px solid` border, a `Canvas` background
7
+ * and `0.25em` padding. `CngxPopoverPanel` and the select panels paint their
8
+ * own surface, but a *bare* popover (a menu placed directly in `[cngxPopover]`,
9
+ * e.g. a headless context menu) inherits that UA chrome and reads as an
10
+ * unstyled black-bordered box.
11
+ *
12
+ * Neutralise the chrome on hosts that carry no surface of their own; the
13
+ * styled surfaces are excluded by class so they keep their own paint. Only the
14
+ * chrome is reset - positioning (`inset`, `position-anchor`, the host's inline
15
+ * `margin`) is owned by `CngxPopover` and left untouched.
16
+ */
17
+ @layer cngx.components {
18
+ [cngxPopover]:not(.cngx-popover-panel):not(.cngx-select__panel) {
19
+ border: 0;
20
+ padding: 0;
21
+ background: transparent;
22
+ color: inherit;
23
+ }
24
+ }