@cngx/common 0.1.0-rc.7 → 0.1.0-rc.9

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 (69) hide show
  1. package/card/README.md +2 -1
  2. package/command/README.md +29 -0
  3. package/data/README.md +15 -3
  4. package/dialog/README.md +23 -1
  5. package/fesm2022/cngx-common-a11y.mjs +517 -184
  6. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  7. package/fesm2022/cngx-common-audio.mjs +62 -17
  8. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  9. package/fesm2022/cngx-common-card.mjs +301 -46
  10. package/fesm2022/cngx-common-card.mjs.map +1 -1
  11. package/fesm2022/cngx-common-chart.mjs +1221 -479
  12. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  13. package/fesm2022/cngx-common-command.mjs +97 -16
  14. package/fesm2022/cngx-common-command.mjs.map +1 -1
  15. package/fesm2022/cngx-common-data.mjs +1496 -499
  16. package/fesm2022/cngx-common-data.mjs.map +1 -1
  17. package/fesm2022/cngx-common-dialog.mjs +236 -61
  18. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  19. package/fesm2022/cngx-common-display.mjs +364 -93
  20. package/fesm2022/cngx-common-display.mjs.map +1 -1
  21. package/fesm2022/cngx-common-interactive.mjs +2040 -1046
  22. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  23. package/fesm2022/cngx-common-layout.mjs +955 -125
  24. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  25. package/fesm2022/cngx-common-popover.mjs +1293 -89
  26. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  27. package/fesm2022/cngx-common-stepper.mjs +997 -453
  28. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  29. package/fesm2022/cngx-common-tabs.mjs +1794 -1265
  30. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  31. package/fesm2022/cngx-common-timeline.mjs +151 -61
  32. package/fesm2022/cngx-common-timeline.mjs.map +1 -1
  33. package/fesm2022/cngx-common.mjs +1 -1
  34. package/interactive/README.md +15 -4
  35. package/layout/README.md +37 -1
  36. package/package.json +20 -7
  37. package/popover/README.md +58 -2
  38. package/schematics/collection.json +9 -0
  39. package/schematics/ng-add/index.js +9 -0
  40. package/schematics/ng-add/schema.json +91 -0
  41. package/schematics/package.json +3 -0
  42. package/stepper/README.md +11 -8
  43. package/theming/components/cngx-accordion.css +1 -1
  44. package/theming/components/cngx-backdrop.css +12 -0
  45. package/theming/components/cngx-button-toggle.css +29 -3
  46. package/theming/components/cngx-data-grid.css +168 -1
  47. package/theming/components/cngx-dialog.css +13 -0
  48. package/theming/components/cngx-listbox.css +21 -12
  49. package/theming/components/cngx-menu.css +56 -16
  50. package/theming/components/cngx-popover-sheet.css +402 -0
  51. package/theming/components/cngx-popover.css +28 -0
  52. package/theming/components/cngx-recycler-placeholder.css +196 -0
  53. package/theming/components/cngx-ripple.css +1 -1
  54. package/theming/components/cngx-slider.css +32 -1
  55. package/theming/components/cngx-tooltip.css +12 -0
  56. package/timeline/README.md +155 -0
  57. package/types/cngx-common-a11y.d.ts +205 -28
  58. package/types/cngx-common-card.d.ts +201 -17
  59. package/types/cngx-common-chart.d.ts +345 -48
  60. package/types/cngx-common-command.d.ts +50 -10
  61. package/types/cngx-common-data.d.ts +743 -92
  62. package/types/cngx-common-dialog.d.ts +161 -10
  63. package/types/cngx-common-display.d.ts +356 -142
  64. package/types/cngx-common-interactive.d.ts +910 -226
  65. package/types/cngx-common-layout.d.ts +603 -32
  66. package/types/cngx-common-popover.d.ts +612 -49
  67. package/types/cngx-common-stepper.d.ts +526 -237
  68. package/types/cngx-common-tabs.d.ts +358 -75
  69. package/types/cngx-common-timeline.d.ts +108 -22
@@ -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,402 @@
1
+ /**
2
+ * @overview
3
+ * Sheet and fullscreen presentation for `[cngxPopoverSheet]` popovers.
4
+ *
5
+ * **Breakpoint**
6
+ *
7
+ * Written once, here: `(pointer: coarse) and (max-width: 48rem)` sets
8
+ * `--cngx-popover-sheet-breakpoint` to `1` on the root, otherwise `0`.
9
+ * `CngxPopoverSheet` reads that property to resolve its `'auto'` request;
10
+ * no TypeScript length constant exists. A viewport query is admitted here
11
+ * because it decides overlay modality, not in-flow layout
12
+ * (responsive-by-default rule 2).
13
+ *
14
+ * **Presentations**
15
+ *
16
+ * Visuals key only on `data-cngx-presentation`, which the directive writes:
17
+ *
18
+ * - `sheet` - bottom-flush, full inline size, content-sized up to
19
+ * `--cngx-popover-sheet-max-block-size`, dimmed `::backdrop`
20
+ * - `fullscreen` - fills the dynamic viewport (`100dvh`)
21
+ * - `anchored` - untouched; the popover keeps its anchored layout
22
+ *
23
+ * In both non-anchored presentations the host is a non-scrolling flex
24
+ * column: the `cngxPopoverSheetHeader` part stays put and every other
25
+ * direct child scrolls. A swipe region inside a scrolling panel never
26
+ * fires, so only the content below the header may scroll.
27
+ *
28
+ * **Settling**
29
+ *
30
+ * While `data-cngx-sheet-settling` is present (the first frames after open,
31
+ * until the panel rect is stable) the host is transparent and holds the
32
+ * slide start state without a transition, so the one-frame offset of the
33
+ * pinned scroll lock on iOS is never visible. The slide starts when the
34
+ * attribute is removed. Opacity keeps the initial focus target focusable.
35
+ *
36
+ * **Safe area**
37
+ *
38
+ * Inline padding is the larger of the token and both horizontal safe-area
39
+ * insets, on both edges, so it stays correct in RTL and in either landscape
40
+ * rotation; the block end pads `env(safe-area-inset-bottom)`. Edge-to-edge
41
+ * landscape on iOS needs the app to opt into `viewport-fit=cover`.
42
+ *
43
+ * **Defaults**
44
+ *
45
+ * The defaults match `CngxBottomSheet` and `CngxDialog` (16px top corners,
46
+ * 80dvh cap, a 40 x 4px handle pill centred on its own row, the dialog
47
+ * shadow, a 50% black backdrop), with phone-sized padding: 16px from
48
+ * `--cngx-space-md`.
49
+ *
50
+ * **Dark mode**
51
+ *
52
+ * Three hooks (`prefers-color-scheme: dark`, `[data-color-scheme="dark"]`,
53
+ * `.dark`) deepen the shadow and dim the handle.
54
+ *
55
+ * **Pair with**
56
+ *
57
+ * - `@cngx/themes/material/popover-sheet-theme` - Material 3 surface
58
+ */
59
+
60
+ @layer cngx.tokens {
61
+ /**
62
+ * Maximum block size of the `sheet` presentation. Room above it keeps
63
+ * the page visible behind the backdrop.
64
+ * @group Layout
65
+ */
66
+ @property --cngx-popover-sheet-max-block-size {
67
+ syntax: '*';
68
+ inherits: false;
69
+ initial-value: 80dvh;
70
+ }
71
+
72
+ /**
73
+ * Corner radius shorthand of the `sheet` presentation. Rounded top
74
+ * corners only, matching the bottom-anchored anatomy.
75
+ * @group Layout
76
+ */
77
+ @property --cngx-popover-sheet-radius {
78
+ syntax: '*';
79
+ inherits: false;
80
+ initial-value: 16px 16px 0 0;
81
+ }
82
+
83
+ /**
84
+ * Padding inside the panel. SET from `--cngx-space-md` on the host, so
85
+ * density reaches it; the safe-area insets win where they are larger.
86
+ * @group Layout
87
+ */
88
+ @property --cngx-popover-sheet-padding {
89
+ syntax: '<length>';
90
+ inherits: true;
91
+ initial-value: 16px;
92
+ }
93
+
94
+ /**
95
+ * Gap between the items of the header row and below it. SET from
96
+ * `--cngx-space-sm`.
97
+ * @group Layout
98
+ */
99
+ @property --cngx-popover-sheet-header-gap {
100
+ syntax: '<length>';
101
+ inherits: true;
102
+ initial-value: 8px;
103
+ }
104
+
105
+ /**
106
+ * Inline size of the decorative handle pill.
107
+ * @group Handle
108
+ */
109
+ @property --cngx-popover-sheet-handle-inline-size {
110
+ syntax: '<length>';
111
+ inherits: true;
112
+ initial-value: 40px;
113
+ }
114
+
115
+ /**
116
+ * Block size of the decorative handle pill.
117
+ * @group Handle
118
+ */
119
+ @property --cngx-popover-sheet-handle-block-size {
120
+ syntax: '<length>';
121
+ inherits: true;
122
+ initial-value: 4px;
123
+ }
124
+
125
+ /**
126
+ * Corner radius of the decorative handle pill.
127
+ * @group Handle
128
+ */
129
+ @property --cngx-popover-sheet-handle-radius {
130
+ syntax: '<length>';
131
+ inherits: true;
132
+ initial-value: 2px;
133
+ }
134
+
135
+ /**
136
+ * Margin shorthand around the handle pill: centres it and pushes the
137
+ * header row down. SET from `--cngx-space-md` on the host.
138
+ * @group Handle
139
+ */
140
+ @property --cngx-popover-sheet-handle-margin {
141
+ syntax: '*';
142
+ inherits: true;
143
+ initial-value: 0 auto 16px;
144
+ }
145
+
146
+ /**
147
+ * Fill of the decorative handle pill. `inherits: true` so the root
148
+ * dark-mode value reaches the handle part.
149
+ * @group Handle
150
+ */
151
+ @property --cngx-popover-sheet-handle-color {
152
+ syntax: '<color>';
153
+ inherits: true;
154
+ initial-value: oklch(0.8 0.005 250);
155
+ }
156
+
157
+ /**
158
+ * Panel surface. SET from `--cngx-color-surface` on the host.
159
+ * @group Surface
160
+ */
161
+ @property --cngx-popover-sheet-surface {
162
+ syntax: '<color>';
163
+ inherits: false;
164
+ initial-value: oklch(1 0 0);
165
+ }
166
+
167
+ /**
168
+ * Panel text colour. SET from `--cngx-color-text` on the host.
169
+ * @group Surface
170
+ */
171
+ @property --cngx-popover-sheet-color {
172
+ syntax: '<color>';
173
+ inherits: false;
174
+ initial-value: oklch(0.2 0 0);
175
+ }
176
+
177
+ /**
178
+ * Drop shadow of the `sheet` presentation, the `CngxDialog` elevation.
179
+ * `inherits: true` so the dark-mode value set on the root reaches the host.
180
+ * @group Surface
181
+ */
182
+ @property --cngx-popover-sheet-shadow {
183
+ syntax: '*';
184
+ inherits: true;
185
+ initial-value: 0 8px 32px oklch(0 0 0 / 0.12);
186
+ }
187
+
188
+ /**
189
+ * Dimming paint of the `sheet` `::backdrop`. Paint only: taps outside
190
+ * the panel are handled by the directive, not by the backdrop.
191
+ * `inherits: true` so the host value reaches the pseudo-element.
192
+ * @group Surface
193
+ */
194
+ @property --cngx-popover-sheet-backdrop {
195
+ syntax: '<color>';
196
+ inherits: true;
197
+ initial-value: oklch(0 0 0 / 0.5);
198
+ }
199
+
200
+ /**
201
+ * Duration of the slide in and out. SET from `--cngx-duration-base`.
202
+ * @group Motion
203
+ * @relatedTo provideMotion, CngxMotionScope, injectMotion
204
+ */
205
+ @property --cngx-popover-sheet-duration {
206
+ syntax: '<time>';
207
+ inherits: false;
208
+ initial-value: 200ms;
209
+ }
210
+
211
+ /**
212
+ * Easing curve of the slide in and out.
213
+ * @group Motion
214
+ */
215
+ @property --cngx-popover-sheet-easing {
216
+ syntax: '*';
217
+ inherits: false;
218
+ initial-value: ease;
219
+ }
220
+
221
+ /* SET-from-scale: the registered initial values above win over a read-site
222
+ * var() fallback, so density, motion and foundation colour reach the sheet
223
+ * only through these host SETs. */
224
+ :where(.cngx-popover-sheet) {
225
+ --cngx-popover-sheet-padding: var(--cngx-space-md);
226
+ --cngx-popover-sheet-header-gap: var(--cngx-space-sm);
227
+ --cngx-popover-sheet-handle-margin: 0 auto var(--cngx-space-md);
228
+ --cngx-popover-sheet-duration: var(--cngx-duration-base);
229
+ --cngx-popover-sheet-surface: var(--cngx-color-surface);
230
+ --cngx-popover-sheet-color: var(--cngx-color-text);
231
+ }
232
+
233
+ @media (prefers-color-scheme: dark) {
234
+ :root:not([data-color-scheme='light']):not(.light) {
235
+ --cngx-popover-sheet-shadow: 0 8px 32px oklch(0 0 0 / 0.5);
236
+ --cngx-popover-sheet-handle-color: oklch(0.5 0.005 250);
237
+ }
238
+ }
239
+ [data-color-scheme='dark'],
240
+ .dark {
241
+ --cngx-popover-sheet-shadow: 0 8px 32px oklch(0 0 0 / 0.5);
242
+ --cngx-popover-sheet-handle-color: oklch(0.5 0.005 250);
243
+ }
244
+ [data-color-scheme='light'],
245
+ .light {
246
+ --cngx-popover-sheet-shadow: 0 8px 32px oklch(0 0 0 / 0.12);
247
+ --cngx-popover-sheet-handle-color: oklch(0.8 0.005 250);
248
+ }
249
+ }
250
+
251
+ @layer cngx.components {
252
+ /* The breakpoint, written once, on the root: every sheet shares one
253
+ * observer that reads it there. Unregistered on purpose: the directive
254
+ * reads the raw value. */
255
+ :root {
256
+ --cngx-popover-sheet-breakpoint: 0;
257
+ }
258
+
259
+ @media (pointer: coarse) and (max-width: 48rem) {
260
+ :root {
261
+ --cngx-popover-sheet-breakpoint: 1;
262
+ }
263
+ }
264
+
265
+ .cngx-popover-sheet:is([data-cngx-presentation='sheet'], [data-cngx-presentation='fullscreen']) {
266
+ position: fixed;
267
+ inset: auto 0 0 0;
268
+ margin: 0;
269
+ box-sizing: border-box;
270
+ inline-size: 100%;
271
+ max-inline-size: 100%;
272
+ min-inline-size: 0;
273
+ max-block-size: var(--cngx-popover-sheet-max-block-size, 80dvh);
274
+ flex-direction: column;
275
+ overflow: hidden;
276
+ border: 0;
277
+ border-radius: var(--cngx-popover-sheet-radius, 16px 16px 0 0);
278
+ padding-block: var(--cngx-popover-sheet-padding, 16px)
279
+ max(var(--cngx-popover-sheet-padding, 16px), env(safe-area-inset-bottom, 0px));
280
+ /* Symmetric on purpose: the notch side flips with the device rotation,
281
+ * and the larger inset on both edges stays correct in RTL. */
282
+ padding-inline: max(
283
+ var(--cngx-popover-sheet-padding, 16px),
284
+ env(safe-area-inset-left, 0px),
285
+ env(safe-area-inset-right, 0px)
286
+ );
287
+ background: var(--cngx-popover-sheet-surface, oklch(1 0 0));
288
+ color: var(--cngx-popover-sheet-color, oklch(0.2 0 0));
289
+ box-shadow: var(--cngx-popover-sheet-shadow, 0 8px 32px oklch(0 0 0 / 0.12));
290
+ translate: 0 0;
291
+ transition:
292
+ translate var(--cngx-popover-sheet-duration, 200ms) var(--cngx-popover-sheet-easing, ease),
293
+ opacity var(--cngx-popover-sheet-duration, 200ms) var(--cngx-popover-sheet-easing, ease);
294
+ }
295
+
296
+ /* Open only: a display value on the closed host would override the UA
297
+ * `[popover]:not(:popover-open) { display: none }` and keep it rendered. */
298
+ .cngx-popover-sheet:is(
299
+ [data-cngx-presentation='sheet'],
300
+ [data-cngx-presentation='fullscreen']
301
+ ):popover-open {
302
+ display: flex;
303
+ }
304
+
305
+ .cngx-popover-sheet[data-cngx-presentation='fullscreen'] {
306
+ inset: 0;
307
+ block-size: 100dvh;
308
+ max-block-size: 100dvh;
309
+ border-radius: 0;
310
+ padding-block-start: max(
311
+ var(--cngx-popover-sheet-padding, 16px),
312
+ env(safe-area-inset-top, 0px)
313
+ );
314
+ box-shadow: none;
315
+ }
316
+
317
+ .cngx-popover-sheet[data-cngx-presentation='sheet']::backdrop {
318
+ background: var(--cngx-popover-sheet-backdrop, oklch(0 0 0 / 0.5));
319
+ }
320
+
321
+ /* Slide start and end state. Opening holds it until the popover flips to
322
+ * open on the next frame; closing returns to it, and CngxPopover waits
323
+ * for the transition before hiding. */
324
+ .cngx-popover-sheet:is(
325
+ [data-cngx-presentation='sheet'],
326
+ [data-cngx-presentation='fullscreen']
327
+ ):is(.cngx-popover--opening, .cngx-popover--closing) {
328
+ translate: 0 100%;
329
+ }
330
+
331
+ .cngx-popover-sheet:is(
332
+ [data-cngx-presentation='sheet'],
333
+ [data-cngx-presentation='fullscreen']
334
+ )[data-cngx-sheet-settling] {
335
+ opacity: 0;
336
+ translate: 0 100%;
337
+ transition: none;
338
+ }
339
+
340
+ /* Only the content below the header scrolls: a swipe region inside a
341
+ * scrolling panel never fires. */
342
+ .cngx-popover-sheet:is([data-cngx-presentation='sheet'], [data-cngx-presentation='fullscreen'])
343
+ > * {
344
+ flex: 1 1 auto;
345
+ min-block-size: 0;
346
+ overflow: auto;
347
+ overscroll-behavior: contain;
348
+ }
349
+
350
+ /* Handle on its own row, title and controls on the next one. */
351
+ .cngx-popover-sheet:is([data-cngx-presentation='sheet'], [data-cngx-presentation='fullscreen'])
352
+ > .cngx-popover-sheet-header {
353
+ flex: none;
354
+ overflow: visible;
355
+ display: flex;
356
+ flex-wrap: wrap;
357
+ align-items: center;
358
+ gap: var(--cngx-popover-sheet-header-gap, 8px);
359
+ padding-block-end: var(--cngx-popover-sheet-header-gap, 8px);
360
+ }
361
+
362
+ .cngx-popover-sheet-handle {
363
+ display: none;
364
+ }
365
+
366
+ .cngx-popover-sheet[data-cngx-presentation='sheet'] .cngx-popover-sheet-handle {
367
+ display: block;
368
+ flex: 0 0 100%;
369
+ }
370
+
371
+ .cngx-popover-sheet[data-cngx-presentation='sheet'] .cngx-popover-sheet-handle::before {
372
+ content: '';
373
+ display: block;
374
+ inline-size: var(--cngx-popover-sheet-handle-inline-size, 40px);
375
+ block-size: var(--cngx-popover-sheet-handle-block-size, 4px);
376
+ margin: var(--cngx-popover-sheet-handle-margin, 0 auto 16px);
377
+ border-radius: var(--cngx-popover-sheet-handle-radius, 2px);
378
+ background: var(--cngx-popover-sheet-handle-color, oklch(0.8 0.005 250));
379
+ }
380
+ }
381
+
382
+ @media (prefers-reduced-motion: reduce) {
383
+ .cngx-popover-sheet:is([data-cngx-presentation='sheet'], [data-cngx-presentation='fullscreen']) {
384
+ transition: none;
385
+ }
386
+ }
387
+
388
+ /* forced-colors (WHCM): the sheet surface is bounded by a box-shadow only,
389
+ * which the forced palette strips, and the handle is a background bar that
390
+ * flattens to Canvas. Re-draw the top edge and the handle with CanvasText.
391
+ * Unlayered to beat the layered component rules. */
392
+ @media (forced-colors: active) {
393
+ .cngx-popover-sheet:is([data-cngx-presentation='sheet'], [data-cngx-presentation='fullscreen']) {
394
+ background: Canvas;
395
+ color: CanvasText;
396
+ border-block-start: 1px solid CanvasText;
397
+ }
398
+
399
+ .cngx-popover-sheet[data-cngx-presentation='sheet'] .cngx-popover-sheet-handle::before {
400
+ background: CanvasText;
401
+ }
402
+ }
@@ -0,0 +1,28 @@
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`, the select panels and the tabs
8
+ * overflow menu paint their own surface, but a *bare* popover (a menu placed
9
+ * directly in `[cngxPopover]`, e.g. a headless context menu) inherits that UA
10
+ * chrome and reads as an 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. A `cngxPopoverSheet`
16
+ * in its sheet or fullscreen presentation paints its own surface
17
+ * (`cngx-popover-sheet.css`), so it is excluded too.
18
+ */
19
+ @layer cngx.components {
20
+ [cngxPopover]:not(.cngx-popover-panel):not(.cngx-select__panel):not(
21
+ .cngx-tab-overflow__panel
22
+ ):not([data-cngx-presentation='sheet']):not([data-cngx-presentation='fullscreen']) {
23
+ border: 0;
24
+ padding: 0;
25
+ background: transparent;
26
+ color: inherit;
27
+ }
28
+ }