@cngx/common 0.0.1-rc.0 → 0.1.0-rc.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.
- package/a11y/README.md +13 -16
- package/card/README.md +2 -21
- package/chart/README.md +5 -8
- package/data/README.md +45 -47
- package/dialog/README.md +12 -15
- package/display/README.md +5 -9
- package/fesm2022/cngx-common-a11y.mjs +140 -40
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +157 -69
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +389 -92
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +311 -151
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +167 -29
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +445 -110
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +2025 -435
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +188 -31
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +711 -90
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +1258 -60
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +247 -41
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +2 -2
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +5 -5
- package/layout/README.md +2 -2
- package/package.json +5 -4
- package/popover/README.md +8 -34
- package/stepper/README.md +49 -8
- package/tabs/README.md +6 -6
- package/theming/components/cngx-async.css +74 -0
- package/theming/components/cngx-backdrop.css +73 -0
- package/theming/components/cngx-badge.css +340 -0
- package/theming/components/cngx-bottom-sheet.css +201 -0
- package/theming/components/cngx-button-toggle.css +99 -0
- package/theming/components/cngx-dialog.css +358 -0
- package/theming/components/cngx-divider.css +145 -0
- package/theming/components/cngx-listbox.css +220 -0
- package/theming/components/cngx-menu.css +371 -0
- package/theming/components/cngx-ripple.css +116 -0
- package/theming/components/cngx-tooltip.css +265 -0
- package/theming/system-tokens.css +24 -0
- package/types/cngx-common-a11y.d.ts +136 -36
- package/types/cngx-common-card.d.ts +137 -22
- package/types/cngx-common-chart.d.ts +337 -40
- package/types/cngx-common-data.d.ts +277 -45
- package/types/cngx-common-dialog.d.ts +162 -22
- package/types/cngx-common-display.d.ts +422 -78
- package/types/cngx-common-interactive.d.ts +1862 -305
- package/types/cngx-common-layout.d.ts +191 -28
- package/types/cngx-common-popover.d.ts +632 -87
- package/types/cngx-common-stepper.d.ts +1110 -38
- package/types/cngx-common-tabs.d.ts +306 -32
- package/types/cngx-common.d.ts +1 -1
- package/README.md +0 -18
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @overview
|
|
3
|
+
* Theming bridge for the `CngxTooltip` directive. The directive
|
|
4
|
+
* renders `<div class="cngx-tooltip">` on demand and toggles
|
|
5
|
+
* transition classes (`cngx-popover--opening` / `-open` / `-closing`)
|
|
6
|
+
* via the underlying `CngxPopover` state machine; this stylesheet
|
|
7
|
+
* paints the pill. Surface defaults to charcoal-on-near-white so it
|
|
8
|
+
* stays neutral and out of the brand-color conversation.
|
|
9
|
+
*
|
|
10
|
+
* **State modifiers**
|
|
11
|
+
*
|
|
12
|
+
* - `cngx-popover--opening` - opacity 0, scale(0.95)
|
|
13
|
+
* - `cngx-popover--open` - opacity 1, scale(1)
|
|
14
|
+
* - `cngx-popover--closing` - opacity 0, scale(0.95)
|
|
15
|
+
*
|
|
16
|
+
* Suppressed under `prefers-reduced-motion: reduce`.
|
|
17
|
+
*
|
|
18
|
+
* **Inheritance**
|
|
19
|
+
*
|
|
20
|
+
* No foundation delegation by design - the tooltip is an inverse
|
|
21
|
+
* surface that intentionally contrasts with the page chrome rather
|
|
22
|
+
* than tracking `--cngx-color-surface`.
|
|
23
|
+
*
|
|
24
|
+
* **Touch devices**
|
|
25
|
+
*
|
|
26
|
+
* `@media (hover: none)` bumps padding, font-size, line-height, and
|
|
27
|
+
* max-width for readability without a per-instance override.
|
|
28
|
+
*
|
|
29
|
+
* **Dark mode**
|
|
30
|
+
*
|
|
31
|
+
* Three hooks (`prefers-color-scheme: dark`, `[data-color-scheme="dark"]`,
|
|
32
|
+
* `.dark`) flip to a light pill on dark text (Material-style
|
|
33
|
+
* inverse-surface) so the tooltip stays as a high-contrast call-out
|
|
34
|
+
* rather than blending into the dark page chrome.
|
|
35
|
+
*
|
|
36
|
+
* **Notes**
|
|
37
|
+
*
|
|
38
|
+
* - The optional `tooltip-indicator.scss` (the `::after` info-icon
|
|
39
|
+
* next to triggers) is a Sass opt-in mixin and ships outside this
|
|
40
|
+
* file.
|
|
41
|
+
* - The pill uses the Popover API top-layer; no z-index needed.
|
|
42
|
+
*
|
|
43
|
+
* **Pair with**
|
|
44
|
+
*
|
|
45
|
+
* - `@cngx/themes/material/tooltip-theme` - Material 3 inverse-surface
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
@layer cngx.tokens {
|
|
49
|
+
/**
|
|
50
|
+
* Tooltip surface color - defaults to a near-black charcoal.
|
|
51
|
+
* @group Surface
|
|
52
|
+
*/
|
|
53
|
+
@property --cngx-tooltip-bg {
|
|
54
|
+
syntax: '<color>';
|
|
55
|
+
inherits: true;
|
|
56
|
+
initial-value: oklch(0.2 0.005 290);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Tooltip text color - defaults to near-white to pair with the
|
|
61
|
+
* default charcoal surface.
|
|
62
|
+
* @group Surface
|
|
63
|
+
*/
|
|
64
|
+
@property --cngx-tooltip-color {
|
|
65
|
+
syntax: '<color>';
|
|
66
|
+
inherits: true;
|
|
67
|
+
initial-value: oklch(0.96 0.005 290);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Font-family stack. Inherits `system-ui` from the foundation.
|
|
72
|
+
* @group Typography
|
|
73
|
+
*/
|
|
74
|
+
@property --cngx-tooltip-font-family {
|
|
75
|
+
syntax: '*';
|
|
76
|
+
inherits: true;
|
|
77
|
+
initial-value: system-ui;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Font-size of the tooltip text.
|
|
82
|
+
* @group Typography
|
|
83
|
+
*/
|
|
84
|
+
@property --cngx-tooltip-font-size {
|
|
85
|
+
syntax: '*';
|
|
86
|
+
inherits: true;
|
|
87
|
+
initial-value: 0.75rem;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Line-height of the tooltip text.
|
|
92
|
+
* @group Typography
|
|
93
|
+
*/
|
|
94
|
+
@property --cngx-tooltip-line-height {
|
|
95
|
+
syntax: '*';
|
|
96
|
+
inherits: true;
|
|
97
|
+
initial-value: 1rem;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Font-weight of the tooltip text.
|
|
102
|
+
* @group Typography
|
|
103
|
+
*/
|
|
104
|
+
@property --cngx-tooltip-font-weight {
|
|
105
|
+
syntax: '<number>';
|
|
106
|
+
inherits: true;
|
|
107
|
+
initial-value: 400;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Letter-spacing - a touch of tracking lifts legibility at the
|
|
112
|
+
* small font-size.
|
|
113
|
+
* @group Typography
|
|
114
|
+
*/
|
|
115
|
+
@property --cngx-tooltip-letter-spacing {
|
|
116
|
+
syntax: '*';
|
|
117
|
+
inherits: true;
|
|
118
|
+
initial-value: 0.033em;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Block-axis padding.
|
|
123
|
+
* @group Layout
|
|
124
|
+
*/
|
|
125
|
+
@property --cngx-tooltip-padding-block {
|
|
126
|
+
syntax: '<length>';
|
|
127
|
+
inherits: false;
|
|
128
|
+
initial-value: 4px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Inline-axis padding.
|
|
133
|
+
* @group Layout
|
|
134
|
+
*/
|
|
135
|
+
@property --cngx-tooltip-padding-inline {
|
|
136
|
+
syntax: '<length>';
|
|
137
|
+
inherits: false;
|
|
138
|
+
initial-value: 8px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Corner radius.
|
|
143
|
+
* @group Layout
|
|
144
|
+
*/
|
|
145
|
+
@property --cngx-tooltip-border-radius {
|
|
146
|
+
syntax: '<length>';
|
|
147
|
+
inherits: false;
|
|
148
|
+
initial-value: 4px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Maximum inline size - caps long tooltip content before it wraps
|
|
153
|
+
* into too narrow a column.
|
|
154
|
+
* @group Layout
|
|
155
|
+
*/
|
|
156
|
+
@property --cngx-tooltip-max-width {
|
|
157
|
+
syntax: '<length>';
|
|
158
|
+
inherits: false;
|
|
159
|
+
initial-value: 200px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Duration of the open / close transition.
|
|
164
|
+
* @group Motion
|
|
165
|
+
*/
|
|
166
|
+
@property --cngx-tooltip-transition-duration {
|
|
167
|
+
syntax: '<time>';
|
|
168
|
+
inherits: false;
|
|
169
|
+
initial-value: 150ms;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Easing curve of the open / close transition.
|
|
174
|
+
* @group Motion
|
|
175
|
+
*/
|
|
176
|
+
@property --cngx-tooltip-transition-easing {
|
|
177
|
+
syntax: '*';
|
|
178
|
+
inherits: false;
|
|
179
|
+
initial-value: cubic-bezier(0.4, 0, 0.2, 1);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* Dark-mode swap - flip to inverse-surface (light pill, dark text)
|
|
183
|
+
* so the tooltip pops off the dark page rather than blending into
|
|
184
|
+
* the surrounding chrome at low contrast. */
|
|
185
|
+
@media (prefers-color-scheme: dark) {
|
|
186
|
+
:root:not([data-color-scheme='light']):not(.light) {
|
|
187
|
+
--cngx-tooltip-bg: oklch(0.95 0.005 290);
|
|
188
|
+
--cngx-tooltip-color: oklch(0.2 0.005 290);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
[data-color-scheme='dark'],
|
|
192
|
+
.dark {
|
|
193
|
+
--cngx-tooltip-bg: oklch(0.95 0.005 290);
|
|
194
|
+
--cngx-tooltip-color: oklch(0.2 0.005 290);
|
|
195
|
+
}
|
|
196
|
+
[data-color-scheme='light'],
|
|
197
|
+
.light {
|
|
198
|
+
--cngx-tooltip-bg: oklch(0.2 0.005 290);
|
|
199
|
+
--cngx-tooltip-color: oklch(0.96 0.005 290);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@layer cngx.components {
|
|
204
|
+
@scope (.cngx-tooltip) {
|
|
205
|
+
:scope {
|
|
206
|
+
position: fixed;
|
|
207
|
+
inset: unset;
|
|
208
|
+
border: none;
|
|
209
|
+
margin: 0;
|
|
210
|
+
box-sizing: border-box;
|
|
211
|
+
|
|
212
|
+
background: var(--cngx-tooltip-bg, oklch(0.2 0.005 290));
|
|
213
|
+
color: var(--cngx-tooltip-color, oklch(0.96 0.005 290));
|
|
214
|
+
font-family: var(--cngx-tooltip-font-family, inherit);
|
|
215
|
+
font-size: var(--cngx-tooltip-font-size, 0.75rem);
|
|
216
|
+
line-height: var(--cngx-tooltip-line-height, 1rem);
|
|
217
|
+
font-weight: var(--cngx-tooltip-font-weight, 400);
|
|
218
|
+
letter-spacing: var(--cngx-tooltip-letter-spacing, 0.033em);
|
|
219
|
+
padding: var(--cngx-tooltip-padding-block, 4px) var(--cngx-tooltip-padding-inline, 8px);
|
|
220
|
+
border-radius: var(--cngx-tooltip-border-radius, 4px);
|
|
221
|
+
max-width: var(--cngx-tooltip-max-width, 200px);
|
|
222
|
+
width: max-content;
|
|
223
|
+
word-wrap: break-word;
|
|
224
|
+
white-space: normal;
|
|
225
|
+
pointer-events: none;
|
|
226
|
+
|
|
227
|
+
/* Popover API top-layer - no z-index needed. */
|
|
228
|
+
transition:
|
|
229
|
+
opacity var(--cngx-tooltip-transition-duration, 150ms)
|
|
230
|
+
var(--cngx-tooltip-transition-easing, cubic-bezier(0.4, 0, 0.2, 1)),
|
|
231
|
+
transform var(--cngx-tooltip-transition-duration, 150ms)
|
|
232
|
+
var(--cngx-tooltip-transition-easing, cubic-bezier(0.4, 0, 0.2, 1));
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
:scope.cngx-popover--opening {
|
|
236
|
+
opacity: 0;
|
|
237
|
+
transform: scale(0.95);
|
|
238
|
+
}
|
|
239
|
+
:scope.cngx-popover--open {
|
|
240
|
+
opacity: 1;
|
|
241
|
+
transform: scale(1);
|
|
242
|
+
}
|
|
243
|
+
:scope.cngx-popover--closing {
|
|
244
|
+
opacity: 0;
|
|
245
|
+
transform: scale(0.95);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/* Touch devices: larger padding + font-size for readability. */
|
|
249
|
+
@media (hover: none) {
|
|
250
|
+
:scope {
|
|
251
|
+
--cngx-tooltip-padding-block: 8px;
|
|
252
|
+
--cngx-tooltip-padding-inline: 16px;
|
|
253
|
+
--cngx-tooltip-font-size: 0.875rem;
|
|
254
|
+
--cngx-tooltip-line-height: 1.25rem;
|
|
255
|
+
--cngx-tooltip-max-width: 280px;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
@media (prefers-reduced-motion: reduce) {
|
|
260
|
+
:scope {
|
|
261
|
+
transition: none;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @overview
|
|
3
|
+
* Domain-specific system tokens for `@cngx/common`. Empty
|
|
4
|
+
* placeholder - the file exists so each lib's `theming/` layer has a
|
|
5
|
+
* canonical home that ng-packagr already ships.
|
|
6
|
+
*
|
|
7
|
+
* **When to populate**
|
|
8
|
+
*
|
|
9
|
+
* Add `@property` declarations here when a token belongs to this
|
|
10
|
+
* lib's domain (atoms and molecules scope: display, interactive,
|
|
11
|
+
* a11y, popover, dialog, card) but isn't tied to a single component.
|
|
12
|
+
*
|
|
13
|
+
* **Inheritance**
|
|
14
|
+
*
|
|
15
|
+
* - System tokens shared across all libs -> `@cngx/core/theming/system-tokens.css`
|
|
16
|
+
* - Per-component tokens -> `<comp>.component.css` next to the component
|
|
17
|
+
* - Per-directive bridges -> `theming/components/<comp>.css`
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
@layer cngx.tokens {
|
|
21
|
+
/* Add @property declarations here when domain-specific system tokens
|
|
22
|
+
* are needed. Empty layer-block is valid CSS and serves as the
|
|
23
|
+
* structural anchor for future additions. */
|
|
24
|
+
}
|
|
@@ -31,6 +31,15 @@ import { ElementRef, InjectionToken, Signal } from '@angular/core';
|
|
|
31
31
|
* }
|
|
32
32
|
* }
|
|
33
33
|
* ```
|
|
34
|
+
*
|
|
35
|
+
* @category common/a11y
|
|
36
|
+
* @docsKind primary
|
|
37
|
+
* @wcag AA
|
|
38
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/aria-expanded.directive.ts
|
|
39
|
+
* @since 0.1.0
|
|
40
|
+
* @relatedTo CngxLiveRegion, CngxExpandable, CngxDisclosure
|
|
41
|
+
* <example-url>http://localhost:4200/#/common/a11y/aria-expanded/accordion-multiple-panels</example-url>
|
|
42
|
+
* <example-url>http://localhost:4200/#/common/a11y/aria-expanded/disclosure-pattern</example-url>
|
|
34
43
|
*/
|
|
35
44
|
declare class CngxAriaExpanded {
|
|
36
45
|
/** Whether the controlled element is currently expanded. Sets `aria-expanded`. */
|
|
@@ -49,11 +58,11 @@ declare class CngxAriaExpanded {
|
|
|
49
58
|
* `assertive` announcements interrupt immediately. `off` disables announcements.
|
|
50
59
|
*
|
|
51
60
|
* Sets `role="alert"` for assertive regions and `role="status"` for polite regions
|
|
52
|
-
* via a host binding
|
|
61
|
+
* via a host binding - no manual attribute wiring needed.
|
|
53
62
|
*
|
|
54
63
|
* Unlike CDK's `LiveAnnouncer` service (which creates a hidden DOM element and
|
|
55
64
|
* requires imperative `announce()` calls), this directive decorates your own
|
|
56
|
-
* element declaratively
|
|
65
|
+
* element declaratively - the content you render IS the announcement.
|
|
57
66
|
*
|
|
58
67
|
* ### Status message
|
|
59
68
|
* ```html
|
|
@@ -69,13 +78,22 @@ declare class CngxAriaExpanded {
|
|
|
69
78
|
* {{ error() }}
|
|
70
79
|
* </div>
|
|
71
80
|
* ```
|
|
81
|
+
*
|
|
82
|
+
* @category common/a11y
|
|
83
|
+
* @docsKind primary
|
|
84
|
+
* @wcag AA
|
|
85
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/live-region.directive.ts
|
|
86
|
+
* @since 0.1.0
|
|
87
|
+
* @relatedTo CngxAriaExpanded
|
|
88
|
+
* <example-url>http://localhost:4200/#/common/a11y/live-region/form-validation-assertive-error-announcements</example-url>
|
|
89
|
+
* <example-url>http://localhost:4200/#/common/a11y/live-region/polite-vs-assertive</example-url>
|
|
72
90
|
*/
|
|
73
91
|
declare class CngxLiveRegion {
|
|
74
92
|
/**
|
|
75
93
|
* Controls the urgency of announcements.
|
|
76
|
-
* - `'polite'`
|
|
77
|
-
* - `'assertive'`
|
|
78
|
-
* - `'off'`
|
|
94
|
+
* - `'polite'` - queued after current speech (default)
|
|
95
|
+
* - `'assertive'` - interrupts immediately
|
|
96
|
+
* - `'off'` - no announcements
|
|
79
97
|
*/
|
|
80
98
|
readonly politeness: _angular_core.InputSignal<"polite" | "assertive" | "off">;
|
|
81
99
|
/** Whether the entire region should be announced as a whole. */
|
|
@@ -112,11 +130,20 @@ declare class CngxLiveRegion {
|
|
|
112
130
|
* ```html
|
|
113
131
|
* <input cngxAutofocus [autofocusDelay]="200" />
|
|
114
132
|
* ```
|
|
133
|
+
*
|
|
134
|
+
* @category common/a11y
|
|
135
|
+
* @docsKind primary
|
|
136
|
+
* @wcag AA
|
|
137
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/autofocus.directive.ts
|
|
138
|
+
* @since 0.1.0
|
|
139
|
+
* @relatedTo CngxFocusRestore, CngxFocusTrap, CngxFocusVisible
|
|
140
|
+
* <example-url>http://localhost:4200/#/common/a11y/autofocus/conditional-focus</example-url>
|
|
141
|
+
* <example-url>http://localhost:4200/#/common/a11y/autofocus/focus-on-insert</example-url>
|
|
115
142
|
*/
|
|
116
143
|
declare class CngxAutofocus {
|
|
117
144
|
/** Whether to focus the element. Defaults to `true` (always focus on render). */
|
|
118
145
|
readonly when: _angular_core.InputSignal<boolean>;
|
|
119
|
-
/** Delay in ms before focusing
|
|
146
|
+
/** Delay in ms before focusing - useful when the element appears during a transition. */
|
|
120
147
|
readonly delay: _angular_core.InputSignal<number>;
|
|
121
148
|
/** `FocusOptions` passed to `element.focus()`. */
|
|
122
149
|
readonly options: _angular_core.InputSignal<FocusOptions>;
|
|
@@ -159,6 +186,15 @@ declare class CngxAutofocus {
|
|
|
159
186
|
* </div>
|
|
160
187
|
* <button #fallbackBtn>Fallback target</button>
|
|
161
188
|
* ```
|
|
189
|
+
*
|
|
190
|
+
* @category common/a11y
|
|
191
|
+
* @docsKind primary
|
|
192
|
+
* @wcag AA
|
|
193
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-restore.directive.ts
|
|
194
|
+
* @since 0.1.0
|
|
195
|
+
* @relatedTo CngxAutofocus, CngxFocusTrap, CngxFocusVisible
|
|
196
|
+
* <example-url>http://localhost:4200/#/common/a11y/focus-restore/inline-details</example-url>
|
|
197
|
+
* <example-url>http://localhost:4200/#/common/a11y/focus-restore/panel-with-automatic-restore</example-url>
|
|
162
198
|
*/
|
|
163
199
|
declare class CngxFocusRestore {
|
|
164
200
|
/** Whether to restore focus when the host element is destroyed. */
|
|
@@ -216,6 +252,15 @@ declare class CngxFocusRestore {
|
|
|
216
252
|
* <a href="/settings">Settings</a>
|
|
217
253
|
* </nav>
|
|
218
254
|
* ```
|
|
255
|
+
*
|
|
256
|
+
* @category common/a11y
|
|
257
|
+
* @docsKind primary
|
|
258
|
+
* @wcag AA
|
|
259
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-trap.directive.ts
|
|
260
|
+
* @since 0.1.0
|
|
261
|
+
* @relatedTo CngxAutofocus, CngxFocusRestore, CngxDialog
|
|
262
|
+
* <example-url>http://localhost:4200/#/common/a11y/focus-trap/modal-dialog</example-url>
|
|
263
|
+
* <example-url>http://localhost:4200/#/common/a11y/focus-trap/slide-out-drawer</example-url>
|
|
219
264
|
*/
|
|
220
265
|
declare class CngxFocusTrap {
|
|
221
266
|
/** Whether the focus trap is active. When `false`, Tab navigates normally. */
|
|
@@ -246,6 +291,15 @@ declare class CngxFocusTrap {
|
|
|
246
291
|
* @if (fv.focusVisible()) { Focus ring visible }
|
|
247
292
|
* </button>
|
|
248
293
|
* ```
|
|
294
|
+
*
|
|
295
|
+
* @category common/a11y
|
|
296
|
+
* @docsKind primary
|
|
297
|
+
* @wcag AA
|
|
298
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-visible.directive.ts
|
|
299
|
+
* @since 0.1.0
|
|
300
|
+
* @relatedTo CngxAutofocus, CngxFocusRestore, CngxFocusTrap
|
|
301
|
+
* <example-url>http://localhost:4200/#/common/a11y/focus-visible/form-fields-custom-focus-ring</example-url>
|
|
302
|
+
* <example-url>http://localhost:4200/#/common/a11y/focus-visible/keyboard-vs-pointer</example-url>
|
|
249
303
|
*/
|
|
250
304
|
declare class CngxFocusVisible {
|
|
251
305
|
private readonly focusVisibleState;
|
|
@@ -275,6 +329,15 @@ declare class CngxFocusVisible {
|
|
|
275
329
|
* <button cngxRovingItem>Three</button>
|
|
276
330
|
* </div>
|
|
277
331
|
* ```
|
|
332
|
+
*
|
|
333
|
+
* @category common/a11y
|
|
334
|
+
* @docsKind primary
|
|
335
|
+
* @wcag AA
|
|
336
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/roving/roving-tabindex.directive.ts
|
|
337
|
+
* @since 0.1.0
|
|
338
|
+
* @relatedTo CngxRovingTabindex, CngxButtonToggle
|
|
339
|
+
* <example-url>http://localhost:4200/#/common/a11y/roving-tabindex/horizontal-toolbar</example-url>
|
|
340
|
+
* <example-url>http://localhost:4200/#/common/a11y/roving-tabindex/vertical-menu</example-url>
|
|
278
341
|
*/
|
|
279
342
|
declare class CngxRovingItem {
|
|
280
343
|
/** @internal Reference used by the parent `CngxRovingTabindex` to set `tabindex`. */
|
|
@@ -289,7 +352,7 @@ declare class CngxRovingItem {
|
|
|
289
352
|
/**
|
|
290
353
|
* Implements the WAI-ARIA roving tabindex pattern for composite widgets.
|
|
291
354
|
*
|
|
292
|
-
* Only the active item in the group has `tabindex="0"`
|
|
355
|
+
* Only the active item in the group has `tabindex="0"` - all others get
|
|
293
356
|
* `tabindex="-1"`. Arrow keys move focus within the group; Tab leaves it.
|
|
294
357
|
* Home/End jump to first/last item.
|
|
295
358
|
*
|
|
@@ -332,10 +395,25 @@ declare class CngxRovingItem {
|
|
|
332
395
|
* }
|
|
333
396
|
* </div>
|
|
334
397
|
* ```
|
|
398
|
+
*
|
|
399
|
+
* @category common/a11y
|
|
400
|
+
* @docsKind primary
|
|
401
|
+
* @wcag AA
|
|
402
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/roving/roving-tabindex.directive.ts
|
|
403
|
+
* @since 0.1.0
|
|
404
|
+
* @relatedTo CngxRovingItem, CngxActiveDescendant
|
|
405
|
+
* <example-url>http://localhost:4200/#/common/a11y/roving-tabindex/horizontal-toolbar</example-url>
|
|
406
|
+
* <example-url>http://localhost:4200/#/common/a11y/roving-tabindex/vertical-menu</example-url>
|
|
335
407
|
*/
|
|
336
408
|
declare class CngxRovingTabindex {
|
|
337
|
-
/**
|
|
338
|
-
|
|
409
|
+
/**
|
|
410
|
+
* Arrow key navigation axis. `'both'` enables both horizontal and
|
|
411
|
+
* vertical arrows. Exposed as a `model` so composite hosts (e.g.
|
|
412
|
+
* `CngxRadioGroup`, where the keyboard axis must always be `'both'`
|
|
413
|
+
* per WAI-ARIA APG regardless of the cosmetic group orientation) can
|
|
414
|
+
* override it from their own constructor.
|
|
415
|
+
*/
|
|
416
|
+
readonly orientation: _angular_core.ModelSignal<"horizontal" | "vertical" | "both">;
|
|
339
417
|
/** Whether navigation wraps from last to first and vice versa. */
|
|
340
418
|
readonly loop: _angular_core.InputSignal<boolean>;
|
|
341
419
|
/** Index of the currently active (focusable) item. Supports two-way `[(activeIndex)]` binding. */
|
|
@@ -369,7 +447,7 @@ declare class CngxRovingTabindex {
|
|
|
369
447
|
* Handles arrow-key, Home, and End navigation within the group.
|
|
370
448
|
* Prevents default scrolling on arrow keys.
|
|
371
449
|
*
|
|
372
|
-
* Unified handler
|
|
450
|
+
* Unified handler - delegates to virtual or contentChildren navigation
|
|
373
451
|
* based on whether `virtualCount` is set.
|
|
374
452
|
*/
|
|
375
453
|
protected handleKeyDown(event: KeyboardEvent): void;
|
|
@@ -379,7 +457,7 @@ declare class CngxRovingTabindex {
|
|
|
379
457
|
*/
|
|
380
458
|
private focusVirtualItem;
|
|
381
459
|
/**
|
|
382
|
-
* Finds the next index in virtual mode. No disabled-item skipping
|
|
460
|
+
* Finds the next index in virtual mode. No disabled-item skipping - can't check
|
|
383
461
|
* disabled state of items not in the DOM.
|
|
384
462
|
*/
|
|
385
463
|
private findNextVirtual;
|
|
@@ -388,14 +466,14 @@ declare class CngxRovingTabindex {
|
|
|
388
466
|
private isVertical;
|
|
389
467
|
/**
|
|
390
468
|
* Searches for the next enabled item starting from `current + direction`.
|
|
391
|
-
* Respects `loop`
|
|
469
|
+
* Respects `loop` - wraps around or stops at the boundary.
|
|
392
470
|
* Skips disabled items.
|
|
393
471
|
*/
|
|
394
472
|
private findNext;
|
|
395
473
|
private findFirst;
|
|
396
474
|
private findLast;
|
|
397
475
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxRovingTabindex, never>;
|
|
398
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxRovingTabindex, "[cngxRovingTabindex]", ["cngxRovingTabindex"], { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "loop": { "alias": "loop"; "required": false; "isSignal": true; }; "activeIndex": { "alias": "activeIndex"; "required": false; "isSignal": true; }; "virtualCount": { "alias": "virtualCount"; "required": false; "isSignal": true; }; }, { "activeIndex": "activeIndexChange"; }, ["items"], never, true, never>;
|
|
476
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxRovingTabindex, "[cngxRovingTabindex]", ["cngxRovingTabindex"], { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "loop": { "alias": "loop"; "required": false; "isSignal": true; }; "activeIndex": { "alias": "activeIndex"; "required": false; "isSignal": true; }; "virtualCount": { "alias": "virtualCount"; "required": false; "isSignal": true; }; }, { "orientation": "orientationChange"; "activeIndex": "activeIndexChange"; }, ["items"], never, true, never>;
|
|
399
477
|
}
|
|
400
478
|
|
|
401
479
|
/**
|
|
@@ -403,9 +481,11 @@ declare class CngxRovingTabindex {
|
|
|
403
481
|
*
|
|
404
482
|
* `id` must be unique and stable across change detection runs (use `nextUid()`
|
|
405
483
|
* from `@cngx/core/utils`). `label` is used by typeahead matching.
|
|
484
|
+
*
|
|
485
|
+
* @category common/a11y
|
|
406
486
|
*/
|
|
407
487
|
interface ActiveDescendantItem {
|
|
408
|
-
/** Unique DOM `id` on the element
|
|
488
|
+
/** Unique DOM `id` on the element - required for `aria-activedescendant`. */
|
|
409
489
|
readonly id: string;
|
|
410
490
|
/** Opaque value emitted on `activated`. Compared with `Object.is` by default. */
|
|
411
491
|
readonly value: unknown;
|
|
@@ -425,13 +505,20 @@ interface ActiveDescendantItem {
|
|
|
425
505
|
* ```
|
|
426
506
|
*
|
|
427
507
|
* The contained directive must expose `id`, `value`, `label`, and optionally
|
|
428
|
-
* `disabled` as signals
|
|
508
|
+
* `disabled` as signals - the AD reads them reactively.
|
|
509
|
+
*
|
|
510
|
+
* @category common/a11y
|
|
511
|
+
* @wcag AA
|
|
512
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/active-descendant/ad-item.token.ts
|
|
513
|
+
* @since 0.1.0
|
|
429
514
|
*/
|
|
430
515
|
declare const CNGX_AD_ITEM: InjectionToken<CngxAdItemHandle>;
|
|
431
516
|
/**
|
|
432
517
|
* Minimum shape an AD-registered directive must expose.
|
|
433
518
|
*
|
|
434
519
|
* The shape is signal-based so the AD recomputes when any field changes.
|
|
520
|
+
*
|
|
521
|
+
* @category common/a11y
|
|
435
522
|
*/
|
|
436
523
|
interface CngxAdItemHandle {
|
|
437
524
|
readonly id: string;
|
|
@@ -445,44 +532,49 @@ interface CngxAdItemHandle {
|
|
|
445
532
|
}
|
|
446
533
|
|
|
447
534
|
/**
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
* option is communicated via `aria-activedescendant`.
|
|
535
|
+
* WAI-ARIA active-descendant pattern. Focus stays on the host; the active
|
|
536
|
+
* option is reported via `aria-activedescendant`.
|
|
451
537
|
*
|
|
452
538
|
* ### When to use this vs. `CngxRovingTabindex`
|
|
453
539
|
*
|
|
454
|
-
* - **Active-descendant** when focus
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
*
|
|
459
|
-
* tab list, grid cells). See `CngxRovingTabindex`.
|
|
540
|
+
* - **Active-descendant** when focus stays on one container (listbox, menu,
|
|
541
|
+
* combobox input) and items must not be tab-stops. Screen readers announce
|
|
542
|
+
* the referenced option while the focus ring stays on the host.
|
|
543
|
+
* - **Roving tabindex** when items themselves are tab-stops (toolbar, tab
|
|
544
|
+
* list, grid cells). See `CngxRovingTabindex`.
|
|
460
545
|
*
|
|
461
546
|
* ### Item registration
|
|
462
547
|
*
|
|
463
|
-
* Items register either by providing `CNGX_AD_ITEM` via `hostDirectives`
|
|
548
|
+
* Items register either by providing `CNGX_AD_ITEM` via `hostDirectives` /
|
|
464
549
|
* `providers`, or by passing a `Signal<ActiveDescendantItem[]>` through the
|
|
465
|
-
* `items` input. The
|
|
466
|
-
*
|
|
550
|
+
* `items` input. The `items` input wins when both are present; use it when
|
|
551
|
+
* items come from a dynamic data source.
|
|
467
552
|
*
|
|
468
553
|
* ### Virtualization
|
|
469
554
|
*
|
|
470
|
-
* When `virtualCount` is set, navigation
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
* `clearPendingHighlight()`.
|
|
555
|
+
* When `virtualCount` is set, navigation can address indices not currently
|
|
556
|
+
* in the DOM. `pendingHighlight` tells the consumer to scroll the missing
|
|
557
|
+
* item into view; the consumer calls `clearPendingHighlight()` afterwards.
|
|
474
558
|
*
|
|
475
559
|
* ### Material/CDK equivalent
|
|
476
560
|
*
|
|
477
|
-
*
|
|
478
|
-
*
|
|
479
|
-
*
|
|
561
|
+
* Same model as `cdk-listbox` and `mat-select`, without the visual shell and
|
|
562
|
+
* driven by signals instead of `ListKeyManager`.
|
|
563
|
+
*
|
|
564
|
+
* @category common/a11y
|
|
565
|
+
* @docsKind primary
|
|
566
|
+
* @wcag AA
|
|
567
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/active-descendant/active-descendant.directive.ts
|
|
568
|
+
* @since 0.1.0
|
|
569
|
+
* @relatedTo CngxRovingTabindex, CngxListbox, CngxMenu
|
|
570
|
+
* <example-url>http://localhost:4200/#/common/a11y/active-descendant/listbox-with-items-input</example-url>
|
|
571
|
+
* <example-url>http://localhost:4200/#/common/a11y/active-descendant/typeahead</example-url>
|
|
480
572
|
*/
|
|
481
573
|
declare class CngxActiveDescendant {
|
|
482
574
|
/**
|
|
483
575
|
* Optional explicit item list. When provided, takes precedence over items
|
|
484
576
|
* registered via `CNGX_AD_ITEM`. Useful for combobox-style consumers that
|
|
485
|
-
* drive the menu from a dynamic data source
|
|
577
|
+
* drive the menu from a dynamic data source - pass the unwrapped array
|
|
486
578
|
* (typically the result of a `computed()`), Angular's signal inputs make it
|
|
487
579
|
* reactive automatically.
|
|
488
580
|
*/
|
|
@@ -584,7 +676,7 @@ declare class CngxActiveDescendant {
|
|
|
584
676
|
*
|
|
585
677
|
* Adds the `cngx-reduced-motion` CSS class to the host when the user prefers
|
|
586
678
|
* reduced motion. The `prefersReducedMotion()` signal updates live when the
|
|
587
|
-
* OS preference changes
|
|
679
|
+
* OS preference changes - use it in TypeScript to skip animations, disable
|
|
588
680
|
* auto-playing media, or choose between animated and instant transitions.
|
|
589
681
|
*
|
|
590
682
|
* Unlike a CSS-only `@media (prefers-reduced-motion: reduce)` approach, this
|
|
@@ -603,6 +695,14 @@ declare class CngxActiveDescendant {
|
|
|
603
695
|
* readonly rm = viewChild(CngxReducedMotion);
|
|
604
696
|
* readonly duration = computed(() => this.rm()?.prefersReducedMotion() ? 0 : 300);
|
|
605
697
|
* ```
|
|
698
|
+
*
|
|
699
|
+
* @category common/a11y
|
|
700
|
+
* @docsKind primary
|
|
701
|
+
* @wcag AA
|
|
702
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/motion/reduced-motion.directive.ts
|
|
703
|
+
* @since 0.1.0
|
|
704
|
+
* <example-url>http://localhost:4200/#/common/a11y/reduced-motion/animation-toggle</example-url>
|
|
705
|
+
* <example-url>http://localhost:4200/#/common/a11y/reduced-motion/toast-notifications-motion-aware</example-url>
|
|
606
706
|
*/
|
|
607
707
|
declare class CngxReducedMotion {
|
|
608
708
|
/** `true` when the user's OS is set to prefer reduced motion. Updates reactively. */
|