@cngx/common 0.1.0-rc.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/README.md +15 -2
- package/button/README.md +258 -0
- package/command/README.md +19 -8
- package/data/README.md +10 -10
- package/fesm2022/cngx-common-a11y.mjs +701 -263
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +83 -64
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-button.mjs +1084 -0
- package/fesm2022/cngx-common-button.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +135 -76
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +749 -296
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +51 -29
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +695 -405
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +112 -112
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +668 -308
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +7066 -2739
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +2121 -492
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-menu-button.mjs +557 -0
- package/fesm2022/cngx-common-menu-button.mjs.map +1 -0
- package/fesm2022/cngx-common-popover.mjs +1207 -569
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +256 -261
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +202 -262
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +28 -61
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +10 -10
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +30 -19
- package/layout/README.md +1 -1
- package/menu-button/README.md +234 -0
- package/package.json +14 -4
- package/popover/README.md +42 -5
- package/popover/tooltip-indicator.scss +52 -0
- package/schematics/ng-add/index.js +7 -7
- package/schematics/ng-add/schema.json +5 -0
- package/stepper/README.md +0 -1
- package/theming/components/cngx-accordion.css +36 -7
- package/theming/components/cngx-async.css +185 -37
- package/theming/components/cngx-backdrop.css +3 -1
- package/theming/components/cngx-badge.css +20 -5
- package/theming/components/cngx-bottom-sheet.css +2 -0
- package/theming/components/cngx-breadcrumb.css +3 -1
- package/theming/components/cngx-button-group.css +325 -0
- package/theming/components/cngx-button-toggle.css +55 -23
- package/theming/components/cngx-button.css +975 -0
- package/theming/components/cngx-data-grid.css +2 -0
- package/theming/components/cngx-dialog.css +3 -1
- package/theming/components/cngx-divider.css +24 -9
- package/theming/components/cngx-drawer.css +153 -0
- package/theming/components/cngx-icon-glyph.css +76 -0
- package/theming/components/cngx-listbox.css +79 -25
- package/theming/components/cngx-menu.css +112 -52
- package/theming/components/cngx-nav.css +1220 -0
- package/theming/components/cngx-popover-sheet.css +43 -11
- package/theming/components/cngx-popover.css +37 -13
- package/theming/components/cngx-recycler-placeholder.css +2 -0
- package/theming/components/cngx-ripple.css +74 -16
- package/theming/components/cngx-sidebar.css +71 -0
- package/theming/components/cngx-slider.css +3 -1
- package/theming/components/cngx-tooltip.css +2 -0
- package/timeline/README.md +2 -2
- package/types/cngx-common-a11y.d.ts +343 -120
- package/types/cngx-common-audio.d.ts +60 -88
- package/types/cngx-common-button.d.ts +698 -0
- package/types/cngx-common-card.d.ts +104 -78
- package/types/cngx-common-chart.d.ts +671 -384
- package/types/cngx-common-command.d.ts +44 -47
- package/types/cngx-common-data.d.ts +350 -342
- package/types/cngx-common-dialog.d.ts +91 -120
- package/types/cngx-common-display.d.ts +475 -300
- package/types/cngx-common-interactive.d.ts +4350 -1723
- package/types/cngx-common-layout.d.ts +1365 -286
- package/types/cngx-common-menu-button.d.ts +382 -0
- package/types/cngx-common-popover.d.ts +671 -289
- package/types/cngx-common-stepper.d.ts +217 -347
- package/types/cngx-common-tabs.d.ts +173 -386
- package/types/cngx-common-timeline.d.ts +25 -104
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# @cngx/common/menu-button
|
|
2
|
+
|
|
3
|
+
Buttons that open a menu, after the WAI-ARIA APG Menu Button Pattern. The entry composes
|
|
4
|
+
`@cngx/common/button`, `@cngx/common/interactive` and `@cngx/common/popover` into three button
|
|
5
|
+
types:
|
|
6
|
+
|
|
7
|
+
- `button[cngxMenuButton]`: a `cngxButton` with an end caret that opens a `cngxMenu` in a
|
|
8
|
+
`cngxPopover`.
|
|
9
|
+
- `button[cngxIconMenuButton]`: the square, icon-only kebab or "more" button.
|
|
10
|
+
- `[cngxSplitButton]`: a main action and a caret that opens the alternatives, framed as one
|
|
11
|
+
button group.
|
|
12
|
+
|
|
13
|
+
All three render on `CngxButtonBrain`. Variant, tone, size, group, `disabled` with a reason and
|
|
14
|
+
the busy layer work as on `cngxButton`; see the [`@cngx/common/button` README](../button/README.md).
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { Component, signal } from '@angular/core';
|
|
20
|
+
import { CngxMenu, CngxMenuItem } from '@cngx/common/interactive';
|
|
21
|
+
import { CngxMenuButton } from '@cngx/common/menu-button';
|
|
22
|
+
import { CngxPopover } from '@cngx/common/popover';
|
|
23
|
+
|
|
24
|
+
@Component({
|
|
25
|
+
selector: 'app-export',
|
|
26
|
+
imports: [CngxMenu, CngxMenuItem, CngxMenuButton, CngxPopover],
|
|
27
|
+
template: `
|
|
28
|
+
<button cngxMenuButton="outline" [menu]="menu" [popover]="pop">Export</button>
|
|
29
|
+
<div cngxPopover placement="bottom-start" #pop="cngxPopover">
|
|
30
|
+
<ul cngxMenu label="Export format" (itemActivated)="format.set($event)" #menu="cngxMenu">
|
|
31
|
+
<li cngxMenuItem value="pdf">PDF</li>
|
|
32
|
+
<li cngxMenuItem value="csv">CSV</li>
|
|
33
|
+
</ul>
|
|
34
|
+
</div>
|
|
35
|
+
`,
|
|
36
|
+
})
|
|
37
|
+
export class AppExport {
|
|
38
|
+
readonly format = signal<unknown>(null);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Menu button
|
|
43
|
+
|
|
44
|
+
`[menu]` takes the `cngxMenu` and `[popover]` the `cngxPopover` around it. The button carries
|
|
45
|
+
`CngxMenuTrigger` and `CngxPopoverTrigger` as host directives and toggles the popover on click.
|
|
46
|
+
|
|
47
|
+
`aria-haspopup` reads `menu` and `aria-controls` names the `role="menu"` element, without a
|
|
48
|
+
`[haspopup]` binding. A popover presented as a sheet or fullscreen reads `dialog` and names the
|
|
49
|
+
popover instead.
|
|
50
|
+
|
|
51
|
+
- ArrowDown, Enter or Space opens the menu on the first item, ArrowUp on the last.
|
|
52
|
+
- Focus moves into the menu, which tracks the highlighted item with `aria-activedescendant`.
|
|
53
|
+
- Escape or an activation closes the menu and returns focus to the button.
|
|
54
|
+
- Tab and Shift+Tab close it and leave focus where it went.
|
|
55
|
+
|
|
56
|
+
`expanded()` mirrors the popover's visibility, and the host carries `data-expanded`.
|
|
57
|
+
|
|
58
|
+
A disabled menu button opens on neither click nor key, and an open menu closes when the button
|
|
59
|
+
becomes disabled. The menu button has no action of its own, since a click opens the menu. Put
|
|
60
|
+
async work on the menu items, not on a `cngxAsyncClick` co-hosted on the button.
|
|
61
|
+
|
|
62
|
+
A projected `cngxButtonStart` element leads the label, as on `cngxButton`.
|
|
63
|
+
|
|
64
|
+
## Caret
|
|
65
|
+
|
|
66
|
+
The end of the button renders the `CNGX_ICON_CHEVRON_DOWN` chevron at `1em` of the button font,
|
|
67
|
+
turned half a turn while the menu is open. It is decorative and hidden from assistive
|
|
68
|
+
technology.
|
|
69
|
+
|
|
70
|
+
- `--cngx-menu-button-caret-size` sizes it.
|
|
71
|
+
- The turn takes `--cngx-button-transition` and is instant under reduced motion.
|
|
72
|
+
- `provideButtonCaretIcon(MyCaret)` swaps the glyph for every menu button and split caret below
|
|
73
|
+
the provider, in `providers` or `viewProviders`. A custom host reads it with
|
|
74
|
+
`injectButtonCaretIcon()`.
|
|
75
|
+
- A projected `cngxButtonEnd` element replaces the caret on one button.
|
|
76
|
+
|
|
77
|
+
## Icon menu button
|
|
78
|
+
|
|
79
|
+
`button[cngxIconMenuButton]` has the bindings and keyboard model of `cngxMenuButton` on the
|
|
80
|
+
icon-button skin: square, `ghost` by default, no caret. It renders the glyph you project.
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<button cngxIconMenuButton aria-label="Actions for Q3 report" [menu]="menu" [popover]="pop">
|
|
84
|
+
<svg aria-hidden="true" viewBox="0 0 24 24" fill="currentColor">
|
|
85
|
+
<circle cx="12" cy="5" r="2" /><circle cx="12" cy="12" r="2" /><circle cx="12" cy="19" r="2" />
|
|
86
|
+
</svg>
|
|
87
|
+
</button>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Name the button after what the menu acts on, not after the glyph. Without `aria-label`,
|
|
91
|
+
`aria-labelledby` or `title` it warns [`CNGX1071`](../../../core-concepts/error-codes/cngx1071.md)
|
|
92
|
+
in development.
|
|
93
|
+
|
|
94
|
+
## Split button
|
|
95
|
+
|
|
96
|
+
`[cngxSplitButton]` frames a main button that runs the default action and a
|
|
97
|
+
`cngxIconMenuButton` caret that opens the alternatives. It is a button group with
|
|
98
|
+
`role="group"`: `variant` and `size` pass to both buttons, and the group needs a name
|
|
99
|
+
([`CNGX1072`](../../../core-concepts/error-codes/cngx1072.md)).
|
|
100
|
+
|
|
101
|
+
```html
|
|
102
|
+
<div cngxSplitButton variant="solid" aria-label="Publish">
|
|
103
|
+
<button cngxButton [cngxAsyncClick]="publish">Publish</button>
|
|
104
|
+
<button cngxIconMenuButton [menu]="menu" [popover]="pop"></button>
|
|
105
|
+
</div>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The split finds its two roles among its direct children. An `ng-container` in between is fine.
|
|
109
|
+
|
|
110
|
+
- The caret is the child that carries `CngxSplitCaret`, as `cngxIconMenuButton` does.
|
|
111
|
+
- The main action is the first other cngx button: `cngxButton`, `cngxIconButton`,
|
|
112
|
+
`cngxActionButton` or a custom host on `CngxButtonBrain`. The split reads it through
|
|
113
|
+
`CNGX_BUTTON_STATE`.
|
|
114
|
+
- Without a main button the split warns
|
|
115
|
+
[`CNGX1073`](../../../core-concepts/error-codes/cngx1073.md).
|
|
116
|
+
- A button deeper inside, for example a kebab in a projected panel, takes neither role and
|
|
117
|
+
keeps its own name and state.
|
|
118
|
+
|
|
119
|
+
The caret follows the main action. While the main button is disabled, running or refused by
|
|
120
|
+
`[enabled]="false"`, the caret reads `aria-disabled`, opens on neither click nor key, and an
|
|
121
|
+
open menu closes. Its `aria-describedby` names the cause: the main button's reason, or "The main
|
|
122
|
+
action is running" while the main action runs. The main button keeps `aria-busy` and the
|
|
123
|
+
announcement. `[disabled]` on the caret blocks only the alternatives and reads the caret's own
|
|
124
|
+
`disabledReason`.
|
|
125
|
+
|
|
126
|
+
The caret needs no glyph and no name. Inside a split it renders the caret in place of any
|
|
127
|
+
projected content, named "More options" by visually hidden text. An `aria-label` on the caret
|
|
128
|
+
wins, and the caret never writes one itself. Both strings come from the language pack (see
|
|
129
|
+
[Configuration](#configuration)).
|
|
130
|
+
|
|
131
|
+
The caret's menu hangs under the whole group, not under the caret. The split takes the explicit
|
|
132
|
+
anchor slot of the caret's popover while it is free, so a `[cngxPopoverAnchor]` of your own on
|
|
133
|
+
that popover keeps precedence. A pointerdown on the main button still closes an open menu.
|
|
134
|
+
|
|
135
|
+
The split has no run method. To run a menu choice through the main action, click the main
|
|
136
|
+
button from the menu's `(itemActivated)` handler, so the busy state and the announcement stay in
|
|
137
|
+
one place. Bind `succeededAnnouncement` and `failedAnnouncement` on its `cngxAsyncClick` to name
|
|
138
|
+
the chosen action.
|
|
139
|
+
|
|
140
|
+
### Custom caret host
|
|
141
|
+
|
|
142
|
+
`CngxSplitCaret` is the caret role as a host directive. Declare it on a
|
|
143
|
+
[custom button host](../button/README.md#building-a-custom-button-host), next to
|
|
144
|
+
`CngxMenuTrigger` and `CngxPopoverTrigger`. As a direct child of a split the host becomes the
|
|
145
|
+
caret, anywhere else it stays an ordinary button. The split hangs the menu under the group only
|
|
146
|
+
when the host co-hosts `CngxPopoverTrigger`, since it reads the caret's popover through it.
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
import { Component, inject } from '@angular/core';
|
|
150
|
+
import { CngxButtonBrain, provideButtonHost } from '@cngx/common/button';
|
|
151
|
+
import { CngxMenuTrigger } from '@cngx/common/interactive';
|
|
152
|
+
import { CngxSplitCaret } from '@cngx/common/menu-button';
|
|
153
|
+
import { CngxPopoverTrigger } from '@cngx/common/popover';
|
|
154
|
+
|
|
155
|
+
@Component({
|
|
156
|
+
selector: 'button[appCaret]',
|
|
157
|
+
hostDirectives: [
|
|
158
|
+
{ directive: CngxButtonBrain, inputs: ['variant: appCaret', 'disabled', 'disabledReason'] },
|
|
159
|
+
{ directive: CngxMenuTrigger, inputs: ['cngxMenuTrigger: menu', 'popover'] },
|
|
160
|
+
{ directive: CngxPopoverTrigger, inputs: ['cngxPopoverTrigger: popover'] },
|
|
161
|
+
CngxSplitCaret,
|
|
162
|
+
],
|
|
163
|
+
providers: [provideButtonHost('appCaret', { defaultVariant: 'solid', iconOnly: true })],
|
|
164
|
+
host: { '(click)': 'handleClick()' },
|
|
165
|
+
template: `
|
|
166
|
+
<svg aria-hidden="true" viewBox="0 0 24 24"><path d="M7 10l5 5 5-5z" /></svg>
|
|
167
|
+
@if (caret.isCaret()) {
|
|
168
|
+
<span class="cngx-sr-only">{{ caret.label() }}</span>
|
|
169
|
+
<span [id]="caret.busyNoteId" hidden>{{ caret.busyNote() }}</span>
|
|
170
|
+
}
|
|
171
|
+
`,
|
|
172
|
+
})
|
|
173
|
+
export class AppCaret {
|
|
174
|
+
protected readonly caret = inject(CngxSplitCaret);
|
|
175
|
+
private readonly brain = inject(CngxButtonBrain);
|
|
176
|
+
private readonly popover = inject(CngxPopoverTrigger);
|
|
177
|
+
|
|
178
|
+
protected handleClick(): void {
|
|
179
|
+
if (this.brain.blocked()) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
this.popover.popoverRef().toggle();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
The directive hands the refusal to the brain as `CNGX_BUTTON_HOST_STATE` and adds the cause to
|
|
188
|
+
`aria-describedby`. A host that provides `CNGX_BUTTON_HOST_STATE` itself replaces that entry and
|
|
189
|
+
folds `caret.refusing()` into its own state.
|
|
190
|
+
|
|
191
|
+
## Configuration
|
|
192
|
+
|
|
193
|
+
Each concern has one provider, and each works in `providers` and `viewProviders`:
|
|
194
|
+
|
|
195
|
+
| Concern | Provider |
|
|
196
|
+
|-|-|
|
|
197
|
+
| Caret glyph | `provideButtonCaretIcon(MyCaret)` |
|
|
198
|
+
| Copy | `provideMenuButtonI18n(withMenuButtonI18nLabels({ ... }))` |
|
|
199
|
+
|
|
200
|
+
Button-wide defaults, the close glyph and the busy glyph have their own providers in
|
|
201
|
+
`@cngx/common/button`.
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
providers: [
|
|
205
|
+
provideButtonCaretIcon(MyCaret),
|
|
206
|
+
provideMenuButtonI18n(withMenuButtonI18nLabels({ splitToggle: 'More actions' })),
|
|
207
|
+
];
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
The labels are the `menuButton` section of the [language pack](../../../core-concepts/i18n.md):
|
|
211
|
+
`splitToggle` names the split caret and `splitMainBusy` describes it while the main action runs.
|
|
212
|
+
`provideMenuButtonI18n(withMenuButtonI18nLabels({ ... }))` overrides single keys on a subtree,
|
|
213
|
+
and a `Signal` passed to `withMenuButtonI18nLabels` follows a runtime language switch. A nested
|
|
214
|
+
provider starts again from the language pack instead of merging onto the outer one, so it repeats
|
|
215
|
+
every outer override it still needs; a runtime language switch reaches the menu buttons below it
|
|
216
|
+
only through that nested provider.
|
|
217
|
+
|
|
218
|
+
## Material
|
|
219
|
+
|
|
220
|
+
`@cngx/themes/material/button-theme` renders menu buttons and split buttons as Material 3 next
|
|
221
|
+
to `[matMenuTriggerFor]`. The split takes the M3 split-button anatomy, which Angular Material
|
|
222
|
+
does not ship. `@cngx/themes/material/menu-theme` makes the `cngxMenu` dropdown read like
|
|
223
|
+
`mat-menu`. The `common/menu-button/menu-button/material-bridge` example shows both.
|
|
224
|
+
|
|
225
|
+
## Not a menu
|
|
226
|
+
|
|
227
|
+
A menu holds actions. Pick another trigger for anything else:
|
|
228
|
+
|
|
229
|
+
- Navigation links behind a button: a popover disclosure, `cngxButton` with
|
|
230
|
+
`cngxPopoverTrigger` and `haspopup="none"`.
|
|
231
|
+
- Content that opens in place: `cngxDisclosure`.
|
|
232
|
+
- A control whose label shows the chosen value: `cngxSelect`.
|
|
233
|
+
|
|
234
|
+
The full decision table is in [Choosing a Trigger](../../../core-concepts/choosing-a-trigger.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cngx/common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Atoms and molecules (a11y, interactive, layout, dialog, popover, display) for the CNGX Angular component library.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cngx",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"directory": "projects/common"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@cngx/utils": "0.
|
|
27
|
-
"@cngx/core": "0.
|
|
26
|
+
"@cngx/utils": "0.3.0",
|
|
27
|
+
"@cngx/core": "0.3.0",
|
|
28
28
|
"@angular/cdk": ">=21.1.0 <23.0.0",
|
|
29
29
|
"@angular/common": ">=21.1.0 <23.0.0",
|
|
30
30
|
"@angular/core": ">=21.1.0 <23.0.0",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"sideEffects": false,
|
|
47
47
|
"exports": {
|
|
48
48
|
"./theming/*.css": "./theming/*.css",
|
|
49
|
+
"./popover/*.scss": "./popover/*.scss",
|
|
49
50
|
"./package.json": {
|
|
50
51
|
"default": "./package.json"
|
|
51
52
|
},
|
|
@@ -61,6 +62,10 @@
|
|
|
61
62
|
"types": "./types/cngx-common-audio.d.ts",
|
|
62
63
|
"default": "./fesm2022/cngx-common-audio.mjs"
|
|
63
64
|
},
|
|
65
|
+
"./button": {
|
|
66
|
+
"types": "./types/cngx-common-button.d.ts",
|
|
67
|
+
"default": "./fesm2022/cngx-common-button.mjs"
|
|
68
|
+
},
|
|
64
69
|
"./card": {
|
|
65
70
|
"types": "./types/cngx-common-card.d.ts",
|
|
66
71
|
"default": "./fesm2022/cngx-common-card.mjs"
|
|
@@ -93,6 +98,10 @@
|
|
|
93
98
|
"types": "./types/cngx-common-layout.d.ts",
|
|
94
99
|
"default": "./fesm2022/cngx-common-layout.mjs"
|
|
95
100
|
},
|
|
101
|
+
"./menu-button": {
|
|
102
|
+
"types": "./types/cngx-common-menu-button.d.ts",
|
|
103
|
+
"default": "./fesm2022/cngx-common-menu-button.mjs"
|
|
104
|
+
},
|
|
96
105
|
"./popover": {
|
|
97
106
|
"types": "./types/cngx-common-popover.d.ts",
|
|
98
107
|
"default": "./fesm2022/cngx-common-popover.mjs"
|
|
@@ -124,5 +133,6 @@
|
|
|
124
133
|
]
|
|
125
134
|
},
|
|
126
135
|
"module": "fesm2022/cngx-common.mjs",
|
|
127
|
-
"typings": "types/cngx-common.d.ts"
|
|
136
|
+
"typings": "types/cngx-common.d.ts",
|
|
137
|
+
"type": "module"
|
|
128
138
|
}
|
package/popover/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Signal-driven popover, tooltip, and popover panel components built on the native
|
|
|
12
12
|
- WCAG 1.4.13 compliant tooltips (dismissable, hoverable, persistent)
|
|
13
13
|
- Material theme SCSS with M3 tokens
|
|
14
14
|
- Exclusive mode (one popover at a time by default)
|
|
15
|
-
- Dismissal defaults: `mode` is `'manual'` (you control open/close; `'auto'` enables native light-dismiss), `[closeOnEscape]` is `true
|
|
15
|
+
- Dismissal defaults: `mode` is `'manual'` (you control open/close; `'auto'` enables native light-dismiss), `[closeOnEscape]` is `true` (it also takes a `Signal<boolean>`, read at keydown time, for a gate that flips inside an event handler), and `[closeOnOutsideClick]` (outside-pointer dismiss) is `false` - opt in when you want click-away to close
|
|
16
16
|
|
|
17
17
|
## Quick Start
|
|
18
18
|
|
|
@@ -67,6 +67,20 @@ The explicit anchor wins over the trigger. When the anchor unmounts, the trigger
|
|
|
67
67
|
</div>
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
+
### Focus return
|
|
71
|
+
|
|
72
|
+
On close, `CngxPopoverTrigger` can return focus to the element that was focused before the popover opened. It only does so when focus would otherwise be lost (on `body` or inside the panel); a close that moved focus to another control leaves it there. The decision resolves in this order:
|
|
73
|
+
|
|
74
|
+
1. `[restoreFocus]` on the trigger, when bound.
|
|
75
|
+
2. The composer claim on the popover (`restoreFocusHint()`). `CngxPopoverPanel` claims `true`, so a panel returns focus to its trigger by default. A menu trigger claims `false`, because the menu focus stack restores.
|
|
76
|
+
3. `false`. A bare `[cngxPopover]` stays opt-in.
|
|
77
|
+
|
|
78
|
+
Bind `[restoreFocus]="false"` on a panel's trigger to keep focus where the browser leaves it. In a sheet or fullscreen presentation the claim is ignored and `CngxPopoverSheet` restores.
|
|
79
|
+
|
|
80
|
+
Composers hint the trigger through owner-keyed claims on `CngxPopover`: `claimHaspopup(owner, value)`, `claimControls(owner, idSignal)` and `claimRestoreFocus(owner, value)`, each with a `release*(owner)` partner called on destroy. With several composers on one popover (a panel around a menu), the last live claim wins and a release removes only that owner's claim.
|
|
81
|
+
|
|
82
|
+
The popover itself reads one more claim: `claimPositionTryFallbacks(owner, chain)` / `releasePositionTryFallbacks(owner)` supplies the `position-try-fallbacks` chain when no `[positionTryFallbacks]` is bound. The menu and context-menu triggers claim `CngxMenuConfig.tryFallbacks` this way, so a clipped menu flips. A bound `[positionTryFallbacks]="[]"` still opts the popover out.
|
|
83
|
+
|
|
70
84
|
## Popover Panel
|
|
71
85
|
|
|
72
86
|
Rich popover molecule with header/body/footer slots, variant styling, arrow, close button, and async action buttons.
|
|
@@ -79,6 +93,7 @@ import {
|
|
|
79
93
|
CngxPopoverBody,
|
|
80
94
|
CngxPopoverFooter,
|
|
81
95
|
CngxPopoverAction,
|
|
96
|
+
CngxPopoverDismiss,
|
|
82
97
|
providePopoverPanel,
|
|
83
98
|
withCloseButton,
|
|
84
99
|
withArrow,
|
|
@@ -102,17 +117,35 @@ import { CngxPending, CngxSucceeded, CngxFailed } from '@cngx/common/interactive
|
|
|
102
117
|
<p cngxPopoverBody>This action cannot be undone.</p>
|
|
103
118
|
|
|
104
119
|
<div cngxPopoverFooter>
|
|
105
|
-
<
|
|
106
|
-
<
|
|
120
|
+
<button cngxPopoverDismiss>Cancel</button>
|
|
121
|
+
<button cngxPopoverAction="solid" tone="danger" [action]="deleteItem" [showDelay]="120">
|
|
107
122
|
Delete
|
|
108
123
|
<ng-template cngxPending>Deleting...</ng-template>
|
|
109
124
|
<ng-template cngxSucceeded>Deleted!</ng-template>
|
|
110
125
|
<ng-template cngxFailed let-err>{{ err }}</ng-template>
|
|
111
|
-
</
|
|
126
|
+
</button>
|
|
112
127
|
</div>
|
|
113
128
|
</cngx-popover-panel>
|
|
114
129
|
```
|
|
115
130
|
|
|
131
|
+
Both footer hosts are button-family hosts on the native `<button>`: `cngx-button.css` from `@cngx/themes/cngx.css` paints them, the size is pinned to `sm` (a bound `size` wins), the default variant is `outline` and the tone comes from `tone`, not from the panel variant. `button[cngxPopoverDismiss]` closes the panel; `button[cngxPopoverAction]` requires `[action]`. Focus returns to the trigger through the panel's restore claim.
|
|
132
|
+
|
|
133
|
+
`button[cngxPopoverAction]` is skin over four host directives: `CngxButtonBrain`, `CngxAsyncClick` (the run and its live region), `CngxActionStatusBrain` from `@cngx/common/interactive` (`succeededAnnouncement`, `failedAnnouncement`, `announce`, `pendingLabel`, `succeededLabel`, `failedLabel`, `externalState`, `(outcome)`; the label cells and the settle announcement, read through `CNGX_ACTION_STATUS`) and `CngxPopoverCloseOnSuccess` (`closeOnSuccessDelay`). The close directive closes the composing `CngxPopover` after each success outcome of the status brain, own run or external edge (`withCloseOnSuccess()` or the per-instance delay, `null` turns it off), cancels the close when a follow-up run starts, and speaks a closing success through `CngxLiveAnnouncer` outside the panel; it covers that outcome through `CNGX_ANNOUNCEMENT_COVER`, so the region inside the panel stays empty and the success is heard once.
|
|
134
|
+
|
|
135
|
+
#### Migration
|
|
136
|
+
|
|
137
|
+
| Old markup | New markup |
|
|
138
|
+
|-|-|
|
|
139
|
+
| `<cngx-popover-action role="dismiss">` | `<button cngxPopoverDismiss>` |
|
|
140
|
+
| `<cngx-popover-action role="confirm" [action]="a">` | `<button cngxPopoverAction [action]="a">` |
|
|
141
|
+
| `variant="primary"` | `cngxPopoverAction="solid" tone="primary"` |
|
|
142
|
+
| `variant="danger"` | `cngxPopoverAction="solid" tone="danger"` |
|
|
143
|
+
| `variant="ghost"` | `cngxPopoverAction="ghost"` |
|
|
144
|
+
| `variant="secondary"` | default (`outline`) |
|
|
145
|
+
| `--cngx-popover-action-*` tokens | `--cngx-button-*` tokens |
|
|
146
|
+
|
|
147
|
+
The confirm action times its busy visual through the loading gate. The `cngxPending` template shows only after `showDelay` (unbound, `CNGX_LOADING_CONFIG.showDelay`), so a run that settles before the delay never flashes "Deleting..."; once shown it is held for `minDwell` past the run, and for that whole window the action is painted busy (not disabled) and refuses a second click. Bind `[showDelay]` / `[minDwell]` to override per instance, or leave them unbound to inherit the config.
|
|
148
|
+
|
|
116
149
|
### Content States
|
|
117
150
|
|
|
118
151
|
```html
|
|
@@ -124,6 +157,8 @@ import { CngxPending, CngxSucceeded, CngxFailed } from '@cngx/common/interactive
|
|
|
124
157
|
</cngx-popover-panel>
|
|
125
158
|
```
|
|
126
159
|
|
|
160
|
+
**State copy.** Without a slot template, the loading, error and empty views still say something. The text resolves in this order: the projected `*cngxPopoverLoading` / `*cngxPopoverError` / `*cngxPopoverEmpty` template (it replaces the whole node), then `[loadingText]` / `[errorText]` / `[emptyText]`, then `providePopoverPanel(withPopoverPanelLabels({ loading, error, empty }))`, then the `popover` section of the language pack ("Loading", "Could not load", "Nothing to show"). The header row and its close button stay in every view. In the error and empty views `aria-describedby` points at that surface; loading speaks through `aria-busy` and the visible text. A slot template still gets the resolved copy: `let-text` on `*cngxPopoverLoading` / `*cngxPopoverEmpty`, and `let-text="text"` next to the raw error (`let-err`) on `*cngxPopoverError`, so a template that only restyles a state can print the default text.
|
|
161
|
+
|
|
127
162
|
### Custom Close Button
|
|
128
163
|
|
|
129
164
|
```html
|
|
@@ -147,7 +182,7 @@ Add `cngxPopoverSheet` to a `[cngxPopover]` and the popover opens as a modal bot
|
|
|
147
182
|
<header cngxPopoverSheetHeader cngxSwipeDismiss="down">
|
|
148
183
|
<span cngxPopoverSheetHandle></span>
|
|
149
184
|
<h2 cngxPopoverSheetTitle>City</h2>
|
|
150
|
-
<
|
|
185
|
+
<button cngxCloseButton aria-label="Close" (click)="sheet.requestClose('close')"></button>
|
|
151
186
|
</header>
|
|
152
187
|
<ul>...</ul>
|
|
153
188
|
</div>
|
|
@@ -208,6 +243,8 @@ The `variant` input is a free-form string mapped to CSS class `cngx-popover-pane
|
|
|
208
243
|
|
|
209
244
|
### Native Support (zero polyfills needed)
|
|
210
245
|
|
|
246
|
+
<!-- compodocx: inline -->
|
|
247
|
+
|
|
211
248
|
- Chrome 125+
|
|
212
249
|
- Firefox 131+
|
|
213
250
|
- Safari 18.4+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Optional CSS-only indicator for tooltip triggers. Shows a small
|
|
2
|
+
// info icon next to elements with `[cngxTooltip]`.
|
|
3
|
+
//
|
|
4
|
+
// By default, the indicator only appears on touch devices (hover: none).
|
|
5
|
+
// To show on all devices, import the `always` mixin instead.
|
|
6
|
+
//
|
|
7
|
+
// @use '@cngx/common/popover/tooltip-indicator' as indicator;
|
|
8
|
+
//
|
|
9
|
+
// // Touch-only (recommended)
|
|
10
|
+
// @include indicator.touch-only();
|
|
11
|
+
//
|
|
12
|
+
// // Always visible
|
|
13
|
+
// @include indicator.always();
|
|
14
|
+
//
|
|
15
|
+
// Customizable via CSS custom properties on the trigger element:
|
|
16
|
+
//
|
|
17
|
+
// --cngx-tooltip-indicator-size (default: 14px)
|
|
18
|
+
// --cngx-tooltip-indicator-gap (default: 4px)
|
|
19
|
+
// --cngx-tooltip-indicator-color (default: --cngx-color-text-muted)
|
|
20
|
+
// --cngx-tooltip-indicator-icon (default: info circle SVG)
|
|
21
|
+
|
|
22
|
+
// Info circle icon (Heroicons 20/solid - MIT)
|
|
23
|
+
$_default-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z' clip-rule='evenodd'/%3E%3C/svg%3E");
|
|
24
|
+
|
|
25
|
+
@mixin _indicator-styles() {
|
|
26
|
+
[cngxTooltip]::after {
|
|
27
|
+
content: '';
|
|
28
|
+
display: inline-block;
|
|
29
|
+
width: var(--cngx-tooltip-indicator-size, 14px);
|
|
30
|
+
height: var(--cngx-tooltip-indicator-size, 14px);
|
|
31
|
+
margin-inline-start: var(--cngx-tooltip-indicator-gap, 4px);
|
|
32
|
+
vertical-align: middle;
|
|
33
|
+
// Quiet by colour, never opacity: the muted text colour.
|
|
34
|
+
background: var(--cngx-tooltip-indicator-color, var(--cngx-color-text-muted, oklch(0.5 0.01 250)));
|
|
35
|
+
mask-image: var(--cngx-tooltip-indicator-icon, #{$_default-icon});
|
|
36
|
+
mask-size: contain;
|
|
37
|
+
mask-repeat: no-repeat;
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/// Show indicator only on touch devices (no hover capability).
|
|
43
|
+
@mixin touch-only() {
|
|
44
|
+
@media (hover: none) {
|
|
45
|
+
@include _indicator-styles();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/// Show indicator on all devices (desktop + mobile).
|
|
50
|
+
@mixin always() {
|
|
51
|
+
@include _indicator-styles();
|
|
52
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var fe=Object.create;var y=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var ge=Object.getOwnPropertyNames;var me=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var xe=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),be=(n,e)=>{for(var r in e)y(n,r,{get:e[r],enumerable:!0})},V=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ge(e))!ye.call(n,o)&&o!==r&&y(n,o,{get:()=>e[o],enumerable:!(t=ue(e,o))||t.enumerable});return n};var he=(n,e,r)=>(r=n!=null?fe(me(n)):{},V(e||!n||!n.__esModule?y(r,"default",{value:n,enumerable:!0}):r,n)),Se=n=>V(y({},"__esModule",{value:!0}),n);var oe=xe((mn,B)=>{"use strict";var A=process||{},re=A.argv||[],O=A.env||{},je=!(O.NO_COLOR||re.includes("--no-color"))&&(!!O.FORCE_COLOR||re.includes("--color")||A.platform==="win32"||(A.stdout||{}).isTTY&&O.TERM!=="dumb"||!!O.CI),De=(n,e,r=n)=>t=>{let o=""+t,i=o.indexOf(e,n.length);return~i?n+Ve(o,e,r,i)+e:n+o+e},Ve=(n,e,r,t)=>{let o="",i=0;do o+=n.substring(i,t)+r,i=t+e.length,t=n.indexOf(e,i);while(~t);return o+n.substring(i)},te=(n=je)=>{let e=n?De:()=>String;return{isColorSupported:n,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};B.exports=te();B.exports.createColors=te});var Qe={};be(Qe,{ngAdd:()=>j});module.exports=Se(Qe);var S=require("@schematics/angular/utility");var U=require("@angular-devkit/schematics"),J=require("@schematics/angular/utility");function P(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function M(n){return n instanceof Error?n.message:String(n)}function G(n){return n.includes(`\r
|
|
2
2
|
`)?`\r
|
|
3
3
|
`:`
|
|
4
|
-
`}var g="package.json";function x(...n){return e=>{let r=e.exists(g)?e.readText(g):void 0;return(0,U.chain)([(0,
|
|
5
|
-
`)&&!
|
|
6
|
-
`)?`${
|
|
7
|
-
`:
|
|
8
|
-
`?
|
|
9
|
-
`)};return{info:
|
|
4
|
+
`}var g="package.json";function Re(n){return/\n([ \t]+)\S/.exec(n)?.[1]??" "}function Te(n,e){return JSON.stringify(JSON.parse(n),null," ").replace(/^\t+/gm,r=>e.repeat(r.length))}function x(...n){return e=>{let r=e.exists(g)?e.readText(g):void 0;return(0,U.chain)([(0,J.addDependency)(...n),t=>{if(r===void 0||!t.exists(g))return;let o=t.readText(g);if(o===r)return;let i=Re(r),s=i===" "?o:Te(o,i),l=G(r),d=r.endsWith(`
|
|
5
|
+
`)&&!s.endsWith(`
|
|
6
|
+
`)?`${s}
|
|
7
|
+
`:s,c=l===`
|
|
8
|
+
`?d:d.replace(/\r?\n/g,l);c!==o&&t.overwrite(g,c)}])}}var v=require("node:fs"),Y=require("node:path"),L=require("@angular-devkit/schematics");function w(n){return P(n)?Object.fromEntries(Object.entries(n).filter(e=>typeof e[1]=="string")):{}}function Ee(n){try{return JSON.parse(n)}catch(e){let r=e instanceof Error?e.message:String(e);throw new L.SchematicsException(`package.json is not valid JSON: ${r.replace(/\.$/,"")}.`)}}function u(n){let e=Ee(n);if(!P(e))throw new L.SchematicsException("package.json is not a JSON object.");return{name:typeof e.name=="string"?e.name:void 0,version:typeof e.version=="string"?e.version:void 0,dependencies:w(e.dependencies),devDependencies:w(e.devDependencies),peerDependencies:w(e.peerDependencies)}}function W(n){let{version:e}=u((0,v.readFileSync)(b(n),"utf8"));if(e===void 0)throw new Error(`No version in ${b(n)}.`);return e}function q(n){let{name:e}=u((0,v.readFileSync)(b(n),"utf8"));if(e===void 0)throw new Error(`No name in ${b(n)}.`);return e}function b(n){return(0,Y.join)(n,"..","..","package.json")}function m(n,e){return n.dependencies[e]??n.devDependencies[e]}var Ce=/^[\s^~<>=v]*(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-([0-9A-Za-z.-]+))?/;function H(n){let e=Ce.exec(n??"");if(e===null)return;let[,r,t="0",o="0",i]=e;return{major:Number(r),minor:Number(t),patch:Number(o),prerelease:i===void 0?[]:i.split(".").map(s=>/^\d+$/.test(s)?Number(s):s)}}function Oe(n,e){return typeof n=="number"&&typeof e=="number"?n-e:typeof n=="number"?-1:typeof e=="number"?1:n===e?0:n<e?-1:1}function X(n,e){let r=H(n),t=H(e);if(r===void 0||t===void 0)return;let o=r.major-t.major||r.minor-t.minor||r.patch-t.patch;if(o!==0)return o;if(r.prerelease.length===0||t.prerelease.length===0)return t.prerelease.length-r.prerelease.length;let i=Math.max(r.prerelease.length,t.prerelease.length);for(let s=0;s<i;s++){let l=r.prerelease[s],d=t.prerelease[s];if(l===void 0||d===void 0)return l===void 0?-1:1;let c=Oe(l,d);if(c!==0)return c}return 0}function h(n,e){let r=n.read(`node_modules/${e}/package.json`);if(r!==null)try{return u(r.toString("utf8")).version}catch{return}}var Ae="package.json",Ne=/^[\s\d.^~<>=|xX*v-]+$/;function Pe(n,e){if(n!==void 0&&Ne.test(n)&&/\d/.test(n))return n;let r=/^(\d+)\.(\d+)\.\d+(-.+)?/.exec(e??"");if(r!==null)return r[3]===void 0?`^${r[1]}.${r[2]}.0`:`^${e}`}function K(n,e){return(r,t)=>{let o=e??t.logger,i=u(r.readText(Ae));if(m(i,n)!==void 0)return;let s=Pe(m(i,"@angular/core"),h(r,"@angular/core"));if(s===void 0){o.info(`Add ${n} matching your @angular/core yourself; cngx cannot read an Angular version to match it to.`);return}return o.info(`Adding ${n}@${s} to match @angular/core, so the install does not pick the ${n} of a newer Angular.`),x(n,s,{install:S.InstallBehavior.None,existing:S.ExistingBehavior.Skip})}}var R=require("@schematics/angular/utility"),z=require("@schematics/angular/utility/json-file");var Z="package.json";function k(n,e,r=!1){return(t,o)=>{let i=m(u(t.readText(Z)),n);if(i!==void 0&&i!==e){r&&o.logger.info(`Replacing ${n}@${i} with ${e} so every @cngx package stays on one version.`);let s=new z.JSONFile(t,Z);s.remove(["dependencies",n]),s.remove(["devDependencies",n])}return x(n,e,{install:R.InstallBehavior.None,existing:R.ExistingBehavior.Replace})}}var T=require("@angular-devkit/schematics"),we=["minimal","recommended","full"],E=["utils","core","common","interop","forms","data-display","ui"],ve=["cngx","material","none"],Le=["en","de"],ke=["claude","cursor","vscode"];function C(n,e){return n.some(r=>r===e)}function $e(n,e){return Array.isArray(e)&&e.every(r=>C(n,r))}function Fe(n){return typeof n=="boolean"}function F(n){return`--${n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`}function _e(n,e){let r=e.length===1?"is":"are";return new T.SchematicsException(`"${e.join('", "')}" ${r} given more than once for ${F(n)}.`)}function Be(n,e){let r=F(n);return new T.SchematicsException(`${r} has an empty entry. Separate the values with single commas, for example ${r} ${e.slice(0,2).join(",")}.`)}function _(n,e,r){return new T.SchematicsException(`"${e.join('", "')}" is not a valid answer for ${F(n)}. Expected one of: ${r.join(", ")}.`)}var Q=["true","false"];function ee(n,e,r){if(r===void 0)return;let t=typeof r=="string"?r.split(",").map(i=>i.trim()):r;if(t.length===0)return;if(t.includes(""))throw Be(n,e);if(!$e(e,t))throw _(n,t.filter(i=>!C(e,i)),e);let o=t.filter((i,s)=>t.indexOf(i)!==s);if(o.length>0)throw _e(n,[...new Set(o)]);return t}function $(n,e,r){if(r!==void 0){if(!C(e,r))throw _(n,[r],e);return r}}function f(n,e){if(e===void 0||Fe(e))return e;if(!C(Q,e))throw _(n,[e],Q);return e==="true"}function Ie(n){return(typeof n=="string"?n.split(",").map(r=>r.trim()):Array.isArray(n)?n:void 0)?.filter(r=>typeof r=="string"&&r.startsWith("@cngx/"))}function ne(n){return{project:n.project,preset:$("preset",we,n.preset),libs:ee("libs",E,n.libs),theme:$("theme",ve,n.theme),i18n:$("i18n",Le,n.i18n),runtimeSwitch:f("runtimeSwitch",n.runtimeSwitch),lint:f("lint",n.lint),a11yPreferences:f("a11yPreferences",n.a11yPreferences),feedback:f("feedback",n.feedback),floatingFallback:f("floatingFallback",n.floatingFallback),starter:f("starter",n.starter),aiTools:ee("aiTools",ke,n.aiTools),yes:f("yes",n.yes),prompts:f("prompts",n.prompts),quiet:f("quiet",n.quiet),pins:Ie(n.pins)}}var p=require("@angular-devkit/schematics"),N=require("@angular-devkit/schematics/tasks");var ie=he(oe());function Me(n,e){if(n.NO_COLOR!==void 0&&n.NO_COLOR!=="")return!1;let r=n.FORCE_COLOR;return r!==void 0?r!=="0"&&r!=="false":e}function se(n,e){let r=Me(n,e),t=(0,ie.createColors)(r);return{enabled:r,bold:t.bold,dim:t.dim,green:t.green,yellow:t.yellow,red:t.red}}function ae(n){let e=n?.toLowerCase();return e==="1"||e==="true"?!0:e==="0"||e==="false"?!1:void 0}function Ge(n){return ae(n.CI)===!0}function Ue(n,e){return ae(n.NG_FORCE_TTY)??(e.isTTY===!0&&!Ge(n))}function de(n,e,r,t,o){let i=Ue(n,e);return{isTTY:i,color:se(n,i),quiet:o,logger:t,terminal:i?Je(e,r):void 0}}function Je(n,e){if(n.write===void 0)return;let r=o=>i=>{o.write?.(`${i}
|
|
9
|
+
`)},t=r(e.write===void 0?n:e);return{info:r(n),warn:t,error:t}}var He=["0.0.0","PLACEHOLDER"].join("-");function le(n){return n===He}var a="@cngx/core",Ye="@angular/cdk";function We(n){return n!=="@cngx/utils"}function qe(n){return n instanceof Error&&n.constructor.name==="CollectionCannotBeResolvedException"}function I(n){try{n.engine.createCollection(a)}catch(e){let r=qe(e)?"it cannot be resolved":M(e);throw new p.SchematicsException(`${a} is installed but its ng-add collection failed to load: ${r}`)}}function Xe(n){return E.find(e=>`@cngx/${e}`===n)}function Ke(n,e){let r=Xe(e),t=ne({libs:n.libs}).libs;if(t===void 0||r===void 0)return n;let o=new Set([...t,r]);return{...n,libs:E.filter(i=>o.has(i))}}function Ze(n){let e=de(process.env,process.stdout,process.stderr,n.logger,!1);return e.terminal??e.logger}function ze(n,e,r,t){return n===void 0?`${a} is not installed yet; installing it before its ng-add runs.`:e===void 0?`${a} ${n} is installed with a version cngx cannot read; installing ${t} before its ng-add runs.`:`${a} ${n} is installed, older than ${r} ${t}; installing ${t} before its ng-add runs.`}function j(n,e=__dirname){return(r,t)=>{let o=W(e),i=q(e),s=Ke(n,i),l=Ze(t),d=h(r,a),c=d===void 0?void 0:X(d,o);if(le(o)){if(d===void 0)throw new p.SchematicsException(`${i} is an unstamped local build (${o}) and ${a} is not installed; pack the libs with node scripts/pack-libs.mjs and install the tarballs.`);return l.info(`${i} is an unstamped local build (${o}); pinning nothing and following the installed ${a} ${d}.`),I(t),(0,p.externalSchematic)(a,"ng-add",s)}if(c!==void 0&&c>0)return l.info(`${a} ${d} is installed, newer than ${i} ${o}; following the installed core.`),I(t),(0,p.externalSchematic)(a,"ng-add",s);if(c===0)return I(t),(0,p.externalSchematic)(a,"ng-add",{...s,pins:[a,i]});let ce=(0,p.chain)([k(a,o,!0),k(i,o,!0)]);return l.info(ze(d,c,i,o)),(0,p.chain)([ce,...We(i)?[K(Ye,l)]:[],(en,D)=>{let pe=D.addTask(new N.NodePackageInstallTask);D.addTask(new N.RunSchematicTask(a,"ng-add",{...s}),[pe])}])}}0&&(module.exports={ngAdd});
|
|
@@ -85,6 +85,11 @@
|
|
|
85
85
|
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
86
86
|
"description": "Print only the summary, not the planned changes.",
|
|
87
87
|
"default": false
|
|
88
|
+
},
|
|
89
|
+
"pins": {
|
|
90
|
+
"oneOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }],
|
|
91
|
+
"description": "Set by a @cngx package shim that delegates in the same run: the @cngx packages core's plan pins beside the selected ones.",
|
|
92
|
+
"visible": false
|
|
88
93
|
}
|
|
89
94
|
},
|
|
90
95
|
"required": []
|
package/stepper/README.md
CHANGED
|
@@ -45,7 +45,6 @@ Resolution priority: per-instance Input → `viewProviders` → root provider
|
|
|
45
45
|
| `withStepperLinear(boolean)` | Default linear-mode flag. |
|
|
46
46
|
| `withStepperCommitMode('optimistic' \| 'pessimistic')` | Default commit mode. |
|
|
47
47
|
| `withStepperRouterSync(mode, paramName?)` | Default router-sync `mode` + `paramName`. |
|
|
48
|
-
| `withStepperAriaLabels({ stepperRegion?, ... })` | App-wide ARIA-label overrides (consumer locale). |
|
|
49
48
|
| `withStepperFallbackLabels({ groupRoleDescription?, stepRoleDescription?, ... })` | App-wide role-description overrides. |
|
|
50
49
|
|
|
51
50
|
### I18n
|