@cngx/common 0.1.0-rc.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/README.md +15 -2
- package/button/README.md +258 -0
- package/command/README.md +42 -2
- package/data/README.md +15 -12
- package/fesm2022/cngx-common-a11y.mjs +1076 -319
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +99 -77
- 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 +138 -78
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +799 -327
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +101 -25
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +861 -423
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +198 -160
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +693 -329
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +7303 -2774
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +2174 -442
- 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 +2109 -557
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +548 -419
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +442 -331
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +44 -71
- 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 +17 -1
- package/menu-button/README.md +234 -0
- package/package.json +31 -8
- package/popover/README.md +81 -4
- package/popover/tooltip-indicator.scss +52 -0
- package/schematics/collection.json +9 -0
- package/schematics/ng-add/index.js +9 -0
- package/schematics/ng-add/schema.json +96 -0
- package/schematics/package.json +3 -0
- package/stepper/README.md +5 -5
- 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 +434 -0
- package/theming/components/cngx-popover.css +37 -9
- 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 +488 -112
- 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 +677 -389
- package/types/cngx-common-command.d.ts +55 -41
- package/types/cngx-common-data.d.ts +506 -360
- package/types/cngx-common-dialog.d.ts +94 -127
- package/types/cngx-common-display.d.ts +475 -300
- package/types/cngx-common-interactive.d.ts +4383 -1721
- package/types/cngx-common-layout.d.ts +1399 -288
- package/types/cngx-common-menu-button.d.ts +382 -0
- package/types/cngx-common-popover.d.ts +990 -268
- package/types/cngx-common-stepper.d.ts +374 -465
- package/types/cngx-common-tabs.d.ts +309 -403
- package/types/cngx-common-timeline.d.ts +50 -109
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { ElementRef, InjectionToken, Provider, TemplateRef
|
|
2
|
+
import { ElementRef, Signal, InjectionToken, Provider, TemplateRef } from '@angular/core';
|
|
3
|
+
import * as _cngx_core_utils from '@cngx/core/utils';
|
|
4
|
+
import { SlotRegistry, KeyedRegistry, CngxAsyncState, AsyncStatus } from '@cngx/core/utils';
|
|
3
5
|
import * as i1 from '@cngx/common/a11y';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import * as
|
|
6
|
+
import { CngxFocusTrapDriver, AriaLivePoliteness } from '@cngx/common/a11y';
|
|
7
|
+
import { AsyncView } from '@cngx/common/data';
|
|
8
|
+
import * as i2 from '@cngx/common/interactive';
|
|
9
|
+
import { CngxAnnouncementCover } from '@cngx/common/interactive';
|
|
10
|
+
import * as i1$1 from '@cngx/common/button';
|
|
11
|
+
import { CngxButtonBrain, CngxButtonStart, CngxButtonEnd } from '@cngx/common/button';
|
|
12
|
+
import * as i1$2 from '@cngx/common/display';
|
|
7
13
|
|
|
8
14
|
/**
|
|
9
15
|
* Lifecycle state of a popover element.
|
|
10
|
-
*
|
|
11
|
-
* @category common/popover
|
|
12
16
|
*/
|
|
13
17
|
type PopoverState = 'closed' | 'opening' | 'open' | 'closing';
|
|
14
18
|
/**
|
|
15
19
|
* Native popover attribute mode.
|
|
16
|
-
*
|
|
17
|
-
* @category common/popover
|
|
18
20
|
*/
|
|
19
21
|
type PopoverMode = 'manual' | 'auto';
|
|
20
22
|
/**
|
|
@@ -23,14 +25,10 @@ type PopoverMode = 'manual' | 'auto';
|
|
|
23
25
|
* compatibility value. Composers (such as `CngxPopoverPanel`) write the
|
|
24
26
|
* popover's `haspopup` signal to hint the trigger toward the right value
|
|
25
27
|
* without forcing the consumer to repeat it.
|
|
26
|
-
*
|
|
27
|
-
* @category common/popover
|
|
28
28
|
*/
|
|
29
29
|
type PopoverHaspopup = 'dialog' | 'listbox' | 'menu' | 'tree' | 'true';
|
|
30
30
|
/**
|
|
31
31
|
* ARIA roles applicable to a `CngxPopoverPanel` host element.
|
|
32
|
-
*
|
|
33
|
-
* @category common/popover
|
|
34
32
|
*/
|
|
35
33
|
type PopoverPanelRole = 'dialog' | 'alertdialog' | 'tooltip' | 'menu' | 'group' | 'region';
|
|
36
34
|
/**
|
|
@@ -38,8 +36,6 @@ type PopoverPanelRole = 'dialog' | 'alertdialog' | 'tooltip' | 'menu' | 'group'
|
|
|
38
36
|
* driven shift / flip recovery. Driven by `CngxPopover.resolvedEdge`;
|
|
39
37
|
* consumers projecting a `cngxPopoverArrow` template receive this value in
|
|
40
38
|
* the slot context so they can rotate or position their glyph accordingly.
|
|
41
|
-
*
|
|
42
|
-
* @category common/popover
|
|
43
39
|
*/
|
|
44
40
|
type ArrowEdge = 'top' | 'bottom' | 'left' | 'right';
|
|
45
41
|
/**
|
|
@@ -51,14 +47,10 @@ type ArrowEdge = 'top' | 'bottom' | 'left' | 'right';
|
|
|
51
47
|
* - `'manual'` - hover and focus are inert. Only `show()` / `hide()`
|
|
52
48
|
* open or close the tooltip. Escape still dismisses an open tooltip
|
|
53
49
|
* for keyboard accessibility.
|
|
54
|
-
*
|
|
55
|
-
* @category common/popover
|
|
56
50
|
*/
|
|
57
51
|
type TooltipTriggerMode = 'auto' | 'manual';
|
|
58
52
|
/**
|
|
59
53
|
* Anchor-relative placement of a popover.
|
|
60
|
-
*
|
|
61
|
-
* @category common/popover
|
|
62
54
|
*/
|
|
63
55
|
type PopoverPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
|
|
64
56
|
/**
|
|
@@ -76,8 +68,6 @@ type PopoverPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-sta
|
|
|
76
68
|
* Mirrors the precedent in `projects/forms/select/shared/select-base.css`
|
|
77
69
|
* which already ships `position-try-fallbacks: flip-block, flip-inline,
|
|
78
70
|
* flip-block flip-inline;` on select panels.
|
|
79
|
-
*
|
|
80
|
-
* @category common/popover
|
|
81
71
|
*/
|
|
82
72
|
type PopoverPositionTryFallback = 'flip-block' | 'flip-inline' | 'flip-start' | 'flip-block flip-inline' | 'flip-inline flip-block' | 'flip-block flip-start' | 'flip-start flip-block' | 'flip-inline flip-start' | 'flip-start flip-inline' | 'flip-block flip-inline flip-start';
|
|
83
73
|
|
|
@@ -91,6 +81,8 @@ type PopoverPositionTryFallback = 'flip-block' | 'flip-inline' | 'flip-start' |
|
|
|
91
81
|
* State lifecycle: `closed` → `opening` → `open` → `closing` → `closed`.
|
|
92
82
|
* CSS classes `cngx-popover--opening`, `cngx-popover--open`, and
|
|
93
83
|
* `cngx-popover--closing` are applied to the host for transition hooks.
|
|
84
|
+
* The host is `inert` while `closing`, so a reader and a pointer skip a
|
|
85
|
+
* panel that is fading out.
|
|
94
86
|
*
|
|
95
87
|
* ### Declarative click popover
|
|
96
88
|
* ```html
|
|
@@ -106,11 +98,11 @@ type PopoverPositionTryFallback = 'flip-block' | 'flip-inline' | 'flip-start' |
|
|
|
106
98
|
* {{ errorSummary() }}
|
|
107
99
|
* </div>
|
|
108
100
|
* ```
|
|
109
|
-
* <example-url
|
|
110
|
-
* <example-url
|
|
111
|
-
* <example-url
|
|
112
|
-
* <example-url
|
|
113
|
-
* <example-url
|
|
101
|
+
* <example-url>/#/common/interactive/listbox/trigger/select-dropdown</example-url>
|
|
102
|
+
* <example-url>/#/common/popover/click-popover</example-url>
|
|
103
|
+
* <example-url>/#/common/popover/controlled-open</example-url>
|
|
104
|
+
* <example-url>/#/common/popover/escape-mode</example-url>
|
|
105
|
+
* <example-url>/#/common/popover/placement-variants</example-url>
|
|
114
106
|
*
|
|
115
107
|
* ### Collision recovery with `<try-tactic>` fallbacks
|
|
116
108
|
* Apply CSS Anchor Positioning's `position-try-fallbacks` declaratively
|
|
@@ -131,12 +123,11 @@ type PopoverPositionTryFallback = 'flip-block' | 'flip-inline' | 'flip-start' |
|
|
|
131
123
|
* `position-try-fallbacks` style - the browser positions the popover at
|
|
132
124
|
* the declared `placement` regardless of viewport clipping.
|
|
133
125
|
*
|
|
134
|
-
* @category common/popover
|
|
135
|
-
* @docsKind primary
|
|
136
126
|
* @wcag AA
|
|
137
127
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover.directive.ts
|
|
138
|
-
* @since 0.
|
|
128
|
+
* @since 0.3.0
|
|
139
129
|
* @relatedTo CngxPopoverTrigger, CngxPopoverPanel, CngxTooltip
|
|
130
|
+
* @axis level molecule
|
|
140
131
|
*/
|
|
141
132
|
declare class CngxPopover {
|
|
142
133
|
/**
|
|
@@ -156,6 +147,7 @@ declare class CngxPopover {
|
|
|
156
147
|
private readonly _injector;
|
|
157
148
|
private readonly direction;
|
|
158
149
|
private pendingClose;
|
|
150
|
+
private ownsFadeInert;
|
|
159
151
|
/**
|
|
160
152
|
* Arrow-bounds contract resolved lazily on first use.
|
|
161
153
|
* Eager inject() would loop: CngxPopover (host directive on the panel)
|
|
@@ -164,23 +156,51 @@ declare class CngxPopover {
|
|
|
164
156
|
*/
|
|
165
157
|
private _arrowBounds;
|
|
166
158
|
private getArrowBounds;
|
|
159
|
+
/**
|
|
160
|
+
* Presentation seam resolved lazily on first use, same reason as
|
|
161
|
+
* {@link getArrowBounds}: the modifier providing it constructs after this
|
|
162
|
+
* directive. `self: true` keeps a popover nested inside a sheet's host from
|
|
163
|
+
* picking up the outer sheet's seam.
|
|
164
|
+
*/
|
|
165
|
+
private _presentationSeam;
|
|
166
|
+
private presentationSeam;
|
|
167
|
+
/**
|
|
168
|
+
* `false` while a presentation modifier lays the panel out as a sheet or
|
|
169
|
+
* fullscreen. Gates every anchor, margin, fallback and floating write:
|
|
170
|
+
* inline styles beat author CSS, so the sheet stylesheet cannot win
|
|
171
|
+
* against them.
|
|
172
|
+
*/
|
|
173
|
+
private readonly anchored;
|
|
174
|
+
private hiding;
|
|
167
175
|
/** Anchor-relative placement. */
|
|
168
176
|
readonly placement: _angular_core.InputSignal<PopoverPlacement>;
|
|
169
177
|
/**
|
|
170
|
-
* CSS `<try-tactic>` fallbacks for `position-try-fallbacks`.
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
178
|
+
* CSS `<try-tactic>` fallbacks for `position-try-fallbacks`. Unbound
|
|
179
|
+
* (default) defers to a composer claim ({@link claimPositionTryFallbacks},
|
|
180
|
+
* a menu trigger claims a flip chain), else writes nothing. A bound
|
|
181
|
+
* empty array writes nothing and opts out of every claim. Non-empty
|
|
182
|
+
* entries are written verbatim, comma-joined, in declaration order.
|
|
183
|
+
* Spec-compatible vocabulary only (no cngx placement tokens).
|
|
174
184
|
*/
|
|
175
|
-
readonly positionTryFallbacks: _angular_core.InputSignal<readonly PopoverPositionTryFallback[]>;
|
|
185
|
+
readonly positionTryFallbacks: _angular_core.InputSignal<readonly PopoverPositionTryFallback[] | undefined>;
|
|
176
186
|
/**
|
|
177
187
|
* Gap between anchor and popover in px, on the placement's main axis
|
|
178
188
|
* (block axis for `top` / `bottom`, inline axis for `left` / `right`);
|
|
179
189
|
* the cross axis stays flush. Same on both positioning engines.
|
|
180
190
|
*/
|
|
181
191
|
readonly offset: _angular_core.InputSignal<number>;
|
|
182
|
-
/**
|
|
183
|
-
|
|
192
|
+
/**
|
|
193
|
+
* Whether Escape key dismisses the popover. Bind a `Signal<boolean>` (not
|
|
194
|
+
* its value) when the gate flips inside an event handler: the popover then
|
|
195
|
+
* reads it at keydown time, so an Escape right after the flip, before the
|
|
196
|
+
* next change detection, already sees the new value.
|
|
197
|
+
*/
|
|
198
|
+
readonly closeOnEscape: _angular_core.InputSignal<boolean | Signal<boolean>>;
|
|
199
|
+
/**
|
|
200
|
+
* Current Escape gate, resolved from {@link closeOnEscape}. Read it instead
|
|
201
|
+
* of the input: a bound signal is read live.
|
|
202
|
+
*/
|
|
203
|
+
readonly escapeEnabled: Signal<boolean>;
|
|
184
204
|
/**
|
|
185
205
|
* Whether a `pointerdown` outside both the popover and its anchor (trigger)
|
|
186
206
|
* dismisses it - menu / listbox light-dismiss. Opt-in (default `false`) so
|
|
@@ -207,6 +227,20 @@ declare class CngxPopover {
|
|
|
207
227
|
* never evicts its ancestor.
|
|
208
228
|
*/
|
|
209
229
|
readonly exclusive: _angular_core.InputSignal<boolean>;
|
|
230
|
+
/**
|
|
231
|
+
* Emits once each time the popover opens: at the end of `show()`, in the
|
|
232
|
+
* caller's task, after the native `showPopover()` call. A `show()` that
|
|
233
|
+
* returns early (already open, no Popover API) emits nothing. Bind it to
|
|
234
|
+
* react to the open as an event instead of watching `state` in an effect.
|
|
235
|
+
*/
|
|
236
|
+
readonly opened: _angular_core.OutputEmitterRef<void>;
|
|
237
|
+
/**
|
|
238
|
+
* Emits once each time the popover reaches `closed`: after `hide()` (at
|
|
239
|
+
* the end of the exit transition when there is one) and after the
|
|
240
|
+
* browser's own light dismiss. A no-op `hide()` and the teardown on
|
|
241
|
+
* destroy emit nothing.
|
|
242
|
+
*/
|
|
243
|
+
readonly closed: _angular_core.OutputEmitterRef<void>;
|
|
210
244
|
/**
|
|
211
245
|
* Programmatic override of {@link exclusive}. `null` (default) defers to the
|
|
212
246
|
* `[exclusive]` input; a boolean wins over it. Lets a composing organism
|
|
@@ -220,7 +254,7 @@ declare class CngxPopover {
|
|
|
220
254
|
* @internal Read-only view of the programmatic {@link exclusive} override.
|
|
221
255
|
* Written via {@link setExclusiveOverride}.
|
|
222
256
|
*/
|
|
223
|
-
readonly exclusiveOverride:
|
|
257
|
+
readonly exclusiveOverride: Signal<boolean | null>;
|
|
224
258
|
/** Effective exclusivity - override wins, else the `[exclusive]` input. */
|
|
225
259
|
private readonly effectiveExclusive;
|
|
226
260
|
/**
|
|
@@ -236,7 +270,7 @@ declare class CngxPopover {
|
|
|
236
270
|
* @internal Read-only view of the programmatic {@link placement} override.
|
|
237
271
|
* Written via {@link setPlacementOverride}.
|
|
238
272
|
*/
|
|
239
|
-
readonly placementOverride:
|
|
273
|
+
readonly placementOverride: Signal<PopoverPlacement | null>;
|
|
240
274
|
/**
|
|
241
275
|
* Effective placement for the CSS-anchor path - override wins, else the
|
|
242
276
|
* `[placement]` input, then fully mirrored against the ambient writing
|
|
@@ -259,22 +293,28 @@ declare class CngxPopover {
|
|
|
259
293
|
/**
|
|
260
294
|
* Programmatic override of {@link positionTryFallbacks}, paired with
|
|
261
295
|
* {@link placementOverride} so a submenu wiring installs the flip chain too.
|
|
262
|
-
* `null` (default) defers to the `[positionTryFallbacks]` input
|
|
296
|
+
* `null` (default) defers to the `[positionTryFallbacks]` input, then to
|
|
297
|
+
* the last live composer claim ({@link claimPositionTryFallbacks}).
|
|
263
298
|
*/
|
|
264
299
|
private readonly positionTryFallbacksOverrideState;
|
|
265
300
|
/**
|
|
266
301
|
* @internal Read-only view of the programmatic {@link positionTryFallbacks}
|
|
267
302
|
* override. Written via {@link setPositionTryFallbacksOverride}.
|
|
268
303
|
*/
|
|
269
|
-
readonly positionTryFallbacksOverride:
|
|
270
|
-
/**
|
|
304
|
+
readonly positionTryFallbacksOverride: Signal<readonly PopoverPositionTryFallback[] | null>;
|
|
305
|
+
/** Owner-keyed claims behind the composer default of {@link positionTryFallbacks}. */
|
|
306
|
+
private readonly positionTryFallbacksClaims;
|
|
307
|
+
/**
|
|
308
|
+
* Effective try-fallbacks: the override, else the `[positionTryFallbacks]`
|
|
309
|
+
* input, else the last live composer claim, else none.
|
|
310
|
+
*/
|
|
271
311
|
private readonly effectivePositionTryFallbacks;
|
|
272
312
|
private readonly stateSignal;
|
|
273
313
|
private readonly idSignal;
|
|
274
314
|
/** Current lifecycle state. */
|
|
275
|
-
readonly state:
|
|
315
|
+
readonly state: Signal<PopoverState>;
|
|
276
316
|
/** Unique auto-generated ID for this popover instance. */
|
|
277
|
-
readonly id:
|
|
317
|
+
readonly id: Signal<string>;
|
|
278
318
|
/** Backing state for {@link focusOrigin}. */
|
|
279
319
|
private readonly focusOriginState;
|
|
280
320
|
/**
|
|
@@ -284,12 +324,25 @@ declare class CngxPopover {
|
|
|
284
324
|
* `CngxPopoverTrigger`'s `restoreFocus` reads it as the restore
|
|
285
325
|
* target; cleared on finalize.
|
|
286
326
|
*/
|
|
287
|
-
readonly focusOrigin:
|
|
327
|
+
readonly focusOrigin: Signal<HTMLElement | null>;
|
|
328
|
+
/**
|
|
329
|
+
* @internal Single close-listener slot, claimed by `CngxPopoverTrigger`
|
|
330
|
+
* through {@link registerCloseListener}. Last registration wins, like the
|
|
331
|
+
* implicit anchor slot: one trigger per popover.
|
|
332
|
+
*/
|
|
333
|
+
private readonly closeListenerSlot;
|
|
288
334
|
/**
|
|
289
335
|
* Implicit anchor slot, written by `CngxPopoverTrigger` and composing
|
|
290
336
|
* organisms via {@link setAnchorElement}.
|
|
291
337
|
*/
|
|
292
338
|
private readonly anchorElementState;
|
|
339
|
+
/**
|
|
340
|
+
* @internal The implicit anchor ({@link setAnchorElement}) even while an
|
|
341
|
+
* explicit anchor shadows it. Read by `CngxPopoverSheet` only: its focus
|
|
342
|
+
* fallback needs a focusable opener when the explicit anchor is a
|
|
343
|
+
* non-focusable box.
|
|
344
|
+
*/
|
|
345
|
+
readonly implicitAnchorElement: Signal<HTMLElement | null>;
|
|
293
346
|
/** Explicit anchor slot, claimed by `CngxPopoverAnchor`. */
|
|
294
347
|
private readonly explicitAnchorElementSlot;
|
|
295
348
|
/**
|
|
@@ -298,7 +351,7 @@ declare class CngxPopover {
|
|
|
298
351
|
* the implicit anchor and `CngxPopoverTrigger` yields its
|
|
299
352
|
* `anchor-name`.
|
|
300
353
|
*/
|
|
301
|
-
readonly explicitAnchorElement:
|
|
354
|
+
readonly explicitAnchorElement: Signal<HTMLElement | null>;
|
|
302
355
|
/**
|
|
303
356
|
* The anchor element for Floating UI fallback positioning, the
|
|
304
357
|
* arrow-offset geometry and the outside-click guard. Precedence: the
|
|
@@ -306,7 +359,7 @@ declare class CngxPopover {
|
|
|
306
359
|
* wins over the implicit one ({@link setAnchorElement},
|
|
307
360
|
* `CngxPopoverTrigger` or a composing organism).
|
|
308
361
|
*/
|
|
309
|
-
readonly anchorElement:
|
|
362
|
+
readonly anchorElement: Signal<HTMLElement | null>;
|
|
310
363
|
/**
|
|
311
364
|
* Inline-axis position the arrow ornament should sit at, expressed as
|
|
312
365
|
* a CSS length pinned to the anchor's centre. Computed from
|
|
@@ -328,22 +381,46 @@ declare class CngxPopover {
|
|
|
328
381
|
* `cngxPopoverArrow` template use this to render their own glyph at
|
|
329
382
|
* the same coordinate the default arrow ornament would.
|
|
330
383
|
*/
|
|
331
|
-
readonly arrowOffset:
|
|
332
|
-
/**
|
|
333
|
-
private readonly
|
|
384
|
+
readonly arrowOffset: Signal<string | null>;
|
|
385
|
+
/** Owner-keyed claims behind {@link haspopup}. */
|
|
386
|
+
private readonly haspopupClaims;
|
|
334
387
|
/**
|
|
335
388
|
* Hint for the `CngxPopoverTrigger`'s `aria-haspopup` value. Composers
|
|
336
|
-
* such as `CngxPopoverPanel`
|
|
389
|
+
* such as `CngxPopoverPanel` claim it via {@link claimHaspopup} so any
|
|
337
390
|
* trigger pointing at the popover defaults to the right role without
|
|
338
|
-
* the consumer having to set `haspopup` on every trigger element.
|
|
339
|
-
*
|
|
391
|
+
* the consumer having to set `haspopup` on every trigger element. With
|
|
392
|
+
* several composers the last live claim wins, and a release keeps the
|
|
393
|
+
* others. Consumer-supplied `haspopup` on the trigger still wins.
|
|
394
|
+
*/
|
|
395
|
+
readonly haspopup: Signal<PopoverHaspopup | undefined>;
|
|
396
|
+
/** Owner-keyed claims behind {@link controlsHint}: each holds an id source. */
|
|
397
|
+
private readonly controlsClaims;
|
|
398
|
+
/**
|
|
399
|
+
* Hint for the `CngxPopoverTrigger`'s `aria-controls` value: the id of the
|
|
400
|
+
* popup element inside the popover (a `role="menu"`), read from the source
|
|
401
|
+
* a composer claims via {@link claimControls}. Derived, so a change of
|
|
402
|
+
* that source id reaches every trigger without another claim. The last
|
|
403
|
+
* live claim wins. `null` in a sheet or fullscreen presentation, where the
|
|
404
|
+
* popup is the dialog itself, so the trigger names the popover. A
|
|
405
|
+
* `controls` bound on the trigger still wins.
|
|
340
406
|
*/
|
|
341
|
-
readonly
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
407
|
+
readonly controlsHint: Signal<string | null>;
|
|
408
|
+
/** Owner-keyed claims behind {@link restoreFocusHint}. */
|
|
409
|
+
private readonly restoreFocusClaims;
|
|
410
|
+
/**
|
|
411
|
+
* Hint for the `CngxPopoverTrigger`'s focus return on close, used when the
|
|
412
|
+
* trigger binds no `[restoreFocus]`. Composers claim it via
|
|
413
|
+
* {@link claimRestoreFocus}: `CngxPopoverPanel` claims `true` (dialog
|
|
414
|
+
* pattern), a menu trigger claims `false` because its focus stack restores.
|
|
415
|
+
* The last live claim wins. `false` in a sheet or fullscreen presentation,
|
|
416
|
+
* where `CngxPopoverSheet` restores focus itself.
|
|
417
|
+
*/
|
|
418
|
+
readonly restoreFocusHint: Signal<boolean | undefined>;
|
|
419
|
+
protected readonly isOpening: Signal<boolean>;
|
|
420
|
+
protected readonly isOpen: Signal<boolean>;
|
|
421
|
+
protected readonly isClosing: Signal<boolean>;
|
|
422
|
+
readonly isVisible: Signal<boolean>;
|
|
423
|
+
protected readonly cssAnchorRef: Signal<string | null>;
|
|
347
424
|
/**
|
|
348
425
|
* Primary edge of the placement, written from the live trigger and panel
|
|
349
426
|
* rects so the arrow lands on the side that actually faces the trigger.
|
|
@@ -360,18 +437,30 @@ declare class CngxPopover {
|
|
|
360
437
|
* so consumers projecting a `cngxPopoverArrow` template can rotate
|
|
361
438
|
* their own glyph to match the rendered placement.
|
|
362
439
|
*/
|
|
363
|
-
readonly resolvedEdge:
|
|
364
|
-
protected readonly cssMargin:
|
|
440
|
+
readonly resolvedEdge: Signal<ArrowEdge>;
|
|
441
|
+
protected readonly cssMargin: Signal<string | null>;
|
|
442
|
+
/**
|
|
443
|
+
* The same offset as one length, for `calc()` consumers: the margin above
|
|
444
|
+
* is a shorthand (`8px 0`) and cannot be multiplied. The sheet skin caps
|
|
445
|
+
* an anchored sheet with it.
|
|
446
|
+
*/
|
|
447
|
+
protected readonly cssOffset: Signal<string | null>;
|
|
365
448
|
/**
|
|
366
449
|
* Comma-joined `position-try-fallbacks` value, or `null` to skip the
|
|
367
|
-
* style write.
|
|
368
|
-
* property cleanly. Unsupported browsers ignore the unknown
|
|
369
|
-
* gating on `SUPPORTS_ANCHOR` would only suppress a harmless write.
|
|
450
|
+
* style write. Written by `writeAnchorPlacement()` so empty / cleared lists
|
|
451
|
+
* drop the property cleanly. Unsupported browsers ignore the unknown
|
|
452
|
+
* property - gating on `SUPPORTS_ANCHOR` would only suppress a harmless write.
|
|
370
453
|
*/
|
|
371
|
-
protected readonly cssPositionTryFallbacks:
|
|
454
|
+
protected readonly cssPositionTryFallbacks: Signal<string | null>;
|
|
372
455
|
constructor();
|
|
373
456
|
/** Open the popover. No-op if not `closed`. */
|
|
374
457
|
show(): void;
|
|
458
|
+
/**
|
|
459
|
+
* Writes `position-area`, `position-try-fallbacks` and the anchor margin from
|
|
460
|
+
* their computeds. `position-area` goes through a style call because its
|
|
461
|
+
* property name differs per browser (`ANCHOR_AREA_PROPERTY`).
|
|
462
|
+
*/
|
|
463
|
+
private writeAnchorPlacement;
|
|
375
464
|
/** Close the popover. No-op if already `closed` or `closing`. */
|
|
376
465
|
hide(): void;
|
|
377
466
|
/** Toggle between open and closed. */
|
|
@@ -404,11 +493,69 @@ declare class CngxPopover {
|
|
|
404
493
|
*/
|
|
405
494
|
unregisterAnchorElement(element: HTMLElement): void;
|
|
406
495
|
/**
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
*
|
|
496
|
+
* Claim the `aria-haspopup` hint triggers fall back to when the consumer
|
|
497
|
+
* sets none. Composers (`CngxPopoverPanel`, menu wirings) claim with
|
|
498
|
+
* themselves as `owner` and release on destroy. The last live claim wins;
|
|
499
|
+
* a re-claim by the same owner replaces its earlier one.
|
|
500
|
+
*/
|
|
501
|
+
claimHaspopup(owner: object, value: PopoverHaspopup): void;
|
|
502
|
+
/**
|
|
503
|
+
* Release `owner`'s `aria-haspopup` claim. Release removes only this
|
|
504
|
+
* owner's claim, so a co-composer's hint survives it.
|
|
505
|
+
*/
|
|
506
|
+
releaseHaspopup(owner: object): void;
|
|
507
|
+
/**
|
|
508
|
+
* Claim the id source triggers name in `aria-controls` when the consumer
|
|
509
|
+
* sets none. Composers (menu wirings) pass the popup element's id Signal,
|
|
510
|
+
* not its value. The last live claim wins; a re-claim by the same owner
|
|
511
|
+
* replaces its earlier one.
|
|
512
|
+
*/
|
|
513
|
+
claimControls(owner: object, source: Signal<string>): void;
|
|
514
|
+
/**
|
|
515
|
+
* Release `owner`'s `aria-controls` claim. Release removes only this
|
|
516
|
+
* owner's claim, so a co-composer's hint survives it.
|
|
517
|
+
*/
|
|
518
|
+
releaseControls(owner: object): void;
|
|
519
|
+
/**
|
|
520
|
+
* Claim the `position-try-fallbacks` chain the popover falls back to
|
|
521
|
+
* while the consumer binds no `[positionTryFallbacks]`. Composers (menu
|
|
522
|
+
* wirings) claim with themselves as `owner` and release on destroy. The
|
|
523
|
+
* last live claim wins; a re-claim by the same owner replaces its
|
|
524
|
+
* earlier one. A bound list, including an empty one, wins over every
|
|
525
|
+
* claim.
|
|
526
|
+
*/
|
|
527
|
+
claimPositionTryFallbacks(owner: object, value: readonly PopoverPositionTryFallback[]): void;
|
|
528
|
+
/**
|
|
529
|
+
* Release `owner`'s `position-try-fallbacks` claim. Release removes only
|
|
530
|
+
* this owner's claim, so a co-composer's chain survives it.
|
|
531
|
+
*/
|
|
532
|
+
releasePositionTryFallbacks(owner: object): void;
|
|
533
|
+
/**
|
|
534
|
+
* Claim the focus-return hint triggers fall back to when the consumer
|
|
535
|
+
* binds no `[restoreFocus]`. The last live claim wins; a re-claim by the
|
|
536
|
+
* same owner replaces its earlier one.
|
|
537
|
+
*/
|
|
538
|
+
claimRestoreFocus(owner: object, value: boolean): void;
|
|
539
|
+
/**
|
|
540
|
+
* Release `owner`'s focus-return claim. Release removes only this owner's
|
|
541
|
+
* claim, so a co-composer's hint survives it.
|
|
542
|
+
*/
|
|
543
|
+
releaseRestoreFocus(owner: object): void;
|
|
544
|
+
/**
|
|
545
|
+
* @internal Install the listener `finalize()` calls synchronously at the
|
|
546
|
+
* end of every close, with the {@link focusOrigin} captured before it is
|
|
547
|
+
* cleared. Runs on every close path (`hide()`, light dismiss), so a close
|
|
548
|
+
* that lands before the next change detection pass still reaches it. A
|
|
549
|
+
* fading close also calls it once at its start, in the `closing` state and
|
|
550
|
+
* before the panel turns `inert`, with the same origin.
|
|
551
|
+
* Replacing a different live listener warns in dev mode (CNGX1081).
|
|
410
552
|
*/
|
|
411
|
-
|
|
553
|
+
registerCloseListener(fn: (origin: HTMLElement | null) => void): void;
|
|
554
|
+
/**
|
|
555
|
+
* @internal Release `fn`. Clears the slot only while `fn` still holds it,
|
|
556
|
+
* so a stale trigger's teardown leaves a successor registered.
|
|
557
|
+
*/
|
|
558
|
+
releaseCloseListener(fn: (origin: HTMLElement | null) => void): void;
|
|
412
559
|
/**
|
|
413
560
|
* @internal Install or clear the programmatic {@link exclusive} override.
|
|
414
561
|
* `null` defers back to the `[exclusive]` input.
|
|
@@ -421,7 +568,8 @@ declare class CngxPopover {
|
|
|
421
568
|
setPlacementOverride(value: PopoverPlacement | null): void;
|
|
422
569
|
/**
|
|
423
570
|
* @internal Install or clear the programmatic {@link positionTryFallbacks}
|
|
424
|
-
* override. `null` defers back to the `[positionTryFallbacks]` input
|
|
571
|
+
* override. `null` defers back to the `[positionTryFallbacks]` input, then
|
|
572
|
+
* to the last live composer claim.
|
|
425
573
|
*/
|
|
426
574
|
setPositionTryFallbacksOverride(value: readonly PopoverPositionTryFallback[] | null): void;
|
|
427
575
|
protected handleToggle(e: ToggleEvent): void;
|
|
@@ -451,11 +599,16 @@ declare class CngxPopover {
|
|
|
451
599
|
* anchor sits outside the panel's inline extent.
|
|
452
600
|
*/
|
|
453
601
|
private updateArrowOffset;
|
|
602
|
+
private arrowFrame;
|
|
603
|
+
private clearFloatingPosition;
|
|
604
|
+
private cancelArrowFrame;
|
|
454
605
|
private get popoverElement();
|
|
455
606
|
private startClosing;
|
|
607
|
+
private claimFadeInert;
|
|
608
|
+
private releaseFadeInert;
|
|
456
609
|
private finalize;
|
|
457
610
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopover, never>;
|
|
458
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopover, "[cngxPopover]", ["cngxPopover"], { "placement": { "alias": "placement"; "required": false; "isSignal": true; }; "positionTryFallbacks": { "alias": "positionTryFallbacks"; "required": false; "isSignal": true; }; "offset": { "alias": "offset"; "required": false; "isSignal": true; }; "closeOnEscape": { "alias": "closeOnEscape"; "required": false; "isSignal": true; }; "closeOnOutsideClick": { "alias": "closeOnOutsideClick"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "controlledOpen": { "alias": "cngxPopoverOpen"; "required": false; "isSignal": true; }; "exclusive": { "alias": "exclusive"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
611
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopover, "[cngxPopover]", ["cngxPopover"], { "placement": { "alias": "placement"; "required": false; "isSignal": true; }; "positionTryFallbacks": { "alias": "positionTryFallbacks"; "required": false; "isSignal": true; }; "offset": { "alias": "offset"; "required": false; "isSignal": true; }; "closeOnEscape": { "alias": "closeOnEscape"; "required": false; "isSignal": true; }; "closeOnOutsideClick": { "alias": "closeOnOutsideClick"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "controlledOpen": { "alias": "cngxPopoverOpen"; "required": false; "isSignal": true; }; "exclusive": { "alias": "exclusive"; "required": false; "isSignal": true; }; }, { "opened": "opened"; "closed": "closed"; }, never, never, true, never>;
|
|
459
612
|
}
|
|
460
613
|
|
|
461
614
|
/**
|
|
@@ -477,27 +630,35 @@ declare class CngxPopover {
|
|
|
477
630
|
* ```
|
|
478
631
|
*
|
|
479
632
|
* ### Focus restoration
|
|
480
|
-
*
|
|
481
|
-
*
|
|
482
|
-
*
|
|
483
|
-
*
|
|
484
|
-
*
|
|
485
|
-
*
|
|
486
|
-
*
|
|
487
|
-
*
|
|
633
|
+
* On close, the trigger can return focus to the element that was focused
|
|
634
|
+
* before the popover opened (the popover snapshots it synchronously in
|
|
635
|
+
* `show()`, so content autofocus cannot displace the restore target). The
|
|
636
|
+
* popover calls the trigger synchronously at the end of every close, so the
|
|
637
|
+
* decision is made at close time and a close that lands before the next
|
|
638
|
+
* change detection pass (a fast Enter then Escape) still restores. The
|
|
639
|
+
* decision resolves in this order: the `[restoreFocus]` input, then the
|
|
640
|
+
* composer claim on the popover (`CngxPopoverPanel` claims `true`, a menu
|
|
641
|
+
* trigger claims `false` because its focus stack restores), then `false`.
|
|
642
|
+
* A bare popover therefore stays opt-in, and the restore runs only when
|
|
643
|
+
* focus is lost at close time. One trigger per popover: a later trigger
|
|
644
|
+
* takes over the close listener, as it does the implicit anchor slot.
|
|
645
|
+
*
|
|
488
646
|
* @wcag AA
|
|
489
647
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-trigger.directive.ts
|
|
490
|
-
* @since 0.
|
|
491
|
-
* @relatedTo CngxPopover, CngxPopoverAnchor, CngxPopoverPanel, CngxTooltip
|
|
492
|
-
* <example-url
|
|
493
|
-
* <example-url
|
|
494
|
-
* <example-url
|
|
495
|
-
* <example-url
|
|
496
|
-
* <example-url
|
|
648
|
+
* @since 0.3.0
|
|
649
|
+
* @relatedTo CngxPopover, CngxPopoverAnchor, CngxPopoverPanel, CngxTooltip, CngxMenuButton, CngxDisclosure
|
|
650
|
+
* <example-url>/#/common/popover/click-popover</example-url>
|
|
651
|
+
* <example-url>/#/common/popover/disclosure/link-list</example-url>
|
|
652
|
+
* <example-url>/#/common/popover/controlled-open</example-url>
|
|
653
|
+
* <example-url>/#/common/popover/escape-mode</example-url>
|
|
654
|
+
* <example-url>/#/common/popover/placement-variants</example-url>
|
|
655
|
+
* <example-url>/#/common/popover/anchor/field-box-anchor</example-url>
|
|
656
|
+
* <example-url>/#/common/menu-button/menu-button/basic</example-url>
|
|
497
657
|
*/
|
|
498
658
|
declare class CngxPopoverTrigger {
|
|
499
659
|
private readonly elRef;
|
|
500
660
|
private readonly destroyRef;
|
|
661
|
+
private readonly doc;
|
|
501
662
|
/** Explicit reference to the popover this trigger controls. */
|
|
502
663
|
readonly popoverRef: _angular_core.InputSignal<CngxPopover>;
|
|
503
664
|
/**
|
|
@@ -515,14 +676,35 @@ declare class CngxPopoverTrigger {
|
|
|
515
676
|
*/
|
|
516
677
|
readonly haspopupInput: _angular_core.InputSignal<PopoverHaspopup | "none" | undefined>;
|
|
517
678
|
/**
|
|
518
|
-
*
|
|
519
|
-
* popover
|
|
520
|
-
*
|
|
521
|
-
*
|
|
522
|
-
*
|
|
523
|
-
* confirm panels, and dialogs that move focus away from the trigger.
|
|
679
|
+
* ARIA controls override. When set, `aria-controls` names this id instead
|
|
680
|
+
* of the popover element - correct when the popup role sits on an element
|
|
681
|
+
* inside the popover (a `role="listbox"` or `role="tree"` panel). `null`
|
|
682
|
+
* or unset falls back to the popover's `controlsHint()` (installed by a
|
|
683
|
+
* composer such as a menu trigger), then to `popoverRef().id()`.
|
|
524
684
|
*/
|
|
525
|
-
readonly
|
|
685
|
+
readonly controlsInput: _angular_core.InputSignal<string | null | undefined>;
|
|
686
|
+
/**
|
|
687
|
+
* When `true` at close time, restores focus to the popover's pre-open
|
|
688
|
+
* focus target (the popover snapshots `document.activeElement`
|
|
689
|
+
* synchronously inside `show()`, before content autofocus can land in
|
|
690
|
+
* the panel and hands it to the trigger when it closes). The value is
|
|
691
|
+
* read when the popover closes, not when it opens. A snapshot of `body`
|
|
692
|
+
* (a browser that does not focus a clicked button, such as Safari)
|
|
693
|
+
* falls back to this trigger. The restore runs only when focus is
|
|
694
|
+
* lost at close time - on `body` or inside the panel - so a close
|
|
695
|
+
* caused by a click or Escape in another control leaves focus there.
|
|
696
|
+
* Unbound, the popover's composer claim decides
|
|
697
|
+
* (`popoverRef().restoreFocusHint()`: `CngxPopoverPanel` claims `true`, a
|
|
698
|
+
* menu trigger `false`), and without a claim it stays `false`, so a bare
|
|
699
|
+
* popover trigger is a passive ARIA atom. Bind `true` or `false` to
|
|
700
|
+
* override the composer.
|
|
701
|
+
*/
|
|
702
|
+
readonly restoreFocusInput: _angular_core.InputSignal<boolean | undefined>;
|
|
703
|
+
/**
|
|
704
|
+
* @internal Resolved focus return: the `[restoreFocus]` input, then the
|
|
705
|
+
* popover's composer claim, then `false`.
|
|
706
|
+
*/
|
|
707
|
+
protected readonly restoreFocus: _angular_core.Signal<boolean>;
|
|
526
708
|
/**
|
|
527
709
|
* Resolved `aria-haspopup`. Consumer override (`haspopup` on the
|
|
528
710
|
* trigger element) wins; otherwise the popover's `haspopup` signal
|
|
@@ -531,15 +713,29 @@ declare class CngxPopoverTrigger {
|
|
|
531
713
|
* binding drops the attribute entirely.
|
|
532
714
|
*/
|
|
533
715
|
protected readonly haspopup: _angular_core.Signal<PopoverHaspopup | null>;
|
|
716
|
+
/**
|
|
717
|
+
* Resolved `aria-controls`: the consumer override, else the popover's
|
|
718
|
+
* composer hint, else the popover id.
|
|
719
|
+
*/
|
|
720
|
+
protected readonly controls: _angular_core.Signal<string>;
|
|
534
721
|
/**
|
|
535
722
|
* CSS anchor name, yielded (`null`) while a `CngxPopoverAnchor` holds
|
|
536
723
|
* the popover's explicit anchor slot.
|
|
537
724
|
*/
|
|
538
725
|
protected readonly cssAnchorName: _angular_core.Signal<string | null>;
|
|
539
|
-
|
|
726
|
+
/**
|
|
727
|
+
* Close-time focus return, called synchronously by the popover at the end
|
|
728
|
+
* of every close with its pre-open focus origin, and once more at the
|
|
729
|
+
* start of a fading close, before the panel turns `inert`. Whichever call
|
|
730
|
+
* finds focus lost restores it; the other is a no-op. The decision is read
|
|
731
|
+
* here, not sampled on open: a close in a sheet presentation resolves
|
|
732
|
+
* `restoreFocus()` to `false` by itself.
|
|
733
|
+
*/
|
|
734
|
+
private readonly handleClose;
|
|
540
735
|
constructor();
|
|
736
|
+
private isFocusLost;
|
|
541
737
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverTrigger, never>;
|
|
542
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverTrigger, "[cngxPopoverTrigger]", ["cngxPopoverTrigger"], { "popoverRef": { "alias": "cngxPopoverTrigger"; "required": true; "isSignal": true; }; "haspopupInput": { "alias": "haspopup"; "required": false; "isSignal": true; }; "
|
|
738
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverTrigger, "[cngxPopoverTrigger]", ["cngxPopoverTrigger"], { "popoverRef": { "alias": "cngxPopoverTrigger"; "required": true; "isSignal": true; }; "haspopupInput": { "alias": "haspopup"; "required": false; "isSignal": true; }; "controlsInput": { "alias": "controls"; "required": false; "isSignal": true; }; "restoreFocusInput": { "alias": "restoreFocus"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
543
739
|
}
|
|
544
740
|
|
|
545
741
|
/**
|
|
@@ -570,11 +766,11 @@ declare class CngxPopoverTrigger {
|
|
|
570
766
|
* releases the slot identity-guarded and the trigger becomes the anchor
|
|
571
767
|
* again.
|
|
572
768
|
*
|
|
573
|
-
* @category common/popover
|
|
574
769
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-anchor.directive.ts
|
|
575
|
-
* @since 0.
|
|
770
|
+
* @since 0.3.0
|
|
576
771
|
* @relatedTo CngxPopover, CngxPopoverTrigger
|
|
577
|
-
* <example-url
|
|
772
|
+
* <example-url>/#/common/popover/anchor/field-box-anchor</example-url>
|
|
773
|
+
* @axis level atom
|
|
578
774
|
*/
|
|
579
775
|
declare class CngxPopoverAnchor {
|
|
580
776
|
private readonly host;
|
|
@@ -597,6 +793,13 @@ declare class CngxPopoverAnchor {
|
|
|
597
793
|
*
|
|
598
794
|
* The consumer sees only the attribute - no extra elements in the template.
|
|
599
795
|
*
|
|
796
|
+
* The tooltip joins the host's `aria-describedby` instead of replacing it. On
|
|
797
|
+
* a plain host the static `aria-describedby` ids are kept and the tooltip id
|
|
798
|
+
* is appended after them. When the host provides `CNGX_DESCRIBED_BY`
|
|
799
|
+
* (`CngxButton`, `CngxIconButton`), the tooltip contributes its id to that
|
|
800
|
+
* registry next to the host's own ids. The id is referenced while the
|
|
801
|
+
* tooltip is `enabled`, whether or not the popup is open.
|
|
802
|
+
*
|
|
600
803
|
* ### Basic
|
|
601
804
|
* ```html
|
|
602
805
|
* <button cngxTooltip="Ctrl+S">Save</button>
|
|
@@ -609,18 +812,17 @@ declare class CngxPopoverAnchor {
|
|
|
609
812
|
* </button>
|
|
610
813
|
* ```
|
|
611
814
|
*
|
|
612
|
-
* @category common/popover
|
|
613
|
-
* @docsKind primary
|
|
614
815
|
* @wcag AA
|
|
615
816
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/tooltip.directive.ts
|
|
616
|
-
* @since 0.
|
|
617
|
-
* @relatedTo CngxPopover, CngxPopoverTrigger
|
|
618
|
-
* <example-url
|
|
619
|
-
* <example-url
|
|
620
|
-
* <example-url
|
|
621
|
-
* <example-url
|
|
622
|
-
* <example-url
|
|
623
|
-
* <example-url
|
|
817
|
+
* @since 0.3.0
|
|
818
|
+
* @relatedTo CngxPopover, CngxPopoverTrigger, CNGX_DESCRIBED_BY
|
|
819
|
+
* <example-url>/#/common/popover/tooltip/basic-tooltip</example-url>
|
|
820
|
+
* <example-url>/#/common/popover/tooltip/custom-delay</example-url>
|
|
821
|
+
* <example-url>/#/common/popover/tooltip/disabled-state</example-url>
|
|
822
|
+
* <example-url>/#/common/popover/tooltip/keyboard-navigation</example-url>
|
|
823
|
+
* <example-url>/#/common/popover/tooltip/placement</example-url>
|
|
824
|
+
* <example-url>/#/common/popover/tooltip/programmatic-control</example-url>
|
|
825
|
+
* @axis level atom
|
|
624
826
|
*/
|
|
625
827
|
declare class CngxTooltip {
|
|
626
828
|
private readonly renderer;
|
|
@@ -628,6 +830,13 @@ declare class CngxTooltip {
|
|
|
628
830
|
private readonly destroyRef;
|
|
629
831
|
private readonly floatingFallback;
|
|
630
832
|
private readonly direction;
|
|
833
|
+
private readonly motion;
|
|
834
|
+
/**
|
|
835
|
+
* @internal
|
|
836
|
+
* Drives the `cngx-reduced-motion` class on the trigger from the app motion
|
|
837
|
+
* axis (`CNGX_MOTION`), falling back to the OS preference on `auto`.
|
|
838
|
+
*/
|
|
839
|
+
protected readonly reducedMotion: _angular_core.Signal<boolean>;
|
|
631
840
|
/** Tooltip text content. */
|
|
632
841
|
readonly text: _angular_core.InputSignal<string>;
|
|
633
842
|
/** Anchor-relative placement. */
|
|
@@ -676,6 +885,16 @@ declare class CngxTooltip {
|
|
|
676
885
|
private tooltipEl;
|
|
677
886
|
private openTimer;
|
|
678
887
|
private closeTimer;
|
|
888
|
+
private readonly ownDescribedBy;
|
|
889
|
+
/**
|
|
890
|
+
* A host that owns `aria-describedby` (`CngxButton`, `CngxIconButton`)
|
|
891
|
+
* provides `CNGX_DESCRIBED_BY` on its element: the tooltip id joins that
|
|
892
|
+
* registry and this binding renders the merged value the host renders, so
|
|
893
|
+
* neither binding drops the other's ids. Without one, the tooltip owns a
|
|
894
|
+
* local registry seeded with the static `aria-describedby`, so the
|
|
895
|
+
* consumer's ids stay ahead of the tooltip id instead of being overwritten.
|
|
896
|
+
*/
|
|
897
|
+
private readonly describedByRegistry;
|
|
679
898
|
protected readonly ariaDescribedBy: _angular_core.Signal<string | null>;
|
|
680
899
|
protected readonly cssAnchorName: _angular_core.Signal<string | null>;
|
|
681
900
|
constructor();
|
|
@@ -703,33 +922,335 @@ declare class CngxTooltip {
|
|
|
703
922
|
*/
|
|
704
923
|
private readonly floatingPositioner;
|
|
705
924
|
private applyFloatingPosition;
|
|
925
|
+
private createLocalDescribedBy;
|
|
706
926
|
private createTooltipElement;
|
|
707
927
|
private finalize;
|
|
708
928
|
private clearTimers;
|
|
709
929
|
private clearOpenTimer;
|
|
710
930
|
private clearCloseTimer;
|
|
711
931
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTooltip, never>;
|
|
712
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxTooltip, "[cngxTooltip]", ["cngxTooltip"], { "text": { "alias": "cngxTooltip"; "required": true; "isSignal": true; }; "placement": { "alias": "tooltipPlacement"; "required": false; "isSignal": true; }; "offset": { "alias": "tooltipOffset"; "required": false; "isSignal": true; }; "openDelay": { "alias": "tooltipDelay"; "required": false; "isSignal": true; }; "closeDelay": { "alias": "closeDelay"; "required": false; "isSignal": true; }; "enabled": { "alias": "enabled"; "required": false; "isSignal": true; }; "triggers": { "alias": "triggers"; "required": false; "isSignal": true; }; "positionTryFallbacks": { "alias": "tooltipPositionTryFallbacks"; "required": false; "isSignal": true; }; }, {}, never, never, true,
|
|
932
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxTooltip, "[cngxTooltip]", ["cngxTooltip"], { "text": { "alias": "cngxTooltip"; "required": true; "isSignal": true; }; "placement": { "alias": "tooltipPlacement"; "required": false; "isSignal": true; }; "offset": { "alias": "tooltipOffset"; "required": false; "isSignal": true; }; "openDelay": { "alias": "tooltipDelay"; "required": false; "isSignal": true; }; "closeDelay": { "alias": "closeDelay"; "required": false; "isSignal": true; }; "enabled": { "alias": "enabled"; "required": false; "isSignal": true; }; "triggers": { "alias": "triggers"; "required": false; "isSignal": true; }; "positionTryFallbacks": { "alias": "tooltipPositionTryFallbacks"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* How an open popover is laid out: anchored to its trigger, as a bottom
|
|
937
|
+
* sheet, or filling the viewport.
|
|
938
|
+
*
|
|
939
|
+
* @since 0.3.0
|
|
940
|
+
*/
|
|
941
|
+
type CngxPopoverPresentation = 'anchored' | 'sheet' | 'fullscreen';
|
|
942
|
+
/**
|
|
943
|
+
* @internal Contract between `CngxPopover` and a presentation modifier on the
|
|
944
|
+
* same element. `CngxPopover` drops every anchor and floating write while
|
|
945
|
+
* `presentation()` is not `'anchored'`, and calls `onShown()` / `onHide()`
|
|
946
|
+
* synchronously inside `show()` / `hide()` so the modifier can move focus and
|
|
947
|
+
* release page state in the caller's stack.
|
|
948
|
+
*/
|
|
949
|
+
interface CngxPopoverPresentationSeam {
|
|
950
|
+
readonly presentation: Signal<CngxPopoverPresentation>;
|
|
951
|
+
/** Runs right after `showPopover()`, with the host already `aria-hidden="false"`. */
|
|
952
|
+
onShown(): void;
|
|
953
|
+
/** Runs once per `hide()`, before any close transition starts (state still open). */
|
|
954
|
+
onHide(): void;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* Why a sheet asked to close: a swipe on the header or handle, a tap outside
|
|
959
|
+
* the panel, the Android back gesture, or a close control inside the sheet.
|
|
960
|
+
*/
|
|
961
|
+
type CngxPopoverSheetCloseReason = 'swipe' | 'backdrop' | 'back' | 'close';
|
|
962
|
+
/** @internal Handle a `CngxPopoverSheetTitle` registers. */
|
|
963
|
+
interface CngxPopoverSheetTitleHandle {
|
|
964
|
+
readonly id: Signal<string>;
|
|
965
|
+
}
|
|
966
|
+
/** @internal Handle a `CngxPopoverSheetInitialFocus` registers. */
|
|
967
|
+
interface CngxPopoverSheetFocusHandle {
|
|
968
|
+
readonly element: HTMLElement;
|
|
969
|
+
/** Whether the element takes part in the next open. Absent means it does. */
|
|
970
|
+
readonly enabled?: Signal<boolean>;
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* @internal What the sheet parts need from `CngxPopoverSheet`. A token
|
|
974
|
+
* instead of the directive class keeps the parts free of the directive
|
|
975
|
+
* import (dialog-title precedent, `CNGX_DIALOG_ARIA_REGISTRY`).
|
|
976
|
+
*/
|
|
977
|
+
interface CngxPopoverSheetPartsHost {
|
|
978
|
+
readonly titleRegistry: SlotRegistry<CngxPopoverSheetTitleHandle>;
|
|
979
|
+
/** Keyed by a per-handle uid; the first enabled handle in document order wins. */
|
|
980
|
+
readonly initialFocusRegistry: KeyedRegistry<CngxPopoverSheetFocusHandle>;
|
|
981
|
+
/** `true` while the sheet lays the panel out as sheet or fullscreen. */
|
|
982
|
+
readonly modal: Signal<boolean>;
|
|
983
|
+
requestClose(reason: CngxPopoverSheetCloseReason): void;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* What a consumer asks for: a fixed presentation, or `'auto'` to let the
|
|
988
|
+
* breakpoint in `cngx-popover-sheet.css` decide.
|
|
989
|
+
*/
|
|
990
|
+
type CngxPopoverPresentationRequest = 'auto' | CngxPopoverPresentation;
|
|
991
|
+
/**
|
|
992
|
+
* Turns a `CngxPopover` into a modal bottom sheet or fullscreen panel on
|
|
993
|
+
* coarse, narrow viewports, and leaves it anchored everywhere else.
|
|
994
|
+
*
|
|
995
|
+
* Place it on the `[cngxPopover]` element. With the default `'auto'` request,
|
|
996
|
+
* the breakpoint written once in `cngx-popover-sheet.css`
|
|
997
|
+
* (`(pointer: coarse) and (max-width: 48rem)`) picks between the anchored
|
|
998
|
+
* panel and `autoPresentation` (`'sheet'` or `'fullscreen'`). Pass a fixed
|
|
999
|
+
* presentation to override it.
|
|
1000
|
+
*
|
|
1001
|
+
* Both non-anchored presentations are modal: the host becomes
|
|
1002
|
+
* `role="dialog"` + `aria-modal="true"`, named by its
|
|
1003
|
+
* `CngxPopoverSheetTitle`; focus moves into the panel inside `show()`, onto
|
|
1004
|
+
* the first enabled `CngxPopoverSheetInitialFocus` (a marked search input
|
|
1005
|
+
* focused there keeps the iOS keyboard of a tap open), Tab is trapped, every page
|
|
1006
|
+
* sibling is `inert`, the page is pinned, and announcements go through
|
|
1007
|
+
* {@link announce} into a live region inside the panel, the only region
|
|
1008
|
+
* VoiceOver speaks under `aria-modal`. On close the page is live again and
|
|
1009
|
+
* focus is back on the opener before the close transition starts.
|
|
1010
|
+
*
|
|
1011
|
+
* The sheet never closes itself. Header swipes, outside taps and the Android
|
|
1012
|
+
* back gesture arrive as `closeRequested` with a reason; the popover hides
|
|
1013
|
+
* unless `closeOnRequest` is `false`, which lets a consumer apply its own
|
|
1014
|
+
* dismiss policy. Escape stays with `CngxPopover`'s `closeOnEscape`.
|
|
1015
|
+
*
|
|
1016
|
+
* Requires `mode="manual"` on the popover (the default): native light dismiss
|
|
1017
|
+
* would bypass `closeRequested`.
|
|
1018
|
+
*
|
|
1019
|
+
* ```html
|
|
1020
|
+
* <button type="button" (click)="pop.show()">Choose city</button>
|
|
1021
|
+
* <div cngxPopover #pop="cngxPopover" cngxPopoverSheet #sheet="cngxPopoverSheet">
|
|
1022
|
+
* <header cngxPopoverSheetHeader cngxSwipeDismiss="down">
|
|
1023
|
+
* <span cngxPopoverSheetHandle></span>
|
|
1024
|
+
* <h2 cngxPopoverSheetTitle>City</h2>
|
|
1025
|
+
* <button type="button" (click)="sheet.requestClose('close')">Close</button>
|
|
1026
|
+
* </header>
|
|
1027
|
+
* <ul>...</ul>
|
|
1028
|
+
* </div>
|
|
1029
|
+
* ```
|
|
1030
|
+
*
|
|
1031
|
+
* @wcag AA
|
|
1032
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-sheet.directive.ts
|
|
1033
|
+
* @since 0.3.0
|
|
1034
|
+
* @relatedTo CngxPopover, CngxSwipeDismiss, CngxFocusTrap, createPinnedScrollLock, injectScopedLiveRegion
|
|
1035
|
+
* <example-url>/#/common/popover/sheet/bottom-sheet</example-url>
|
|
1036
|
+
* <example-url>/#/common/popover/sheet/fullscreen-search</example-url>
|
|
1037
|
+
* @axis level molecule
|
|
1038
|
+
*/
|
|
1039
|
+
declare class CngxPopoverSheet implements CngxPopoverPresentationSeam, CngxPopoverSheetPartsHost, CngxFocusTrapDriver {
|
|
1040
|
+
private readonly popover;
|
|
1041
|
+
private readonly trap;
|
|
1042
|
+
private readonly announcer;
|
|
1043
|
+
private readonly doc;
|
|
1044
|
+
private readonly injector;
|
|
1045
|
+
private readonly win;
|
|
1046
|
+
private readonly host;
|
|
1047
|
+
private readonly staticRole;
|
|
1048
|
+
private readonly staticLabelledBy;
|
|
1049
|
+
private readonly staticTabindex;
|
|
1050
|
+
/**
|
|
1051
|
+
* Requested presentation. `'auto'` (default, also the bare attribute)
|
|
1052
|
+
* resolves through the stylesheet breakpoint.
|
|
1053
|
+
*/
|
|
1054
|
+
readonly request: _angular_core.InputSignalWithTransform<CngxPopoverPresentationRequest, "" | CngxPopoverPresentationRequest>;
|
|
1055
|
+
/**
|
|
1056
|
+
* What `'auto'` resolves to below the breakpoint: a content-sized `'sheet'`
|
|
1057
|
+
* or a `'fullscreen'` panel (for panels led by a text input).
|
|
1058
|
+
*/
|
|
1059
|
+
readonly autoPresentation: _angular_core.InputSignal<"sheet" | "fullscreen">;
|
|
1060
|
+
/** Id of the element naming the dialog. Wins over a registered `CngxPopoverSheetTitle`. */
|
|
1061
|
+
readonly labelledBy: _angular_core.InputSignal<string | undefined>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Whether the sheet returns focus on close (to `restoreTarget`, else to the
|
|
1064
|
+
* element focused before it opened). Turn it off when a `closing` handler
|
|
1065
|
+
* moves focus itself.
|
|
1066
|
+
*/
|
|
1067
|
+
readonly restoreFocus: _angular_core.InputSignal<boolean>;
|
|
1068
|
+
/** Element to return focus to on close. Defaults to the element focused before open. */
|
|
1069
|
+
readonly restoreTarget: _angular_core.InputSignal<HTMLElement | undefined>;
|
|
1070
|
+
/**
|
|
1071
|
+
* Whether a close request hides the popover. `false` only emits
|
|
1072
|
+
* `closeRequested`, so the consumer decides.
|
|
1073
|
+
*/
|
|
1074
|
+
readonly closeOnRequest: _angular_core.InputSignal<boolean>;
|
|
1075
|
+
/** A swipe, outside tap, back gesture or close control asked the sheet to close. */
|
|
1076
|
+
readonly closeRequested: _angular_core.OutputEmitterRef<CngxPopoverSheetCloseReason>;
|
|
1077
|
+
/**
|
|
1078
|
+
* Emits synchronously inside `hide()` while the page is already live again,
|
|
1079
|
+
* before the close transition. The place to move focus out of the panel.
|
|
1080
|
+
* Fires only for a modal close.
|
|
1081
|
+
*/
|
|
1082
|
+
readonly closing: _angular_core.OutputEmitterRef<void>;
|
|
1083
|
+
private readonly breakpoint;
|
|
1084
|
+
/** Resolved presentation, reflected as `data-cngx-presentation`. */
|
|
1085
|
+
readonly presentation: _angular_core.Signal<CngxPopoverPresentation>;
|
|
1086
|
+
/** `true` in the sheet and fullscreen presentations. */
|
|
1087
|
+
readonly modal: _angular_core.Signal<boolean>;
|
|
1088
|
+
private readonly showing;
|
|
1089
|
+
private readonly modalShowing;
|
|
1090
|
+
/**
|
|
1091
|
+
* @internal Drives the composed `CngxFocusTrap`: Tab stays inside while
|
|
1092
|
+
* modal and opening or open, so the trap anchors leave the Tab order when
|
|
1093
|
+
* the close starts.
|
|
1094
|
+
*/
|
|
1095
|
+
readonly focusTrapEnabled: _angular_core.Signal<boolean>;
|
|
1096
|
+
/** @internal The sheet moves focus itself, inside `show()`. */
|
|
1097
|
+
readonly focusTrapAutoFocus = false;
|
|
1098
|
+
/** @internal */
|
|
1099
|
+
readonly titleRegistry: _cngx_core_utils.SlotRegistry<CngxPopoverSheetTitleHandle>;
|
|
1100
|
+
/** @internal */
|
|
1101
|
+
readonly initialFocusRegistry: _cngx_core_utils.KeyedRegistry<CngxPopoverSheetFocusHandle>;
|
|
1102
|
+
protected readonly roleAttr: _angular_core.Signal<string | null>;
|
|
1103
|
+
protected readonly ariaModal: _angular_core.Signal<"true" | null>;
|
|
1104
|
+
protected readonly ariaLabelledBy: _angular_core.Signal<string | null>;
|
|
1105
|
+
protected readonly tabindexAttr: _angular_core.Signal<string | null>;
|
|
1106
|
+
private readonly region;
|
|
1107
|
+
private engaged;
|
|
1108
|
+
private savedFocus;
|
|
1109
|
+
private inerted;
|
|
1110
|
+
private lifted;
|
|
1111
|
+
private releaseLock;
|
|
1112
|
+
private settlingFrame;
|
|
1113
|
+
private readonly devWarned;
|
|
1114
|
+
private readonly closeWatcher;
|
|
1115
|
+
private readonly outsidePointerDown;
|
|
1116
|
+
private clickSwallowTimer;
|
|
1117
|
+
private escapeKeyTimer;
|
|
1118
|
+
private readonly escapeKeydown;
|
|
1119
|
+
private readonly swallowClick;
|
|
1120
|
+
private readonly swallowMouseDown;
|
|
1121
|
+
constructor();
|
|
1122
|
+
/** @internal Seam call from `CngxPopover.show()`, after `showPopover()`. */
|
|
1123
|
+
onShown(): void;
|
|
1124
|
+
/** @internal Seam call from `CngxPopover.hide()`, before the close transition. */
|
|
1125
|
+
onHide(): void;
|
|
1126
|
+
/**
|
|
1127
|
+
* Ask the sheet to close. Emits `closeRequested` once per open (no-op
|
|
1128
|
+
* unless the popover is opening or open) and hides when `closeOnRequest`
|
|
1129
|
+
* is on.
|
|
1130
|
+
*/
|
|
1131
|
+
requestClose(reason: CngxPopoverSheetCloseReason): void;
|
|
1132
|
+
/**
|
|
1133
|
+
* Speak `message` from the live region inside the panel. Use it for
|
|
1134
|
+
* every announcement while the sheet is modal: VoiceOver drops body-level
|
|
1135
|
+
* regions under `aria-modal`.
|
|
1136
|
+
*/
|
|
1137
|
+
announce(message: string, politeness?: AriaLivePoliteness): void;
|
|
1138
|
+
/**
|
|
1139
|
+
* Move focus to the first enabled `CngxPopoverSheetInitialFocus` in
|
|
1140
|
+
* document order, else the first tabbable element, else the host. Runs on
|
|
1141
|
+
* every modal open.
|
|
1142
|
+
*/
|
|
1143
|
+
focusInitial(): void;
|
|
1144
|
+
private initialFocusTarget;
|
|
1145
|
+
protected handleBeforeToggle(event: ToggleEvent): void;
|
|
1146
|
+
private disengage;
|
|
1147
|
+
private engage;
|
|
1148
|
+
private rehomeFocusIntoSheet;
|
|
1149
|
+
private rehomeFocusAfterFlip;
|
|
1150
|
+
private focusFirstTaker;
|
|
1151
|
+
private focusableAnchor;
|
|
1152
|
+
private openerToRestore;
|
|
1153
|
+
private release;
|
|
1154
|
+
private handleBackGesture;
|
|
1155
|
+
private armClickSwallow;
|
|
1156
|
+
private disarmClickSwallow;
|
|
1157
|
+
private liftOwnInert;
|
|
1158
|
+
private applyInert;
|
|
1159
|
+
private skipsInert;
|
|
1160
|
+
private restoreInert;
|
|
1161
|
+
private handOffPendingAnnouncements;
|
|
1162
|
+
private startSettling;
|
|
1163
|
+
private stopSettling;
|
|
1164
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverSheet, never>;
|
|
1165
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverSheet, "[cngxPopoverSheet]", ["cngxPopoverSheet"], { "request": { "alias": "cngxPopoverSheet"; "required": false; "isSignal": true; }; "autoPresentation": { "alias": "autoPresentation"; "required": false; "isSignal": true; }; "labelledBy": { "alias": "labelledBy"; "required": false; "isSignal": true; }; "restoreFocus": { "alias": "restoreFocus"; "required": false; "isSignal": true; }; "restoreTarget": { "alias": "restoreTarget"; "required": false; "isSignal": true; }; "closeOnRequest": { "alias": "closeOnRequest"; "required": false; "isSignal": true; }; }, { "closeRequested": "closeRequested"; "closing": "closing"; }, never, never, true, [{ directive: typeof i1.CngxFocusTrap; inputs: {}; outputs: {}; }]>;
|
|
713
1166
|
}
|
|
714
1167
|
|
|
1168
|
+
/**
|
|
1169
|
+
* Header row of a `CngxPopoverSheet`. Stays put while the content below it
|
|
1170
|
+
* scrolls; add `cngxSwipeDismiss="down"` to close the sheet by swiping it.
|
|
1171
|
+
*
|
|
1172
|
+
* @since 0.3.0
|
|
1173
|
+
* @relatedTo CngxPopoverSheet, CngxSwipeDismiss
|
|
1174
|
+
*/
|
|
1175
|
+
declare class CngxPopoverSheetHeader {
|
|
1176
|
+
constructor();
|
|
1177
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverSheetHeader, never>;
|
|
1178
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverSheetHeader, "[cngxPopoverSheetHeader]", never, {}, {}, never, never, true, never>;
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* The element that names a modal `CngxPopoverSheet`. The sheet points its
|
|
1182
|
+
* `aria-labelledby` here, never at the header that also holds buttons.
|
|
1183
|
+
*
|
|
1184
|
+
* @since 0.3.0
|
|
1185
|
+
* @relatedTo CngxPopoverSheet
|
|
1186
|
+
*/
|
|
1187
|
+
declare class CngxPopoverSheetTitle implements CngxPopoverSheetTitleHandle {
|
|
1188
|
+
/** Generated id the sheet references. */
|
|
1189
|
+
readonly id: _angular_core.Signal<string>;
|
|
1190
|
+
constructor();
|
|
1191
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverSheetTitle, never>;
|
|
1192
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverSheetTitle, "[cngxPopoverSheetTitle]", never, {}, {}, never, never, true, never>;
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* Decorative drag handle. Always `aria-hidden`: screen-reader users close
|
|
1196
|
+
* the sheet through its close control, since their swipe is consumed by
|
|
1197
|
+
* navigation.
|
|
1198
|
+
*
|
|
1199
|
+
* @since 0.3.0
|
|
1200
|
+
* @relatedTo CngxPopoverSheet
|
|
1201
|
+
*/
|
|
1202
|
+
declare class CngxPopoverSheetHandle {
|
|
1203
|
+
constructor();
|
|
1204
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverSheetHandle, never>;
|
|
1205
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverSheetHandle, "[cngxPopoverSheetHandle]", never, {}, {}, never, never, true, never>;
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Marks the element that receives focus when a modal `CngxPopoverSheet`
|
|
1209
|
+
* opens, e.g. the search input of a fullscreen panel. Without one the first
|
|
1210
|
+
* tabbable element is focused.
|
|
1211
|
+
*
|
|
1212
|
+
* A panel can mark several elements. The first enabled one in document order
|
|
1213
|
+
* takes focus, so a search field that should lead only some opens binds
|
|
1214
|
+
* `[cngxPopoverSheetInitialFocus]="condition"` and the list below it carries
|
|
1215
|
+
* the bare attribute as the default target. The condition is read when the
|
|
1216
|
+
* sheet opens.
|
|
1217
|
+
*
|
|
1218
|
+
* @since 0.3.0
|
|
1219
|
+
* @relatedTo CngxPopoverSheet
|
|
1220
|
+
*/
|
|
1221
|
+
declare class CngxPopoverSheetInitialFocus implements CngxPopoverSheetFocusHandle {
|
|
1222
|
+
/** The element focused on open. */
|
|
1223
|
+
readonly element: HTMLElement;
|
|
1224
|
+
/**
|
|
1225
|
+
* `false` keeps this element out of the next open's focus choice. The bare
|
|
1226
|
+
* attribute, or no binding, leaves it enabled.
|
|
1227
|
+
*/
|
|
1228
|
+
readonly enabledInput: _angular_core.InputSignalWithTransform<boolean | undefined, boolean | "" | undefined>;
|
|
1229
|
+
/** @internal Read by the sheet on open. */
|
|
1230
|
+
readonly enabled: _angular_core.Signal<boolean>;
|
|
1231
|
+
private readonly key;
|
|
1232
|
+
constructor();
|
|
1233
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverSheetInitialFocus, never>;
|
|
1234
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverSheetInitialFocus, "[cngxPopoverSheetInitialFocus]", never, { "enabledInput": { "alias": "cngxPopoverSheetInitialFocus"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
interface ComputePositionSignature {
|
|
1238
|
+
computePosition(reference: HTMLElement, floating: HTMLElement, options?: {
|
|
1239
|
+
placement?: string;
|
|
1240
|
+
middleware?: unknown[];
|
|
1241
|
+
}): Promise<{
|
|
1242
|
+
x: number;
|
|
1243
|
+
y: number;
|
|
1244
|
+
placement: string;
|
|
1245
|
+
}>;
|
|
1246
|
+
}
|
|
715
1247
|
/**
|
|
716
1248
|
* Signature matching `@floating-ui/dom` `computePosition`.
|
|
717
1249
|
* The consumer provides the actual function - the library never imports it directly.
|
|
718
|
-
*
|
|
719
|
-
* @category common/popover
|
|
720
1250
|
*/
|
|
721
|
-
type ComputePositionFn =
|
|
722
|
-
placement?: string;
|
|
723
|
-
middleware?: unknown[];
|
|
724
|
-
}) => Promise<{
|
|
725
|
-
x: number;
|
|
726
|
-
y: number;
|
|
727
|
-
placement: string;
|
|
728
|
-
}>;
|
|
1251
|
+
type ComputePositionFn = ComputePositionSignature['computePosition'];
|
|
729
1252
|
/**
|
|
730
1253
|
* Configuration for the Floating UI positioning fallback.
|
|
731
|
-
*
|
|
732
|
-
* @category common/popover
|
|
733
1254
|
*/
|
|
734
1255
|
interface FloatingFallbackConfig {
|
|
735
1256
|
/** The `computePosition` function from `@floating-ui/dom`. */
|
|
@@ -744,9 +1265,8 @@ interface FloatingFallbackConfig {
|
|
|
744
1265
|
* Injection token for the Floating UI fallback.
|
|
745
1266
|
* `null` when not provided - CSS Anchor Positioning is used instead.
|
|
746
1267
|
*
|
|
747
|
-
* @category common/popover
|
|
748
1268
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/floating-fallback.ts
|
|
749
|
-
* @since 0.
|
|
1269
|
+
* @since 0.3.0
|
|
750
1270
|
*/
|
|
751
1271
|
declare const CNGX_FLOATING_FALLBACK: InjectionToken<FloatingFallbackConfig | null>;
|
|
752
1272
|
/**
|
|
@@ -764,8 +1284,6 @@ declare const CNGX_FLOATING_FALLBACK: InjectionToken<FloatingFallbackConfig | nu
|
|
|
764
1284
|
* provideFloatingFallback(computePosition, [flip(), shift()]),
|
|
765
1285
|
* ]
|
|
766
1286
|
* ```
|
|
767
|
-
*
|
|
768
|
-
* @category common/popover
|
|
769
1287
|
*/
|
|
770
1288
|
declare function provideFloatingFallback(computePosition: ComputePositionFn, middleware?: unknown[]): Provider;
|
|
771
1289
|
|
|
@@ -774,20 +1292,33 @@ declare function provideFloatingFallback(computePosition: ComputePositionFn, mid
|
|
|
774
1292
|
* `CngxPopoverPanel`. `providePopoverPanel(withPopoverPanelLabels(...))`
|
|
775
1293
|
* overrides single keys on top of it.
|
|
776
1294
|
*
|
|
777
|
-
* @
|
|
778
|
-
* @since 0.1.0
|
|
1295
|
+
* @since 0.3.0
|
|
779
1296
|
* @relatedTo CngxPopoverPanel, withPopoverPanelLabels
|
|
780
1297
|
*/
|
|
781
1298
|
interface CngxPopoverLanguageSection {
|
|
782
1299
|
/** Accessible name of the built-in close button. */
|
|
783
1300
|
readonly close: string;
|
|
1301
|
+
/**
|
|
1302
|
+
* Text of the loading view. A projected `*cngxPopoverLoading` template
|
|
1303
|
+
* replaces it.
|
|
1304
|
+
*/
|
|
1305
|
+
readonly loading: string;
|
|
1306
|
+
/**
|
|
1307
|
+
* Text of the error view, and the panel's description there. A projected
|
|
1308
|
+
* `*cngxPopoverError` template replaces it.
|
|
1309
|
+
*/
|
|
1310
|
+
readonly error: string;
|
|
1311
|
+
/**
|
|
1312
|
+
* Text of the empty view, and the panel's description there. A projected
|
|
1313
|
+
* `*cngxPopoverEmpty` template replaces it.
|
|
1314
|
+
*/
|
|
1315
|
+
readonly empty: string;
|
|
784
1316
|
}
|
|
785
1317
|
/**
|
|
786
1318
|
* The English popover section: the single source of the popover panel's
|
|
787
1319
|
* English copy.
|
|
788
1320
|
*
|
|
789
|
-
* @
|
|
790
|
-
* @since 0.1.0
|
|
1321
|
+
* @since 0.3.0
|
|
791
1322
|
* @relatedTo CngxPopoverPanel
|
|
792
1323
|
*/
|
|
793
1324
|
declare const CNGX_POPOVER_LANGUAGE_EN: CngxPopoverLanguageSection;
|
|
@@ -804,8 +1335,6 @@ declare module '@cngx/core/i18n' {
|
|
|
804
1335
|
* `left` / `right`) and the inline-axis offset in CSS pixels that the
|
|
805
1336
|
* library would have placed the default diamond at. Either can be used to
|
|
806
1337
|
* rotate, translate, or theme the custom glyph so it tracks the trigger.
|
|
807
|
-
*
|
|
808
|
-
* @category common/popover
|
|
809
1338
|
*/
|
|
810
1339
|
interface CngxPopoverArrowContext {
|
|
811
1340
|
/** Primary edge of the panel facing the trigger. */
|
|
@@ -821,9 +1350,8 @@ interface CngxPopoverArrowContext {
|
|
|
821
1350
|
/**
|
|
822
1351
|
* Marks the header content inside `cngx-popover-panel`.
|
|
823
1352
|
*
|
|
824
|
-
* @category common/popover
|
|
825
1353
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
|
|
826
|
-
* @since 0.
|
|
1354
|
+
* @since 0.3.0
|
|
827
1355
|
* @relatedTo CngxPopoverPanel, CngxPopoverBody, CngxPopoverFooter
|
|
828
1356
|
*/
|
|
829
1357
|
declare class CngxPopoverHeader {
|
|
@@ -833,9 +1361,8 @@ declare class CngxPopoverHeader {
|
|
|
833
1361
|
/**
|
|
834
1362
|
* Marks the body content inside `cngx-popover-panel`.
|
|
835
1363
|
*
|
|
836
|
-
* @category common/popover
|
|
837
1364
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
|
|
838
|
-
* @since 0.
|
|
1365
|
+
* @since 0.3.0
|
|
839
1366
|
* @relatedTo CngxPopoverPanel, CngxPopoverHeader, CngxPopoverFooter
|
|
840
1367
|
*/
|
|
841
1368
|
declare class CngxPopoverBody {
|
|
@@ -845,9 +1372,8 @@ declare class CngxPopoverBody {
|
|
|
845
1372
|
/**
|
|
846
1373
|
* Marks the footer content inside `cngx-popover-panel`.
|
|
847
1374
|
*
|
|
848
|
-
* @category common/popover
|
|
849
1375
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
|
|
850
|
-
* @since 0.
|
|
1376
|
+
* @since 0.3.0
|
|
851
1377
|
* @relatedTo CngxPopoverPanel, CngxPopoverHeader, CngxPopoverBody, CngxPopoverAction
|
|
852
1378
|
*/
|
|
853
1379
|
declare class CngxPopoverFooter {
|
|
@@ -865,9 +1391,8 @@ declare class CngxPopoverFooter {
|
|
|
865
1391
|
* </ng-template>
|
|
866
1392
|
* ```
|
|
867
1393
|
*
|
|
868
|
-
* @category common/popover
|
|
869
1394
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
|
|
870
|
-
* @since 0.
|
|
1395
|
+
* @since 0.3.0
|
|
871
1396
|
* @relatedTo CngxPopoverPanel
|
|
872
1397
|
*/
|
|
873
1398
|
declare class CngxPopoverClose {
|
|
@@ -876,41 +1401,84 @@ declare class CngxPopoverClose {
|
|
|
876
1401
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverClose, "ng-template[cngxPopoverClose]", never, {}, {}, never, never, true, never>;
|
|
877
1402
|
}
|
|
878
1403
|
/**
|
|
879
|
-
*
|
|
1404
|
+
* Context passed to a `*cngxPopoverLoading` or `*cngxPopoverEmpty` template:
|
|
1405
|
+
* the copy the panel would render without the template, resolved from the
|
|
1406
|
+
* `[loadingText]` / `[emptyText]` input, then `withPopoverPanelLabels(...)`,
|
|
1407
|
+
* then the `popover` section of the active language pack. A template that
|
|
1408
|
+
* only restyles the state can print it instead of carrying its own string.
|
|
1409
|
+
*
|
|
1410
|
+
* @since 0.3.0
|
|
1411
|
+
*/
|
|
1412
|
+
interface CngxPopoverStateCopyContext {
|
|
1413
|
+
/** The resolved default copy of the state view. */
|
|
1414
|
+
readonly $implicit: string;
|
|
1415
|
+
/** Same value as `$implicit`, for a named `let-text="text"`. */
|
|
1416
|
+
readonly text: string;
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* Context passed to a `*cngxPopoverError` template.
|
|
1420
|
+
*
|
|
1421
|
+
* `$implicit` stays the raw error (from `[error]` or the bound `[state]`),
|
|
1422
|
+
* `text` is the copy the panel would render without the template, resolved
|
|
1423
|
+
* from `[errorText]`, then `withPopoverPanelLabels(...)`, then the language
|
|
1424
|
+
* pack.
|
|
1425
|
+
*
|
|
1426
|
+
* @since 0.3.0
|
|
1427
|
+
*/
|
|
1428
|
+
interface CngxPopoverErrorContext {
|
|
1429
|
+
/** The raw error behind the error view. */
|
|
1430
|
+
readonly $implicit: unknown;
|
|
1431
|
+
/** Same value as `$implicit`, for a named `let-error="error"`. */
|
|
1432
|
+
readonly error: unknown;
|
|
1433
|
+
/** The resolved default error copy. */
|
|
1434
|
+
readonly text: string;
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* Template shown while panel content is loading. Context:
|
|
1438
|
+
* `CngxPopoverStateCopyContext` (`$implicit` / `text` = resolved loading copy).
|
|
1439
|
+
*
|
|
1440
|
+
* ```html
|
|
1441
|
+
* <ng-template cngxPopoverLoading let-text>
|
|
1442
|
+
* <span class="brand-spinner" aria-hidden="true"></span> {{ text }}
|
|
1443
|
+
* </ng-template>
|
|
1444
|
+
* ```
|
|
880
1445
|
*
|
|
881
|
-
* @category common/popover
|
|
882
1446
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
|
|
883
|
-
* @since 0.
|
|
1447
|
+
* @since 0.3.0
|
|
884
1448
|
* @relatedTo CngxPopoverPanel, CngxPopoverEmpty, CngxPopoverError
|
|
885
1449
|
*/
|
|
886
1450
|
declare class CngxPopoverLoading {
|
|
887
|
-
readonly templateRef: TemplateRef<
|
|
1451
|
+
readonly templateRef: TemplateRef<CngxPopoverStateCopyContext>;
|
|
1452
|
+
static ngTemplateContextGuard(_dir: CngxPopoverLoading, ctx: unknown): ctx is CngxPopoverStateCopyContext;
|
|
888
1453
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverLoading, never>;
|
|
889
1454
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverLoading, "ng-template[cngxPopoverLoading]", never, {}, {}, never, never, true, never>;
|
|
890
1455
|
}
|
|
891
1456
|
/**
|
|
892
|
-
* Template shown when panel content is empty.
|
|
1457
|
+
* Template shown when panel content is empty. Context:
|
|
1458
|
+
* `CngxPopoverStateCopyContext` (`$implicit` / `text` = resolved empty copy).
|
|
893
1459
|
*
|
|
894
|
-
* @category common/popover
|
|
895
1460
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
|
|
896
|
-
* @since 0.
|
|
1461
|
+
* @since 0.3.0
|
|
897
1462
|
* @relatedTo CngxPopoverPanel, CngxPopoverLoading, CngxPopoverError
|
|
898
1463
|
*/
|
|
899
1464
|
declare class CngxPopoverEmpty {
|
|
900
|
-
readonly templateRef: TemplateRef<
|
|
1465
|
+
readonly templateRef: TemplateRef<CngxPopoverStateCopyContext>;
|
|
1466
|
+
static ngTemplateContextGuard(_dir: CngxPopoverEmpty, ctx: unknown): ctx is CngxPopoverStateCopyContext;
|
|
901
1467
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverEmpty, never>;
|
|
902
1468
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverEmpty, "ng-template[cngxPopoverEmpty]", never, {}, {}, never, never, true, never>;
|
|
903
1469
|
}
|
|
904
1470
|
/**
|
|
905
|
-
* Template shown when panel content failed to load. Context:
|
|
1471
|
+
* Template shown when panel content failed to load. Context:
|
|
1472
|
+
* `CngxPopoverErrorContext` (`$implicit` / `error` = the raw error, `text` =
|
|
1473
|
+
* resolved error copy).
|
|
906
1474
|
*
|
|
907
|
-
* @category common/popover
|
|
908
1475
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
|
|
909
|
-
* @since 0.
|
|
1476
|
+
* @since 0.3.0
|
|
910
1477
|
* @relatedTo CngxPopoverPanel, CngxPopoverLoading, CngxPopoverEmpty
|
|
911
1478
|
*/
|
|
912
1479
|
declare class CngxPopoverError {
|
|
913
|
-
readonly templateRef: TemplateRef<
|
|
1480
|
+
readonly templateRef: TemplateRef<CngxPopoverErrorContext>;
|
|
1481
|
+
static ngTemplateContextGuard(_dir: CngxPopoverError, ctx: unknown): ctx is CngxPopoverErrorContext;
|
|
914
1482
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverError, never>;
|
|
915
1483
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverError, "ng-template[cngxPopoverError]", never, {}, {}, never, never, true, never>;
|
|
916
1484
|
}
|
|
@@ -931,9 +1499,8 @@ declare class CngxPopoverError {
|
|
|
931
1499
|
* </cngx-popover-panel>
|
|
932
1500
|
* ```
|
|
933
1501
|
*
|
|
934
|
-
* @category common/popover
|
|
935
1502
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
|
|
936
|
-
* @since 0.
|
|
1503
|
+
* @since 0.3.0
|
|
937
1504
|
* @relatedTo CngxPopoverPanel, CngxPopover
|
|
938
1505
|
*/
|
|
939
1506
|
declare class CngxPopoverArrow {
|
|
@@ -944,8 +1511,6 @@ declare class CngxPopoverArrow {
|
|
|
944
1511
|
|
|
945
1512
|
/**
|
|
946
1513
|
* Configuration for `CngxPopoverPanel` provided via `providePopoverPanel()`.
|
|
947
|
-
*
|
|
948
|
-
* @category common/popover
|
|
949
1514
|
*/
|
|
950
1515
|
interface CngxPopoverPanelConfig {
|
|
951
1516
|
/**
|
|
@@ -991,23 +1556,19 @@ interface CngxPopoverPanelConfig {
|
|
|
991
1556
|
* same shape as the popover section of a language pack, declared once as
|
|
992
1557
|
* {@link CngxPopoverLanguageSection}.
|
|
993
1558
|
*
|
|
994
|
-
* @
|
|
995
|
-
* @since 0.1.0
|
|
1559
|
+
* @since 0.3.0
|
|
996
1560
|
*/
|
|
997
1561
|
type CngxPopoverPanelLabels = CngxPopoverLanguageSection;
|
|
998
1562
|
/**
|
|
999
1563
|
* Feature function signature for `providePopoverPanel()`.
|
|
1000
|
-
*
|
|
1001
|
-
* @category common/popover
|
|
1002
1564
|
*/
|
|
1003
1565
|
type PopoverPanelFeature = (config: CngxPopoverPanelConfig) => CngxPopoverPanelConfig;
|
|
1004
1566
|
|
|
1005
1567
|
/**
|
|
1006
1568
|
* Injection token for popover panel configuration.
|
|
1007
1569
|
*
|
|
1008
|
-
* @category common/popover
|
|
1009
1570
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel.config.ts
|
|
1010
|
-
* @since 0.
|
|
1571
|
+
* @since 0.3.0
|
|
1011
1572
|
*/
|
|
1012
1573
|
declare const CNGX_POPOVER_PANEL_CONFIG: InjectionToken<CngxPopoverPanelConfig>;
|
|
1013
1574
|
/**
|
|
@@ -1021,8 +1582,6 @@ declare const CNGX_POPOVER_PANEL_CONFIG: InjectionToken<CngxPopoverPanelConfig>;
|
|
|
1021
1582
|
* ),
|
|
1022
1583
|
* ]
|
|
1023
1584
|
* ```
|
|
1024
|
-
*
|
|
1025
|
-
* @category common/popover
|
|
1026
1585
|
*/
|
|
1027
1586
|
declare function providePopoverPanel(...features: PopoverPanelFeature[]): Provider;
|
|
1028
1587
|
/**
|
|
@@ -1032,34 +1591,24 @@ declare function providePopoverPanel(...features: PopoverPanelFeature[]): Provid
|
|
|
1032
1591
|
* ```typescript
|
|
1033
1592
|
* withAutoDismiss({ info: 5000, success: 3000 })
|
|
1034
1593
|
* ```
|
|
1035
|
-
*
|
|
1036
|
-
* @category common/popover
|
|
1037
1594
|
*/
|
|
1038
1595
|
declare function withAutoDismiss(timing: Record<string, number>): PopoverPanelFeature;
|
|
1039
1596
|
/**
|
|
1040
1597
|
* Auto-close the panel after an async action in the footer succeeds.
|
|
1041
1598
|
*
|
|
1042
1599
|
* @param delay - Delay in ms before closing. Defaults to `300`.
|
|
1043
|
-
*
|
|
1044
|
-
* @category common/popover
|
|
1045
1600
|
*/
|
|
1046
1601
|
declare function withCloseOnSuccess(delay?: number): PopoverPanelFeature;
|
|
1047
1602
|
/**
|
|
1048
1603
|
* Set the default variant applied when no `variant` input is set.
|
|
1049
|
-
*
|
|
1050
|
-
* @category common/popover
|
|
1051
1604
|
*/
|
|
1052
1605
|
declare function withDefaultVariant(variant: string): PopoverPanelFeature;
|
|
1053
1606
|
/**
|
|
1054
1607
|
* Show the close button on all panels by default.
|
|
1055
|
-
*
|
|
1056
|
-
* @category common/popover
|
|
1057
1608
|
*/
|
|
1058
1609
|
declare function withCloseButton(show?: boolean): PopoverPanelFeature;
|
|
1059
1610
|
/**
|
|
1060
1611
|
* Show the arrow on all panels by default.
|
|
1061
|
-
*
|
|
1062
|
-
* @category common/popover
|
|
1063
1612
|
*/
|
|
1064
1613
|
declare function withArrow(show?: boolean): PopoverPanelFeature;
|
|
1065
1614
|
/**
|
|
@@ -1076,8 +1625,6 @@ declare function withArrow(show?: boolean): PopoverPanelFeature;
|
|
|
1076
1625
|
* providePopoverPanel(withArrowTemplate(brandArrowTpl)),
|
|
1077
1626
|
* ]
|
|
1078
1627
|
* ```
|
|
1079
|
-
*
|
|
1080
|
-
* @category common/popover
|
|
1081
1628
|
*/
|
|
1082
1629
|
declare function withArrowTemplate(tpl: TemplateRef<CngxPopoverArrowContext>): PopoverPanelFeature;
|
|
1083
1630
|
/**
|
|
@@ -1092,8 +1639,7 @@ declare function withArrowTemplate(tpl: TemplateRef<CngxPopoverArrowContext>): P
|
|
|
1092
1639
|
* ]
|
|
1093
1640
|
* ```
|
|
1094
1641
|
*
|
|
1095
|
-
* @
|
|
1096
|
-
* @since 0.1.0
|
|
1642
|
+
* @since 0.3.0
|
|
1097
1643
|
*/
|
|
1098
1644
|
declare function withPopoverPanelLabels(labels: Partial<CngxPopoverPanelLabels> | Signal<Partial<CngxPopoverPanelLabels>>): PopoverPanelFeature;
|
|
1099
1645
|
|
|
@@ -1112,8 +1658,6 @@ declare function withPopoverPanelLabels(labels: Partial<CngxPopoverPanelLabels>
|
|
|
1112
1658
|
* working when used outside a `CngxPopoverPanel` (e.g. bare `[cngxPopover]`
|
|
1113
1659
|
* on a `<div>`). The fallback value matches the panel's default
|
|
1114
1660
|
* border-radius initial value (12 px).
|
|
1115
|
-
*
|
|
1116
|
-
* @category common/popover
|
|
1117
1661
|
*/
|
|
1118
1662
|
interface CngxPopoverArrowBounds {
|
|
1119
1663
|
/**
|
|
@@ -1125,9 +1669,8 @@ interface CngxPopoverArrowBounds {
|
|
|
1125
1669
|
/**
|
|
1126
1670
|
* Injection token for the arrow-bounds contract.
|
|
1127
1671
|
*
|
|
1128
|
-
* @category common/popover
|
|
1129
1672
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-arrow-bounds.ts
|
|
1130
|
-
* @since 0.
|
|
1673
|
+
* @since 0.3.0
|
|
1131
1674
|
*/
|
|
1132
1675
|
declare const CNGX_POPOVER_ARROW_BOUNDS: InjectionToken<CngxPopoverArrowBounds>;
|
|
1133
1676
|
|
|
@@ -1140,6 +1683,13 @@ declare const CNGX_POPOVER_ARROW_BOUNDS: InjectionToken<CngxPopoverArrowBounds>;
|
|
|
1140
1683
|
* `closeOnOutsideClick`, `mode`, `exclusive`, `cngxPopoverOpen`) are
|
|
1141
1684
|
* forwarded.
|
|
1142
1685
|
*
|
|
1686
|
+
* ### Focus return
|
|
1687
|
+
* On by default: when the panel closes and focus would otherwise be lost
|
|
1688
|
+
* (on `body` or inside the panel), its `CngxPopoverTrigger` returns focus
|
|
1689
|
+
* to the element focused before open. Opt out with `[restoreFocus]="false"`
|
|
1690
|
+
* on the trigger. A close that moves focus to another control leaves it
|
|
1691
|
+
* there.
|
|
1692
|
+
*
|
|
1143
1693
|
* The `variant` input is a free-form string mapped to a CSS class
|
|
1144
1694
|
* (`cngx-popover-panel--{variant}`). Five variants are pre-themed
|
|
1145
1695
|
* in `popover-panel-theme.scss`: `default`, `info`, `warning`,
|
|
@@ -1152,10 +1702,8 @@ declare const CNGX_POPOVER_ARROW_BOUNDS: InjectionToken<CngxPopoverArrowBounds>;
|
|
|
1152
1702
|
* <span cngxPopoverHeader>Delete Item?</span>
|
|
1153
1703
|
* <p cngxPopoverBody>This action cannot be undone.</p>
|
|
1154
1704
|
* <div cngxPopoverFooter>
|
|
1155
|
-
* <
|
|
1156
|
-
* <
|
|
1157
|
-
* Delete
|
|
1158
|
-
* </cngx-popover-action>
|
|
1705
|
+
* <button cngxPopoverDismiss>Cancel</button>
|
|
1706
|
+
* <button cngxPopoverAction="solid" tone="danger" [action]="delete">Delete</button>
|
|
1159
1707
|
* </div>
|
|
1160
1708
|
* </cngx-popover-panel>
|
|
1161
1709
|
* ```
|
|
@@ -1169,20 +1717,28 @@ declare const CNGX_POPOVER_ARROW_BOUNDS: InjectionToken<CngxPopoverArrowBounds>;
|
|
|
1169
1717
|
* </cngx-popover-panel>
|
|
1170
1718
|
* ```
|
|
1171
1719
|
*
|
|
1172
|
-
*
|
|
1173
|
-
*
|
|
1720
|
+
* ### State copy
|
|
1721
|
+
* The loading, error and empty views never render an empty box. Without a
|
|
1722
|
+
* slot template each shows default copy, resolved in this order: the
|
|
1723
|
+
* projected `*cngxPopoverLoading` / `*cngxPopoverError` / `*cngxPopoverEmpty`
|
|
1724
|
+
* template (replaces the whole node), then `[loadingText]` / `[errorText]` /
|
|
1725
|
+
* `[emptyText]`, then `withPopoverPanelLabels(...)`, then the `popover`
|
|
1726
|
+
* section of the language pack. The header row (title and close button)
|
|
1727
|
+
* stays in every view.
|
|
1728
|
+
*
|
|
1174
1729
|
* @wcag AA
|
|
1175
1730
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel.component.ts
|
|
1176
|
-
* @since 0.
|
|
1177
|
-
* @relatedTo CngxPopover, CngxPopoverAction, CngxPopoverHeader, CngxPopoverBody, CngxPopoverFooter
|
|
1731
|
+
* @since 0.3.0
|
|
1732
|
+
* @relatedTo CngxPopover, CngxPopoverAction, CngxPopoverDismiss, CngxPopoverHeader, CngxPopoverBody, CngxPopoverFooter
|
|
1178
1733
|
* @slot cngxPopoverArrow Replaces the pointer that ties the panel to its trigger.
|
|
1179
1734
|
* @slot cngxPopoverClose Replaces the dismiss control.
|
|
1180
1735
|
* @slot cngxPopoverLoading Rendered while the panel's content is loading.
|
|
1181
1736
|
* @slot cngxPopoverEmpty Rendered when the panel has nothing to show.
|
|
1182
1737
|
* @slot cngxPopoverError Rendered when the panel's content failed to load.
|
|
1183
|
-
* <example-url
|
|
1184
|
-
* <example-url
|
|
1185
|
-
* <example-url
|
|
1738
|
+
* <example-url>/#/common/popover/popover-panel/content-states</example-url>
|
|
1739
|
+
* <example-url>/#/common/popover/popover-panel/variants</example-url>
|
|
1740
|
+
* <example-url>/#/common/popover/popover-panel/with-footer-actions</example-url>
|
|
1741
|
+
* @axis level organism
|
|
1186
1742
|
*/
|
|
1187
1743
|
declare class CngxPopoverPanel implements CngxPopoverArrowBounds {
|
|
1188
1744
|
/** The underlying popover state machine. */
|
|
@@ -1229,6 +1785,15 @@ declare class CngxPopoverPanel implements CngxPopoverArrowBounds {
|
|
|
1229
1785
|
private readonly labels;
|
|
1230
1786
|
/** Accessible name of the built-in close button. */
|
|
1231
1787
|
protected readonly closeLabel: _angular_core.Signal<string>;
|
|
1788
|
+
/**
|
|
1789
|
+
* Copy of the state views: rendered without a slot template, handed to a
|
|
1790
|
+
* slot template as its `text` context. Input, then config, then pack.
|
|
1791
|
+
* Read tracked on purpose - the panel has no live region, so a language
|
|
1792
|
+
* flip only updates the visible text in place.
|
|
1793
|
+
*/
|
|
1794
|
+
protected readonly resolvedLoadingText: _angular_core.Signal<string>;
|
|
1795
|
+
protected readonly resolvedErrorText: _angular_core.Signal<string>;
|
|
1796
|
+
protected readonly resolvedEmptyText: _angular_core.Signal<string>;
|
|
1232
1797
|
/** Resolved showClose - input takes precedence over config. */
|
|
1233
1798
|
readonly showClose: _angular_core.Signal<boolean>;
|
|
1234
1799
|
/** Resolved showArrow - input takes precedence over config. */
|
|
@@ -1244,12 +1809,34 @@ declare class CngxPopoverPanel implements CngxPopoverArrowBounds {
|
|
|
1244
1809
|
readonly error: _angular_core.InputSignal<unknown>;
|
|
1245
1810
|
/** Whether the panel content is empty. Fallback when `[state]` is not set. */
|
|
1246
1811
|
readonly empty: _angular_core.InputSignal<boolean>;
|
|
1247
|
-
/**
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1812
|
+
/**
|
|
1813
|
+
* Text shown in the loading view when no `*cngxPopoverLoading` template is
|
|
1814
|
+
* projected. Unbound, it falls back to `withPopoverPanelLabels` and the
|
|
1815
|
+
* `popover` section of the language pack.
|
|
1816
|
+
*/
|
|
1817
|
+
readonly loadingText: _angular_core.InputSignal<string | undefined>;
|
|
1818
|
+
/**
|
|
1819
|
+
* Text shown in the error view when no `*cngxPopoverError` template is
|
|
1820
|
+
* projected. Unbound, it falls back to `withPopoverPanelLabels` and the
|
|
1821
|
+
* `popover` section of the language pack.
|
|
1822
|
+
*/
|
|
1823
|
+
readonly errorText: _angular_core.InputSignal<string | undefined>;
|
|
1824
|
+
/**
|
|
1825
|
+
* Text shown in the empty view when no `*cngxPopoverEmpty` template is
|
|
1826
|
+
* projected. Unbound, it falls back to `withPopoverPanelLabels` and the
|
|
1827
|
+
* `popover` section of the language pack.
|
|
1828
|
+
*/
|
|
1829
|
+
readonly emptyText: _angular_core.InputSignal<string | undefined>;
|
|
1830
|
+
/**
|
|
1831
|
+
* @internal The one view the panel body renders. A bound `[state]` goes
|
|
1832
|
+
* through the shared `resolveAsyncView` table (the same derivation the
|
|
1833
|
+
* select panel uses), so a first-load error shows the error slot and an
|
|
1834
|
+
* idle state renders no body (`'none'`). Without `[state]` the manual
|
|
1835
|
+
* inputs resolve in the order loading, error, empty.
|
|
1836
|
+
*/
|
|
1837
|
+
protected readonly view: _angular_core.Signal<AsyncView>;
|
|
1838
|
+
/** @internal The error handed to the `*cngxPopoverError` template. */
|
|
1839
|
+
protected readonly viewError: _angular_core.Signal<unknown>;
|
|
1253
1840
|
protected readonly headerSlot: _angular_core.Signal<CngxPopoverHeader | undefined>;
|
|
1254
1841
|
protected readonly footerSlot: _angular_core.Signal<CngxPopoverFooter | undefined>;
|
|
1255
1842
|
protected readonly closeTpl: _angular_core.Signal<CngxPopoverClose | undefined>;
|
|
@@ -1279,105 +1866,241 @@ declare class CngxPopoverPanel implements CngxPopoverArrowBounds {
|
|
|
1279
1866
|
private readonly uid;
|
|
1280
1867
|
protected readonly headerId: string;
|
|
1281
1868
|
protected readonly bodyId: string;
|
|
1869
|
+
protected readonly errorId: string;
|
|
1870
|
+
protected readonly emptyId: string;
|
|
1282
1871
|
/**
|
|
1283
|
-
* Only point to the header when one is projected
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1872
|
+
* Only point to the header when one is projected. The header row renders
|
|
1873
|
+
* in every view (loading, error, empty, content), so `hasHeader()` alone is
|
|
1874
|
+
* the gate: with a header the reference always resolves, and without one a
|
|
1875
|
+
* bare id would leave AT with an empty accessible name.
|
|
1286
1876
|
*/
|
|
1287
1877
|
protected readonly ariaLabelledBy: _angular_core.Signal<string | null>;
|
|
1288
|
-
/**
|
|
1878
|
+
/**
|
|
1879
|
+
* The surface that describes the current view: the body in `content`, the
|
|
1880
|
+
* error surface in `error` / `content+error`, the empty surface in `empty`.
|
|
1881
|
+
* Loading speaks through `aria-busy` and its visible text, and `none`
|
|
1882
|
+
* renders nothing, so both emit no reference. Every emitted id resolves
|
|
1883
|
+
* because each surface always renders in its view.
|
|
1884
|
+
*/
|
|
1289
1885
|
protected readonly ariaDescribedBy: _angular_core.Signal<string | null>;
|
|
1290
1886
|
protected readonly hostClass: _angular_core.Signal<string>;
|
|
1291
1887
|
private autoDismissTimer;
|
|
1292
1888
|
constructor();
|
|
1293
1889
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverPanel, never>;
|
|
1294
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxPopoverPanel, "cngx-popover-panel", ["cngxPopoverPanel"], { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "role": { "alias": "role"; "required": false; "isSignal": true; }; "showCloseInput": { "alias": "showClose"; "required": false; "isSignal": true; }; "showArrowInput": { "alias": "showArrow"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "empty": { "alias": "empty"; "required": false; "isSignal": true; }; }, {}, ["headerSlot", "footerSlot", "closeTpl", "loadingTpl", "emptyTpl", "errorTpl", "arrowTplDirective"], ["[cngxPopoverHeader]", "[cngxPopoverBody]", "*", "[cngxPopoverFooter]"], true, [{ directive: typeof CngxPopover; inputs: { "placement": "placement"; "positionTryFallbacks": "positionTryFallbacks"; "offset": "offset"; "closeOnEscape": "closeOnEscape"; "closeOnOutsideClick": "closeOnOutsideClick"; "mode": "mode"; "exclusive": "exclusive"; "cngxPopoverOpen": "cngxPopoverOpen"; }; outputs: {}; }]>;
|
|
1890
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxPopoverPanel, "cngx-popover-panel", ["cngxPopoverPanel"], { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "role": { "alias": "role"; "required": false; "isSignal": true; }; "showCloseInput": { "alias": "showClose"; "required": false; "isSignal": true; }; "showArrowInput": { "alias": "showArrow"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "empty": { "alias": "empty"; "required": false; "isSignal": true; }; "loadingText": { "alias": "loadingText"; "required": false; "isSignal": true; }; "errorText": { "alias": "errorText"; "required": false; "isSignal": true; }; "emptyText": { "alias": "emptyText"; "required": false; "isSignal": true; }; }, {}, ["headerSlot", "footerSlot", "closeTpl", "loadingTpl", "emptyTpl", "errorTpl", "arrowTplDirective"], ["[cngxPopoverHeader]", "[cngxPopoverBody]", "*", "[cngxPopoverFooter]"], true, [{ directive: typeof CngxPopover; inputs: { "placement": "placement"; "positionTryFallbacks": "positionTryFallbacks"; "offset": "offset"; "closeOnEscape": "closeOnEscape"; "closeOnOutsideClick": "closeOnOutsideClick"; "mode": "mode"; "exclusive": "exclusive"; "cngxPopoverOpen": "cngxPopoverOpen"; }; outputs: { "opened": "opened"; "closed": "closed"; }; }]>;
|
|
1295
1891
|
}
|
|
1296
1892
|
|
|
1297
1893
|
/**
|
|
1298
|
-
*
|
|
1894
|
+
* Closes the composing `CngxPopover` after each success outcome of the
|
|
1895
|
+
* co-hosted `CngxActionStatusBrain` (an own run, or a `success` edge of a
|
|
1896
|
+
* bound `[externalState]`): `CNGX_POPOVER_PANEL_CONFIG.closeOnSuccessDelay`
|
|
1897
|
+
* (`withCloseOnSuccess()`), or `[closeOnSuccessDelay]` per instance. A
|
|
1898
|
+
* follow-up run cancels a scheduled close. Focus returns to the trigger
|
|
1899
|
+
* through the panel's restore claim; this directive restores nothing.
|
|
1900
|
+
*
|
|
1901
|
+
* The runner's live region sits inside the panel, which hides after the
|
|
1902
|
+
* delay (maybe 0 ms) and can take the text with it before AT reads it. So
|
|
1903
|
+
* a success that arms a close is covered (`CNGX_ANNOUNCEMENT_COVER`, the
|
|
1904
|
+
* region gets `''`) and spoken through `CngxLiveAnnouncer` outside, scoped
|
|
1905
|
+
* to the popover's parent, once, with the text `CNGX_ACTION_STATUS` resolves
|
|
1906
|
+
* for it, unless another co-hosted cover (a toast) voices it already. Only
|
|
1907
|
+
* this arming case is covered here: the runner speaks any other settle in a
|
|
1908
|
+
* closed panel through `CngxLiveAnnouncer` itself. A selector-less host
|
|
1909
|
+
* directive; `CngxPopoverAction` co-hosts it
|
|
1910
|
+
* next to `CngxActionStatusBrain`.
|
|
1299
1911
|
*
|
|
1300
|
-
* @
|
|
1912
|
+
* @wcag AA
|
|
1913
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-close-on-success.directive.ts
|
|
1914
|
+
* @since 0.3.0
|
|
1915
|
+
* @relatedTo CngxPopoverAction, CngxActionStatusBrain, CNGX_ANNOUNCEMENT_COVER, CNGX_POPOVER_PANEL_CONFIG
|
|
1916
|
+
* <example-url>/#/common/popover/popover-panel/close-on-success</example-url>
|
|
1917
|
+
* @axis level molecule
|
|
1301
1918
|
*/
|
|
1302
|
-
|
|
1919
|
+
declare class CngxPopoverCloseOnSuccess implements CngxAnnouncementCover {
|
|
1920
|
+
private readonly popover;
|
|
1921
|
+
private readonly config;
|
|
1922
|
+
private readonly announcer;
|
|
1923
|
+
private readonly status;
|
|
1924
|
+
private readonly injector;
|
|
1925
|
+
private readonly coverUnits;
|
|
1926
|
+
/**
|
|
1927
|
+
* Per-instance close-on-success, named after the
|
|
1928
|
+
* `CNGX_POPOVER_PANEL_CONFIG.closeOnSuccessDelay` it overrides. A number
|
|
1929
|
+
* closes the composing popover that many ms after each success, also
|
|
1930
|
+
* without `withCloseOnSuccess()`; `null` keeps this confirm's popover open
|
|
1931
|
+
* although the config closes it; unbound (`undefined`) uses the config.
|
|
1932
|
+
*/
|
|
1933
|
+
readonly closeOnSuccessDelay: _angular_core.InputSignal<number | null | undefined>;
|
|
1934
|
+
private closeOnSuccessTimer;
|
|
1935
|
+
constructor();
|
|
1936
|
+
/** `true` for a success that arms a close: it is spoken outside the panel instead. */
|
|
1937
|
+
covers(status: 'success' | 'error'): boolean;
|
|
1938
|
+
/** One outcome: re-arms the close and speaks a closing success outside the panel. */
|
|
1939
|
+
private handleOutcome;
|
|
1940
|
+
private announceOutside;
|
|
1941
|
+
/** `true` when another co-hosted cover (a toast) already voices the success. */
|
|
1942
|
+
private coveredElsewhere;
|
|
1943
|
+
/** The close delay an outcome arms, or `undefined` when it closes nothing. */
|
|
1944
|
+
private closeDelayFor;
|
|
1945
|
+
private clearCloseOnSuccessTimer;
|
|
1946
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverCloseOnSuccess, never>;
|
|
1947
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverCloseOnSuccess, never, ["cngxPopoverCloseOnSuccess"], { "closeOnSuccessDelay": { "alias": "closeOnSuccessDelay"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1303
1950
|
/**
|
|
1304
|
-
*
|
|
1305
|
-
*
|
|
1306
|
-
*
|
|
1307
|
-
*
|
|
1308
|
-
*
|
|
1309
|
-
*
|
|
1310
|
-
*
|
|
1311
|
-
*
|
|
1312
|
-
*
|
|
1313
|
-
*
|
|
1314
|
-
*
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
*
|
|
1951
|
+
* Async confirm button for a `cngx-popover-panel` footer. A
|
|
1952
|
+
* `CngxButtonBrain` host on the native `<button>` with `cngxAsyncClick`
|
|
1953
|
+
* co-hosted: `[action]` (required) runs on click, and the button stylesheet
|
|
1954
|
+
* paints it. The variant is the selector's own value (default `outline`),
|
|
1955
|
+
* `tone` and `size` are inputs, and the size is pinned to `sm` against the
|
|
1956
|
+
* group and the config (the input still wins). Tone comes from the button
|
|
1957
|
+
* family, not from the panel variant. To close without a run, use
|
|
1958
|
+
* `button[cngxPopoverDismiss]`.
|
|
1959
|
+
*
|
|
1960
|
+
* `disabled` renders `aria-disabled="true"`, keeps the button focusable,
|
|
1961
|
+
* refuses the run and references a `disabledReason` through
|
|
1962
|
+
* `aria-describedby`. `aria-busy`, `data-pending` and `data-busy` come from
|
|
1963
|
+
* the brain over the co-hosted run.
|
|
1964
|
+
*
|
|
1965
|
+
* Supports the `cngxPending` / `cngxSucceeded` / `cngxFailed` templates and
|
|
1966
|
+
* the `pendingLabel` / `succeededLabel` / `failedLabel` strings of
|
|
1967
|
+
* `CngxActionButton`, or use `status()` + `@switch` for full control.
|
|
1968
|
+
* `[externalState]` reflects a run started elsewhere, `(outcome)` emits once
|
|
1969
|
+
* per own settle and per external `success` / `error` edge. The
|
|
1970
|
+
* label follows the busy gate (`CNGX_LOADING_CONFIG.showDelay`, held for
|
|
1971
|
+
* `minDwell`; `[showDelay]` / `[minDwell]` per button): while the busy
|
|
1972
|
+
* visual shows, through the run and its dwell after the settle, the pending
|
|
1973
|
+
* template stays visible with no spinner, and without one the spinner covers
|
|
1974
|
+
* the idle label. The result templates show once the busy visual releases, so
|
|
1975
|
+
* a fast run goes from the idle label straight to the result. Every label
|
|
1976
|
+
* cell stays mounted in one grid cell (the inactive ones `visibility: hidden`
|
|
1977
|
+
* and `aria-hidden`), so the button keeps the width of its widest label and a
|
|
1978
|
+
* right-aligned footer never shifts; the active cell alone names it. `status()`
|
|
1979
|
+
* stays immediate; branch a hand-rolled `@switch` on {@link busyVisible} for
|
|
1980
|
+
* the same timing.
|
|
1981
|
+
*
|
|
1982
|
+
* The status layer comes from the `CngxActionStatusBrain` host directive
|
|
1983
|
+
* (read through `CNGX_ACTION_STATUS`) and close-on-success from the
|
|
1984
|
+
* `CngxPopoverCloseOnSuccess` host directive; the component is the skin.
|
|
1985
|
+
* Each settle is spoken once through the `cngxAsyncClick` live region next
|
|
1986
|
+
* to the button: `succeededAnnouncement` / `failedAnnouncement`, else the
|
|
1987
|
+
* text of the rendered result template (`aria-hidden` parts skipped; read
|
|
1988
|
+
* from its cell even while the dwell still hides it), else
|
|
1989
|
+
* `CNGX_INTERACTIVE_I18N.asyncClickSucceeded` / `asyncClickFailed`.
|
|
1990
|
+
* `announce="never"` keeps the region empty. Under
|
|
1991
|
+
* `withCloseOnSuccess()` the panel closes once per success; focus returns
|
|
1992
|
+
* to the trigger through the panel's restore claim; `[closeOnSuccessDelay]`
|
|
1993
|
+
* overrides the config per confirm (`null` turns it off). A success that closes
|
|
1994
|
+
* the panel is spoken through `CngxLiveAnnouncer` outside it instead (the
|
|
1995
|
+
* sibling region hides with the panel), still once.
|
|
1996
|
+
*
|
|
1997
|
+
* Migration from `cngx-popover-action`: `variant="primary"` is
|
|
1998
|
+
* `cngxPopoverAction="solid" tone="primary"`, `variant="danger"` is
|
|
1999
|
+
* `cngxPopoverAction="solid" tone="danger"`, `variant="ghost"` is
|
|
2000
|
+
* `cngxPopoverAction="ghost"`, `variant="secondary"` is the default
|
|
2001
|
+
* `outline`; `role="dismiss"` is `button[cngxPopoverDismiss]`.
|
|
1318
2002
|
*
|
|
1319
2003
|
* ### Confirm with templates
|
|
1320
2004
|
* ```html
|
|
1321
|
-
* <
|
|
2005
|
+
* <button cngxPopoverAction="solid" tone="primary" [action]="save">
|
|
1322
2006
|
* Save
|
|
1323
2007
|
* <ng-template cngxPending>Saving...</ng-template>
|
|
1324
2008
|
* <ng-template cngxSucceeded>Saved!</ng-template>
|
|
1325
2009
|
* <ng-template cngxFailed let-err>{{ err }}</ng-template>
|
|
1326
|
-
* </
|
|
2010
|
+
* </button>
|
|
1327
2011
|
* ```
|
|
1328
2012
|
*
|
|
1329
|
-
* ### With
|
|
2013
|
+
* ### With `@switch`
|
|
1330
2014
|
* ```html
|
|
1331
|
-
* <
|
|
2015
|
+
* <button cngxPopoverAction [action]="save" #act="cngxPopoverAction">
|
|
1332
2016
|
* @switch (act.status()) {
|
|
1333
|
-
* @case ('pending')
|
|
2017
|
+
* @case ('pending') { Saving... }
|
|
1334
2018
|
* @case ('success') { Done }
|
|
1335
|
-
* @default
|
|
2019
|
+
* @default { Save }
|
|
1336
2020
|
* }
|
|
1337
|
-
* </
|
|
2021
|
+
* </button>
|
|
1338
2022
|
* ```
|
|
1339
2023
|
*
|
|
1340
|
-
* @category common/popover
|
|
1341
|
-
* @docsKind primary
|
|
1342
2024
|
* @wcag AA
|
|
1343
2025
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-action.component.ts
|
|
1344
|
-
* @since 0.
|
|
1345
|
-
* @relatedTo CngxPopoverPanel, CngxPopoverFooter
|
|
1346
|
-
* @slot cngxPending
|
|
1347
|
-
* @slot cngxSucceeded
|
|
1348
|
-
* @slot cngxFailed
|
|
1349
|
-
* <example-url
|
|
1350
|
-
* <example-url
|
|
1351
|
-
* <example-url
|
|
2026
|
+
* @since 0.3.0
|
|
2027
|
+
* @relatedTo CngxPopoverDismiss, CngxPopoverPanel, CngxPopoverFooter, CngxButtonBrain, CngxAsyncClick, CngxActionStatusBrain, CngxPopoverCloseOnSuccess
|
|
2028
|
+
* @slot cngxPending Replaces the label while the action runs, once the run outlasts the show delay.
|
|
2029
|
+
* @slot cngxSucceeded Replaces the label after the action succeeds, once the busy visual releases.
|
|
2030
|
+
* @slot cngxFailed Replaces the label when the action fails, once the busy visual releases; gets the error.
|
|
2031
|
+
* <example-url>/#/common/popover/popover-panel/with-footer-actions</example-url>
|
|
2032
|
+
* <example-url>/#/common/popover/popover-panel/with-dividers</example-url>
|
|
2033
|
+
* <example-url>/#/common/popover/popover-panel/footer-actions-plain</example-url>
|
|
2034
|
+
* <example-url>/#/common/popover/popover-panel/close-on-success</example-url>
|
|
2035
|
+
* @axis level organism
|
|
1352
2036
|
*/
|
|
1353
2037
|
declare class CngxPopoverAction {
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
readonly
|
|
1363
|
-
/**
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
*
|
|
1371
|
-
*
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
readonly status: _angular_core.Signal<AsyncStatus>;
|
|
1375
|
-
private closeOnSuccessTimer;
|
|
1376
|
-
constructor();
|
|
1377
|
-
protected handleDismiss(): void;
|
|
1378
|
-
private clearCloseOnSuccessTimer;
|
|
2038
|
+
protected readonly brain: CngxButtonBrain;
|
|
2039
|
+
protected readonly actionStatus: i2.CngxActionStatus;
|
|
2040
|
+
protected readonly startSlot: Signal<CngxButtonStart | undefined>;
|
|
2041
|
+
protected readonly endSlot: Signal<CngxButtonEnd | undefined>;
|
|
2042
|
+
/**
|
|
2043
|
+
* Effective status - `'idle' | 'pending' | 'success' | 'error'`:
|
|
2044
|
+
* `[externalState]` when bound, else the run. Immediate, not gated.
|
|
2045
|
+
*/
|
|
2046
|
+
readonly status: Signal<AsyncStatus>;
|
|
2047
|
+
/**
|
|
2048
|
+
* `true` while the busy visual shows: the run after the loading config's
|
|
2049
|
+
* show delay, held for its min-dwell.
|
|
2050
|
+
*/
|
|
2051
|
+
readonly busyVisible: Signal<boolean>;
|
|
2052
|
+
/**
|
|
2053
|
+
* `CngxAsyncState` view of the effective lifecycle (`[externalState]` when
|
|
2054
|
+
* bound, else the run). Bind it to a state consumer: `[state]="act.state"`
|
|
2055
|
+
* on `cngxToastOn` or `cngxAlertOn`.
|
|
2056
|
+
*/
|
|
2057
|
+
readonly state: CngxAsyncState<unknown>;
|
|
1379
2058
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverAction, never>;
|
|
1380
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxPopoverAction, "
|
|
2059
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxPopoverAction, "button[cngxPopoverAction]", ["cngxPopoverAction"], {}, {}, ["startSlot", "endSlot"], ["[cngxButtonStart]", "*", "[cngxButtonEnd]"], true, [{ directive: typeof i1$1.CngxButtonBrain; inputs: { "variant": "cngxPopoverAction"; "tone": "tone"; "size": "size"; "disabled": "disabled"; "disabledReason": "disabledReason"; "cngxDescribedBy": "cngxDescribedBy"; "type": "type"; }; outputs: {}; }, { directive: typeof i2.CngxAsyncClick; inputs: { "cngxAsyncClick": "action"; "feedbackDuration": "feedbackDuration"; "showDelay": "showDelay"; "minDwell": "minDwell"; }; outputs: { "settled": "settled"; }; }, { directive: typeof i2.CngxActionStatusBrain; inputs: { "succeededAnnouncement": "succeededAnnouncement"; "failedAnnouncement": "failedAnnouncement"; "announce": "announce"; "pendingLabel": "pendingLabel"; "succeededLabel": "succeededLabel"; "failedLabel": "failedLabel"; "externalState": "externalState"; }; outputs: { "outcome": "outcome"; }; }, { directive: typeof CngxPopoverCloseOnSuccess; inputs: { "closeOnSuccessDelay": "closeOnSuccessDelay"; }; outputs: {}; }]>;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
/**
|
|
2063
|
+
* Footer button that closes the popover it sits in. A `CngxButtonBrain`
|
|
2064
|
+
* host on the native `<button>`, painted by the button stylesheet: the
|
|
2065
|
+
* variant is the selector's own value (default `outline`), `tone` and
|
|
2066
|
+
* `size` are inputs, and the size is pinned to `sm` against the group and
|
|
2067
|
+
* the config (the input still wins).
|
|
2068
|
+
*
|
|
2069
|
+
* `disabled` renders `aria-disabled="true"`, keeps the button focusable,
|
|
2070
|
+
* swallows the click (the popover stays open) and references a
|
|
2071
|
+
* `disabledReason` through `aria-describedby`. Focus returns to the
|
|
2072
|
+
* trigger through the composing `CngxPopoverPanel`, which claims the
|
|
2073
|
+
* restore; the button has no restore of its own. Outside a popover the
|
|
2074
|
+
* click does nothing.
|
|
2075
|
+
*
|
|
2076
|
+
* For an async confirm next to it, use `button[cngxPopoverAction]`.
|
|
2077
|
+
*
|
|
2078
|
+
* ```html
|
|
2079
|
+
* <div cngxPopoverFooter>
|
|
2080
|
+
* <button cngxPopoverDismiss>Cancel</button>
|
|
2081
|
+
* <button cngxPopoverAction="solid" tone="danger" [action]="delete">Delete</button>
|
|
2082
|
+
* </div>
|
|
2083
|
+
* ```
|
|
2084
|
+
*
|
|
2085
|
+
* @wcag AA
|
|
2086
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-dismiss.component.ts
|
|
2087
|
+
* @since 0.3.0
|
|
2088
|
+
* @relatedTo CngxPopoverAction, CngxPopoverPanel, CngxPopoverFooter, CngxButtonBrain
|
|
2089
|
+
* <example-url>/#/common/popover/popover-panel/with-footer-actions</example-url>
|
|
2090
|
+
* <example-url>/#/common/popover/popover-panel/with-dividers</example-url>
|
|
2091
|
+
* <example-url>/#/common/popover/popover-panel/footer-actions-plain</example-url>
|
|
2092
|
+
* <example-url>/#/common/popover/popover-panel/close-on-success</example-url>
|
|
2093
|
+
* @axis level molecule
|
|
2094
|
+
*/
|
|
2095
|
+
declare class CngxPopoverDismiss {
|
|
2096
|
+
private readonly popover;
|
|
2097
|
+
/** @internal */
|
|
2098
|
+
protected readonly brain: CngxButtonBrain;
|
|
2099
|
+
protected readonly startSlot: _angular_core.Signal<CngxButtonStart | undefined>;
|
|
2100
|
+
protected readonly endSlot: _angular_core.Signal<CngxButtonEnd | undefined>;
|
|
2101
|
+
protected handleClick(): void;
|
|
2102
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverDismiss, never>;
|
|
2103
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxPopoverDismiss, "button[cngxPopoverDismiss]", ["cngxPopoverDismiss"], {}, {}, ["startSlot", "endSlot"], ["[cngxButtonStart]", "*", "[cngxButtonEnd]"], true, [{ directive: typeof i1$1.CngxButtonBrain; inputs: { "variant": "cngxPopoverDismiss"; "tone": "tone"; "size": "size"; "disabled": "disabled"; "disabledReason": "disabledReason"; "cngxDescribedBy": "cngxDescribedBy"; "type": "type"; }; outputs: {}; }]>;
|
|
1381
2104
|
}
|
|
1382
2105
|
|
|
1383
2106
|
/**
|
|
@@ -1406,21 +2129,20 @@ declare class CngxPopoverAction {
|
|
|
1406
2129
|
* ### Vertical separator between footer action groups
|
|
1407
2130
|
* ```html
|
|
1408
2131
|
* <div cngxPopoverFooter>
|
|
1409
|
-
* <
|
|
2132
|
+
* <button cngxPopoverDismiss>Cancel</button>
|
|
1410
2133
|
* <span cngxPopoverDivider orientation="vertical"></span>
|
|
1411
|
-
* <
|
|
2134
|
+
* <button cngxPopoverAction [action]="save">Save</button>
|
|
1412
2135
|
* </div>
|
|
1413
2136
|
* ```
|
|
1414
2137
|
*
|
|
1415
|
-
* @category common/popover
|
|
1416
2138
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-divider.directive.ts
|
|
1417
|
-
* @since 0.
|
|
2139
|
+
* @since 0.3.0
|
|
1418
2140
|
* @relatedTo CngxPopoverPanel, CngxDivider
|
|
1419
2141
|
*/
|
|
1420
2142
|
declare class CngxPopoverDivider {
|
|
1421
2143
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverDivider, never>;
|
|
1422
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverDivider, "[cngxPopoverDivider]", ["cngxPopoverDivider"], {}, {}, never, never, true, [{ directive: typeof i1$
|
|
2144
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverDivider, "[cngxPopoverDivider]", ["cngxPopoverDivider"], {}, {}, never, never, true, [{ directive: typeof i1$2.CngxDivider; inputs: { "orientation": "orientation"; "inset": "inset"; }; outputs: {}; }]>;
|
|
1423
2145
|
}
|
|
1424
2146
|
|
|
1425
|
-
export { CNGX_FLOATING_FALLBACK, CNGX_POPOVER_ARROW_BOUNDS, CNGX_POPOVER_LANGUAGE_EN, CNGX_POPOVER_PANEL_CONFIG, CngxPopover, CngxPopoverAction, CngxPopoverAnchor, CngxPopoverArrow, CngxPopoverBody, CngxPopoverClose, CngxPopoverDivider, CngxPopoverEmpty, CngxPopoverError, CngxPopoverFooter, CngxPopoverHeader, CngxPopoverLoading, CngxPopoverPanel, CngxPopoverTrigger, CngxTooltip, provideFloatingFallback, providePopoverPanel, withArrow, withArrowTemplate, withAutoDismiss, withCloseButton, withCloseOnSuccess, withDefaultVariant, withPopoverPanelLabels };
|
|
1426
|
-
export type { ArrowEdge, CngxPopoverArrowBounds, CngxPopoverArrowContext, CngxPopoverLanguageSection, CngxPopoverPanelConfig, CngxPopoverPanelLabels, ComputePositionFn, FloatingFallbackConfig,
|
|
2147
|
+
export { CNGX_FLOATING_FALLBACK, CNGX_POPOVER_ARROW_BOUNDS, CNGX_POPOVER_LANGUAGE_EN, CNGX_POPOVER_PANEL_CONFIG, CngxPopover, CngxPopoverAction, CngxPopoverAnchor, CngxPopoverArrow, CngxPopoverBody, CngxPopoverClose, CngxPopoverCloseOnSuccess, CngxPopoverDismiss, CngxPopoverDivider, CngxPopoverEmpty, CngxPopoverError, CngxPopoverFooter, CngxPopoverHeader, CngxPopoverLoading, CngxPopoverPanel, CngxPopoverSheet, CngxPopoverSheetHandle, CngxPopoverSheetHeader, CngxPopoverSheetInitialFocus, CngxPopoverSheetTitle, CngxPopoverTrigger, CngxTooltip, provideFloatingFallback, providePopoverPanel, withArrow, withArrowTemplate, withAutoDismiss, withCloseButton, withCloseOnSuccess, withDefaultVariant, withPopoverPanelLabels };
|
|
2148
|
+
export type { ArrowEdge, CngxPopoverArrowBounds, CngxPopoverArrowContext, CngxPopoverErrorContext, CngxPopoverLanguageSection, CngxPopoverPanelConfig, CngxPopoverPanelLabels, CngxPopoverPresentation, CngxPopoverPresentationRequest, CngxPopoverSheetCloseReason, CngxPopoverStateCopyContext, ComputePositionFn, FloatingFallbackConfig, PopoverHaspopup, PopoverMode, PopoverPanelFeature, PopoverPanelRole, PopoverPlacement, PopoverPositionTryFallback, PopoverState, TooltipTriggerMode };
|