@cngx/common 0.1.0-rc.6 → 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 (72) hide show
  1. package/card/README.md +2 -1
  2. package/chart/README.md +85 -0
  3. package/command/README.md +157 -0
  4. package/data/README.md +33 -1
  5. package/dialog/README.md +23 -1
  6. package/fesm2022/cngx-common-a11y.mjs +356 -180
  7. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  8. package/fesm2022/cngx-common-audio.mjs +84 -42
  9. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  10. package/fesm2022/cngx-common-card.mjs +311 -53
  11. package/fesm2022/cngx-common-card.mjs.map +1 -1
  12. package/fesm2022/cngx-common-chart.mjs +4360 -1625
  13. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  14. package/fesm2022/cngx-common-command.mjs +171 -0
  15. package/fesm2022/cngx-common-command.mjs.map +1 -0
  16. package/fesm2022/cngx-common-data.mjs +1556 -616
  17. package/fesm2022/cngx-common-data.mjs.map +1 -1
  18. package/fesm2022/cngx-common-dialog.mjs +518 -112
  19. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  20. package/fesm2022/cngx-common-display.mjs +468 -87
  21. package/fesm2022/cngx-common-display.mjs.map +1 -1
  22. package/fesm2022/cngx-common-interactive.mjs +2725 -1303
  23. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  24. package/fesm2022/cngx-common-layout.mjs +943 -164
  25. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  26. package/fesm2022/cngx-common-popover.mjs +769 -103
  27. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  28. package/fesm2022/cngx-common-stepper.mjs +816 -348
  29. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  30. package/fesm2022/cngx-common-tabs.mjs +2330 -1554
  31. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  32. package/fesm2022/cngx-common-timeline.mjs +1170 -0
  33. package/fesm2022/cngx-common-timeline.mjs.map +1 -0
  34. package/fesm2022/cngx-common.mjs +2 -2
  35. package/fesm2022/cngx-common.mjs.map +1 -1
  36. package/interactive/README.md +15 -4
  37. package/layout/README.md +21 -1
  38. package/package.json +11 -1
  39. package/popover/README.md +18 -2
  40. package/stepper/README.md +7 -5
  41. package/theming/components/cngx-accordion.css +4 -1
  42. package/theming/components/cngx-backdrop.css +12 -0
  43. package/theming/components/cngx-badge.css +22 -0
  44. package/theming/components/cngx-bottom-sheet.css +14 -2
  45. package/theming/components/cngx-breadcrumb.css +8 -0
  46. package/theming/components/cngx-button-toggle.css +73 -5
  47. package/theming/components/cngx-data-grid.css +234 -1
  48. package/theming/components/cngx-dialog.css +25 -0
  49. package/theming/components/cngx-divider.css +12 -0
  50. package/theming/components/cngx-listbox.css +48 -12
  51. package/theming/components/cngx-menu.css +91 -15
  52. package/theming/components/cngx-popover.css +24 -0
  53. package/theming/components/cngx-recycler-placeholder.css +196 -0
  54. package/theming/components/cngx-ripple.css +2 -2
  55. package/theming/components/cngx-slider.css +32 -1
  56. package/theming/components/cngx-tooltip.css +23 -0
  57. package/timeline/README.md +155 -0
  58. package/types/cngx-common-a11y.d.ts +101 -31
  59. package/types/cngx-common-audio.d.ts +32 -32
  60. package/types/cngx-common-card.d.ts +211 -20
  61. package/types/cngx-common-chart.d.ts +1605 -169
  62. package/types/cngx-common-command.d.ts +190 -0
  63. package/types/cngx-common-data.d.ts +842 -163
  64. package/types/cngx-common-dialog.d.ts +372 -28
  65. package/types/cngx-common-display.d.ts +432 -148
  66. package/types/cngx-common-interactive.d.ts +1553 -370
  67. package/types/cngx-common-layout.d.ts +613 -27
  68. package/types/cngx-common-popover.d.ts +376 -36
  69. package/types/cngx-common-stepper.d.ts +414 -114
  70. package/types/cngx-common-tabs.d.ts +597 -72
  71. package/types/cngx-common-timeline.d.ts +1125 -0
  72. package/types/cngx-common.d.ts +1 -1
@@ -10,8 +10,13 @@
10
10
  * **State modifiers**
11
11
  *
12
12
  * - `--checked` - primary fill, on-primary text, primary border
13
- * - `--disabled` - opacity 0.5, `cursor: not-allowed`
14
- * - `:hover:not(--disabled)` - 8% primary tint over the surface
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
16
+ * - `:hover:not(--disabled):not(--checked)` - 8% primary tint over the surface
17
+ * - `--checked:hover:not(--disabled)` - primary fill darkened for feedback,
18
+ * keeping the on-primary text contrast (an unguarded plain hover would drop
19
+ * a checked segment to the pale tint under near-white text)
15
20
  *
16
21
  * **Segmented-control geometry**
17
22
  *
@@ -60,6 +65,10 @@
60
65
  display: inline-flex;
61
66
  align-items: center;
62
67
  justify-content: center;
68
+ /* Touch-target floor - segmented-control buttons are primary tap
69
+ targets; lift each to the pointer-derived hit-area minimum on
70
+ the block axis. Inert at 0px on a fine pointer. */
71
+ min-block-size: var(--cngx-target-min, 0px);
63
72
  gap: 0.375rem;
64
73
  padding: var(--cngx-button-toggle-padding-block, 0.4rem) var(--cngx-button-toggle-padding-inline, 0.875rem);
65
74
  border: 1px solid var(--cngx-color-border, oklch(0.88 0.005 250));
@@ -68,7 +77,7 @@
68
77
  font: inherit;
69
78
  font-size: var(--cngx-font-size-sm, 0.8125rem);
70
79
  cursor: pointer;
71
- 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);
72
81
  }
73
82
 
74
83
  /* Segmented-control geometry: collapse adjacent borders inside the
@@ -87,7 +96,13 @@
87
96
  border-end-end-radius: var(--cngx-radius-md, 0.375rem);
88
97
  }
89
98
 
90
- :scope:hover:not(.cngx-button-toggle--disabled) {
99
+ /* Hover on an UNCHECKED segment: 8% primary tint over the surface. The
100
+ * `:not(--checked)` guard is load-bearing - this rule sets only the
101
+ * background, and it out-specifies the checked rule below (0,3,0 vs 0,2,0),
102
+ * so without the guard a hovered checked segment would drop to the pale
103
+ * tint while keeping its on-primary (near-white) text: white-on-pale, an
104
+ * invisible label. Checked hover is handled by its own rule. */
105
+ :scope:hover:not(.cngx-button-toggle--disabled):not(.cngx-button-toggle--checked) {
91
106
  background: color-mix(in oklch, var(--cngx-color-primary, oklch(0.66 0.19 50)) 8%, var(--cngx-color-surface, oklch(1 0 0)));
92
107
  }
93
108
 
@@ -97,9 +112,62 @@
97
112
  border-color: var(--cngx-color-primary, oklch(0.66 0.19 50));
98
113
  }
99
114
 
115
+ /* Hover on a CHECKED segment: keep the primary fill (so the on-primary text
116
+ * stays legible) and darken it a touch for feedback. Darkening toward black
117
+ * only deepens the fill, so the on-primary text contrast is preserved in
118
+ * light and dark. */
119
+ :scope.cngx-button-toggle--checked:hover:not(.cngx-button-toggle--disabled) {
120
+ background: color-mix(in oklch, var(--cngx-color-primary, oklch(0.66 0.19 50)) 88%, black);
121
+ border-color: color-mix(in oklch, var(--cngx-color-primary, oklch(0.66 0.19 50)) 88%, black);
122
+ }
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. */
100
127
  :scope.cngx-button-toggle--disabled {
101
- 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);
102
130
  cursor: not-allowed;
103
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
+ }
138
+ }
139
+ }
140
+
141
+ /* forced-colors (WHCM): the checked segment is a primary background fill (with a
142
+ * primary border-color and on-primary text); the fill flattens to Canvas and the
143
+ * border/text force to the same system colours as an unchecked segment, so the
144
+ * pressed state is lost. Re-signal with the system Highlight pair. Two rules are
145
+ * load-bearing here: (1) the host is a `<button>`, and the UA forces a
146
+ * form-control's background to ButtonFace with a priority that beats an author
147
+ * `background: Highlight`, so `forced-color-adjust: none` is required to opt this
148
+ * segment out of the forcing and let the Highlight through; (2) the base rule is
149
+ * `:scope.cngx-button-toggle--checked` (specificity 0,2,0), so the override
150
+ * repeats the host class (`.cngx-button-toggle.cngx-button-toggle--checked`) to
151
+ * match it. Unlayered + direct selector (outside @scope). */
152
+ @media (forced-colors: active) {
153
+ .cngx-button-toggle.cngx-button-toggle--checked {
154
+ forced-color-adjust: none;
155
+ background: Highlight !important;
156
+ color: HighlightText !important;
157
+ border-color: Highlight !important;
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;
104
172
  }
105
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` /
@@ -150,4 +153,234 @@
150
153
  inherits: true;
151
154
  initial-value: 160px;
152
155
  }
156
+
157
+ /**
158
+ * Opt-in maximum block size. Unset (`none`) leaves the grid content-height; a
159
+ * length caps it, turning the host into a vertical scrollport that pins the
160
+ * column head (`data-grid-accordion.component.css`). The pinned head is gated by
161
+ * a style query on this token, so registering a resolvable `none` initial is what
162
+ * makes bounded vs unbounded distinguishable to that query.
163
+ * @group Grid
164
+ */
165
+ @property --cngx-dga-max-block-size {
166
+ syntax: '<length> | none';
167
+ inherits: true;
168
+ initial-value: none;
169
+ }
170
+
171
+ /**
172
+ * Stacking order of the pinned column head over the rows scrolling beneath it
173
+ * (bounded mode only).
174
+ * @group Grid
175
+ */
176
+ @property --cngx-dga-head-z {
177
+ syntax: '<integer>';
178
+ inherits: true;
179
+ initial-value: 2;
180
+ }
181
+
182
+ /**
183
+ * Opaque fill behind the pinned column head so scrolling rows never show through
184
+ * (bounded mode only). Universal syntax with NO initial-value, so the use-site
185
+ * fallback to the foundation surface token stays live - a fixed colour initial
186
+ * would defeat it (reference_property_color_initial_defeats_fallback) and render
187
+ * a light head in dark mode. The unskinned base reads it as the head's fill; the
188
+ * content skins paint `.cngx-dga-header` background directly, so this token is the
189
+ * base default they may override, not one they currently set.
190
+ * @group Surface
191
+ */
192
+ @property --cngx-dga-head-bg {
193
+ syntax: '*';
194
+ inherits: true;
195
+ }
196
+
197
+ /**
198
+ * Stacking order of the pinned footer over the rows scrolling beneath it
199
+ * (bounded mode only).
200
+ * @group Grid
201
+ */
202
+ @property --cngx-dga-foot-z {
203
+ syntax: '<integer>';
204
+ inherits: true;
205
+ initial-value: 2;
206
+ }
207
+
208
+ /**
209
+ * Opaque fill behind the pinned footer so scrolling rows never show through
210
+ * (bounded mode only). Universal syntax with NO initial-value, so the use-site
211
+ * fallback to the foundation surface token stays live - a fixed colour initial
212
+ * would defeat it (reference_property_color_initial_defeats_fallback). The unskinned
213
+ * base reads it as the footer's fill; the content skins paint `.cngx-dga-footer`
214
+ * background directly, so this token is the base default they may override, not one
215
+ * they currently set.
216
+ * @group Surface
217
+ */
218
+ @property --cngx-dga-foot-bg {
219
+ syntax: '*';
220
+ inherits: true;
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
+ }
153
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
@@ -360,3 +373,15 @@
360
373
  }
361
374
  }
362
375
  }
376
+
377
+ /* forced-colors (WHCM): the dialog border defaults to `none`, so its sole
378
+ * boundary is the elevation box-shadow, which is forced to none - and the
379
+ * surface flattens to Canvas, leaving the modal edgeless against the page.
380
+ * Re-draw a real edge with a system-colour border. Unlayered + direct selector
381
+ * (outside @scope) to beat the layered component rule and sidestep the
382
+ * @scope/layer cascade trap. */
383
+ @media (forced-colors: active) {
384
+ dialog[cngxDialog] {
385
+ border: 1px solid ButtonBorder;
386
+ }
387
+ }
@@ -147,3 +147,15 @@
147
147
  }
148
148
  }
149
149
  }
150
+
151
+ /* forced-colors (WHCM): the divider line is painted with background-color on a
152
+ * 1px-thin block (both the horizontal and vertical variants), and the forced
153
+ * palette flattens it to Canvas - the separator vanishes. Re-draw it in the
154
+ * system foreground ink so the line survives (a bare <hr> gets its border
155
+ * forced the same way). Unlayered + direct selector (outside @scope) to beat
156
+ * the layered component rule and sidestep the @scope/layer cascade trap. */
157
+ @media (forced-colors: active) {
158
+ .cngx-divider {
159
+ background: CanvasText;
160
+ }
161
+ }
@@ -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
@@ -205,6 +196,11 @@
205
196
  cursor: pointer;
206
197
  user-select: none;
207
198
  color: inherit;
199
+
200
+ /* Touch-target floor - each option is a tap target; floor its hit box to
201
+ the pointer-derived minimum on the block axis. Inert at 0px on a fine
202
+ pointer, so [data-density] still drives the natural row height. */
203
+ min-block-size: var(--cngx-target-min, 0px);
208
204
  }
209
205
 
210
206
  .cngx-option--highlighted {
@@ -215,8 +211,9 @@
215
211
  background: var(--cngx-option-selected-bg, oklch(0.66 0.19 50 / 0.18));
216
212
  }
217
213
 
214
+ /* Disabled by colour, never opacity (the field recipe). */
218
215
  .cngx-option--disabled {
219
- 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);
220
217
  cursor: not-allowed;
221
218
  }
222
219
 
@@ -224,3 +221,42 @@
224
221
  display: none;
225
222
  }
226
223
  }
224
+
225
+ /* forced-colors (WHCM): both the selected option and the keyboard-highlighted
226
+ * option (aria-activedescendant cursor) are background tints with no border, and
227
+ * both flatten to Canvas - the committed selection and the cursor vanish.
228
+ * Re-signal the committed selection with the Highlight pair, and draw the
229
+ * transient cursor as an inset CanvasText outline so the two stay distinct and
230
+ * combinable. Unlayered + direct selectors (outside @layer) to beat the layered
231
+ * component rule. */
232
+ @media (forced-colors: active) {
233
+ .cngx-option--selected {
234
+ /* The option is a <div cngxOption> (not a form control), so no
235
+ * forced-color-adjust is needed. The base rule is a plain class in
236
+ * @layer cngx.components with no @scope, so this unlayered block wins
237
+ * without !important (unlayered beats layered). */
238
+ background: Highlight;
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;
246
+ }
247
+ .cngx-option--highlighted {
248
+ outline: 2px solid CanvasText;
249
+ outline-offset: -2px;
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
+ }
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 {
@@ -300,16 +310,38 @@
300
310
  cursor: pointer;
301
311
  user-select: none;
302
312
  color: inherit;
313
+ /* Touch-target floor - menu rows are primary tap targets; lift each
314
+ to the pointer-derived hit-area minimum on the block axis. Inert
315
+ at 0px on a fine pointer. */
316
+ min-block-size: var(--cngx-target-min, 0px);
317
+ }
318
+
319
+ /* Adjacent-target spacing floor (WCAG 2.5.8) - stacked menu rows keep at
320
+ least the pointer-derived gap between neighbours so densely packed items
321
+ stay distinguishable as separate tap targets. An adjacent-sibling margin
322
+ avoids changing the container's block-flow layout model; inert at 0px on a
323
+ fine pointer, and a vertical margin is a no-op on a horizontal menubar. */
324
+ :is([cngxMenuItem], [cngxMenuItemCheckbox], [cngxMenuItemRadio], [cngxMenuItemSubmenu])
325
+ + :is([cngxMenuItem], [cngxMenuItemCheckbox], [cngxMenuItemRadio], [cngxMenuItemSubmenu]) {
326
+ margin-block-start: var(--cngx-target-gap, 0px);
303
327
  }
304
328
 
305
329
  .cngx-menu-item--highlighted {
306
330
  background: var(--cngx-menu-item-highlight-bg, oklch(0.66 0.19 50 / 0.1));
307
331
  }
308
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). */
309
337
  .cngx-menu-item--disabled {
310
- 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);
311
339
  cursor: not-allowed;
312
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
+ }
313
345
 
314
346
  /*
315
347
  * Checked menu item gets a bolder label PLUS a leading indicator
@@ -319,13 +351,14 @@
319
351
  * get a filled dot (`●`) to mirror the standard form-control
320
352
  * vocabulary. The pseudo lives outside the slot grid so it doesn't
321
353
  * conflict with `[cngxMenuItemIcon]` content - `:has()` suppresses
322
- * 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.
323
356
  */
324
357
  .cngx-menu-item--checked {
325
358
  font-weight: var(--cngx-menu-item-checked-font-weight, 600);
326
359
  }
327
360
  [cngxMenuItemCheckbox].cngx-menu-item--checked:not(:has(.cngx-menu-item__icon))::before {
328
- content: '✓';
361
+ content: '✓' / '';
329
362
  display: inline-flex;
330
363
  align-items: center;
331
364
  justify-content: center;
@@ -334,7 +367,7 @@
334
367
  font-weight: 700;
335
368
  }
336
369
  [cngxMenuItemRadio].cngx-menu-item--checked:not(:has(.cngx-menu-item__icon))::before {
337
- content: '●';
370
+ content: '●' / '';
338
371
  display: inline-flex;
339
372
  align-items: center;
340
373
  justify-content: center;
@@ -376,3 +409,46 @@
376
409
  list-style: none;
377
410
  }
378
411
  }
412
+
413
+ /* forced-colors (WHCM): the highlighted item (keyboard cursor) is a background
414
+ * tint and the separator is a 1px background-color hairline - both flatten to
415
+ * Canvas, erasing the cursor and the dividers. Re-signal the active item with
416
+ * the Highlight pair and re-draw the separator with CanvasText ink. The checked
417
+ * item self-heals (its ::before glyph + bolder weight survive). Unlayered +
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. */
422
+ @media (forced-colors: active) {
423
+ .cngx-menu-item--highlighted {
424
+ /* Menu items are typically <button>s; the UA forces a form-control
425
+ * background to ButtonFace, so opt out with forced-color-adjust, then set
426
+ * the Highlight pair. The base rule is a plain class in @layer
427
+ * cngx.components with no @scope, so this unlayered block wins without
428
+ * !important (unlayered beats layered; the opt-out beats the UA forcing). */
429
+ forced-color-adjust: none;
430
+ background: Highlight;
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);
437
+ }
438
+ [cngxMenuSeparator] {
439
+ background: CanvasText;
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
+ }
454
+ }