@cngx/ui 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 (106) hide show
  1. package/README.md +118 -59
  2. package/action-button/README.md +170 -53
  3. package/breadcrumb/README.md +5 -6
  4. package/collection/README.md +1 -1
  5. package/command-palette/README.md +4 -3
  6. package/data-grid-accordion/README.md +1 -1
  7. package/empty-state/README.md +2 -3
  8. package/feedback/README.md +1 -1
  9. package/fesm2022/cngx-ui-a11y.mjs +13 -23
  10. package/fesm2022/cngx-ui-a11y.mjs.map +1 -1
  11. package/fesm2022/cngx-ui-accordion.mjs +44 -66
  12. package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
  13. package/fesm2022/cngx-ui-action-button.mjs +213 -335
  14. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  15. package/fesm2022/cngx-ui-breadcrumb.mjs +60 -80
  16. package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
  17. package/fesm2022/cngx-ui-chart-panel.mjs +18 -31
  18. package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -1
  19. package/fesm2022/cngx-ui-collection.mjs +28 -44
  20. package/fesm2022/cngx-ui-collection.mjs.map +1 -1
  21. package/fesm2022/cngx-ui-command-palette.mjs +29 -51
  22. package/fesm2022/cngx-ui-command-palette.mjs.map +1 -1
  23. package/fesm2022/cngx-ui-context-menu.mjs +78 -83
  24. package/fesm2022/cngx-ui-context-menu.mjs.map +1 -1
  25. package/fesm2022/cngx-ui-data-grid-accordion.mjs +52 -74
  26. package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
  27. package/fesm2022/cngx-ui-empty-state.mjs +17 -44
  28. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
  29. package/fesm2022/cngx-ui-feedback.mjs +589 -467
  30. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  31. package/fesm2022/cngx-ui-layout.mjs +17 -13
  32. package/fesm2022/cngx-ui-layout.mjs.map +1 -1
  33. package/fesm2022/cngx-ui-mat-accordion.mjs +3 -5
  34. package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
  35. package/fesm2022/cngx-ui-mat-paginator.mjs +5 -9
  36. package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -1
  37. package/fesm2022/cngx-ui-mat-stepper.mjs +6 -9
  38. package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
  39. package/fesm2022/cngx-ui-mat-tabs.mjs +71 -68
  40. package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
  41. package/fesm2022/cngx-ui-nav-rail.mjs +440 -0
  42. package/fesm2022/cngx-ui-nav-rail.mjs.map +1 -0
  43. package/fesm2022/cngx-ui-overlay.mjs +9 -10
  44. package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
  45. package/fesm2022/cngx-ui-paginator.mjs +149 -171
  46. package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
  47. package/fesm2022/cngx-ui-sidenav.mjs +858 -721
  48. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  49. package/fesm2022/cngx-ui-skeleton.mjs +17 -19
  50. package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
  51. package/fesm2022/cngx-ui-speak.mjs +21 -74
  52. package/fesm2022/cngx-ui-speak.mjs.map +1 -1
  53. package/fesm2022/cngx-ui-stat-card.mjs +39 -62
  54. package/fesm2022/cngx-ui-stat-card.mjs.map +1 -1
  55. package/fesm2022/cngx-ui-stepper.mjs +207 -90
  56. package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
  57. package/fesm2022/cngx-ui-tabs.mjs +71 -32
  58. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  59. package/fesm2022/cngx-ui-timeline.mjs +21 -27
  60. package/fesm2022/cngx-ui-timeline.mjs.map +1 -1
  61. package/fesm2022/cngx-ui-toc.mjs +27 -40
  62. package/fesm2022/cngx-ui-toc.mjs.map +1 -1
  63. package/fesm2022/cngx-ui.mjs +5 -5
  64. package/fesm2022/cngx-ui.mjs.map +1 -1
  65. package/mat-tabs/README.md +28 -14
  66. package/mat-tabs/styles/mat-tabs.css +233 -258
  67. package/nav-rail/README.md +325 -0
  68. package/package.json +10 -5
  69. package/paginator/README.md +10 -0
  70. package/schematics/ng-add/index.js +7 -7
  71. package/schematics/ng-add/schema.json +5 -0
  72. package/sidenav/README.md +150 -55
  73. package/skeleton/README.md +1 -1
  74. package/speak/README.md +1 -2
  75. package/stepper/README.md +20 -5
  76. package/tabs/README.md +13 -0
  77. package/timeline/README.md +1 -1
  78. package/toc/README.md +1 -1
  79. package/types/cngx-ui-a11y.d.ts +20 -38
  80. package/types/cngx-ui-accordion.d.ts +45 -77
  81. package/types/cngx-ui-action-button.d.ts +113 -151
  82. package/types/cngx-ui-breadcrumb.d.ts +58 -94
  83. package/types/cngx-ui-chart-panel.d.ts +22 -40
  84. package/types/cngx-ui-collection.d.ts +30 -53
  85. package/types/cngx-ui-command-palette.d.ts +40 -64
  86. package/types/cngx-ui-context-menu.d.ts +67 -44
  87. package/types/cngx-ui-data-grid-accordion.d.ts +49 -77
  88. package/types/cngx-ui-empty-state.d.ts +18 -8
  89. package/types/cngx-ui-feedback.d.ts +264 -289
  90. package/types/cngx-ui-layout.d.ts +4 -12
  91. package/types/cngx-ui-mat-accordion.d.ts +2 -3
  92. package/types/cngx-ui-mat-paginator.d.ts +4 -10
  93. package/types/cngx-ui-mat-stepper.d.ts +5 -10
  94. package/types/cngx-ui-mat-tabs.d.ts +43 -69
  95. package/types/cngx-ui-nav-rail.d.ts +416 -0
  96. package/types/cngx-ui-overlay.d.ts +4 -13
  97. package/types/cngx-ui-paginator.d.ts +164 -154
  98. package/types/cngx-ui-sidenav.d.ts +557 -437
  99. package/types/cngx-ui-skeleton.d.ts +7 -13
  100. package/types/cngx-ui-speak.d.ts +40 -24
  101. package/types/cngx-ui-stat-card.d.ts +45 -36
  102. package/types/cngx-ui-stepper.d.ts +183 -62
  103. package/types/cngx-ui-tabs.d.ts +101 -27
  104. package/types/cngx-ui-timeline.d.ts +20 -48
  105. package/types/cngx-ui-toc.d.ts +30 -51
  106. package/types/cngx-ui.d.ts +1 -1
@@ -6,36 +6,36 @@
6
6
  * `<a>.mat-mdc-tab-link` elements (nav bar) and the trailing-edge
7
7
  * molecule wrapper; this stylesheet paints them. Tokens stay under the
8
8
  * Material-bridge namespace (`--cngx-mat-tab-*` / `--cngx-mat-tabs-
9
- * more-*`) - no `--cngx-color-*` fallbacks because the Material
10
- * design system owns the canonical theme. Shipped as a standalone
11
- * stylesheet asset (consumer imports once in their global
12
- * stylesheet) because Angular only allows `styleUrl` on
13
- * `@Component`, not on `@Directive`.
9
+ * more-*`). Shipped as a standalone stylesheet asset (consumer imports
10
+ * once in their global stylesheet) because Angular only allows
11
+ * `styleUrl` on `@Component`, not on `@Directive`.
14
12
  *
15
13
  * **State modifiers**
16
14
  *
17
- * - `.cngx-mat-tab--error` - rejected commit; tinted color, outline
18
- * ring, font-weight bump. Specificity bump `.mat-mdc-tab.cngx-
19
- * mat-tab--error` is load-bearing - Material 21's `.mdc-tab` sets
20
- * `outline: none` at (0,1,0). `[data-reason="failed"]` stays in the
21
- * error red; `[data-reason="refused"]` (the commit action answered
22
- * `false`) takes the rejection amber and keeps the resting label colour
23
- * - `.cngx-mat-tab__rejection-icon` - `aria-hidden` glyph disc the
24
- * decoration appends to the rejected tab: `!` on a failed commit,
25
- * `\2298` on a refused one, so the two never differ by colour alone.
26
- * On its own it sits at the tab's trailing top corner, the spot and size
27
- * of the has-errors badge; when the tab also carries that badge it drops
28
- * back inline after the label, so the two discs never overlap
15
+ * - `.cngx-mat-tab--error` - rejected commit, marked by colour only: the
16
+ * label takes the reason colour plus a font-weight bump, no outline and
17
+ * no surface. Specificity bump `.mat-mdc-tab.cngx-mat-tab--error` is
18
+ * load-bearing against Material's unlayered (0,1,0) tab rules.
19
+ * `[data-reason="failed"]` takes the error red; `[data-reason="refused"]`
20
+ * (the commit action answered `false`) the refused amber, label included
21
+ * - `.cngx-mat-tab__rejection-icon` - `aria-hidden` standalone icon the
22
+ * decoration appends to the rejected tab, after the label: an alert
23
+ * triangle on a failed commit, a slashed circle on a refused one, so the
24
+ * two never differ by colour alone
29
25
  * - `.cngx-mat-tab--error` + `.mat-mdc-tab-disabled` - no extra rule:
30
- * Material paints the disabled label colour and the error outline
26
+ * Material paints the disabled label colour and the rejection icon
31
27
  * stays, so it does not pass for a healthy disabled tab
32
- * - `.cngx-mat-tab--has-errors` - form-validation errors present;
33
- * renders an `::after` red disc with an `!` glyph at the trailing
34
- * corner. Distinct semantic from `--error` and the two coexist
35
- * - `.cngx-mat-tab--error.cngx-mat-tab--has-errors` - co-occurrence;
36
- * shifts the has-errors glyph inward via
37
- * `--cngx-mat-tab-has-errors-glyph-offset-stacked` so the two
38
- * signals do not merge
28
+ * - `.cngx-mat-tab--has-errors` - form-validation errors present; the
29
+ * decoration appends an `aria-hidden` alert icon
30
+ * (`.cngx-mat-tab__error-badge`) after the label. Distinct semantic from
31
+ * `--error` and the two coexist: the badge comes first, the rejection
32
+ * icon after it
33
+ * - `.cngx-mat-tab__icon-svg` - the `<svg>` inside both icons, built from
34
+ * the shared `@cngx/utils` icon data; `--stroke` marks an outline icon
35
+ *
36
+ * Under forced colors the icons paint CanvasText and a rejected tab gets
37
+ * an inset CanvasText outline, the one cue that survives the system
38
+ * palette.
39
39
  *
40
40
  * **Trailing-edge overflow**
41
41
  *
@@ -51,31 +51,29 @@
51
51
  *
52
52
  * **Material wiring**
53
53
  *
54
- * Every `--cngx-mat-tab-*` token except the has-errors glyph size is
55
- * `@property`-registered, the colour tokens with a literal oklch initial value,
56
- * so a registered value always wins over an inline `var()` fallback - this
57
- * stylesheet therefore carries no `--mat-sys-*` fallbacks of its own. The two
58
- * refused tokens register without an initial value, so their amber and
59
- * resting-text fallbacks apply until a theme sets them. The size exception,
60
- * `--cngx-mat-tab-has-errors-glyph-size`, is deliberately left unregistered so
61
- * its `rem` fallback scales with text-only zoom (see its note below). The
62
- * Material alignment is delivered by the
63
- * `@cngx/themes/material/tabs-theme` bridge (`@include tabs.theme($theme)`),
64
- * which sets the colour tokens on `.mat-mdc-tab-group`:
54
+ * The colour tokens are `@property`-registered without an initial value
55
+ * and set per colour scheme below, so the bridge's value on the
56
+ * tab group wins by inheritance. The `@cngx/themes/material/tabs-theme`
57
+ * bridge (`@include tabs.theme($theme)`) sets them on `.mat-mdc-tab-group`:
65
58
  *
66
59
  * - `--cngx-mat-tab-error-color` <- `--mat-sys-error`
67
60
  * - `--cngx-mat-tab-refused-color` <- `--mat-sys-tertiary`
61
+ * - `--cngx-mat-tab-refused-text-color` <- `--mat-sys-tertiary`
68
62
  * - `--cngx-mat-tab-has-errors-color` <- `--mat-sys-error`
69
- * - `--cngx-mat-tab-has-errors-glyph-color` <- `--mat-sys-on-error`
70
63
  * - `--cngx-mat-tabs-more-bg` <- `--mat-sys-surface`
71
64
  *
72
- * Imported standalone (no bridge), the tokens keep the literal defaults
73
- * declared below.
65
+ * Imported standalone (no bridge), the colours derive from the cngx
66
+ * foundation danger / warning / text tokens when they are present and
67
+ * from the same literal values otherwise, with a light and a dark set:
68
+ * the failed colour reads --cngx-color-danger-text, falling back to danger
69
+ * at the core text-rung lightness (4.5:1 as label text), the refused amber
70
+ * is warning mixed 70% (icon) and 55% (label) toward it.
74
71
  *
75
72
  * **Dark mode**
76
73
  *
77
- * Three hooks deepen the trailing-edge wrapper background and its
78
- * gradient-fade shadow so the molecule blends into a dark page
74
+ * Three hooks switch the error, refused and has-errors colours to their
75
+ * dark-scheme values, and deepen the trailing-edge wrapper background and
76
+ * its gradient-fade shadow so the molecule blends into a dark page
79
77
  * surface rather than into a white-on-dark seam:
80
78
  *
81
79
  * - `prefers-color-scheme: dark`
@@ -85,24 +83,23 @@
85
83
 
86
84
  @layer cngx.tokens {
87
85
  /**
88
- * Text + outline color of a rejected tab. Wired to `--mat-sys-error`
89
- * by the `@cngx/themes/material/tabs-theme` bridge; standalone it keeps
90
- * the literal default below.
86
+ * Label and icon colour of a failed tab (the commit action threw).
87
+ * Registered without an initial value and set per colour scheme
88
+ * below. Wired to `--mat-sys-error` by the
89
+ * `@cngx/themes/material/tabs-theme` bridge.
91
90
  * @group State / Error
92
91
  */
93
92
  @property --cngx-mat-tab-error-color {
94
- syntax: '<color>';
93
+ syntax: '*';
95
94
  inherits: true;
96
- initial-value: oklch(0.45 0.15 25);
97
95
  }
98
96
 
99
97
  /**
100
- * Outline and glyph-disc colour of a refused tab (the commit action
101
- * answered `false`). A refusal is no error, so it wears the rejection
102
- * amber; a failed commit keeps `--cngx-mat-tab-error-color`. Registered
103
- * without an initial value, so the amber fallback applies until a theme
104
- * sets it. Wired to `--mat-sys-tertiary` by the
105
- * `@cngx/themes/material/tabs-theme` bridge.
98
+ * Icon colour of a refused tab (the commit action answered `false`). A
99
+ * refusal is no error, so it wears amber; a failed commit keeps
100
+ * `--cngx-mat-tab-error-color`. Registered without an initial value and
101
+ * set per colour scheme below. Wired to `--mat-sys-tertiary`
102
+ * by the `@cngx/themes/material/tabs-theme` bridge.
106
103
  * @group State / Refused
107
104
  */
108
105
  @property --cngx-mat-tab-refused-color {
@@ -111,8 +108,9 @@
111
108
  }
112
109
 
113
110
  /**
114
- * Text color of a refused tab. Defaults to the resting tab text colour:
115
- * amber text would fall under the 4.5:1 text contrast.
111
+ * Label colour of a refused tab: a darker amber than the icon, so the
112
+ * text clears 4.5:1. Registered without an initial value and set per
113
+ * colour scheme below.
116
114
  * @group State / Refused
117
115
  */
118
116
  @property --cngx-mat-tab-refused-text-color {
@@ -121,43 +119,33 @@
121
119
  }
122
120
 
123
121
  /**
124
- * Gap between a rejected tab's label and its rejection glyph disc when
125
- * the disc sits inline (the tab also carries the has-errors badge, which
126
- * keeps the corner), derived from the spacing scale (`--cngx-space-xs`)
127
- * below. The disc itself shares `--cngx-mat-tab-has-errors-glyph-size`.
122
+ * Rendered size of the rejection icon after the label, in `em` of the
123
+ * tab label font. The universal syntax keeps the `em` unresolved until
124
+ * the icon reads it.
128
125
  * @group State / Error
129
126
  */
130
- @property --cngx-mat-tab-rejection-icon-gap {
127
+ @property --cngx-mat-tab-rejection-icon-size {
131
128
  syntax: '*';
132
- inherits: false;
133
- initial-value: 0.25rem;
134
- }
135
-
136
- /* Read on the glyph itself (inherits: false), so the scale SET lands there. */
137
- .cngx-mat-tab__rejection-icon {
138
- --cngx-mat-tab-rejection-icon-gap: var(--cngx-space-xs, 0.25rem);
129
+ inherits: true;
130
+ initial-value: 1.15em;
139
131
  }
140
132
 
141
133
  /**
142
- * Outline shorthand of a rejected tab.
134
+ * Gap between a tab's label and the icons after it (the has-errors
135
+ * badge and the rejection icon), derived from the spacing scale
136
+ * (`--cngx-space-xs`) below.
143
137
  * @group State / Error
144
138
  */
145
- @property --cngx-mat-tab-error-outline {
139
+ @property --cngx-mat-tab-icon-gap {
146
140
  syntax: '*';
147
141
  inherits: false;
148
- initial-value: 2px solid currentColor;
142
+ initial-value: 0.25rem;
149
143
  }
150
144
 
151
- /**
152
- * Outline offset of the rejected-tab outline. Negative by default: the
153
- * Material label container clips its overflow, so an outline outside the
154
- * tab box would lose its top, bottom and trailing edges.
155
- * @group State / Error
156
- */
157
- @property --cngx-mat-tab-error-outline-offset {
158
- syntax: '<length>';
159
- inherits: false;
160
- initial-value: -2px;
145
+ /* Read on the icons themselves (inherits: false), so the scale SET lands there. */
146
+ .cngx-mat-tab__rejection-icon,
147
+ .cngx-mat-tab__error-badge {
148
+ --cngx-mat-tab-icon-gap: var(--cngx-space-xs, 0.25rem);
161
149
  }
162
150
 
163
151
  /**
@@ -171,71 +159,26 @@
171
159
  }
172
160
 
173
161
  /**
174
- * Inset of the `has-errors` glyph from the tab edges.
175
- * @group State / HasErrors
176
- */
177
- @property --cngx-mat-tab-has-errors-glyph-offset {
178
- syntax: '<length>';
179
- inherits: false;
180
- initial-value: 4px;
181
- }
182
-
183
- /**
184
- * Larger inset when the tab is BOTH rejected and carries form
185
- * errors - keeps the two signals visually distinct.
186
- * @group State / HasErrors
187
- */
188
- @property --cngx-mat-tab-has-errors-glyph-offset-stacked {
189
- syntax: '<length>';
190
- inherits: false;
191
- initial-value: 6px;
192
- }
193
-
194
- /*
195
- * Diameter of the `has-errors` glyph disc. Intentionally NOT
196
- * @property-registered - the one exception to the all-tokens-registered
197
- * note above. A registered `<length>` computes a `rem` value to an absolute
198
- * px once, pinning the badge to a fixed size and defeating text-only zoom.
199
- * Left unregistered so the `var(--..., 1rem)` fallbacks at the glyph rule
200
- * scale the disc and glyph together with the root font-size. Still
201
- * consumer-overridable - set `--cngx-mat-tab-has-errors-glyph-size` on any
202
- * ancestor and the `var()` use-sites pick it up; it just no longer appears on
203
- * the compodoc Theming tab (unregistered tokens carry no typed metadata).
204
- */
205
-
206
- /**
207
- * Background of the `has-errors` glyph disc. Wired to `--mat-sys-error`
208
- * by the `@cngx/themes/material/tabs-theme` bridge; standalone it keeps
209
- * the literal default below. Inherits so a host-level override reaches
210
- * the `::after` glyph.
162
+ * Colour of the `has-errors` alert icon after the label. Registered
163
+ * without an initial value and set per colour scheme below.
164
+ * Wired to `--mat-sys-error` by the `@cngx/themes/material/tabs-theme`
165
+ * bridge.
211
166
  * @group State / HasErrors
212
167
  */
213
168
  @property --cngx-mat-tab-has-errors-color {
214
- syntax: '<color>';
169
+ syntax: '*';
215
170
  inherits: true;
216
- initial-value: oklch(0.45 0.15 25);
217
171
  }
218
172
 
219
173
  /**
220
- * Glyph color inside the `has-errors` disc. Wired to `--mat-sys-on-error`
221
- * by the `@cngx/themes/material/tabs-theme` bridge; standalone it keeps
222
- * the literal default below.
174
+ * Rendered size of the `has-errors` alert icon, in `em` of the tab
175
+ * label font.
223
176
  * @group State / HasErrors
224
177
  */
225
- @property --cngx-mat-tab-has-errors-glyph-color {
226
- syntax: '<color>';
178
+ @property --cngx-mat-tab-has-errors-icon-size {
179
+ syntax: '*';
227
180
  inherits: true;
228
- initial-value: oklch(1 0 0);
229
- }
230
-
231
- /**
232
- * Font-weight of the `has-errors` glyph (`!`).
233
- * @group State / HasErrors
234
- */
235
- @property --cngx-mat-tab-has-errors-font-weight {
236
- syntax: '<number>';
237
- inherits: false;
238
- initial-value: 700;
181
+ initial-value: 1.15em;
239
182
  }
240
183
 
241
184
  /**
@@ -278,8 +221,6 @@
278
221
  * its own; the `@cngx/themes/material/tabs-theme` bridge supersedes them
279
222
  * by setting `--cngx-mat-tabs-more-bg` to `--mat-sys-surface` on the tab
280
223
  * group, a nearer ancestor of the wrapper, so it wins by inheritance.
281
- * Stays under the Material-bridge namespace (no `--cngx-color-*`
282
- * delegation) per the file-header contract.
283
224
  */
284
225
  :root {
285
226
  --cngx-mat-tabs-more-bg: oklch(1 0 0);
@@ -304,118 +245,144 @@
304
245
  --cngx-mat-tabs-more-bg: oklch(1 0 0);
305
246
  --cngx-mat-tabs-more-shadow: -8px 0 8px -4px oklch(0 0 0 / 0.1);
306
247
  }
248
+
249
+ /*
250
+ * Error, refused and has-errors colours per scheme. The selectors mirror
251
+ * the foundation scheme blocks in `@cngx/core/theming/system-tokens.css`
252
+ * (OS auto-follow on `:root`, explicit dark / light on any element), so a
253
+ * `[data-color-scheme]` / `.dark` island switches them too.
254
+ */
255
+ :root {
256
+ --cngx-mat-tab-error-color: var(
257
+ --cngx-color-danger-text,
258
+ oklch(from var(--cngx-color-danger, oklch(0.6 0.18 25)) 0.46 c h)
259
+ );
260
+ --cngx-mat-tab-has-errors-color: var(--cngx-color-danger, oklch(0.6 0.18 25));
261
+ --cngx-mat-tab-refused-color: color-mix(
262
+ in oklab,
263
+ var(--cngx-color-warning, oklch(0.72 0.15 75)) 70%,
264
+ var(--cngx-color-text, oklch(0.2 0.01 250))
265
+ );
266
+ --cngx-mat-tab-refused-text-color: color-mix(
267
+ in oklab,
268
+ var(--cngx-color-warning, oklch(0.72 0.15 75)) 55%,
269
+ var(--cngx-color-text, oklch(0.2 0.01 250))
270
+ );
271
+ }
272
+
273
+ @media (prefers-color-scheme: dark) {
274
+ :root:not([data-color-scheme='light']):not(.light) {
275
+ --cngx-mat-tab-error-color: var(
276
+ --cngx-color-danger-text,
277
+ oklch(from var(--cngx-color-danger, oklch(0.68 0.17 25)) 0.74 c h)
278
+ );
279
+ --cngx-mat-tab-has-errors-color: var(--cngx-color-danger, oklch(0.68 0.17 25));
280
+ --cngx-mat-tab-refused-color: color-mix(
281
+ in oklab,
282
+ var(--cngx-color-warning, oklch(0.78 0.14 75)) 70%,
283
+ var(--cngx-color-text, oklch(0.95 0.01 250))
284
+ );
285
+ --cngx-mat-tab-refused-text-color: color-mix(
286
+ in oklab,
287
+ var(--cngx-color-warning, oklch(0.78 0.14 75)) 55%,
288
+ var(--cngx-color-text, oklch(0.95 0.01 250))
289
+ );
290
+ }
291
+ }
292
+
293
+ [data-color-scheme='dark'],
294
+ .dark {
295
+ --cngx-mat-tab-error-color: var(
296
+ --cngx-color-danger-text,
297
+ oklch(from var(--cngx-color-danger, oklch(0.68 0.17 25)) 0.74 c h)
298
+ );
299
+ --cngx-mat-tab-has-errors-color: var(--cngx-color-danger, oklch(0.68 0.17 25));
300
+ --cngx-mat-tab-refused-color: color-mix(
301
+ in oklab,
302
+ var(--cngx-color-warning, oklch(0.78 0.14 75)) 70%,
303
+ var(--cngx-color-text, oklch(0.95 0.01 250))
304
+ );
305
+ --cngx-mat-tab-refused-text-color: color-mix(
306
+ in oklab,
307
+ var(--cngx-color-warning, oklch(0.78 0.14 75)) 55%,
308
+ var(--cngx-color-text, oklch(0.95 0.01 250))
309
+ );
310
+ }
311
+
312
+ [data-color-scheme='light'],
313
+ .light {
314
+ --cngx-mat-tab-error-color: var(
315
+ --cngx-color-danger-text,
316
+ oklch(from var(--cngx-color-danger, oklch(0.6 0.18 25)) 0.46 c h)
317
+ );
318
+ --cngx-mat-tab-has-errors-color: var(--cngx-color-danger, oklch(0.6 0.18 25));
319
+ --cngx-mat-tab-refused-color: color-mix(
320
+ in oklab,
321
+ var(--cngx-color-warning, oklch(0.72 0.15 75)) 70%,
322
+ var(--cngx-color-text, oklch(0.2 0.01 250))
323
+ );
324
+ --cngx-mat-tab-refused-text-color: color-mix(
325
+ in oklab,
326
+ var(--cngx-color-warning, oklch(0.72 0.15 75)) 55%,
327
+ var(--cngx-color-text, oklch(0.2 0.01 250))
328
+ );
329
+ }
307
330
  }
308
331
 
309
332
  @layer cngx.components {
310
333
  /*
311
- * Rejection glyph. `::before` (Material's focus indicator) and `::after`
312
- * (the has-errors badge) are taken, so the decoration appends this
313
- * `aria-hidden` span to the tab element itself, next to its
314
- * screen-reader descriptor. Laid out inline after the label row by
315
- * default; the corner rule below lifts it out when the corner is free.
334
+ * The has-errors badge and the rejection icon. `::before` is Material's
335
+ * focus indicator, so the decorations append these `aria-hidden` spans
336
+ * to the tab element itself, next to their screen-reader descriptors.
337
+ * Material's `.mdc-tab` is a centred flex row, so both follow
338
+ * `.mdc-tab__content` (the label) and centre with it; `order` keeps the
339
+ * badge before the rejection icon whichever decoration mounts first.
340
+ * Standalone stroke glyphs, no disc.
316
341
  */
342
+ .cngx-mat-tab__error-badge,
317
343
  .cngx-mat-tab__rejection-icon {
318
344
  display: inline-flex;
319
345
  align-items: center;
320
- justify-content: center;
321
346
  flex: 0 0 auto;
322
347
  align-self: center;
323
- width: var(--cngx-mat-tab-has-errors-glyph-size, 1rem);
324
- height: var(--cngx-mat-tab-has-errors-glyph-size, 1rem);
325
- margin-inline-start: var(--cngx-mat-tab-rejection-icon-gap, 0.25rem);
326
- border-radius: 50%;
327
- background: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
328
- color: var(--cngx-mat-tab-has-errors-glyph-color, oklch(1 0 0));
329
- font-size: calc(var(--cngx-mat-tab-has-errors-glyph-size, 1rem) * 0.75);
330
- font-weight: var(--cngx-mat-tab-has-errors-font-weight, 700);
331
- line-height: 1;
348
+ margin-inline-start: var(--cngx-mat-tab-icon-gap, 0.25rem);
332
349
  pointer-events: none;
333
350
  }
334
351
 
335
- .cngx-mat-tab__rejection-icon[data-reason='refused'] {
336
- background: var(--cngx-mat-tab-refused-color, oklch(0.62 0.15 60));
352
+ .cngx-mat-tab__error-badge {
353
+ order: 1;
354
+ color: var(--cngx-mat-tab-has-errors-color, oklch(0.6 0.18 25));
337
355
  }
338
356
 
339
- /*
340
- * No has-errors badge on the tab: the disc takes the badge's corner.
341
- * It resolves against the tab (Material's `.mdc-tab` is
342
- * `position: relative`; set here too for a bare tab link), which is why
343
- * the decoration never mounts it inside `.mdc-tab__content`, itself a
344
- * positioning context.
345
- */
346
- .mat-mdc-tab.cngx-mat-tab--error:not(.cngx-mat-tab--has-errors),
347
- .mat-mdc-tab-link.cngx-mat-tab--error:not(.cngx-mat-tab--has-errors) {
348
- position: relative;
357
+ .cngx-mat-tab__rejection-icon {
358
+ order: 2;
359
+ color: var(--cngx-mat-tab-error-color, oklch(0.5 0.14 25));
349
360
  }
350
361
 
351
- .cngx-mat-tab--error:not(.cngx-mat-tab--has-errors) > .cngx-mat-tab__rejection-icon {
352
- position: absolute;
353
- top: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
354
- inset-inline-end: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
355
- margin: 0;
356
- z-index: 1;
362
+ .cngx-mat-tab__rejection-icon[data-reason='refused'] {
363
+ color: var(--cngx-mat-tab-refused-color, oklch(0.56 0.11 74));
357
364
  }
358
365
 
359
366
  /*
360
- * A disabled-and-rejected tab takes no fade: Material paints the
361
- * disabled label colour, and the error outline above keeps it apart
362
- * from a healthy disabled tab. Disabled is colour, never opacity.
367
+ * The icons' `<svg>`, built and painted by the decorations from the shared
368
+ * icon data. Both draw on the 24-unit grid at stroke width 2, sized in em
369
+ * of the tab label font.
363
370
  */
371
+ .cngx-mat-tab__icon-svg {
372
+ --cngx-icon-svg-size: 1.15em;
373
+ --cngx-icon-svg-stroke-width: 2;
364
374
 
365
- /*
366
- * Per-tab form-error aggregation badge. Distinct semantic from
367
- * `--error` - `--error` means "your last commit was refused";
368
- * `--has-errors` means "this tab contains form-validation errors
369
- * right now". The two coexist and a tab can carry both
370
- * simultaneously.
371
- */
372
- .cngx-mat-tab--has-errors {
373
- position: relative;
375
+ /* Functional - hardcoded */
376
+ display: block;
377
+ flex: none;
374
378
  }
375
379
 
376
- /*
377
- * The badge lives on `::after` because Material owns `::before` on every
378
- * `.mat-focus-indicator` tab: with `mat.strong-focus-indicators()` its
379
- * unlayered rule (`display`, `inset`, `border`, and `content: ''` on
380
- * focus) beats any rule in this layer regardless of specificity, which
381
- * hid the badge entirely and stole the focus ring's pseudo-element.
382
- */
383
- .mat-mdc-tab.cngx-mat-tab--has-errors::after,
384
- .mat-mdc-tab-link.cngx-mat-tab--has-errors::after {
385
- content: '!' / '';
386
- position: absolute;
387
- top: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
388
- inset-inline-end: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
389
- inset-inline-start: auto;
390
- bottom: auto;
391
- display: inline-flex;
392
- align-items: center;
393
- justify-content: center;
394
- width: var(--cngx-mat-tab-has-errors-glyph-size, 1rem);
395
- height: var(--cngx-mat-tab-has-errors-glyph-size, 1rem);
396
- margin: 0;
397
- border: 0;
398
- border-radius: 50%;
399
- background: var(--cngx-mat-tab-has-errors-color, oklch(0.45 0.15 25));
400
- color: var(--cngx-mat-tab-has-errors-glyph-color, oklch(1 0 0));
401
- font-size: calc(var(--cngx-mat-tab-has-errors-glyph-size, 1rem) * 0.75);
402
- font-weight: var(--cngx-mat-tab-has-errors-font-weight, 700);
403
- line-height: 1;
404
- pointer-events: none;
405
- z-index: 1;
380
+ .cngx-mat-tab__error-badge > .cngx-mat-tab__icon-svg {
381
+ --cngx-icon-svg-size: var(--cngx-mat-tab-has-errors-icon-size, 1.15em);
406
382
  }
407
383
 
408
- /*
409
- * Co-occurrence: when a tab is BOTH rejected and carries form
410
- * errors, the rejection outline already draws focus to the edges;
411
- * shift the has-errors badge slightly inward so the two signals
412
- * read as distinct rather than visually merging. The rejection disc
413
- * leaves the corner to the badge and sits inline after the label.
414
- */
415
- .mat-mdc-tab.cngx-mat-tab--error.cngx-mat-tab--has-errors::after,
416
- .mat-mdc-tab-link.cngx-mat-tab--error.cngx-mat-tab--has-errors::after {
417
- top: var(--cngx-mat-tab-has-errors-glyph-offset-stacked, 6px);
418
- inset-inline-end: var(--cngx-mat-tab-has-errors-glyph-offset-stacked, 6px);
384
+ .cngx-mat-tab__rejection-icon > .cngx-mat-tab__icon-svg {
385
+ --cngx-icon-svg-size: var(--cngx-mat-tab-rejection-icon-size, 1.15em);
419
386
  }
420
387
 
421
388
  /*
@@ -465,13 +432,14 @@
465
432
  }
466
433
 
467
434
  /*
468
- * Rejected-tab paint. Unlayered on purpose: Material ships its tab styles
469
- * unlayered through the component decorator (`.mdc-tab { outline: none }`,
470
- * the font-weight on `.mat-mdc-tab`), and an unlayered rule beats every
471
- * layered one whatever its specificity, so inside `@layer cngx.components`
472
- * the outline and the weight never painted. Out here the specificity bump to
473
- * `.mat-mdc-tab.cngx-mat-tab--error` (0,2,0) decides against Material's
474
- * (0,1,0) rules, which are injected after the global styles.
435
+ * Rejected-tab paint: colour only, no outline and no surface. Unlayered on
436
+ * purpose: Material ships its tab styles unlayered through the component
437
+ * decorator (the font-weight on `.mat-mdc-tab`), and an unlayered rule beats
438
+ * every layered one whatever its specificity, so inside
439
+ * `@layer cngx.components` the weight never painted. Out here the
440
+ * specificity bump to `.mat-mdc-tab.cngx-mat-tab--error` (0,2,0) decides
441
+ * against Material's (0,1,0) rules, which are injected after the global
442
+ * styles.
475
443
  *
476
444
  * `.mat-mdc-tab-link` carries the same decoration for the native
477
445
  * `[cngxMatTabNav]` bridge - the link element is also (0,1,0), so the
@@ -479,48 +447,55 @@
479
447
  *
480
448
  * The label text is painted by Material on `.mdc-tab__text-label` from its
481
449
  * own `--mat-tab-*-label-text-color` tokens, up to (0,4,0) for the active
482
- * hovered tab, so a colour on the tab never reached it. A failed tab sets
483
- * those tokens instead; the label inherits them past every Material state
484
- * selector, and the disabled colour stays Material's.
450
+ * hovered tab, so a colour on the tab never reached it. A rejected tab sets
451
+ * those tokens instead, from the reason colour; the label inherits them
452
+ * past every Material state selector, and the disabled colour stays
453
+ * Material's.
485
454
  */
486
455
  .mat-mdc-tab.cngx-mat-tab--error,
487
456
  .mat-mdc-tab-link.cngx-mat-tab--error {
488
- color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
489
- outline: var(--cngx-mat-tab-error-outline, 2px solid currentColor);
490
- outline-offset: var(--cngx-mat-tab-error-outline-offset, -2px);
457
+ --_cngx-mat-tab-rejection-text: var(--cngx-mat-tab-error-color, oklch(0.5 0.14 25));
458
+ --mat-tab-inactive-label-text-color: var(--_cngx-mat-tab-rejection-text, oklch(0.5 0.14 25));
459
+ --mat-tab-inactive-focus-label-text-color: var(
460
+ --_cngx-mat-tab-rejection-text,
461
+ oklch(0.5 0.14 25)
462
+ );
463
+ --mat-tab-inactive-hover-label-text-color: var(
464
+ --_cngx-mat-tab-rejection-text,
465
+ oklch(0.5 0.14 25)
466
+ );
467
+ --mat-tab-active-label-text-color: var(--_cngx-mat-tab-rejection-text, oklch(0.5 0.14 25));
468
+ --mat-tab-active-focus-label-text-color: var(--_cngx-mat-tab-rejection-text, oklch(0.5 0.14 25));
469
+ --mat-tab-active-hover-label-text-color: var(--_cngx-mat-tab-rejection-text, oklch(0.5 0.14 25));
470
+ color: var(--_cngx-mat-tab-rejection-text, oklch(0.5 0.14 25));
491
471
  font-weight: var(--cngx-mat-tab-error-font-weight, 600);
492
472
  }
493
473
 
494
- .mat-mdc-tab.cngx-mat-tab--error:not([data-reason='refused']),
495
- .mat-mdc-tab-link.cngx-mat-tab--error:not([data-reason='refused']) {
496
- --mat-tab-inactive-label-text-color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
497
- --mat-tab-inactive-focus-label-text-color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
498
- --mat-tab-inactive-hover-label-text-color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
499
- --mat-tab-active-label-text-color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
500
- --mat-tab-active-focus-label-text-color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
501
- --mat-tab-active-hover-label-text-color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
502
- }
503
-
504
474
  /*
505
- * A refused commit is no error: the outline and the glyph disc take the
506
- * rejection amber, the text keeps its resting colour (amber text would
507
- * fall under the 4.5:1 text contrast), so its label keeps Material's
508
- * tokens. A failed one stays red above.
475
+ * A refused commit is no error: the label takes the refused amber (the
476
+ * darker text step, 4.5:1), the icon the brighter one. A failed one stays
477
+ * red above.
509
478
  */
510
479
  .mat-mdc-tab.cngx-mat-tab--error[data-reason='refused'],
511
480
  .mat-mdc-tab-link.cngx-mat-tab--error[data-reason='refused'] {
512
- color: var(--cngx-mat-tab-refused-text-color, currentColor);
513
- outline-color: var(--cngx-mat-tab-refused-color, oklch(0.62 0.15 60));
481
+ --_cngx-mat-tab-rejection-text: var(--cngx-mat-tab-refused-text-color, oklch(0.49 0.07 75));
514
482
  }
515
483
 
516
- /* forced-colors (WHCM): the glyph disc is a background fill, which the forced
517
- * palette drops. Paint it in system colours so the refused and the failed
518
- * glyph both keep their disc; the outline contour survives on its own.
519
- * Unlayered to beat the layered component rule. */
484
+ /* forced-colors (WHCM): the icons are bare stroke glyphs painting in
485
+ * currentColor; pin them to CanvasText so they never leave the system
486
+ * palette. The label colour is forced away, so an inset CanvasText outline
487
+ * (no layout shift) keeps a rejected tab distinguishable; the focus ring
488
+ * keeps its own indicator. Unlayered to beat the layered component rule and
489
+ * Material's unlayered `.mdc-tab { outline: none }`. */
520
490
  @media (forced-colors: active) {
491
+ .cngx-mat-tab__error-badge,
521
492
  .cngx-mat-tab__rejection-icon {
522
- forced-color-adjust: none;
523
- background: CanvasText;
524
- color: Canvas;
493
+ color: CanvasText;
494
+ }
495
+
496
+ .mat-mdc-tab.cngx-mat-tab--error:not(:focus-visible),
497
+ .mat-mdc-tab-link.cngx-mat-tab--error:not(:focus-visible) {
498
+ outline: 2px solid CanvasText;
499
+ outline-offset: -2px;
525
500
  }
526
501
  }