@cngx/ui 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 (108) 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 +9 -5
  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 +55 -60
  12. package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
  13. package/fesm2022/cngx-ui-action-button.mjs +220 -339
  14. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  15. package/fesm2022/cngx-ui-breadcrumb.mjs +100 -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 -34
  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 +138 -89
  24. package/fesm2022/cngx-ui-context-menu.mjs.map +1 -1
  25. package/fesm2022/cngx-ui-data-grid-accordion.mjs +135 -77
  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 +648 -495
  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 +6 -7
  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 +315 -134
  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 +212 -188
  46. package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
  47. package/fesm2022/cngx-ui-sidenav.mjs +872 -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 +259 -130
  56. package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
  57. package/fesm2022/cngx-ui-tabs.mjs +148 -50
  58. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  59. package/fesm2022/cngx-ui-timeline.mjs +48 -32
  60. package/fesm2022/cngx-ui-timeline.mjs.map +1 -1
  61. package/fesm2022/cngx-ui-toc.mjs +59 -48
  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 +57 -19
  66. package/mat-tabs/styles/mat-tabs.css +285 -163
  67. package/nav-rail/README.md +325 -0
  68. package/package.json +37 -8
  69. package/paginator/README.md +10 -0
  70. package/schematics/collection.json +9 -0
  71. package/schematics/ng-add/index.js +9 -0
  72. package/schematics/ng-add/schema.json +96 -0
  73. package/schematics/package.json +3 -0
  74. package/sidenav/README.md +150 -55
  75. package/skeleton/README.md +1 -1
  76. package/speak/README.md +1 -2
  77. package/stepper/README.md +20 -5
  78. package/tabs/README.md +13 -0
  79. package/timeline/README.md +1 -1
  80. package/toc/README.md +1 -1
  81. package/types/cngx-ui-a11y.d.ts +20 -38
  82. package/types/cngx-ui-accordion.d.ts +46 -71
  83. package/types/cngx-ui-action-button.d.ts +113 -151
  84. package/types/cngx-ui-breadcrumb.d.ts +60 -85
  85. package/types/cngx-ui-chart-panel.d.ts +22 -40
  86. package/types/cngx-ui-collection.d.ts +30 -43
  87. package/types/cngx-ui-command-palette.d.ts +40 -64
  88. package/types/cngx-ui-context-menu.d.ts +109 -48
  89. package/types/cngx-ui-data-grid-accordion.d.ts +50 -75
  90. package/types/cngx-ui-empty-state.d.ts +18 -8
  91. package/types/cngx-ui-feedback.d.ts +275 -292
  92. package/types/cngx-ui-layout.d.ts +4 -12
  93. package/types/cngx-ui-mat-accordion.d.ts +5 -5
  94. package/types/cngx-ui-mat-paginator.d.ts +4 -10
  95. package/types/cngx-ui-mat-stepper.d.ts +5 -10
  96. package/types/cngx-ui-mat-tabs.d.ts +86 -89
  97. package/types/cngx-ui-nav-rail.d.ts +416 -0
  98. package/types/cngx-ui-overlay.d.ts +4 -13
  99. package/types/cngx-ui-paginator.d.ts +186 -161
  100. package/types/cngx-ui-sidenav.d.ts +557 -437
  101. package/types/cngx-ui-skeleton.d.ts +7 -13
  102. package/types/cngx-ui-speak.d.ts +40 -24
  103. package/types/cngx-ui-stat-card.d.ts +45 -36
  104. package/types/cngx-ui-stepper.d.ts +205 -84
  105. package/types/cngx-ui-tabs.d.ts +104 -28
  106. package/types/cngx-ui-timeline.d.ts +31 -51
  107. package/types/cngx-ui-toc.d.ts +43 -54
  108. package/types/cngx-ui.d.ts +1 -1
@@ -6,28 +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)
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
21
25
  * - `.cngx-mat-tab--error` + `.mat-mdc-tab-disabled` - no extra rule:
22
- * Material paints the disabled label colour and the error outline
26
+ * Material paints the disabled label colour and the rejection icon
23
27
  * stays, so it does not pass for a healthy disabled tab
24
- * - `.cngx-mat-tab--has-errors` - form-validation errors present;
25
- * renders a `::before` red disc with an `!` glyph at the trailing
26
- * corner. Distinct semantic from `--error` and the two coexist
27
- * - `.cngx-mat-tab--error.cngx-mat-tab--has-errors` - co-occurrence;
28
- * shifts the has-errors glyph inward via
29
- * `--cngx-mat-tab-has-errors-glyph-offset-stacked` so the two
30
- * 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.
31
39
  *
32
40
  * **Trailing-edge overflow**
33
41
  *
@@ -43,28 +51,29 @@
43
51
  *
44
52
  * **Material wiring**
45
53
  *
46
- * Every `--cngx-mat-tab-*` token except the has-errors glyph size is
47
- * `@property`-registered with a literal oklch initial value, so a registered
48
- * value always wins over an inline `var()` fallback - this stylesheet
49
- * therefore carries no `--mat-sys-*` fallbacks of its own. The one exception,
50
- * `--cngx-mat-tab-has-errors-glyph-size`, is deliberately left unregistered so
51
- * its `rem` fallback scales with text-only zoom (see its note below). The
52
- * Material alignment is delivered by the
53
- * `@cngx/themes/material/tabs-theme` bridge (`@include tabs.theme($theme)`),
54
- * 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`:
55
58
  *
56
59
  * - `--cngx-mat-tab-error-color` <- `--mat-sys-error`
60
+ * - `--cngx-mat-tab-refused-color` <- `--mat-sys-tertiary`
61
+ * - `--cngx-mat-tab-refused-text-color` <- `--mat-sys-tertiary`
57
62
  * - `--cngx-mat-tab-has-errors-color` <- `--mat-sys-error`
58
- * - `--cngx-mat-tab-has-errors-glyph-color` <- `--mat-sys-on-error`
59
63
  * - `--cngx-mat-tabs-more-bg` <- `--mat-sys-surface`
60
64
  *
61
- * Imported standalone (no bridge), the tokens keep the literal defaults
62
- * 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.
63
71
  *
64
72
  * **Dark mode**
65
73
  *
66
- * Three hooks deepen the trailing-edge wrapper background and its
67
- * 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
68
77
  * surface rather than into a white-on-dark seam:
69
78
  *
70
79
  * - `prefers-color-scheme: dark`
@@ -74,113 +83,102 @@
74
83
 
75
84
  @layer cngx.tokens {
76
85
  /**
77
- * Text + outline color of a rejected tab. Wired to `--mat-sys-error`
78
- * by the `@cngx/themes/material/tabs-theme` bridge; standalone it keeps
79
- * 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.
80
90
  * @group State / Error
81
91
  */
82
92
  @property --cngx-mat-tab-error-color {
83
- syntax: '<color>';
93
+ syntax: '*';
84
94
  inherits: true;
85
- initial-value: oklch(0.45 0.15 25);
86
95
  }
87
96
 
88
97
  /**
89
- * Outline shorthand of a rejected tab.
90
- * @group State / Error
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.
103
+ * @group State / Refused
91
104
  */
92
- @property --cngx-mat-tab-error-outline {
105
+ @property --cngx-mat-tab-refused-color {
93
106
  syntax: '*';
94
- inherits: false;
95
- initial-value: 2px solid currentColor;
107
+ inherits: true;
96
108
  }
97
109
 
98
110
  /**
99
- * Outline offset of the rejected-tab outline.
100
- * @group State / Error
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.
114
+ * @group State / Refused
101
115
  */
102
- @property --cngx-mat-tab-error-outline-offset {
103
- syntax: '<length>';
104
- inherits: false;
105
- initial-value: 1px;
116
+ @property --cngx-mat-tab-refused-text-color {
117
+ syntax: '*';
118
+ inherits: true;
106
119
  }
107
120
 
108
121
  /**
109
- * Font-weight bump of a rejected tab.
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.
110
125
  * @group State / Error
111
126
  */
112
- @property --cngx-mat-tab-error-font-weight {
113
- syntax: '<number>';
114
- inherits: false;
115
- initial-value: 600;
127
+ @property --cngx-mat-tab-rejection-icon-size {
128
+ syntax: '*';
129
+ inherits: true;
130
+ initial-value: 1.15em;
116
131
  }
117
132
 
118
133
  /**
119
- * Inset of the `has-errors` glyph from the tab edges.
120
- * @group State / HasErrors
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.
137
+ * @group State / Error
121
138
  */
122
- @property --cngx-mat-tab-has-errors-glyph-offset {
123
- syntax: '<length>';
139
+ @property --cngx-mat-tab-icon-gap {
140
+ syntax: '*';
124
141
  inherits: false;
125
- initial-value: 4px;
142
+ initial-value: 0.25rem;
143
+ }
144
+
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);
126
149
  }
127
150
 
128
151
  /**
129
- * Larger inset when the tab is BOTH rejected and carries form
130
- * errors - keeps the two signals visually distinct.
131
- * @group State / HasErrors
152
+ * Font-weight bump of a rejected tab.
153
+ * @group State / Error
132
154
  */
133
- @property --cngx-mat-tab-has-errors-glyph-offset-stacked {
134
- syntax: '<length>';
155
+ @property --cngx-mat-tab-error-font-weight {
156
+ syntax: '<number>';
135
157
  inherits: false;
136
- initial-value: 6px;
158
+ initial-value: 600;
137
159
  }
138
160
 
139
- /*
140
- * Diameter of the `has-errors` glyph disc. Intentionally NOT
141
- * @property-registered - the one exception to the all-tokens-registered
142
- * note above. A registered `<length>` computes a `rem` value to an absolute
143
- * px once, pinning the badge to a fixed size and defeating text-only zoom.
144
- * Left unregistered so the `var(--..., 1rem)` fallbacks at the glyph rule
145
- * scale the disc and glyph together with the root font-size. Still
146
- * consumer-overridable - set `--cngx-mat-tab-has-errors-glyph-size` on any
147
- * ancestor and the `var()` use-sites pick it up; it just no longer appears on
148
- * the compodoc Theming tab (unregistered tokens carry no typed metadata).
149
- */
150
-
151
161
  /**
152
- * Background of the `has-errors` glyph disc. Wired to `--mat-sys-error`
153
- * by the `@cngx/themes/material/tabs-theme` bridge; standalone it keeps
154
- * the literal default below. Inherits so a host-level override reaches
155
- * the `::before` 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.
156
166
  * @group State / HasErrors
157
167
  */
158
168
  @property --cngx-mat-tab-has-errors-color {
159
- syntax: '<color>';
169
+ syntax: '*';
160
170
  inherits: true;
161
- initial-value: oklch(0.45 0.15 25);
162
171
  }
163
172
 
164
173
  /**
165
- * Glyph color inside the `has-errors` disc. Wired to `--mat-sys-on-error`
166
- * by the `@cngx/themes/material/tabs-theme` bridge; standalone it keeps
167
- * the literal default below.
174
+ * Rendered size of the `has-errors` alert icon, in `em` of the tab
175
+ * label font.
168
176
  * @group State / HasErrors
169
177
  */
170
- @property --cngx-mat-tab-has-errors-glyph-color {
171
- syntax: '<color>';
178
+ @property --cngx-mat-tab-has-errors-icon-size {
179
+ syntax: '*';
172
180
  inherits: true;
173
- initial-value: oklch(1 0 0);
174
- }
175
-
176
- /**
177
- * Font-weight of the `has-errors` glyph (`!`).
178
- * @group State / HasErrors
179
- */
180
- @property --cngx-mat-tab-has-errors-font-weight {
181
- syntax: '<number>';
182
- inherits: false;
183
- initial-value: 700;
181
+ initial-value: 1.15em;
184
182
  }
185
183
 
186
184
  /**
@@ -223,8 +221,6 @@
223
221
  * its own; the `@cngx/themes/material/tabs-theme` bridge supersedes them
224
222
  * by setting `--cngx-mat-tabs-more-bg` to `--mat-sys-surface` on the tab
225
223
  * group, a nearer ancestor of the wrapper, so it wins by inheritance.
226
- * Stays under the Material-bridge namespace (no `--cngx-color-*`
227
- * delegation) per the file-header contract.
228
224
  */
229
225
  :root {
230
226
  --cngx-mat-tabs-more-bg: oklch(1 0 0);
@@ -249,87 +245,144 @@
249
245
  --cngx-mat-tabs-more-bg: oklch(1 0 0);
250
246
  --cngx-mat-tabs-more-shadow: -8px 0 8px -4px oklch(0 0 0 / 0.1);
251
247
  }
252
- }
253
248
 
254
- @layer cngx.components {
255
249
  /*
256
- * Specificity bump to `.mat-mdc-tab.cngx-mat-tab--error` (0,2,0) is
257
- * load-bearing - Material 21's `.mdc-tab` rule (0,1,0) sets
258
- * `outline: none` to suppress the browser's default focus outline,
259
- * and ships those styles inline via the component decorator. Since
260
- * the component-scoped CSS is injected into `<head>` AFTER the
261
- * `angular.json` global styles when the component first renders,
262
- * a same-specificity rule loses the cascade.
263
- *
264
- * `.mat-mdc-tab-link` carries the same decoration for the native
265
- * `[cngxMatTabNav]` bridge - the link element is also (0,1,0), so the
266
- * doubled selector wins identically.
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.
267
254
  */
268
- .mat-mdc-tab.cngx-mat-tab--error,
269
- .mat-mdc-tab-link.cngx-mat-tab--error {
270
- color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
271
- outline: var(--cngx-mat-tab-error-outline, 2px solid currentColor);
272
- outline-offset: var(--cngx-mat-tab-error-outline-offset, 1px);
273
- font-weight: var(--cngx-mat-tab-error-font-weight, 600);
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
+ );
274
271
  }
275
272
 
276
- /*
277
- * A disabled-and-rejected tab takes no fade: Material paints the
278
- * disabled label colour, and the error outline above keeps it apart
279
- * from a healthy disabled tab. Disabled is colour, never opacity.
280
- */
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
+ }
281
292
 
282
- /*
283
- * Per-tab form-error aggregation badge. Distinct semantic from
284
- * `--error` - `--error` means "your last commit was refused";
285
- * `--has-errors` means "this tab contains form-validation errors
286
- * right now". The two coexist and a tab can carry both
287
- * simultaneously.
288
- */
289
- .cngx-mat-tab--has-errors {
290
- position: relative;
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
+ );
291
310
  }
292
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
+ }
330
+ }
331
+
332
+ @layer cngx.components {
293
333
  /*
294
- * Specificity is `.mat-mdc-tab.cngx-mat-tab--has-errors` (0,2,1)
295
- * to beat Material's own `.mat-focus-indicator::before` (0,1,1)
296
- * which sets `inset: 0` on the same pseudo-element.
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.
297
341
  */
298
- .mat-mdc-tab.cngx-mat-tab--has-errors::before,
299
- .mat-mdc-tab-link.cngx-mat-tab--has-errors::before {
300
- content: '!' / '';
301
- position: absolute;
302
- top: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
303
- inset-inline-end: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
304
- inset-inline-start: auto;
305
- bottom: auto;
342
+ .cngx-mat-tab__error-badge,
343
+ .cngx-mat-tab__rejection-icon {
306
344
  display: inline-flex;
307
345
  align-items: center;
308
- justify-content: center;
309
- width: var(--cngx-mat-tab-has-errors-glyph-size, 1rem);
310
- height: var(--cngx-mat-tab-has-errors-glyph-size, 1rem);
311
- margin: 0;
312
- border: 0;
313
- border-radius: 50%;
314
- background: var(--cngx-mat-tab-has-errors-color, oklch(0.45 0.15 25));
315
- color: var(--cngx-mat-tab-has-errors-glyph-color, oklch(1 0 0));
316
- font-size: calc(var(--cngx-mat-tab-has-errors-glyph-size, 1rem) * 0.75);
317
- font-weight: var(--cngx-mat-tab-has-errors-font-weight, 700);
318
- line-height: 1;
346
+ flex: 0 0 auto;
347
+ align-self: center;
348
+ margin-inline-start: var(--cngx-mat-tab-icon-gap, 0.25rem);
319
349
  pointer-events: none;
320
- z-index: 1;
350
+ }
351
+
352
+ .cngx-mat-tab__error-badge {
353
+ order: 1;
354
+ color: var(--cngx-mat-tab-has-errors-color, oklch(0.6 0.18 25));
355
+ }
356
+
357
+ .cngx-mat-tab__rejection-icon {
358
+ order: 2;
359
+ color: var(--cngx-mat-tab-error-color, oklch(0.5 0.14 25));
360
+ }
361
+
362
+ .cngx-mat-tab__rejection-icon[data-reason='refused'] {
363
+ color: var(--cngx-mat-tab-refused-color, oklch(0.56 0.11 74));
321
364
  }
322
365
 
323
366
  /*
324
- * Co-occurrence: when a tab is BOTH rejected and carries form
325
- * errors, the rejection outline already draws focus to the edges;
326
- * shift the has-errors badge slightly inward so the two signals
327
- * read as distinct rather than visually merging.
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.
328
370
  */
329
- .mat-mdc-tab.cngx-mat-tab--error.cngx-mat-tab--has-errors::before,
330
- .mat-mdc-tab-link.cngx-mat-tab--error.cngx-mat-tab--has-errors::before {
331
- top: var(--cngx-mat-tab-has-errors-glyph-offset-stacked, 6px);
332
- inset-inline-end: var(--cngx-mat-tab-has-errors-glyph-offset-stacked, 6px);
371
+ .cngx-mat-tab__icon-svg {
372
+ --cngx-icon-svg-size: 1.15em;
373
+ --cngx-icon-svg-stroke-width: 2;
374
+
375
+ /* Functional - hardcoded */
376
+ display: block;
377
+ flex: none;
378
+ }
379
+
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);
382
+ }
383
+
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);
333
386
  }
334
387
 
335
388
  /*
@@ -377,3 +430,72 @@
377
430
  border: 0;
378
431
  }
379
432
  }
433
+
434
+ /*
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.
443
+ *
444
+ * `.mat-mdc-tab-link` carries the same decoration for the native
445
+ * `[cngxMatTabNav]` bridge - the link element is also (0,1,0), so the
446
+ * doubled selector wins identically.
447
+ *
448
+ * The label text is painted by Material on `.mdc-tab__text-label` from its
449
+ * own `--mat-tab-*-label-text-color` tokens, up to (0,4,0) for the active
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.
454
+ */
455
+ .mat-mdc-tab.cngx-mat-tab--error,
456
+ .mat-mdc-tab-link.cngx-mat-tab--error {
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));
471
+ font-weight: var(--cngx-mat-tab-error-font-weight, 600);
472
+ }
473
+
474
+ /*
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.
478
+ */
479
+ .mat-mdc-tab.cngx-mat-tab--error[data-reason='refused'],
480
+ .mat-mdc-tab-link.cngx-mat-tab--error[data-reason='refused'] {
481
+ --_cngx-mat-tab-rejection-text: var(--cngx-mat-tab-refused-text-color, oklch(0.49 0.07 75));
482
+ }
483
+
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 }`. */
490
+ @media (forced-colors: active) {
491
+ .cngx-mat-tab__error-badge,
492
+ .cngx-mat-tab__rejection-icon {
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;
500
+ }
501
+ }