@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
@@ -4,9 +4,10 @@
4
4
  * chrome that a bare `<ul cngxMenu>…</ul>` renders as a usable
5
5
  * popover menu: bullets stripped, items laid out in a flex row with
6
6
  * icon / label / suffix / kbd slots, keyboard-cursor and checked-state
7
- * signals painted in. Container surface (background, border, radius)
8
- * is owned by the popover panel that hosts the menu -
9
- * `cngx-popover-panel.css` paints the chrome.
7
+ * signals painted in. The container paints a default floating surface
8
+ * (background, border, radius, elevation) from the `--cngx-menu-bg`,
9
+ * `-border`, `-radius` and `-shadow` tokens; a host that paints its own
10
+ * surface around the menu sets those tokens on its menu.
10
11
  *
11
12
  * **Selectors**
12
13
  *
@@ -14,6 +15,9 @@
14
15
  * - `[cngxMenuItem]`, `[cngxMenuItemCheckbox]`, `[cngxMenuItemRadio]`,
15
16
  * `[cngxMenuItemSubmenu]` - item hosts
16
17
  * - `.cngx-menu-item__icon`, `__label`, `__suffix`, `__kbd` - slots
18
+ * - `.cngx-menu-item__indicator` - checked indicator the checkbox / radio
19
+ * item inserts; `__indicator-svg` is its icon, `--stroke` marks an
20
+ * outline
17
21
  * - `.cngx-menu-item--highlighted`, `--disabled`, `--checked` - state
18
22
  * - `[cngxMenuSeparator]` - hairline divider
19
23
  *
@@ -24,11 +28,12 @@
24
28
  * - `--disabled` - 38% text (the disabled field recipe), never opacity,
25
29
  * shortcut and checked glyph included; `cursor: not-allowed`; GrayText
26
30
  * under forced colors
27
- * - `--checked` - bolder font-weight plus a leading glyph drawn by
28
- * `::before` so the cue lands even without a projected icon:
29
- * `[cngxMenuItemCheckbox]` -> `&check;`, `[cngxMenuItemRadio]` ->
30
- * filled dot. `:has(.cngx-menu-item__icon)` suppresses the pseudo
31
- * when a projected icon already occupies the slot.
31
+ * - `--checked` - bolder font-weight plus a leading
32
+ * `.cngx-menu-item__indicator` the item directive inserts, so the cue
33
+ * lands even without a projected icon: `[cngxMenuItemCheckbox]` -> a
34
+ * check, `[cngxMenuItemRadio]` -> a filled dot, both from the shared
35
+ * icon set. `:has(.cngx-menu-item__icon)` hides the indicator when a
36
+ * projected icon already occupies the slot.
32
37
  *
33
38
  * **Inheritance**
34
39
  *
@@ -38,6 +43,10 @@
38
43
  * - `--cngx-menu-item-highlight-bg` -> `color-mix(primary, transparent)`
39
44
  * - `--cngx-menu-item-checked-color` -> `--cngx-color-primary`
40
45
  * - `--cngx-menu-separator-color` -> `--cngx-color-border`
46
+ * - `--cngx-menu-bg` -> `--cngx-color-surface`
47
+ * - `--cngx-menu-border` -> 1px `--cngx-color-border`
48
+ * - `--cngx-menu-radius` -> `--cngx-radius-md`
49
+ * - `--cngx-menu-shadow` -> `--cngx-shadow-md`
41
50
  *
42
51
  * The highlight tint is a `color-mix()` so Material's `--mat-sys-primary`
43
52
  * (or any other primary override) flows through without forking.
@@ -52,6 +61,8 @@
52
61
  * **Pair with**
53
62
  *
54
63
  * - `@cngx/themes/material/interactive-controls-theme` - Material 3 surface
64
+ *
65
+ * @themes CngxMenu, CngxMenuItem, CngxMenuItemCheckbox, CngxMenuItemRadio, CngxMenuItemSubmenu, CngxMenuSeparator
55
66
  */
56
67
 
57
68
  @layer cngx.tokens {
@@ -106,6 +117,48 @@
106
117
  initial-value: oklch(0.66 0.19 50 / 0.1);
107
118
  }
108
119
 
120
+ /**
121
+ * Background of the menu container. Unset by default, so the container
122
+ * paints `--cngx-color-surface`. A host that paints its own surface around
123
+ * the menu sets it to `transparent` on its menu.
124
+ * @group Surface
125
+ * @see [[--cngx-color-surface]]
126
+ */
127
+ @property --cngx-menu-bg {
128
+ syntax: '*';
129
+ inherits: false;
130
+ }
131
+
132
+ /**
133
+ * Border shorthand of the menu container. Unset by default, so the
134
+ * container draws a 1px `--cngx-color-border` line.
135
+ * @group Surface
136
+ */
137
+ @property --cngx-menu-border {
138
+ syntax: '*';
139
+ inherits: false;
140
+ }
141
+
142
+ /**
143
+ * Corner radius of the menu container. Unset by default, so it follows
144
+ * `--cngx-radius-md`.
145
+ * @group Surface
146
+ */
147
+ @property --cngx-menu-radius {
148
+ syntax: '*';
149
+ inherits: false;
150
+ }
151
+
152
+ /**
153
+ * Elevation of the menu container. Unset by default, so it follows
154
+ * `--cngx-shadow-md`.
155
+ * @group Surface
156
+ */
157
+ @property --cngx-menu-shadow {
158
+ syntax: '*';
159
+ inherits: false;
160
+ }
161
+
109
162
  /**
110
163
  * Padding shorthand inside the menu container.
111
164
  * @group Layout
@@ -159,7 +212,7 @@
159
212
  }
160
213
 
161
214
  /**
162
- * Color of the leading checkmark glyph painted on a checked item.
215
+ * Color of the leading check or dot indicator on a checked item.
163
216
  * Tracks the foundation primary so the cue matches the highlight
164
217
  * accent.
165
218
  * @group State / Checked
@@ -270,8 +323,9 @@
270
323
  outline: none;
271
324
  /* Default floating surface so a bare menu (e.g. a headless context menu in
272
325
  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. */
326
+ Delegates to the foundation so dark-mode swaps cascade. A host that
327
+ paints its own surface around the menu sets the --cngx-menu-* surface
328
+ tokens on its menu (or strips it on its own menu class). */
275
329
  background: var(--cngx-menu-bg, var(--cngx-color-surface, oklch(1 0 0)));
276
330
  color: var(--cngx-menu-color, var(--cngx-color-text, inherit));
277
331
  border: var(--cngx-menu-border, 1px solid var(--cngx-color-border, oklch(0.85 0.01 250)));
@@ -279,15 +333,6 @@
279
333
  box-shadow: var(--cngx-menu-shadow, var(--cngx-shadow-md, 0 4px 12px oklch(0 0 0 / 0.12)));
280
334
  }
281
335
 
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;
289
- }
290
-
291
336
  [cngxMenu]:focus-visible {
292
337
  outline: var(--cngx-menu-focus-outline-width, 2px) solid
293
338
  var(--cngx-menu-focus-outline-color, oklch(0.66 0.19 50));
@@ -327,53 +372,68 @@
327
372
  }
328
373
 
329
374
  .cngx-menu-item--highlighted {
330
- background: var(--cngx-menu-item-highlight-bg, oklch(0.66 0.19 50 / 0.1));
375
+ background: var(--cngx-menu-item-highlight-bg);
331
376
  }
332
377
 
333
378
  /* 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). */
379
+ * the checked indicator carry their own colours, so they follow
380
+ * explicitly. */
337
381
  .cngx-menu-item--disabled {
338
382
  color: color-mix(in oklab, var(--cngx-color-text, oklch(0.2 0.01 250)) 38%, transparent);
339
383
  cursor: not-allowed;
340
384
  }
341
385
  .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 {
386
+ .cngx-menu-item--disabled > .cngx-menu-item__indicator {
343
387
  color: inherit;
344
388
  }
345
389
 
346
390
  /*
347
- * Checked menu item gets a bolder label PLUS a leading indicator
348
- * glyph drawn via `::before` so the committed-state signal lands
349
- * even when the consumer hasn't projected an explicit icon.
350
- * Checkbox-flavoured items get a tick (`✓`), radio-flavoured items
351
- * get a filled dot (`●`) to mirror the standard form-control
352
- * vocabulary. The pseudo lives outside the slot grid so it doesn't
353
- * conflict with `[cngxMenuItemIcon]` content - `:has()` suppresses
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.
391
+ * Checked menu item gets a bolder label PLUS a leading indicator the
392
+ * checkbox / radio item directive inserts while checked, so the
393
+ * committed-state signal lands even when the consumer hasn't projected an
394
+ * explicit icon: a check on checkbox items, a filled dot on radio items, to
395
+ * mirror the standard form-control vocabulary. The indicator lives outside
396
+ * the slot grid, so `:has()` hides it when a projected icon is present. It
397
+ * is aria-hidden; `aria-checked` carries the state.
356
398
  */
357
399
  .cngx-menu-item--checked {
358
400
  font-weight: var(--cngx-menu-item-checked-font-weight, 600);
359
401
  }
360
- [cngxMenuItemCheckbox].cngx-menu-item--checked:not(:has(.cngx-menu-item__icon))::before {
361
- content: '✓' / '';
362
- display: inline-flex;
363
- align-items: center;
364
- justify-content: center;
365
- min-width: var(--cngx-menu-item-icon-min-width, 1.25rem);
402
+ .cngx-menu-item__indicator {
403
+ position: relative;
404
+ flex: none;
405
+ align-self: stretch;
406
+ min-inline-size: var(--cngx-menu-item-icon-min-width, 1.25rem);
366
407
  color: var(--cngx-menu-item-checked-color, oklch(0.66 0.19 50));
367
- font-weight: 700;
368
408
  }
369
- [cngxMenuItemRadio].cngx-menu-item--checked:not(:has(.cngx-menu-item__icon))::before {
370
- content: '●' / '';
371
- display: inline-flex;
372
- align-items: center;
373
- justify-content: center;
374
- min-width: var(--cngx-menu-item-icon-min-width, 1.25rem);
375
- color: var(--cngx-menu-item-checked-color, oklch(0.66 0.19 50));
376
- font-size: 0.875em;
409
+ :has(.cngx-menu-item__icon) > .cngx-menu-item__indicator {
410
+ display: none;
411
+ }
412
+
413
+ /* The svg is centred in the indicator out of flow, so its box never grows
414
+ the row. Physical left / top pair with the physical translate, so the
415
+ centring holds under RTL. The item directive paints it and sizes it from
416
+ `--cngx-icon-svg-size`. */
417
+ .cngx-menu-item__indicator-svg {
418
+ position: absolute;
419
+ left: 50%;
420
+ top: 50%;
421
+ translate: -50% -50%;
422
+ }
423
+
424
+ /* The check box lands on exactly 1rem (16px at a 16px root), in the 15 to 19px
425
+ band, where the hand-hinted 16-grid small check is drawn. It follows the root
426
+ text scale, not the item font, so it is 16px in the default theme and under
427
+ the Material bridge (0.875rem item font) alike - the bridge needs no edit for
428
+ this row. The trade: the check no longer tracks a retuned item font (Q2). */
429
+ [cngxMenuItemCheckbox] > .cngx-menu-item__indicator > .cngx-menu-item__indicator-svg {
430
+ --cngx-icon-svg-size: 1rem;
431
+ }
432
+
433
+ /* The dot is a fill glyph 8 grid units across; scaling the box by 24/8
434
+ inks it 0.7em across, level with the check. */
435
+ [cngxMenuItemRadio] > .cngx-menu-item__indicator > .cngx-menu-item__indicator-svg {
436
+ --cngx-icon-svg-size: calc(0.7em * 24 / 8);
377
437
  }
378
438
 
379
439
  .cngx-menu-item__icon {
@@ -414,11 +474,11 @@
414
474
  * tint and the separator is a 1px background-color hairline - both flatten to
415
475
  * Canvas, erasing the cursor and the dividers. Re-signal the active item with
416
476
  * the Highlight pair and re-draw the separator with CanvasText ink. The checked
417
- * item self-heals (its ::before glyph + bolder weight survive). Unlayered +
477
+ * item self-heals (its indicator + bolder weight survive). Unlayered +
418
478
  * direct selectors (outside @layer) to beat the layered component rule.
419
479
  * The highlighted item opts out of forcing, so its children see the UNFORCED
420
480
  * author colours: it declares `--_cngx-forced-ink` and the shortcut and the
421
- * checked glyph (both carry their own colours) paint that ink. */
481
+ * checked indicator (both carry their own colours) paint that ink. */
422
482
  @media (forced-colors: active) {
423
483
  .cngx-menu-item--highlighted {
424
484
  /* Menu items are typically <button>s; the UA forces a form-control
@@ -432,7 +492,7 @@
432
492
  --_cngx-forced-ink: HighlightText;
433
493
  }
434
494
  .cngx-menu-item--highlighted .cngx-menu-item__kbd,
435
- :is([cngxMenuItemCheckbox], [cngxMenuItemRadio]).cngx-menu-item--highlighted.cngx-menu-item--checked::before {
495
+ .cngx-menu-item--highlighted > .cngx-menu-item__indicator {
436
496
  color: var(--_cngx-forced-ink, currentColor);
437
497
  }
438
498
  [cngxMenuSeparator] {