@cngx/common 0.1.0-rc.9 → 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 (88) hide show
  1. package/a11y/README.md +15 -2
  2. package/button/README.md +258 -0
  3. package/command/README.md +19 -8
  4. package/data/README.md +10 -10
  5. package/fesm2022/cngx-common-a11y.mjs +701 -263
  6. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  7. package/fesm2022/cngx-common-audio.mjs +83 -64
  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 +135 -76
  12. package/fesm2022/cngx-common-card.mjs.map +1 -1
  13. package/fesm2022/cngx-common-chart.mjs +749 -296
  14. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  15. package/fesm2022/cngx-common-command.mjs +51 -29
  16. package/fesm2022/cngx-common-command.mjs.map +1 -1
  17. package/fesm2022/cngx-common-data.mjs +695 -405
  18. package/fesm2022/cngx-common-data.mjs.map +1 -1
  19. package/fesm2022/cngx-common-dialog.mjs +112 -112
  20. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  21. package/fesm2022/cngx-common-display.mjs +668 -308
  22. package/fesm2022/cngx-common-display.mjs.map +1 -1
  23. package/fesm2022/cngx-common-interactive.mjs +7066 -2739
  24. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  25. package/fesm2022/cngx-common-layout.mjs +2121 -492
  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 +1207 -569
  30. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  31. package/fesm2022/cngx-common-stepper.mjs +256 -261
  32. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  33. package/fesm2022/cngx-common-tabs.mjs +202 -262
  34. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  35. package/fesm2022/cngx-common-timeline.mjs +28 -61
  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 +1 -1
  41. package/menu-button/README.md +234 -0
  42. package/package.json +14 -4
  43. package/popover/README.md +42 -5
  44. package/popover/tooltip-indicator.scss +52 -0
  45. package/schematics/ng-add/index.js +7 -7
  46. package/schematics/ng-add/schema.json +5 -0
  47. package/stepper/README.md +0 -1
  48. package/theming/components/cngx-accordion.css +36 -7
  49. package/theming/components/cngx-async.css +185 -37
  50. package/theming/components/cngx-backdrop.css +3 -1
  51. package/theming/components/cngx-badge.css +20 -5
  52. package/theming/components/cngx-bottom-sheet.css +2 -0
  53. package/theming/components/cngx-breadcrumb.css +3 -1
  54. package/theming/components/cngx-button-group.css +325 -0
  55. package/theming/components/cngx-button-toggle.css +55 -23
  56. package/theming/components/cngx-button.css +975 -0
  57. package/theming/components/cngx-data-grid.css +2 -0
  58. package/theming/components/cngx-dialog.css +3 -1
  59. package/theming/components/cngx-divider.css +24 -9
  60. package/theming/components/cngx-drawer.css +153 -0
  61. package/theming/components/cngx-icon-glyph.css +76 -0
  62. package/theming/components/cngx-listbox.css +79 -25
  63. package/theming/components/cngx-menu.css +112 -52
  64. package/theming/components/cngx-nav.css +1220 -0
  65. package/theming/components/cngx-popover-sheet.css +43 -11
  66. package/theming/components/cngx-popover.css +37 -13
  67. package/theming/components/cngx-recycler-placeholder.css +2 -0
  68. package/theming/components/cngx-ripple.css +74 -16
  69. package/theming/components/cngx-sidebar.css +71 -0
  70. package/theming/components/cngx-slider.css +3 -1
  71. package/theming/components/cngx-tooltip.css +2 -0
  72. package/timeline/README.md +2 -2
  73. package/types/cngx-common-a11y.d.ts +343 -120
  74. package/types/cngx-common-audio.d.ts +60 -88
  75. package/types/cngx-common-button.d.ts +698 -0
  76. package/types/cngx-common-card.d.ts +104 -78
  77. package/types/cngx-common-chart.d.ts +671 -384
  78. package/types/cngx-common-command.d.ts +44 -47
  79. package/types/cngx-common-data.d.ts +350 -342
  80. package/types/cngx-common-dialog.d.ts +91 -120
  81. package/types/cngx-common-display.d.ts +475 -300
  82. package/types/cngx-common-interactive.d.ts +4350 -1723
  83. package/types/cngx-common-layout.d.ts +1365 -286
  84. package/types/cngx-common-menu-button.d.ts +382 -0
  85. package/types/cngx-common-popover.d.ts +671 -289
  86. package/types/cngx-common-stepper.d.ts +217 -347
  87. package/types/cngx-common-tabs.d.ts +173 -386
  88. package/types/cngx-common-timeline.d.ts +25 -104
@@ -23,6 +23,8 @@
23
23
  * registered initial-value defeats any `var()` fallback anyway
24
24
  * (reference_property_color_initial_defeats_fallback); the derivation is always a
25
25
  * SET at the host, never the registration.
26
+ *
27
+ * @themes CngxDataGridAccordion
26
28
  */
27
29
 
28
30
  @layer cngx.tokens {
@@ -52,6 +52,8 @@
52
52
  * **Pair with**
53
53
  *
54
54
  * - `@cngx/themes/material/dialog-theme` - Material 3 surface + elevation
55
+ *
56
+ * @themes CngxDialog, CngxDialogDraggable
55
57
  */
56
58
 
57
59
  @layer cngx.tokens {
@@ -300,7 +302,7 @@
300
302
  max-width: var(--cngx-dialog-max-width, 560px);
301
303
  max-height: var(--cngx-dialog-max-height, 80vh);
302
304
  width: 100%;
303
- background: var(--cngx-dialog-bg, var(--cngx-color-surface, oklch(1 0 0)));
305
+ background: var(--cngx-dialog-bg);
304
306
  color: var(--cngx-dialog-color, inherit);
305
307
  box-shadow: var(--cngx-dialog-shadow, 0 8px 32px oklch(0 0 0 / 0.12));
306
308
  overflow: auto;
@@ -9,9 +9,10 @@
9
9
  *
10
10
  * - default - horizontal hairline, `margin-block` breathing room
11
11
  * - `--vertical` - inline-block column, `margin-inline` breathing room,
12
- * `align-self: stretch` so it fills its flex parent
12
+ * `align-self: stretch` so it fills its flex parent (1em floor outside one)
13
13
  * - `--inset` - drops the line in from the start/end edge to align
14
- * with indented list content; stacks with `--vertical`
14
+ * with indented list content; stacks with `--vertical`, where it clips
15
+ * the line inside the row height instead of growing the row
15
16
  *
16
17
  * **Inheritance**
17
18
  *
@@ -34,6 +35,8 @@
34
35
  * **Pair with**
35
36
  *
36
37
  * - `@cngx/themes/material/divider-theme` - Material 3 outline-variant
38
+ *
39
+ * @themes CngxDivider
37
40
  */
38
41
 
39
42
  @layer cngx.tokens {
@@ -107,6 +110,13 @@
107
110
  .dark {
108
111
  --cngx-divider-color: oklch(0.45 0.005 250);
109
112
  }
113
+
114
+ /* Derive the spacing from the density scale: the registered initial defeats
115
+ * a use-site fallback, so the default lives in a SET. Kept in this layer so
116
+ * a Material bridge and a consumer override still win. */
117
+ .cngx-divider {
118
+ --cngx-divider-spacing: var(--cngx-space-sm);
119
+ }
110
120
  }
111
121
 
112
122
  @layer cngx.components {
@@ -121,29 +131,34 @@
121
131
  box-sizing: border-box;
122
132
  width: 100%;
123
133
  height: var(--cngx-divider-thickness, 1px);
124
- margin-block: var(--cngx-divider-spacing, var(--cngx-space-sm, 8px));
134
+ margin-block: var(--cngx-divider-spacing);
125
135
  margin-inline: 0;
126
136
  border: 0;
127
- background: var(--cngx-divider-color, var(--cngx-color-border, oklch(0.9 0.01 250)));
137
+ background: var(--cngx-divider-color);
128
138
  }
129
139
 
130
140
  /* Vertical variant - thin column, horizontal breathing room. */
131
141
  :scope.cngx-divider--vertical {
132
142
  display: inline-block;
133
143
  width: var(--cngx-divider-thickness, 1px);
134
- height: 1em;
144
+ /* Auto height so align-self: stretch fills a flex row; the 1em floor
145
+ keeps the line visible outside a flex parent. */
146
+ height: auto;
147
+ min-block-size: 1em;
135
148
  margin-block: 0;
136
- margin-inline: var(--cngx-divider-spacing, var(--cngx-space-sm, 8px));
149
+ margin-inline: var(--cngx-divider-spacing);
137
150
  align-self: stretch;
138
151
  }
139
152
 
140
153
  /* Inset variant - drops the line in from the start/end edge. */
141
154
  :scope.cngx-divider--inset {
142
- margin-inline: var(--cngx-divider-inset-amount, var(--cngx-space-md, 16px));
155
+ margin-inline: var(--cngx-divider-inset-amount);
143
156
  }
157
+ /* Clip instead of margin-block: a margin counts toward the flex item's
158
+ outer size and grows the row. The 25% cap keeps a line in short rows. */
144
159
  :scope.cngx-divider--vertical.cngx-divider--inset {
145
- margin-block: var(--cngx-divider-inset-amount, var(--cngx-space-md, 16px));
146
- margin-inline: var(--cngx-divider-spacing, var(--cngx-space-sm, 8px));
160
+ margin-inline: var(--cngx-divider-spacing);
161
+ clip-path: inset(min(var(--cngx-divider-inset-amount), 25%) 0);
147
162
  }
148
163
  }
149
164
  }
@@ -0,0 +1,153 @@
1
+ /**
2
+ * @overview
3
+ * Base skin for `CngxDrawer`: panel position, surface and motion, plus the
4
+ * scrim. Opt-in: add the `.cngx-drawer` class alongside `[cngxDrawer]`.
5
+ *
6
+ * The panel (`CngxDrawerPanel`) sits absolute on its side of the host (the
7
+ * physical `.cngx-drawer-panel--left` / `--right` / `--top` / `--bottom`
8
+ * classes), on a surface with a border toward the content, and slides in
9
+ * from off the host. In `push` mode the panel slides the same way at its
10
+ * full size, and the content (`.cngx-drawer-content`, which fills the rest
11
+ * of the host's flex row) moves aside by the panel size on that side
12
+ * (`data-drawer-push`, written by `CngxDrawerContent` while a push panel is
13
+ * open). The panel never narrows, so nothing inside it rewraps while it
14
+ * moves. The host clips what lies outside it, so a closed panel paints
15
+ * nothing.
16
+ *
17
+ * The host paints a scrim over itself while a modal `CngxDrawerPanel` inside it is open
18
+ * (`modality` `page` or `contained`; the panel renders
19
+ * `.cngx-drawer-panel--modal` + `.cngx-drawer-panel--open`). The scrim is
20
+ * a pseudo-element of the host: a press on it lands on the host, outside
21
+ * the panel, and closes the drawer. Inert, focus and scroll lock stay with
22
+ * the panel; this stylesheet only paints.
23
+ *
24
+ * For a clipped drawer below a live app header, keep the header outside
25
+ * the `[cngxDrawer]` host: the scrim covers the host only.
26
+ *
27
+ * The host becomes the containing block (`position: relative`) so panel
28
+ * and scrim cover exactly the host. The panel sits above the scrim
29
+ * (`--cngx-drawer-panel-z-index` above `--cngx-drawer-scrim-z-index`).
30
+ * `[cngxDrawerSurface]` on its own gets no skin: it is the behaviour-only
31
+ * surface you position yourself.
32
+ *
33
+ * **Inheritance**
34
+ *
35
+ * - `--cngx-drawer-panel-inline-size` -> `220px` (left and right panels)
36
+ * - `--cngx-drawer-panel-block-size` -> `120px` (top and bottom panels)
37
+ * - `--cngx-drawer-panel-bg` -> `--cngx-color-surface`
38
+ * - `--cngx-drawer-panel-border-color` -> `--cngx-color-border`
39
+ * - `--cngx-drawer-panel-border-width` -> `1px`
40
+ * - `--cngx-drawer-panel-duration` -> `--cngx-duration-base` (the slide
41
+ * and the push margin of the content)
42
+ * - `--cngx-drawer-panel-z-index` -> `2`
43
+ * - `--cngx-drawer-scrim-bg` -> `--cngx-backdrop-bg` (the same scrim
44
+ * colour as `CngxBackdrop`, including its Material bridge)
45
+ * - `--cngx-drawer-scrim-duration` -> `--cngx-duration-base`
46
+ *
47
+ * @themes CngxDrawer
48
+ */
49
+
50
+ @layer cngx.components {
51
+ @scope (.cngx-drawer) {
52
+ :scope {
53
+ /* Functional - panel and scrim cover the host box; a closed panel
54
+ lies outside it */
55
+ position: relative;
56
+ display: flex;
57
+ overflow: clip;
58
+ }
59
+
60
+ .cngx-drawer-panel {
61
+ /* Functional - over the content on its side */
62
+ position: absolute;
63
+ box-sizing: border-box;
64
+
65
+ /* Themable - token-driven */
66
+ z-index: var(--cngx-drawer-panel-z-index, 2);
67
+ background: var(--cngx-drawer-panel-bg, var(--cngx-color-surface, oklch(1 0 0)));
68
+ transition: transform var(--cngx-drawer-panel-duration, var(--cngx-duration-base, 200ms))
69
+ ease;
70
+ }
71
+
72
+ .cngx-drawer-panel--left {
73
+ inset: 0 auto 0 0;
74
+ width: var(--cngx-drawer-panel-inline-size, 220px);
75
+ border-right: var(--cngx-drawer-panel-border-width, 1px) solid
76
+ var(--cngx-drawer-panel-border-color, var(--cngx-color-border, oklch(0.92 0 0)));
77
+ transform: translateX(-100%);
78
+ }
79
+
80
+ .cngx-drawer-panel--right {
81
+ inset: 0 0 0 auto;
82
+ width: var(--cngx-drawer-panel-inline-size, 220px);
83
+ border-left: var(--cngx-drawer-panel-border-width, 1px) solid
84
+ var(--cngx-drawer-panel-border-color, var(--cngx-color-border, oklch(0.92 0 0)));
85
+ transform: translateX(100%);
86
+ }
87
+
88
+ .cngx-drawer-panel--top {
89
+ inset: 0 0 auto 0;
90
+ height: var(--cngx-drawer-panel-block-size, 120px);
91
+ border-bottom: var(--cngx-drawer-panel-border-width, 1px) solid
92
+ var(--cngx-drawer-panel-border-color, var(--cngx-color-border, oklch(0.92 0 0)));
93
+ transform: translateY(-100%);
94
+ }
95
+
96
+ .cngx-drawer-panel--bottom {
97
+ inset: auto 0 0 0;
98
+ height: var(--cngx-drawer-panel-block-size, 120px);
99
+ border-top: var(--cngx-drawer-panel-border-width, 1px) solid
100
+ var(--cngx-drawer-panel-border-color, var(--cngx-color-border, oklch(0.92 0 0)));
101
+ transform: translateY(100%);
102
+ }
103
+
104
+ .cngx-drawer-panel--open {
105
+ transform: none;
106
+ }
107
+
108
+ .cngx-drawer-content {
109
+ flex: 1 1 auto;
110
+ min-width: 0;
111
+ min-height: 0;
112
+ transition: margin var(--cngx-drawer-panel-duration, var(--cngx-duration-base, 200ms)) ease;
113
+ }
114
+
115
+ /* Push: the panel slides at full size like over, the content gives way
116
+ by the panel size. Physical sides, as the panel classes. */
117
+ .cngx-drawer-content[data-drawer-push='left'] {
118
+ margin-left: var(--cngx-drawer-panel-inline-size, 220px);
119
+ }
120
+
121
+ .cngx-drawer-content[data-drawer-push='right'] {
122
+ margin-right: var(--cngx-drawer-panel-inline-size, 220px);
123
+ }
124
+
125
+ .cngx-drawer-content[data-drawer-push='top'] {
126
+ margin-top: var(--cngx-drawer-panel-block-size, 120px);
127
+ }
128
+
129
+ .cngx-drawer-content[data-drawer-push='bottom'] {
130
+ margin-bottom: var(--cngx-drawer-panel-block-size, 120px);
131
+ }
132
+
133
+ :scope::after {
134
+ /* Functional - hardcoded, not part of theming surface */
135
+ content: '';
136
+ position: absolute;
137
+ inset: 0;
138
+ opacity: 0;
139
+ pointer-events: none;
140
+
141
+ /* Themable - token-driven */
142
+ z-index: var(--cngx-drawer-scrim-z-index, 1);
143
+ background: var(--cngx-drawer-scrim-bg, var(--cngx-backdrop-bg, oklch(0 0 0 / 0.5)));
144
+ transition: opacity var(--cngx-drawer-scrim-duration, var(--cngx-duration-base, 200ms));
145
+ }
146
+
147
+ /* Shown while a modal panel inside the host is open. */
148
+ :scope:has(.cngx-drawer-panel--modal.cngx-drawer-panel--open)::after {
149
+ opacity: 1;
150
+ pointer-events: auto;
151
+ }
152
+ }
153
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @overview
3
+ * Pixel-hinted tiers of the default cngx glyphs. Both renderers,
4
+ * `CngxIconSvg` and `createIconSvgElement`, put `.cngx-icon-glyph` on the
5
+ * svg and draw an icon's 12-grid `micro` drawing as a second path,
6
+ * `.cngx-icon-svg__micro`, and its 16-grid `small` drawing as a third,
7
+ * `.cngx-icon-svg__small`, next to the 24-grid `.cngx-icon-svg__path`.
8
+ * The svg is a size container: a 10 to 14px box shows the micro path, a 15
9
+ * to 19px box the small path, each instead of the 24-grid path. The
10
+ * selection comes from layout: no size input, no measurement, and it is the
11
+ * same on every device pixel ratio.
12
+ *
13
+ * The rules live here and not in `icon-svg.component.css` because an svg
14
+ * the helper builds loads no component stylesheet. Without this sheet both
15
+ * hinted paths keep their `display="none"` presentation attribute and the
16
+ * 24-grid path shows alone.
17
+ *
18
+ * An icon without a drawing on a tier renders no path for it, and the band
19
+ * rule then leaves its 24-grid path showing: the 24-grid path is hidden in
20
+ * a band only where that band's hinted path is one of its siblings. Both
21
+ * rules use the general sibling combinator (`~`), so an icon with a small
22
+ * drawing and no micro (or the reverse) works in either band independently
23
+ * of the pinned DOM order.
24
+ *
25
+ * Both hinted paths are fill outlines in `currentColor`. The stroke-width
26
+ * tokens drive the 24-grid path only; the hinted weight is part of the
27
+ * drawing.
28
+ *
29
+ * The band bounds are px literals: `@container` conditions take no `var()`,
30
+ * and the bands are about device pixels, so they must not follow the text
31
+ * scale. Two edges couple to consumers:
32
+ * - 15px (micro/small boundary): the checkmark step in
33
+ * `checkbox-indicator.component.css` (14.5px) and the reorder grip floor
34
+ * in `reorder-list.component.css` (15px) mirror it; move them together.
35
+ * - 20px (small upper edge): the checkbox lg checkmark renders at exactly
36
+ * 20px and must stay at or above it, out of the small band
37
+ * (`checkbox-indicator.geometry.spec.ts` pins it).
38
+ */
39
+
40
+ @layer cngx.components {
41
+ .cngx-icon-glyph {
42
+ /* Functional - hardcoded */
43
+ container: cngx-icon-glyph / size;
44
+ /* Size containment drops the svg's natural ratio; every glyph draws on a
45
+ square viewBox, so a rule that sizes one axis keeps the other. */
46
+ aspect-ratio: 1;
47
+ }
48
+
49
+ .cngx-icon-svg__micro,
50
+ .cngx-icon-svg__small {
51
+ /* Functional - hardcoded */
52
+ display: none;
53
+ fill: currentColor;
54
+ stroke: none;
55
+ }
56
+
57
+ @container cngx-icon-glyph (10px <= width < 15px) {
58
+ .cngx-icon-svg__path:has(~ .cngx-icon-svg__micro) {
59
+ display: none;
60
+ }
61
+
62
+ .cngx-icon-svg__micro {
63
+ display: inline;
64
+ }
65
+ }
66
+
67
+ @container cngx-icon-glyph (15px <= width < 20px) {
68
+ .cngx-icon-svg__path:has(~ .cngx-icon-svg__small) {
69
+ display: none;
70
+ }
71
+
72
+ .cngx-icon-svg__small {
73
+ display: inline;
74
+ }
75
+ }
76
+ }
@@ -5,8 +5,10 @@
5
5
  * as a usable option list: bullets stripped, options laid out with
6
6
  * breathing room, keyboard-cursor and selected-state signals
7
7
  * painted in. Container surface (background, border, radius) is
8
- * owned by the surrounding panel - `select-base.css` paints panel
9
- * chrome at higher specificity for the select family.
8
+ * owned by the surrounding panel. The rules sit in the nested layer
9
+ * `cngx.components.skin`, so an owner stylesheet directly in
10
+ * `cngx.components` (the select panels, the paginator) wins by layer,
11
+ * never by load order.
10
12
  *
11
13
  * **Selectors**
12
14
  *
@@ -31,8 +33,10 @@
31
33
  * **Inheritance**
32
34
  *
33
35
  * - `--cngx-listbox-focus-outline-color` -> `--cngx-color-primary`
34
- * - `--cngx-option-highlight-bg`, `--cngx-option-selected-bg` -
35
- * low-alpha primary tints, no foundation delegation by design
36
+ * - `--cngx-option-highlight-bg`, `--cngx-option-selected-bg` ->
37
+ * `--cngx-color-primary`, mixed with `transparent` at 10% / 18%.
38
+ * Assigned on `:root`; a subtree that re-themes the primary
39
+ * re-declares both tints
36
40
  *
37
41
  * **Dark mode**
38
42
  *
@@ -44,6 +48,8 @@
44
48
  * **Pair with**
45
49
  *
46
50
  * - `@cngx/themes/material/interactive-controls-theme` - Material 3 surface
51
+ *
52
+ * @themes CngxListbox, CngxOption
47
53
  */
48
54
 
49
55
  @layer cngx.tokens {
@@ -82,9 +88,10 @@
82
88
  }
83
89
 
84
90
  /**
85
- * Background tint of the keyboard-highlighted option. Low-alpha
86
- * primary so the highlight reads as an accent without competing
87
- * with selected-state visuals.
91
+ * Background tint of the keyboard-highlighted option: the primary
92
+ * mixed with `transparent` at 10% (18% dark), assigned on `:root`.
93
+ * The initial is the light default. A subtree that re-themes
94
+ * `--cngx-color-primary` re-declares this tint too.
88
95
  * @group State / Highlighted
89
96
  * @see [[--cngx-color-primary]]
90
97
  */
@@ -95,9 +102,11 @@
95
102
  }
96
103
 
97
104
  /**
98
- * Background of a selected option. Slightly higher alpha than the
99
- * highlight tint so selection reads as committed state rather than
100
- * transient cursor position.
105
+ * Background of a selected option: the primary mixed with
106
+ * `transparent` at 18% (28% dark), a step above the highlight so
107
+ * selection reads as committed state. The initial is the light
108
+ * default. A subtree that re-themes `--cngx-color-primary`
109
+ * re-declares this tint too.
101
110
  * @group State / Selected
102
111
  * @see [[--cngx-color-primary]]
103
112
  */
@@ -127,6 +136,18 @@
127
136
  initial-value: 6px 10px;
128
137
  }
129
138
 
139
+ /**
140
+ * Minimum block size of each option row. The option floors it against
141
+ * `--cngx-target-min`, so a coarse pointer keeps its tap target.
142
+ * @group Layout
143
+ * @see [[--cngx-target-min]]
144
+ */
145
+ @property --cngx-option-min-height {
146
+ syntax: '<length>';
147
+ inherits: false;
148
+ initial-value: 0px;
149
+ }
150
+
130
151
  /**
131
152
  * Corner radius of each option.
132
153
  * @group Layout
@@ -138,37 +159,70 @@
138
159
  }
139
160
 
140
161
  /*
141
- * Default-theme palette. Highlight + selected tints flip to higher
142
- * alphas on dark surfaces so the accent stays perceptible against
162
+ * Default-theme palette. Highlight + selected tints are `color-mix()`
163
+ * tints of the foundation primary and flip to higher alphas on dark
164
+ * surfaces so the accent stays perceptible against
143
165
  * the darker background without blowing out into a solid block.
144
166
  */
145
167
  :root {
146
168
  --cngx-listbox-focus-outline-color: var(--cngx-color-primary, oklch(0.66 0.19 50));
147
- --cngx-option-highlight-bg: oklch(0.66 0.19 50 / 0.1);
148
- --cngx-option-selected-bg: oklch(0.66 0.19 50 / 0.18);
169
+ --cngx-option-highlight-bg: color-mix(
170
+ in oklch,
171
+ var(--cngx-color-primary, oklch(0.66 0.19 50)) 10%,
172
+ transparent
173
+ );
174
+ --cngx-option-selected-bg: color-mix(
175
+ in oklch,
176
+ var(--cngx-color-primary, oklch(0.66 0.19 50)) 18%,
177
+ transparent
178
+ );
149
179
  }
150
180
 
151
181
  @media (prefers-color-scheme: dark) {
152
182
  :root:not([data-color-scheme='light']):not(.light) {
153
- --cngx-option-highlight-bg: oklch(0.72 0.18 50 / 0.18);
154
- --cngx-option-selected-bg: oklch(0.72 0.18 50 / 0.28);
183
+ --cngx-option-highlight-bg: color-mix(
184
+ in oklch,
185
+ var(--cngx-color-primary, oklch(0.72 0.18 50)) 18%,
186
+ transparent
187
+ );
188
+ --cngx-option-selected-bg: color-mix(
189
+ in oklch,
190
+ var(--cngx-color-primary, oklch(0.72 0.18 50)) 28%,
191
+ transparent
192
+ );
155
193
  }
156
194
  }
157
195
 
158
196
  :root[data-color-scheme='dark'],
159
197
  :root.dark {
160
- --cngx-option-highlight-bg: oklch(0.72 0.18 50 / 0.18);
161
- --cngx-option-selected-bg: oklch(0.72 0.18 50 / 0.28);
198
+ --cngx-option-highlight-bg: color-mix(
199
+ in oklch,
200
+ var(--cngx-color-primary, oklch(0.72 0.18 50)) 18%,
201
+ transparent
202
+ );
203
+ --cngx-option-selected-bg: color-mix(
204
+ in oklch,
205
+ var(--cngx-color-primary, oklch(0.72 0.18 50)) 28%,
206
+ transparent
207
+ );
162
208
  }
163
209
 
164
210
  :root[data-color-scheme='light'],
165
211
  :root.light {
166
- --cngx-option-highlight-bg: oklch(0.66 0.19 50 / 0.1);
167
- --cngx-option-selected-bg: oklch(0.66 0.19 50 / 0.18);
212
+ --cngx-option-highlight-bg: color-mix(
213
+ in oklch,
214
+ var(--cngx-color-primary, oklch(0.66 0.19 50)) 10%,
215
+ transparent
216
+ );
217
+ --cngx-option-selected-bg: color-mix(
218
+ in oklch,
219
+ var(--cngx-color-primary, oklch(0.66 0.19 50)) 18%,
220
+ transparent
221
+ );
168
222
  }
169
223
  }
170
224
 
171
- @layer cngx.components {
225
+ @layer cngx.components.skin {
172
226
  [cngxListbox] {
173
227
  /* Derive container padding from the global scale (SET-from-scale rule; the
174
228
  registered pixel initial defeats the use-site fallback). 4 -> xs. */
@@ -200,15 +254,15 @@
200
254
  /* Touch-target floor - each option is a tap target; floor its hit box to
201
255
  the pointer-derived minimum on the block axis. Inert at 0px on a fine
202
256
  pointer, so [data-density] still drives the natural row height. */
203
- min-block-size: var(--cngx-target-min, 0px);
257
+ min-block-size: max(var(--cngx-option-min-height, 0px), var(--cngx-target-min, 0px));
204
258
  }
205
259
 
206
260
  .cngx-option--highlighted {
207
- background: var(--cngx-option-highlight-bg, oklch(0.66 0.19 50 / 0.1));
261
+ background: var(--cngx-option-highlight-bg);
208
262
  }
209
263
 
210
264
  .cngx-option--selected {
211
- background: var(--cngx-option-selected-bg, oklch(0.66 0.19 50 / 0.18));
265
+ background: var(--cngx-option-selected-bg);
212
266
  }
213
267
 
214
268
  /* Disabled by colour, never opacity (the field recipe). */
@@ -233,7 +287,7 @@
233
287
  .cngx-option--selected {
234
288
  /* The option is a <div cngxOption> (not a form control), so no
235
289
  * 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
290
+ * @layer cngx.components.skin with no @scope, so this unlayered block wins
237
291
  * without !important (unlayered beats layered). */
238
292
  background: Highlight;
239
293
  color: HighlightText;