@cngx/ui 0.0.1-rc.0 → 0.1.0-rc.1

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 (60) hide show
  1. package/README.md +22 -48
  2. package/action-button/README.md +9 -11
  3. package/empty-state/README.md +11 -26
  4. package/feedback/README.md +3 -3
  5. package/fesm2022/cngx-ui-action-button.mjs +30 -26
  6. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  7. package/fesm2022/cngx-ui-empty-state.mjs +26 -21
  8. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
  9. package/fesm2022/cngx-ui-feedback.mjs +498 -261
  10. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  11. package/fesm2022/cngx-ui-layout.mjs +32 -5
  12. package/fesm2022/cngx-ui-layout.mjs.map +1 -1
  13. package/fesm2022/cngx-ui-mat-stepper.mjs +119 -297
  14. package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
  15. package/fesm2022/cngx-ui-mat-tabs.mjs +455 -120
  16. package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
  17. package/fesm2022/cngx-ui-material.mjs +14 -3
  18. package/fesm2022/cngx-ui-material.mjs.map +1 -1
  19. package/fesm2022/cngx-ui-overlay.mjs +22 -3
  20. package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
  21. package/fesm2022/cngx-ui-sidenav.mjs +107 -28
  22. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  23. package/fesm2022/cngx-ui-skeleton.mjs +61 -20
  24. package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
  25. package/fesm2022/cngx-ui-speak.mjs +14 -5
  26. package/fesm2022/cngx-ui-speak.mjs.map +1 -1
  27. package/fesm2022/cngx-ui-stepper.mjs +659 -163
  28. package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
  29. package/fesm2022/cngx-ui-tabs.mjs +306 -55
  30. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  31. package/fesm2022/cngx-ui.mjs +2 -1
  32. package/fesm2022/cngx-ui.mjs.map +1 -1
  33. package/layout/README.md +9 -44
  34. package/mat-stepper/README.md +37 -17
  35. package/mat-tabs/README.md +13 -13
  36. package/mat-tabs/styles/mat-tabs.css +357 -213
  37. package/material/README.md +19 -19
  38. package/overlay/README.md +11 -11
  39. package/package.json +7 -6
  40. package/sidenav/README.md +4 -19
  41. package/skeleton/README.md +3 -17
  42. package/speak/README.md +15 -15
  43. package/stepper/README.md +213 -5
  44. package/tabs/README.md +22 -4
  45. package/theming/system-tokens.css +29 -0
  46. package/types/cngx-ui-action-button.d.ts +28 -13
  47. package/types/cngx-ui-empty-state.d.ts +21 -9
  48. package/types/cngx-ui-feedback.d.ts +437 -121
  49. package/types/cngx-ui-layout.d.ts +38 -8
  50. package/types/cngx-ui-mat-stepper.d.ts +100 -134
  51. package/types/cngx-ui-mat-tabs.d.ts +291 -84
  52. package/types/cngx-ui-material.d.ts +12 -1
  53. package/types/cngx-ui-overlay.d.ts +25 -4
  54. package/types/cngx-ui-sidenav.d.ts +106 -12
  55. package/types/cngx-ui-skeleton.d.ts +62 -8
  56. package/types/cngx-ui-speak.d.ts +10 -2
  57. package/types/cngx-ui-stepper.d.ts +390 -57
  58. package/types/cngx-ui-tabs.d.ts +182 -18
  59. package/types/cngx-ui.d.ts +1 -0
  60. package/speak/speak-button-theme.scss +0 -78
@@ -1,233 +1,377 @@
1
- /*
2
- * @cngx/ui/mat-tabs — Material-themed sticky-error skin.
1
+ /**
2
+ * @overview
3
+ * Material-themed sticky-error skin for `[cngxMatTabs]` and the native
4
+ * `[cngxMatTabNav]` bridge. The directives apply modifier classes onto
5
+ * Material's `<button>.mat-mdc-tab` elements (tab group) or
6
+ * `<a>.mat-mdc-tab-link` elements (nav bar) and the trailing-edge
7
+ * molecule wrapper; this stylesheet paints them. Tokens stay under the
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`.
3
14
  *
4
- * Applied imperatively by `[cngxMatTabs]` (via Renderer2) onto the
5
- * `<button>.mat-mdc-tab` element whose index matches
6
- * `presenter.lastFailedIndex()`. The class persists until the user
7
- * successfully re-picks the failed target OR programmatically
8
- * dismisses via `clearLastFailed()`.
15
+ * **State modifiers**
9
16
  *
10
- * Themed via `--mat-sys-error` by default with `--cngx-mat-tab-error-*`
11
- * consumer overrides. Three-tier fallback: consumer override →
12
- * Material design token → hard-coded `#c62828`.
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)
21
+ * - `.cngx-mat-tab--error` + `.mat-mdc-tab-disabled` - fades the
22
+ * rejection signal so it does not pass for a healthy disabled tab
23
+ * - `.cngx-mat-tab--has-errors` - form-validation errors present;
24
+ * renders a `::before` red disc with an `!` glyph at the trailing
25
+ * corner. Distinct semantic from `--error` and the two coexist
26
+ * - `.cngx-mat-tab--error.cngx-mat-tab--has-errors` - co-occurrence;
27
+ * shifts the has-errors glyph inward via
28
+ * `--cngx-mat-tab-has-errors-glyph-offset-stacked` so the two
29
+ * signals do not merge
13
30
  *
14
- * No animation: `tabs-accepted-debt §3` covers the cngx-native pulse
15
- * keyframe limitation; the Material variant ships no pulse for the
16
- * same architectural reason (avoids competing with Material's
17
- * existing ink-bar transition + ripple). Re-evaluate when ≥1 consumer
18
- * issue requests a pulse OR a sibling cngx feature adopts a shared
19
- * `createPulseOnEdge` factory the Material variant can compose
20
- * against.
31
+ * **Trailing-edge overflow**
21
32
  *
22
- * Shipped as a standalone stylesheet asset (NOT folded into JS via
23
- * `styleUrls` — Angular only honours `styleUrls` on `@Component`,
24
- * not on `@Directive`). Consumer imports once in their global
25
- * stylesheet — Material-ecosystem prebuilt-themes pattern.
33
+ * `.cngx-mat-tabs-more` wraps the dynamically-mounted
34
+ * `<cngx-tab-overflow>` molecule that `[cngxMatTabs]` appends into
35
+ * `.mat-mdc-tab-header`. The wrapper:
36
+ *
37
+ * - drives the molecule's component-API cascade vars
38
+ * (`--cngx-tab-overflow-bg`, `--cngx-tab-overflow-button-bg`) so
39
+ * the trigger fades into the page surface
40
+ * - collapses to zero layout space when the inner trigger button is
41
+ * hidden (= no clipped tabs) via `:has()`
42
+ *
43
+ * **Material wiring**
44
+ *
45
+ * Every `--cngx-mat-tab-*` token is `@property`-registered with a literal
46
+ * oklch initial value, so a registered value always wins over an inline
47
+ * `var()` fallback - this stylesheet therefore carries no `--mat-sys-*`
48
+ * fallbacks of its own. The Material alignment is delivered by the
49
+ * `@cngx/themes/material/tabs-theme` bridge (`@include tabs.theme($theme)`),
50
+ * which sets the colour tokens on `.mat-mdc-tab-group`:
51
+ *
52
+ * - `--cngx-mat-tab-error-color` <- `--mat-sys-error`
53
+ * - `--cngx-mat-tab-has-errors-color` <- `--mat-sys-error`
54
+ * - `--cngx-mat-tab-has-errors-glyph-color` <- `--mat-sys-on-error`
55
+ * - `--cngx-mat-tabs-more-bg` <- `--mat-sys-surface`
56
+ *
57
+ * Imported standalone (no bridge), the tokens keep the literal defaults
58
+ * declared below.
59
+ *
60
+ * **Dark mode**
61
+ *
62
+ * Three hooks deepen the trailing-edge wrapper background and its
63
+ * gradient-fade shadow so the molecule blends into a dark page
64
+ * surface rather than into a white-on-dark seam:
65
+ *
66
+ * - `prefers-color-scheme: dark`
67
+ * - `[data-color-scheme="dark"]`
68
+ * - `.dark` class
26
69
  */
27
70
 
28
- /*
29
- * Specificity bump to `.mat-mdc-tab.cngx-mat-tab--error` (0,2,0) is
30
- * load-bearing — Material 21's `.mdc-tab` rule (0,1,0) sets
31
- * `outline: none` to suppress the browser's default focus outline,
32
- * and ships those styles inline via the component decorator. Since
33
- * the component-scoped CSS is injected into `<head>` AFTER the
34
- * `angular.json` global styles when the component first renders,
35
- * a same-specificity rule loses the cascade — `outline` would be
36
- * stripped and only `color` / `font-weight` would land. Mirrors
37
- * the same bump on `.mat-mdc-tab.cngx-mat-tab--has-errors::before`
38
- * below.
39
- */
40
- .mat-mdc-tab.cngx-mat-tab--error {
41
- color: var(--cngx-mat-tab-error-color, var(--mat-sys-error, #c62828));
42
- outline: var(--cngx-mat-tab-error-outline, 2px solid currentColor);
43
- outline-offset: var(--cngx-mat-tab-error-outline-offset, 1px);
44
- font-weight: var(--cngx-mat-tab-error-font-weight, 600);
45
- }
71
+ @layer cngx.tokens {
72
+ /**
73
+ * Text + outline color of a rejected tab. Wired to `--mat-sys-error`
74
+ * by the `@cngx/themes/material/tabs-theme` bridge; standalone it keeps
75
+ * the literal default below.
76
+ * @group State / Error
77
+ */
78
+ @property --cngx-mat-tab-error-color {
79
+ syntax: '<color>';
80
+ inherits: true;
81
+ initial-value: oklch(0.45 0.15 25);
82
+ }
83
+
84
+ /**
85
+ * Outline shorthand of a rejected tab.
86
+ * @group State / Error
87
+ */
88
+ @property --cngx-mat-tab-error-outline {
89
+ syntax: '*';
90
+ inherits: false;
91
+ initial-value: 2px solid currentColor;
92
+ }
93
+
94
+ /**
95
+ * Outline offset of the rejected-tab outline.
96
+ * @group State / Error
97
+ */
98
+ @property --cngx-mat-tab-error-outline-offset {
99
+ syntax: '<length>';
100
+ inherits: false;
101
+ initial-value: 1px;
102
+ }
103
+
104
+ /**
105
+ * Font-weight bump of a rejected tab.
106
+ * @group State / Error
107
+ */
108
+ @property --cngx-mat-tab-error-font-weight {
109
+ syntax: '<number>';
110
+ inherits: false;
111
+ initial-value: 600;
112
+ }
113
+
114
+ /**
115
+ * Inset of the `has-errors` glyph from the tab edges.
116
+ * @group State / HasErrors
117
+ */
118
+ @property --cngx-mat-tab-has-errors-glyph-offset {
119
+ syntax: '<length>';
120
+ inherits: false;
121
+ initial-value: 4px;
122
+ }
123
+
124
+ /**
125
+ * Larger inset when the tab is BOTH rejected and carries form
126
+ * errors - keeps the two signals visually distinct.
127
+ * @group State / HasErrors
128
+ */
129
+ @property --cngx-mat-tab-has-errors-glyph-offset-stacked {
130
+ syntax: '<length>';
131
+ inherits: false;
132
+ initial-value: 6px;
133
+ }
134
+
135
+ /**
136
+ * Diameter of the `has-errors` glyph disc.
137
+ * @group State / HasErrors
138
+ */
139
+ @property --cngx-mat-tab-has-errors-glyph-size {
140
+ syntax: '<length>';
141
+ inherits: false;
142
+ initial-value: 16px;
143
+ }
144
+
145
+ /**
146
+ * Background of the `has-errors` glyph disc. Wired to `--mat-sys-error`
147
+ * by the `@cngx/themes/material/tabs-theme` bridge; standalone it keeps
148
+ * the literal default below. Inherits so a host-level override reaches
149
+ * the `::before` glyph.
150
+ * @group State / HasErrors
151
+ */
152
+ @property --cngx-mat-tab-has-errors-color {
153
+ syntax: '<color>';
154
+ inherits: true;
155
+ initial-value: oklch(0.45 0.15 25);
156
+ }
157
+
158
+ /**
159
+ * Glyph color inside the `has-errors` disc. Wired to `--mat-sys-on-error`
160
+ * by the `@cngx/themes/material/tabs-theme` bridge; standalone it keeps
161
+ * the literal default below.
162
+ * @group State / HasErrors
163
+ */
164
+ @property --cngx-mat-tab-has-errors-glyph-color {
165
+ syntax: '<color>';
166
+ inherits: true;
167
+ initial-value: oklch(1 0 0);
168
+ }
169
+
170
+ /**
171
+ * Font-weight of the `has-errors` glyph (`!`).
172
+ * @group State / HasErrors
173
+ */
174
+ @property --cngx-mat-tab-has-errors-font-weight {
175
+ syntax: '<number>';
176
+ inherits: false;
177
+ initial-value: 700;
178
+ }
179
+
180
+ /**
181
+ * Stacking-context order of the trailing-edge overflow wrapper.
182
+ * @group Layout
183
+ */
184
+ @property --cngx-mat-tabs-more-z {
185
+ syntax: '<number>';
186
+ inherits: false;
187
+ initial-value: 2;
188
+ }
189
+
190
+ /**
191
+ * Background of the trailing-edge overflow wrapper. Wired to
192
+ * `--mat-sys-surface` by the `@cngx/themes/material/tabs-theme` bridge;
193
+ * standalone it keeps the `:root` palette below (light + dark).
194
+ * @group Surface
195
+ */
196
+ @property --cngx-mat-tabs-more-bg {
197
+ syntax: '<color>';
198
+ inherits: true;
199
+ initial-value: oklch(1 0 0);
200
+ }
201
+
202
+ /**
203
+ * Drop-shadow of the trailing-edge overflow wrapper.
204
+ * @group Surface
205
+ */
206
+ @property --cngx-mat-tabs-more-shadow {
207
+ syntax: '*';
208
+ inherits: true;
209
+ initial-value: -8px 0 8px -4px oklch(0 0 0 / 0.1);
210
+ }
46
211
 
47
- .mat-mdc-tab-disabled.cngx-mat-tab--error {
48
212
  /*
49
- * A disabled-and-rejected tab keeps the rejection signal but
50
- * fades to disambiguate it from a healthy disabled tab. Material
51
- * itself dims disabled tabs via the `--mat-tab-header-disabled-*`
52
- * tokens; this overlay multiplies the dimming.
213
+ * Standalone palette pass. The `cngx-mat-tabs-more` molecule sits over
214
+ * the Material tab header - its background needs to match the page
215
+ * surface so the gradient fades into "nothing" rather than into
216
+ * white-on-dark. These values apply when the stylesheet is imported on
217
+ * its own; the `@cngx/themes/material/tabs-theme` bridge supersedes them
218
+ * by setting `--cngx-mat-tabs-more-bg` to `--mat-sys-surface` on the tab
219
+ * group, a nearer ancestor of the wrapper, so it wins by inheritance.
220
+ * Stays under the Material-bridge namespace (no `--cngx-color-*`
221
+ * delegation) per the file-header contract.
53
222
  */
54
- opacity: 0.7;
55
- }
223
+ :root {
224
+ --cngx-mat-tabs-more-bg: oklch(1 0 0);
225
+ --cngx-mat-tabs-more-shadow: -8px 0 8px -4px oklch(0 0 0 / 0.1);
226
+ }
56
227
 
57
- /*
58
- * Per-tab form-error aggregation badge. Distinct semantic from
59
- * `--error` — `--error` means "your last commit was refused";
60
- * `--has-errors` means "this tab contains form-validation errors
61
- * right now". The two coexist (different sources, different
62
- * lifecycles, different remediation paths) and a tab can carry both
63
- * simultaneously.
64
- *
65
- * Three-tier fallback per CSS var: consumer override → Material
66
- * design token → hard-coded value. The badge glyph is a `::before`
67
- * pseudo-element so it stacks cleanly with Material's own focus
68
- * ring and ripple — Material's button uses neither `::before` nor
69
- * `::after` for its core visuals.
70
- *
71
- * No animation: same `tabs-accepted-debt §3` rationale as
72
- * `--error` — pulse-on-edge is deferred to a future shared
73
- * `createPulseOnEdge` factory.
74
- */
75
- .cngx-mat-tab--has-errors {
76
- position: relative;
77
- }
228
+ @media (prefers-color-scheme: dark) {
229
+ :root:not([data-color-scheme='light']):not(.light) {
230
+ --cngx-mat-tabs-more-bg: oklch(0.2 0.01 250);
231
+ --cngx-mat-tabs-more-shadow: -8px 0 8px -4px oklch(0 0 0 / 0.45);
232
+ }
233
+ }
78
234
 
79
- /*
80
- * Specificity is `.mat-mdc-tab.cngx-mat-tab--has-errors` (0,2,1)
81
- * to beat Material's own `.mat-focus-indicator::before` (0,1,1)
82
- * which sets `inset: 0` on the same pseudo-element. Without the
83
- * boost, the `top` / `inset-inline-end` declarations get collapsed
84
- * to 0 by Material's later-cascade rule and the badge sits dead-
85
- * centred under the focus ring instead of at the trailing-top
86
- * corner. Right + transform fall back for older inset-inline-end
87
- * support.
88
- */
89
- .mat-mdc-tab.cngx-mat-tab--has-errors::before {
90
- content: '!';
91
- position: absolute;
92
- top: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
93
- right: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
94
- inset-inline-end: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
95
- inset-inline-start: auto;
96
- bottom: auto;
97
- display: inline-flex;
98
- align-items: center;
99
- justify-content: center;
100
- width: var(--cngx-mat-tab-has-errors-glyph-size, 16px);
101
- height: var(--cngx-mat-tab-has-errors-glyph-size, 16px);
102
- margin: 0;
103
- border: 0;
104
- border-radius: 50%;
105
- background: var(
106
- --cngx-mat-tab-has-errors-color,
107
- var(--mat-sys-error, #c62828)
108
- );
109
- color: var(
110
- --cngx-mat-tab-has-errors-glyph-color,
111
- var(--mat-sys-on-error, #ffffff)
112
- );
113
- font-size: calc(var(--cngx-mat-tab-has-errors-glyph-size, 16px) * 0.75);
114
- font-weight: var(--cngx-mat-tab-has-errors-font-weight, 700);
115
- line-height: 1;
116
- pointer-events: none;
117
- z-index: 1;
118
- }
235
+ :root[data-color-scheme='dark'],
236
+ :root.dark {
237
+ --cngx-mat-tabs-more-bg: oklch(0.2 0.01 250);
238
+ --cngx-mat-tabs-more-shadow: -8px 0 8px -4px oklch(0 0 0 / 0.45);
239
+ }
119
240
 
120
- /*
121
- * Co-occurrence: when a tab is BOTH rejected and carries form
122
- * errors, the rejection outline already draws focus to the edges;
123
- * shift the has-errors badge slightly inward so the two signals
124
- * read as distinct rather than visually merging.
125
- */
126
- .mat-mdc-tab.cngx-mat-tab--error.cngx-mat-tab--has-errors::before {
127
- top: var(--cngx-mat-tab-has-errors-glyph-offset-stacked, 6px);
128
- right: var(--cngx-mat-tab-has-errors-glyph-offset-stacked, 6px);
129
- inset-inline-end: var(--cngx-mat-tab-has-errors-glyph-offset-stacked, 6px);
241
+ :root[data-color-scheme='light'],
242
+ :root.light {
243
+ --cngx-mat-tabs-more-bg: oklch(1 0 0);
244
+ --cngx-mat-tabs-more-shadow: -8px 0 8px -4px oklch(0 0 0 / 0.1);
245
+ }
130
246
  }
131
247
 
132
- /*
133
- * Trailing-edge skin for the dynamically-mounted `<cngx-tab-overflow>`
134
- * molecule. `[cngxMatTabs]` programmatically appends the molecule
135
- * into `.mat-mdc-tab-header` and adds the `cngx-mat-tabs-more` class
136
- * via `Renderer2` (`mat-tabs.directive.ts`'s afterNextRender block).
137
- *
138
- * Layout: flex item alongside `.mat-mdc-tab-label-container`. Material's
139
- * `.mat-mdc-tab-header` is itself a flex container, so the More
140
- * affordance flows naturally as a sibling of the label-container —
141
- * the label-container shrinks to fit, the More button takes its
142
- * natural width, and the trailing tab is no longer occluded by an
143
- * absolutely-positioned overlay. If consumers opt back into
144
- * Material's pagination (see the auto-hide rule below), the
145
- * pagination-after arrow becomes a third flex sibling and the
146
- * available width is split across all three; the IntersectionObserver
147
- * picks up the new layout automatically.
148
- *
149
- * Three-tier fallback per CSS var: consumer override → Material
150
- * design token → hard-coded value.
151
- */
152
- .cngx-mat-tabs-more {
153
- flex: 0 0 auto;
154
- align-self: stretch;
155
- display: flex;
156
- align-items: center;
157
- z-index: var(--cngx-mat-tabs-more-z, 2);
248
+ @layer cngx.components {
249
+ /*
250
+ * Specificity bump to `.mat-mdc-tab.cngx-mat-tab--error` (0,2,0) is
251
+ * load-bearing - Material 21's `.mdc-tab` rule (0,1,0) sets
252
+ * `outline: none` to suppress the browser's default focus outline,
253
+ * and ships those styles inline via the component decorator. Since
254
+ * the component-scoped CSS is injected into `<head>` AFTER the
255
+ * `angular.json` global styles when the component first renders,
256
+ * a same-specificity rule loses the cascade.
257
+ *
258
+ * `.mat-mdc-tab-link` carries the same decoration for the native
259
+ * `[cngxMatTabNav]` bridge - the link element is also (0,1,0), so the
260
+ * doubled selector wins identically.
261
+ */
262
+ .mat-mdc-tab.cngx-mat-tab--error,
263
+ .mat-mdc-tab-link.cngx-mat-tab--error {
264
+ color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
265
+ outline: var(--cngx-mat-tab-error-outline, 2px solid currentColor);
266
+ outline-offset: var(--cngx-mat-tab-error-outline-offset, 1px);
267
+ font-weight: var(--cngx-mat-tab-error-font-weight, 600);
268
+ }
269
+
270
+ .mat-mdc-tab-disabled.cngx-mat-tab--error {
271
+ /*
272
+ * A disabled-and-rejected tab keeps the rejection signal but
273
+ * fades to disambiguate it from a healthy disabled tab.
274
+ */
275
+ opacity: 0.7;
276
+ }
158
277
 
159
278
  /*
160
- * Drive the molecule's own component-API cascade variables. The
161
- * `<cngx-tab-overflow>` :host CSS defaults `--cngx-tab-overflow-bg`
162
- * to `transparent` (sensible for the cngx-native variant that sits
163
- * in a flow-positioned strip wrapper); the Material variant gives
164
- * the More button an opaque surface so it reads as a distinct
165
- * affordance against Material's strip background even when the
166
- * popover panel is closed. The component's :host rule reads these
167
- * variables, so resolution happens at the right specificity tier
168
- * without us shouting through a higher-specificity selector.
169
- */
170
- --cngx-tab-overflow-bg: var(
171
- --cngx-mat-tabs-more-bg,
172
- var(--mat-app-background-color, #ffffff)
173
- );
174
- --cngx-tab-overflow-button-bg: var(
175
- --cngx-mat-tabs-more-bg,
176
- var(--mat-app-background-color, #ffffff)
177
- );
178
-
179
- box-shadow: var(
180
- --cngx-mat-tabs-more-shadow,
181
- -8px 0 8px -4px rgba(0, 0, 0, 0.1)
182
- );
183
- }
279
+ * Per-tab form-error aggregation badge. Distinct semantic from
280
+ * `--error` - `--error` means "your last commit was refused";
281
+ * `--has-errors` means "this tab contains form-validation errors
282
+ * right now". The two coexist and a tab can carry both
283
+ * simultaneously.
284
+ */
285
+ .cngx-mat-tab--has-errors {
286
+ position: relative;
287
+ }
184
288
 
185
- /*
186
- * Collapse the wrapper to zero layout space when the inner trigger
187
- * button is hidden (= no clipped tabs). Without this, the molecule's
188
- * `display: inline-flex` :host rule keeps reserving width for an
189
- * empty wrapper — the label-container would shrink even when no
190
- * overflow exists.
191
- */
192
- .cngx-mat-tabs-more:has(.cngx-tab-overflow__trigger[hidden]) {
193
- display: none;
194
- }
289
+ /*
290
+ * Specificity is `.mat-mdc-tab.cngx-mat-tab--has-errors` (0,2,1)
291
+ * to beat Material's own `.mat-focus-indicator::before` (0,1,1)
292
+ * which sets `inset: 0` on the same pseudo-element.
293
+ */
294
+ .mat-mdc-tab.cngx-mat-tab--has-errors::before,
295
+ .mat-mdc-tab-link.cngx-mat-tab--has-errors::before {
296
+ content: '!';
297
+ position: absolute;
298
+ top: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
299
+ right: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
300
+ inset-inline-end: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
301
+ inset-inline-start: auto;
302
+ bottom: auto;
303
+ display: inline-flex;
304
+ align-items: center;
305
+ justify-content: center;
306
+ width: var(--cngx-mat-tab-has-errors-glyph-size, 16px);
307
+ height: var(--cngx-mat-tab-has-errors-glyph-size, 16px);
308
+ margin: 0;
309
+ border: 0;
310
+ border-radius: 50%;
311
+ background: var(--cngx-mat-tab-has-errors-color, oklch(0.45 0.15 25));
312
+ color: var(--cngx-mat-tab-has-errors-glyph-color, oklch(1 0 0));
313
+ font-size: calc(var(--cngx-mat-tab-has-errors-glyph-size, 16px) * 0.75);
314
+ font-weight: var(--cngx-mat-tab-has-errors-font-weight, 700);
315
+ line-height: 1;
316
+ pointer-events: none;
317
+ z-index: 1;
318
+ }
195
319
 
196
- /*
197
- * Material's pagination arrows (`<` / `>`) remain visible alongside
198
- * the More button: both are flex siblings of `.mat-mdc-tab-label-container`
199
- * inside `.mat-mdc-tab-header`, so the available width is split across
200
- * all of them and the IntersectionObserver picks up the new container
201
- * width automatically. Consumers who want to hide Material's
202
- * pagination (More button as the only overflow affordance) can do so
203
- * with a one-line theme-level override:
204
- *
205
- * .mat-mdc-tab-header:has(cngx-tab-overflow)
206
- * .mat-mdc-tab-header-pagination {
207
- * display: none;
208
- * }
209
- */
320
+ /*
321
+ * Co-occurrence: when a tab is BOTH rejected and carries form
322
+ * errors, the rejection outline already draws focus to the edges;
323
+ * shift the has-errors badge slightly inward so the two signals
324
+ * read as distinct rather than visually merging.
325
+ */
326
+ .mat-mdc-tab.cngx-mat-tab--error.cngx-mat-tab--has-errors::before,
327
+ .mat-mdc-tab-link.cngx-mat-tab--error.cngx-mat-tab--has-errors::before {
328
+ top: var(--cngx-mat-tab-has-errors-glyph-offset-stacked, 6px);
329
+ right: var(--cngx-mat-tab-has-errors-glyph-offset-stacked, 6px);
330
+ inset-inline-end: var(--cngx-mat-tab-has-errors-glyph-offset-stacked, 6px);
331
+ }
210
332
 
211
- /*
212
- * SR-only utility for the per-tab error descriptor span
213
- * (`<span class="cngx-sr-only" id="${handle.id}-errors">` mounted by
214
- * the aggregator-decoration effect). The span carries the consumer-
215
- * supplied `aggregator.announcement()` phrase; AT reads it through
216
- * the patched `aria-describedby`, sighted users see only the badge
217
- * glyph. `@cngx/ui/mat-tabs` ships this utility inside its own
218
- * stylesheet so consumers importing only `mat-tabs.css` (per the
219
- * README) do not paint the announcement inline next to the tab
220
- * label. Mirrors the rule in `@cngx/common/tabs/styles/tabs-base.css`
221
- * for the cngx-native variant.
222
- */
223
- .cngx-sr-only {
224
- position: absolute;
225
- width: 1px;
226
- height: 1px;
227
- margin: -1px;
228
- padding: 0;
229
- overflow: hidden;
230
- clip: rect(0, 0, 0, 0);
231
- white-space: nowrap;
232
- border: 0;
333
+ /*
334
+ * Trailing-edge skin for the dynamically-mounted `<cngx-tab-overflow>`
335
+ * molecule. `[cngxMatTabs]` programmatically appends the molecule
336
+ * into `.mat-mdc-tab-header` and adds the `cngx-mat-tabs-more` class.
337
+ */
338
+ .cngx-mat-tabs-more {
339
+ flex: 0 0 auto;
340
+ align-self: stretch;
341
+ display: flex;
342
+ align-items: center;
343
+ z-index: var(--cngx-mat-tabs-more-z, 2);
344
+
345
+ /*
346
+ * Drive the molecule's own component-API cascade variables.
347
+ */
348
+ --cngx-tab-overflow-bg: var(--cngx-mat-tabs-more-bg, oklch(1 0 0));
349
+ --cngx-tab-overflow-button-bg: var(--cngx-mat-tabs-more-bg, oklch(1 0 0));
350
+
351
+ box-shadow: var(--cngx-mat-tabs-more-shadow, -8px 0 8px -4px oklch(0 0 0 / 0.1));
352
+ }
353
+
354
+ /*
355
+ * Collapse the wrapper to zero layout space when the inner trigger
356
+ * button is hidden (= no clipped tabs).
357
+ */
358
+ .cngx-mat-tabs-more:has(.cngx-tab-overflow__trigger[hidden]) {
359
+ display: none;
360
+ }
361
+
362
+ /*
363
+ * SR-only utility for the per-tab error descriptor span mounted by
364
+ * the aggregator-decoration effect.
365
+ */
366
+ .cngx-sr-only {
367
+ position: absolute;
368
+ width: 1px;
369
+ height: 1px;
370
+ margin: -1px;
371
+ padding: 0;
372
+ overflow: hidden;
373
+ clip: rect(0, 0, 0, 0);
374
+ white-space: nowrap;
375
+ border: 0;
376
+ }
233
377
  }
@@ -42,42 +42,42 @@ export class ExampleComponent {
42
42
 
43
43
  `CngxMatPaginator` is a Material Design paginator component that wraps the Material `mat-paginator` element and wires it to a `CngxPaginate` directive. It provides:
44
44
 
45
- - **Type-safe integration** — Explicit `[cngxPaginateRef]` input (no ancestor injection)
46
- - **Automatic state sync** — Page index, page size, and total count are automatically synchronized
47
- - **Page size selector** — Customizable page size options via `[pageSizeOptions]`
48
- - **Disabled state** — Paginator disables when `CngxPaginate.isBusy()` is true
45
+ - **Type-safe integration** - Explicit `[cngxPaginateRef]` input (no ancestor injection)
46
+ - **Automatic state sync** - Page index, page size, and total count are automatically synchronized
47
+ - **Page size selector** - Customizable page size options via `[pageSizeOptions]`
48
+ - **Disabled state** - Paginator disables when `CngxPaginate.isBusy()` is true
49
49
 
50
- The component requires an explicit reference to the `CngxPaginate` directive instance — no hidden ancestor injection, no implicit wiring.
50
+ The component requires an explicit reference to the `CngxPaginate` directive instance - no hidden ancestor injection, no implicit wiring.
51
51
 
52
52
  ## Accessibility
53
53
 
54
54
  `CngxMatPaginator` delegates accessibility to Material's `mat-paginator` component. The Material paginator is fully accessible with:
55
55
 
56
- - **ARIA labels** — Paginator navigation and page size controls are properly labeled
57
- - **Keyboard navigation** — Tab order and keyboard shortcuts for page navigation
58
- - **Disabled state** — When `isBusy()` is true, controls are disabled and announced to screen readers
56
+ - **ARIA labels** - Paginator navigation and page size controls are properly labeled
57
+ - **Keyboard navigation** - Tab order and keyboard shortcuts for page navigation
58
+ - **Disabled state** - When `isBusy()` is true, controls are disabled and announced to screen readers
59
59
 
60
60
  ## Composition
61
61
 
62
62
  `CngxMatPaginator` composes:
63
63
 
64
- - **Material paginator** — `mat-paginator` component from `@angular/material/paginator`
65
- - **CngxPaginate directive** — Manages pagination state (page index, page size, total)
66
- - **Event handling** — Subscribes to Material paginator's `page` event and updates directive state
64
+ - **Material paginator** - `mat-paginator` component from `@angular/material/paginator`
65
+ - **CngxPaginate directive** - Manages pagination state (page index, page size, total)
66
+ - **Event handling** - Subscribes to Material paginator's `page` event and updates directive state
67
67
 
68
68
  ## How It Works
69
69
 
70
- 1. **Setup** — Consumer applies `cngxPaginate` on a container element and assigns a template reference
71
- 2. **Data binding** — Consumer passes `[total]="items.length"` to the directive
72
- 3. **Component wire-up** — `CngxMatPaginator` binds to the directive via `[cngxPaginateRef]`
73
- 4. **State sync** — Component reads `ref.pageIndex()`, `ref.pageSize()`, `ref.total()` and binds to Material's `mat-paginator`
74
- 5. **User interaction** — When user changes page or page size, Material's `page` event fires
75
- 6. **State update** — `CngxMatPaginator.handlePage()` calls `ref.setPageSize()` and `ref.setPage()` to update directive state
76
- 7. **Data refresh** — Consumer reactively filters/slices data based on directive signals
70
+ 1. **Setup** - Consumer applies `cngxPaginate` on a container element and assigns a template reference
71
+ 2. **Data binding** - Consumer passes `[total]="items.length"` to the directive
72
+ 3. **Component wire-up** - `CngxMatPaginator` binds to the directive via `[cngxPaginateRef]`
73
+ 4. **State sync** - Component reads `ref.pageIndex()`, `ref.pageSize()`, `ref.total()` and binds to Material's `mat-paginator`
74
+ 5. **User interaction** - When user changes page or page size, Material's `page` event fires
75
+ 6. **State update** - `CngxMatPaginator.handlePage()` calls `ref.setPageSize()` and `ref.setPage()` to update directive state
76
+ 7. **Data refresh** - Consumer reactively filters/slices data based on directive signals
77
77
 
78
78
  ## Material Theming
79
79
 
80
- `CngxMatPaginator` uses the standard Material `mat-paginator` component, which inherits theming from your Material theme automatically. No additional theme configuration needed — include the Material theme in your global stylesheet.
80
+ `CngxMatPaginator` uses the standard Material `mat-paginator` component, which inherits theming from your Material theme automatically. No additional theme configuration needed - include the Material theme in your global stylesheet.
81
81
 
82
82
  ```scss
83
83
  @use '@angular/material' as mat;