@cngx/common 0.1.0-rc.7 → 0.1.0-rc.8
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/card/README.md +2 -1
- package/data/README.md +10 -1
- package/dialog/README.md +23 -1
- package/fesm2022/cngx-common-a11y.mjs +125 -111
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +47 -5
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +300 -46
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +1176 -453
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +37 -10
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +1318 -469
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +151 -14
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +340 -73
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +1744 -952
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +841 -114
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +350 -60
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +727 -317
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1601 -1243
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +137 -53
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +1 -1
- package/interactive/README.md +15 -4
- package/layout/README.md +21 -1
- package/package.json +3 -3
- package/popover/README.md +18 -2
- package/stepper/README.md +6 -4
- package/theming/components/cngx-accordion.css +1 -1
- package/theming/components/cngx-backdrop.css +12 -0
- package/theming/components/cngx-button-toggle.css +29 -3
- package/theming/components/cngx-data-grid.css +168 -1
- package/theming/components/cngx-dialog.css +13 -0
- package/theming/components/cngx-listbox.css +21 -12
- package/theming/components/cngx-menu.css +56 -16
- package/theming/components/cngx-popover.css +24 -0
- package/theming/components/cngx-recycler-placeholder.css +196 -0
- package/theming/components/cngx-ripple.css +1 -1
- package/theming/components/cngx-slider.css +32 -1
- package/theming/components/cngx-tooltip.css +12 -0
- package/timeline/README.md +155 -0
- package/types/cngx-common-a11y.d.ts +42 -18
- package/types/cngx-common-card.d.ts +201 -17
- package/types/cngx-common-chart.d.ts +343 -47
- package/types/cngx-common-command.d.ts +31 -8
- package/types/cngx-common-data.d.ts +581 -68
- package/types/cngx-common-dialog.d.ts +158 -3
- package/types/cngx-common-display.d.ts +356 -142
- package/types/cngx-common-interactive.d.ts +859 -210
- package/types/cngx-common-layout.d.ts +567 -28
- package/types/cngx-common-popover.d.ts +262 -39
- package/types/cngx-common-stepper.d.ts +366 -116
- package/types/cngx-common-tabs.d.ts +214 -50
- package/types/cngx-common-timeline.d.ts +82 -16
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { ElementRef, InjectionToken, Provider, TemplateRef } from '@angular/core';
|
|
2
|
+
import { ElementRef, InjectionToken, Provider, TemplateRef, Signal } from '@angular/core';
|
|
3
3
|
import * as i1 from '@cngx/common/a11y';
|
|
4
4
|
import { CngxAsyncState, AsyncStatus } from '@cngx/core/utils';
|
|
5
5
|
import { AsyncAction, CngxPending, CngxSucceeded, CngxFailed } from '@cngx/common/interactive';
|
|
@@ -155,6 +155,7 @@ declare class CngxPopover {
|
|
|
155
155
|
private readonly floatingFallback;
|
|
156
156
|
private readonly _injector;
|
|
157
157
|
private readonly direction;
|
|
158
|
+
private pendingClose;
|
|
158
159
|
/**
|
|
159
160
|
* Arrow-bounds contract resolved lazily on first use.
|
|
160
161
|
* Eager inject() would loop: CngxPopover (host directive on the panel)
|
|
@@ -172,7 +173,11 @@ declare class CngxPopover {
|
|
|
172
173
|
* order. Spec-compatible vocabulary only (no cngx placement tokens).
|
|
173
174
|
*/
|
|
174
175
|
readonly positionTryFallbacks: _angular_core.InputSignal<readonly PopoverPositionTryFallback[]>;
|
|
175
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* Gap between anchor and popover in px, on the placement's main axis
|
|
178
|
+
* (block axis for `top` / `bottom`, inline axis for `left` / `right`);
|
|
179
|
+
* the cross axis stays flush. Same on both positioning engines.
|
|
180
|
+
*/
|
|
176
181
|
readonly offset: _angular_core.InputSignal<number>;
|
|
177
182
|
/** Whether Escape key dismisses the popover. */
|
|
178
183
|
readonly closeOnEscape: _angular_core.InputSignal<boolean>;
|
|
@@ -203,7 +208,6 @@ declare class CngxPopover {
|
|
|
203
208
|
*/
|
|
204
209
|
readonly exclusive: _angular_core.InputSignal<boolean>;
|
|
205
210
|
/**
|
|
206
|
-
* @internal
|
|
207
211
|
* Programmatic override of {@link exclusive}. `null` (default) defers to the
|
|
208
212
|
* `[exclusive]` input; a boolean wins over it. Lets a composing organism
|
|
209
213
|
* (e.g. a submenu wiring in `@cngx/ui/context-menu`) open a nested panel
|
|
@@ -211,11 +215,15 @@ declare class CngxPopover {
|
|
|
211
215
|
* Controlled+uncontrolled derivation: {@link effectiveExclusive} resolves
|
|
212
216
|
* the override first, then the input.
|
|
213
217
|
*/
|
|
214
|
-
readonly
|
|
218
|
+
private readonly exclusiveOverrideState;
|
|
219
|
+
/**
|
|
220
|
+
* @internal Read-only view of the programmatic {@link exclusive} override.
|
|
221
|
+
* Written via {@link setExclusiveOverride}.
|
|
222
|
+
*/
|
|
223
|
+
readonly exclusiveOverride: _angular_core.Signal<boolean | null>;
|
|
215
224
|
/** Effective exclusivity - override wins, else the `[exclusive]` input. */
|
|
216
225
|
private readonly effectiveExclusive;
|
|
217
226
|
/**
|
|
218
|
-
* @internal
|
|
219
227
|
* Programmatic override of {@link placement}. `null` (default) defers to the
|
|
220
228
|
* `[placement]` input; a value wins over it. Lets a composing organism (the
|
|
221
229
|
* submenu wiring in `@cngx/ui/context-menu`) flank a nested panel to the
|
|
@@ -223,7 +231,12 @@ declare class CngxPopover {
|
|
|
223
231
|
* {@link exclusiveOverride}; {@link effectivePlacement} resolves the override
|
|
224
232
|
* first, then the input.
|
|
225
233
|
*/
|
|
226
|
-
readonly
|
|
234
|
+
private readonly placementOverrideState;
|
|
235
|
+
/**
|
|
236
|
+
* @internal Read-only view of the programmatic {@link placement} override.
|
|
237
|
+
* Written via {@link setPlacementOverride}.
|
|
238
|
+
*/
|
|
239
|
+
readonly placementOverride: _angular_core.Signal<PopoverPlacement | null>;
|
|
227
240
|
/**
|
|
228
241
|
* Effective placement for the CSS-anchor path - override wins, else the
|
|
229
242
|
* `[placement]` input, then fully mirrored against the ambient writing
|
|
@@ -244,12 +257,16 @@ declare class CngxPopover {
|
|
|
244
257
|
*/
|
|
245
258
|
private readonly floatingPlacement;
|
|
246
259
|
/**
|
|
247
|
-
* @internal
|
|
248
260
|
* Programmatic override of {@link positionTryFallbacks}, paired with
|
|
249
261
|
* {@link placementOverride} so a submenu wiring installs the flip chain too.
|
|
250
262
|
* `null` (default) defers to the `[positionTryFallbacks]` input.
|
|
251
263
|
*/
|
|
252
|
-
|
|
264
|
+
private readonly positionTryFallbacksOverrideState;
|
|
265
|
+
/**
|
|
266
|
+
* @internal Read-only view of the programmatic {@link positionTryFallbacks}
|
|
267
|
+
* override. Written via {@link setPositionTryFallbacksOverride}.
|
|
268
|
+
*/
|
|
269
|
+
readonly positionTryFallbacksOverride: _angular_core.Signal<readonly PopoverPositionTryFallback[] | null>;
|
|
253
270
|
/** Effective try-fallbacks - override wins, else the `[positionTryFallbacks]` input. */
|
|
254
271
|
private readonly effectivePositionTryFallbacks;
|
|
255
272
|
private readonly stateSignal;
|
|
@@ -258,14 +275,41 @@ declare class CngxPopover {
|
|
|
258
275
|
readonly state: _angular_core.Signal<PopoverState>;
|
|
259
276
|
/** Unique auto-generated ID for this popover instance. */
|
|
260
277
|
readonly id: _angular_core.Signal<string>;
|
|
278
|
+
/** Backing state for {@link focusOrigin}. */
|
|
279
|
+
private readonly focusOriginState;
|
|
261
280
|
/**
|
|
262
|
-
* The
|
|
263
|
-
*
|
|
281
|
+
* The element that held focus when {@link show} was entered, captured
|
|
282
|
+
* synchronously BEFORE the native `showPopover()` call - content
|
|
283
|
+
* autofocus inside the panel therefore cannot displace it.
|
|
284
|
+
* `CngxPopoverTrigger`'s `restoreFocus` reads it as the restore
|
|
285
|
+
* target; cleared on finalize.
|
|
264
286
|
*/
|
|
265
|
-
readonly
|
|
287
|
+
readonly focusOrigin: _angular_core.Signal<HTMLElement | null>;
|
|
288
|
+
/**
|
|
289
|
+
* Implicit anchor slot, written by `CngxPopoverTrigger` and composing
|
|
290
|
+
* organisms via {@link setAnchorElement}.
|
|
291
|
+
*/
|
|
292
|
+
private readonly anchorElementState;
|
|
293
|
+
/** Explicit anchor slot, claimed by `CngxPopoverAnchor`. */
|
|
294
|
+
private readonly explicitAnchorElementSlot;
|
|
295
|
+
/**
|
|
296
|
+
* The element a `CngxPopoverAnchor` registered via
|
|
297
|
+
* {@link registerAnchorElement}, or `null`. While non-null it shadows
|
|
298
|
+
* the implicit anchor and `CngxPopoverTrigger` yields its
|
|
299
|
+
* `anchor-name`.
|
|
300
|
+
*/
|
|
301
|
+
readonly explicitAnchorElement: _angular_core.Signal<HTMLElement | null>;
|
|
302
|
+
/**
|
|
303
|
+
* The anchor element for Floating UI fallback positioning, the
|
|
304
|
+
* arrow-offset geometry and the outside-click guard. Precedence: the
|
|
305
|
+
* explicit anchor ({@link registerAnchorElement}, `CngxPopoverAnchor`)
|
|
306
|
+
* wins over the implicit one ({@link setAnchorElement},
|
|
307
|
+
* `CngxPopoverTrigger` or a composing organism).
|
|
308
|
+
*/
|
|
309
|
+
readonly anchorElement: _angular_core.Signal<HTMLElement | null>;
|
|
266
310
|
/**
|
|
267
311
|
* Inline-axis position the arrow ornament should sit at, expressed as
|
|
268
|
-
* a CSS length pinned to the
|
|
312
|
+
* a CSS length pinned to the anchor's centre. Computed from
|
|
269
313
|
* `anchorElement()` + the panel's own bounding box on every show /
|
|
270
314
|
* reposition / window resize.
|
|
271
315
|
*
|
|
@@ -285,14 +329,16 @@ declare class CngxPopover {
|
|
|
285
329
|
* the same coordinate the default arrow ornament would.
|
|
286
330
|
*/
|
|
287
331
|
readonly arrowOffset: _angular_core.Signal<string | null>;
|
|
332
|
+
/** Backing state for {@link haspopup}. */
|
|
333
|
+
private readonly haspopupState;
|
|
288
334
|
/**
|
|
289
335
|
* Hint for the `CngxPopoverTrigger`'s `aria-haspopup` value. Composers
|
|
290
|
-
* such as `CngxPopoverPanel`
|
|
291
|
-
* at the popover defaults to the right role without
|
|
292
|
-
* having to set `haspopup` on every trigger element.
|
|
293
|
-
* `haspopup` on the trigger still wins.
|
|
336
|
+
* such as `CngxPopoverPanel` install it via {@link setHaspopup} so any
|
|
337
|
+
* trigger pointing at the popover defaults to the right role without
|
|
338
|
+
* the consumer having to set `haspopup` on every trigger element.
|
|
339
|
+
* Consumer-supplied `haspopup` on the trigger still wins.
|
|
294
340
|
*/
|
|
295
|
-
readonly haspopup: _angular_core.
|
|
341
|
+
readonly haspopup: _angular_core.Signal<PopoverHaspopup | undefined>;
|
|
296
342
|
protected readonly isOpening: _angular_core.Signal<boolean>;
|
|
297
343
|
protected readonly isOpen: _angular_core.Signal<boolean>;
|
|
298
344
|
protected readonly isClosing: _angular_core.Signal<boolean>;
|
|
@@ -330,11 +376,61 @@ declare class CngxPopover {
|
|
|
330
376
|
hide(): void;
|
|
331
377
|
/** Toggle between open and closed. */
|
|
332
378
|
toggle(): void;
|
|
379
|
+
/**
|
|
380
|
+
* Register the anchor element for fallback positioning and arrow
|
|
381
|
+
* geometry, or clear it with `null`. Called by `CngxPopoverTrigger`
|
|
382
|
+
* on registration/destroy and by composing organisms that anchor a
|
|
383
|
+
* panel to a virtual element (context-menu pointer coords).
|
|
384
|
+
*/
|
|
385
|
+
setAnchorElement(element: HTMLElement | null): void;
|
|
386
|
+
/**
|
|
387
|
+
* Release the implicit anchor slot - but only while `element` still
|
|
388
|
+
* holds it. A trigger destroyed after another writer claimed the slot
|
|
389
|
+
* leaves that writer untouched.
|
|
390
|
+
*/
|
|
391
|
+
releaseAnchorElement(element: HTMLElement): void;
|
|
392
|
+
/**
|
|
393
|
+
* Claim the explicit anchor slot. Called by `CngxPopoverAnchor`; last
|
|
394
|
+
* registration wins. The explicit anchor shadows every
|
|
395
|
+
* {@link setAnchorElement} writer (trigger, submenu, context-menu
|
|
396
|
+
* virtual anchor) for positioning, arrow geometry and outside-click
|
|
397
|
+
* handling until it is unregistered.
|
|
398
|
+
*/
|
|
399
|
+
registerAnchorElement(element: HTMLElement): void;
|
|
400
|
+
/**
|
|
401
|
+
* Release the explicit anchor slot - but only while `element` still
|
|
402
|
+
* holds it. A stale anchor releasing after a successor registered is
|
|
403
|
+
* a no-op.
|
|
404
|
+
*/
|
|
405
|
+
unregisterAnchorElement(element: HTMLElement): void;
|
|
406
|
+
/**
|
|
407
|
+
* Install the `aria-haspopup` hint triggers fall back to when the
|
|
408
|
+
* consumer sets none. Composers (`CngxPopoverPanel`, menu wirings)
|
|
409
|
+
* call this once at construction; `undefined` clears the hint.
|
|
410
|
+
*/
|
|
411
|
+
setHaspopup(value: PopoverHaspopup | undefined): void;
|
|
412
|
+
/**
|
|
413
|
+
* @internal Install or clear the programmatic {@link exclusive} override.
|
|
414
|
+
* `null` defers back to the `[exclusive]` input.
|
|
415
|
+
*/
|
|
416
|
+
setExclusiveOverride(value: boolean | null): void;
|
|
417
|
+
/**
|
|
418
|
+
* @internal Install or clear the programmatic {@link placement} override.
|
|
419
|
+
* `null` defers back to the `[placement]` input.
|
|
420
|
+
*/
|
|
421
|
+
setPlacementOverride(value: PopoverPlacement | null): void;
|
|
422
|
+
/**
|
|
423
|
+
* @internal Install or clear the programmatic {@link positionTryFallbacks}
|
|
424
|
+
* override. `null` defers back to the `[positionTryFallbacks]` input.
|
|
425
|
+
*/
|
|
426
|
+
setPositionTryFallbacksOverride(value: readonly PopoverPositionTryFallback[] | null): void;
|
|
333
427
|
protected handleToggle(e: ToggleEvent): void;
|
|
334
428
|
/**
|
|
335
429
|
* @internal Called by the global outside-click listener for every open
|
|
336
430
|
* popover. Hides this one when it opted into `closeOnOutsideClick` and the
|
|
337
|
-
* pointerdown landed outside
|
|
431
|
+
* pointerdown landed outside its panel, its anchor and its trigger (the
|
|
432
|
+
* implicit anchor holder, which differs from the anchor while a
|
|
433
|
+
* `CngxPopoverAnchor` holds the popover).
|
|
338
434
|
*/
|
|
339
435
|
closeIfOutsidePointerDown(target: EventTarget | null): void;
|
|
340
436
|
/**
|
|
@@ -348,11 +444,11 @@ declare class CngxPopover {
|
|
|
348
444
|
*/
|
|
349
445
|
private applyFloatingPosition;
|
|
350
446
|
/**
|
|
351
|
-
* Recompute the arrow's edge and inline offset from the live
|
|
447
|
+
* Recompute the arrow's edge and inline offset from the live anchor and
|
|
352
448
|
* panel rects. The resolved edge captures any browser-driven flip; the
|
|
353
449
|
* offset is clamped inside the panel's rounded-corner bounds so the
|
|
354
450
|
* arrow's base stays flush with the panel's straight edge even when the
|
|
355
|
-
*
|
|
451
|
+
* anchor sits outside the panel's inline extent.
|
|
356
452
|
*/
|
|
357
453
|
private updateArrowOffset;
|
|
358
454
|
private get popoverElement();
|
|
@@ -368,7 +464,10 @@ declare class CngxPopover {
|
|
|
368
464
|
* Sets `aria-expanded`, `aria-controls`, and `aria-haspopup` based on the
|
|
369
465
|
* referenced popover's state. Also sets `anchor-name` for CSS Anchor
|
|
370
466
|
* Positioning and registers the anchor element on the popover for fallback
|
|
371
|
-
* positioning.
|
|
467
|
+
* positioning. Both geometry jobs take effect only while no `CngxPopoverAnchor`
|
|
468
|
+
* holds the popover: when the focusable trigger is not the visible box the
|
|
469
|
+
* panel should hang under, put `[cngxPopoverAnchor]` on that box and the
|
|
470
|
+
* trigger yields its `anchor-name` while keeping every ARIA attribute.
|
|
372
471
|
*
|
|
373
472
|
* Contains **no event handlers** - the consumer binds interactions directly:
|
|
374
473
|
*
|
|
@@ -378,24 +477,27 @@ declare class CngxPopover {
|
|
|
378
477
|
* ```
|
|
379
478
|
*
|
|
380
479
|
* ### Focus restoration
|
|
381
|
-
* Opt in with `[restoreFocus]="true"` to
|
|
382
|
-
*
|
|
383
|
-
*
|
|
480
|
+
* Opt in with `[restoreFocus]="true"` to restore focus on close to the
|
|
481
|
+
* element that was focused before the popover opened (the popover
|
|
482
|
+
* snapshots it synchronously in `show()`, so content autofocus cannot
|
|
483
|
+
* displace the restore target). Useful for menus, confirm panels, and
|
|
484
|
+
* dialogs that steal focus from the trigger.
|
|
384
485
|
*
|
|
385
486
|
* @category common/popover
|
|
386
487
|
* @docsKind primary
|
|
387
488
|
* @wcag AA
|
|
388
489
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-trigger.directive.ts
|
|
389
490
|
* @since 0.1.0
|
|
390
|
-
* @relatedTo CngxPopover, CngxPopoverPanel, CngxTooltip
|
|
491
|
+
* @relatedTo CngxPopover, CngxPopoverAnchor, CngxPopoverPanel, CngxTooltip
|
|
391
492
|
* <example-url>http://localhost:4200/#/common/popover/click-popover</example-url>
|
|
392
493
|
* <example-url>http://localhost:4200/#/common/popover/controlled-open</example-url>
|
|
393
494
|
* <example-url>http://localhost:4200/#/common/popover/escape-mode</example-url>
|
|
394
495
|
* <example-url>http://localhost:4200/#/common/popover/placement-variants</example-url>
|
|
496
|
+
* <example-url>http://localhost:4200/#/common/popover/anchor/field-box-anchor</example-url>
|
|
395
497
|
*/
|
|
396
498
|
declare class CngxPopoverTrigger {
|
|
397
499
|
private readonly elRef;
|
|
398
|
-
private readonly
|
|
500
|
+
private readonly destroyRef;
|
|
399
501
|
/** Explicit reference to the popover this trigger controls. */
|
|
400
502
|
readonly popoverRef: _angular_core.InputSignal<CngxPopover>;
|
|
401
503
|
/**
|
|
@@ -413,11 +515,12 @@ declare class CngxPopoverTrigger {
|
|
|
413
515
|
*/
|
|
414
516
|
readonly haspopupInput: _angular_core.InputSignal<PopoverHaspopup | "none" | undefined>;
|
|
415
517
|
/**
|
|
416
|
-
* When `true`,
|
|
417
|
-
* popover
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
518
|
+
* When `true`, remembers the popover's pre-open focus target (the
|
|
519
|
+
* popover snapshots `document.activeElement` synchronously inside
|
|
520
|
+
* `show()`, before content autofocus can land in the panel) and
|
|
521
|
+
* restores focus to it when the popover closes. Defaults to `false`
|
|
522
|
+
* so the trigger stays a passive ARIA atom; opt in for menus,
|
|
523
|
+
* confirm panels, and dialogs that move focus away from the trigger.
|
|
421
524
|
*/
|
|
422
525
|
readonly restoreFocus: _angular_core.InputSignal<boolean>;
|
|
423
526
|
/**
|
|
@@ -428,6 +531,10 @@ declare class CngxPopoverTrigger {
|
|
|
428
531
|
* binding drops the attribute entirely.
|
|
429
532
|
*/
|
|
430
533
|
protected readonly haspopup: _angular_core.Signal<PopoverHaspopup | null>;
|
|
534
|
+
/**
|
|
535
|
+
* CSS anchor name, yielded (`null`) while a `CngxPopoverAnchor` holds
|
|
536
|
+
* the popover's explicit anchor slot.
|
|
537
|
+
*/
|
|
431
538
|
protected readonly cssAnchorName: _angular_core.Signal<string | null>;
|
|
432
539
|
private savedFocus;
|
|
433
540
|
constructor();
|
|
@@ -435,6 +542,52 @@ declare class CngxPopoverTrigger {
|
|
|
435
542
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverTrigger, "[cngxPopoverTrigger]", ["cngxPopoverTrigger"], { "popoverRef": { "alias": "cngxPopoverTrigger"; "required": true; "isSignal": true; }; "haspopupInput": { "alias": "haspopup"; "required": false; "isSignal": true; }; "restoreFocus": { "alias": "restoreFocus"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
436
543
|
}
|
|
437
544
|
|
|
545
|
+
/**
|
|
546
|
+
* Geometry anchor atom: positions a `CngxPopover` against its host
|
|
547
|
+
* element instead of against the popover's trigger.
|
|
548
|
+
*
|
|
549
|
+
* Reach for it when the focusable trigger is not the visible box the
|
|
550
|
+
* panel should hang under - an `<input>` inside a bordered field row, an
|
|
551
|
+
* icon button inside a toolbar segment. The trigger keeps every ARIA
|
|
552
|
+
* attribute (`aria-expanded`, `aria-controls`, `aria-haspopup`); this
|
|
553
|
+
* atom owns only the geometry. It is the cngx counterpart of Material's
|
|
554
|
+
* `matAutocompleteOrigin`.
|
|
555
|
+
*
|
|
556
|
+
* ```html
|
|
557
|
+
* <div class="field" [cngxPopoverAnchor]="pop">
|
|
558
|
+
* <input [cngxPopoverTrigger]="pop" (focus)="pop.show()" aria-label="City" />
|
|
559
|
+
* </div>
|
|
560
|
+
* <div cngxPopover #pop="cngxPopover" placement="bottom-start">…</div>
|
|
561
|
+
* ```
|
|
562
|
+
*
|
|
563
|
+
* While the atom holds the popover's explicit anchor slot it emits
|
|
564
|
+
* `anchor-name` for CSS Anchor Positioning and is the reference element
|
|
565
|
+
* of the Floating UI fallback, the arrow geometry and the outside-click
|
|
566
|
+
* guard; `CngxPopoverTrigger` yields its own `anchor-name`. The explicit
|
|
567
|
+
* anchor wins over every `setAnchorElement` writer. With two atoms on one
|
|
568
|
+
* popover the last registered wins, and only the holder emits
|
|
569
|
+
* `anchor-name`. On destroy (or when the bound popover changes) the atom
|
|
570
|
+
* releases the slot identity-guarded and the trigger becomes the anchor
|
|
571
|
+
* again.
|
|
572
|
+
*
|
|
573
|
+
* @category common/popover
|
|
574
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-anchor.directive.ts
|
|
575
|
+
* @since 0.1.0
|
|
576
|
+
* @relatedTo CngxPopover, CngxPopoverTrigger
|
|
577
|
+
* <example-url>http://localhost:4200/#/common/popover/anchor/field-box-anchor</example-url>
|
|
578
|
+
*/
|
|
579
|
+
declare class CngxPopoverAnchor {
|
|
580
|
+
private readonly host;
|
|
581
|
+
/** The popover this element anchors. */
|
|
582
|
+
readonly popoverRef: _angular_core.InputSignal<CngxPopover>;
|
|
583
|
+
/** Whether this host currently holds the popover's explicit anchor slot. */
|
|
584
|
+
protected readonly isAnchor: _angular_core.Signal<boolean>;
|
|
585
|
+
protected readonly cssAnchorName: _angular_core.Signal<string | null>;
|
|
586
|
+
constructor();
|
|
587
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverAnchor, never>;
|
|
588
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverAnchor, "[cngxPopoverAnchor]", ["cngxPopoverAnchor"], { "popoverRef": { "alias": "cngxPopoverAnchor"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
589
|
+
}
|
|
590
|
+
|
|
438
591
|
/**
|
|
439
592
|
* String-input tooltip directive applied to the trigger element.
|
|
440
593
|
*
|
|
@@ -581,7 +734,10 @@ type ComputePositionFn = (reference: HTMLElement, floating: HTMLElement, options
|
|
|
581
734
|
interface FloatingFallbackConfig {
|
|
582
735
|
/** The `computePosition` function from `@floating-ui/dom`. */
|
|
583
736
|
computePosition: ComputePositionFn;
|
|
584
|
-
/**
|
|
737
|
+
/**
|
|
738
|
+
* Middleware array (e.g. `[flip(), shift()]`). The popover prepends its own
|
|
739
|
+
* offset middleware, so do not pass `offset()` here.
|
|
740
|
+
*/
|
|
585
741
|
middleware?: unknown[];
|
|
586
742
|
}
|
|
587
743
|
/**
|
|
@@ -601,11 +757,11 @@ declare const CNGX_FLOATING_FALLBACK: InjectionToken<FloatingFallbackConfig | nu
|
|
|
601
757
|
* never imports it directly, keeping the bundle at zero cost for modern browsers.
|
|
602
758
|
*
|
|
603
759
|
* ```typescript
|
|
604
|
-
* import { computePosition, flip,
|
|
760
|
+
* import { computePosition, flip, shift } from '@floating-ui/dom';
|
|
605
761
|
*
|
|
606
762
|
* // In app.config.ts or component providers:
|
|
607
763
|
* providers: [
|
|
608
|
-
* provideFloatingFallback(computePosition, [
|
|
764
|
+
* provideFloatingFallback(computePosition, [flip(), shift()]),
|
|
609
765
|
* ]
|
|
610
766
|
* ```
|
|
611
767
|
*
|
|
@@ -613,6 +769,34 @@ declare const CNGX_FLOATING_FALLBACK: InjectionToken<FloatingFallbackConfig | nu
|
|
|
613
769
|
*/
|
|
614
770
|
declare function provideFloatingFallback(computePosition: ComputePositionFn, middleware?: unknown[]): Provider;
|
|
615
771
|
|
|
772
|
+
/**
|
|
773
|
+
* The popover section of a {@link CngxLanguagePack}: the copy of
|
|
774
|
+
* `CngxPopoverPanel`. `providePopoverPanel(withPopoverPanelLabels(...))`
|
|
775
|
+
* overrides single keys on top of it.
|
|
776
|
+
*
|
|
777
|
+
* @category common/popover
|
|
778
|
+
* @since 0.1.0
|
|
779
|
+
* @relatedTo CngxPopoverPanel, withPopoverPanelLabels
|
|
780
|
+
*/
|
|
781
|
+
interface CngxPopoverLanguageSection {
|
|
782
|
+
/** Accessible name of the built-in close button. */
|
|
783
|
+
readonly close: string;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* The English popover section: the single source of the popover panel's
|
|
787
|
+
* English copy.
|
|
788
|
+
*
|
|
789
|
+
* @category common/popover
|
|
790
|
+
* @since 0.1.0
|
|
791
|
+
* @relatedTo CngxPopoverPanel
|
|
792
|
+
*/
|
|
793
|
+
declare const CNGX_POPOVER_LANGUAGE_EN: CngxPopoverLanguageSection;
|
|
794
|
+
declare module '@cngx/core/i18n' {
|
|
795
|
+
interface CngxLanguagePack {
|
|
796
|
+
readonly popover: CngxPopoverLanguageSection;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
|
|
616
800
|
/**
|
|
617
801
|
* Context object passed to a `*cngxPopoverArrow` template.
|
|
618
802
|
*
|
|
@@ -795,7 +979,22 @@ interface CngxPopoverPanelConfig {
|
|
|
795
979
|
*/
|
|
796
980
|
arrow?: TemplateRef<CngxPopoverArrowContext>;
|
|
797
981
|
};
|
|
982
|
+
/**
|
|
983
|
+
* App-wide panel copy, set via `withPopoverPanelLabels(...)`. Unset keys
|
|
984
|
+
* keep the English default. A `Signal` of a partial bundle switches
|
|
985
|
+
* languages at runtime; the panel reads it reactively.
|
|
986
|
+
*/
|
|
987
|
+
readonly labels?: Partial<CngxPopoverPanelLabels> | Signal<Partial<CngxPopoverPanelLabels>>;
|
|
798
988
|
}
|
|
989
|
+
/**
|
|
990
|
+
* User-facing copy of `CngxPopoverPanel`. Library defaults are English. The
|
|
991
|
+
* same shape as the popover section of a language pack, declared once as
|
|
992
|
+
* {@link CngxPopoverLanguageSection}.
|
|
993
|
+
*
|
|
994
|
+
* @category common/popover
|
|
995
|
+
* @since 0.1.0
|
|
996
|
+
*/
|
|
997
|
+
type CngxPopoverPanelLabels = CngxPopoverLanguageSection;
|
|
799
998
|
/**
|
|
800
999
|
* Feature function signature for `providePopoverPanel()`.
|
|
801
1000
|
*
|
|
@@ -881,6 +1080,22 @@ declare function withArrow(show?: boolean): PopoverPanelFeature;
|
|
|
881
1080
|
* @category common/popover
|
|
882
1081
|
*/
|
|
883
1082
|
declare function withArrowTemplate(tpl: TemplateRef<CngxPopoverArrowContext>): PopoverPanelFeature;
|
|
1083
|
+
/**
|
|
1084
|
+
* Set the app-wide panel copy. Unset keys keep the language pack's copy, or
|
|
1085
|
+
* the English default; pass a
|
|
1086
|
+
* `Signal` of a partial bundle to switch languages at runtime. A later call
|
|
1087
|
+
* replaces the whole bundle. Mirrors `withDialogLabels`.
|
|
1088
|
+
*
|
|
1089
|
+
* ```typescript
|
|
1090
|
+
* providers: [
|
|
1091
|
+
* providePopoverPanel(withPopoverPanelLabels({ close: 'Schliessen' })),
|
|
1092
|
+
* ]
|
|
1093
|
+
* ```
|
|
1094
|
+
*
|
|
1095
|
+
* @category common/popover
|
|
1096
|
+
* @since 0.1.0
|
|
1097
|
+
*/
|
|
1098
|
+
declare function withPopoverPanelLabels(labels: Partial<CngxPopoverPanelLabels> | Signal<Partial<CngxPopoverPanelLabels>>): PopoverPanelFeature;
|
|
884
1099
|
|
|
885
1100
|
/**
|
|
886
1101
|
* Geometry contract for the popover panel's arrow ornament.
|
|
@@ -921,8 +1136,9 @@ declare const CNGX_POPOVER_ARROW_BOUNDS: InjectionToken<CngxPopoverArrowBounds>;
|
|
|
921
1136
|
* styling, arrow, close button, and content state templates.
|
|
922
1137
|
*
|
|
923
1138
|
* Composes `CngxPopover` via `hostDirectives` - all popover inputs
|
|
924
|
-
* (`placement`, `
|
|
925
|
-
* `cngxPopoverOpen`) are
|
|
1139
|
+
* (`placement`, `positionTryFallbacks`, `offset`, `closeOnEscape`,
|
|
1140
|
+
* `closeOnOutsideClick`, `mode`, `exclusive`, `cngxPopoverOpen`) are
|
|
1141
|
+
* forwarded.
|
|
926
1142
|
*
|
|
927
1143
|
* The `variant` input is a free-form string mapped to a CSS class
|
|
928
1144
|
* (`cngx-popover-panel--{variant}`). Five variants are pre-themed
|
|
@@ -1006,6 +1222,13 @@ declare class CngxPopoverPanel implements CngxPopoverArrowBounds {
|
|
|
1006
1222
|
readonly showCloseInput: _angular_core.InputSignal<boolean | undefined>;
|
|
1007
1223
|
/** Show an arrow. Falls back to global config from `providePopoverPanel(withArrow())`. */
|
|
1008
1224
|
readonly showArrowInput: _angular_core.InputSignal<boolean | undefined>;
|
|
1225
|
+
/**
|
|
1226
|
+
* Panel copy: `config.labels` over the popover section of the active
|
|
1227
|
+
* language pack, one shared merge per config object.
|
|
1228
|
+
*/
|
|
1229
|
+
private readonly labels;
|
|
1230
|
+
/** Accessible name of the built-in close button. */
|
|
1231
|
+
protected readonly closeLabel: _angular_core.Signal<string>;
|
|
1009
1232
|
/** Resolved showClose - input takes precedence over config. */
|
|
1010
1233
|
readonly showClose: _angular_core.Signal<boolean>;
|
|
1011
1234
|
/** Resolved showArrow - input takes precedence over config. */
|
|
@@ -1068,7 +1291,7 @@ declare class CngxPopoverPanel implements CngxPopoverArrowBounds {
|
|
|
1068
1291
|
private autoDismissTimer;
|
|
1069
1292
|
constructor();
|
|
1070
1293
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverPanel, never>;
|
|
1071
|
-
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"; "mode": "mode"; "exclusive": "exclusive"; "cngxPopoverOpen": "cngxPopoverOpen"; }; outputs: {}; }]>;
|
|
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: {}; }]>;
|
|
1072
1295
|
}
|
|
1073
1296
|
|
|
1074
1297
|
/**
|
|
@@ -1199,5 +1422,5 @@ declare class CngxPopoverDivider {
|
|
|
1199
1422
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverDivider, "[cngxPopoverDivider]", ["cngxPopoverDivider"], {}, {}, never, never, true, [{ directive: typeof i1$1.CngxDivider; inputs: { "orientation": "orientation"; "inset": "inset"; }; outputs: {}; }]>;
|
|
1200
1423
|
}
|
|
1201
1424
|
|
|
1202
|
-
export { CNGX_FLOATING_FALLBACK, CNGX_POPOVER_ARROW_BOUNDS, CNGX_POPOVER_PANEL_CONFIG, CngxPopover, CngxPopoverAction, CngxPopoverArrow, CngxPopoverBody, CngxPopoverClose, CngxPopoverDivider, CngxPopoverEmpty, CngxPopoverError, CngxPopoverFooter, CngxPopoverHeader, CngxPopoverLoading, CngxPopoverPanel, CngxPopoverTrigger, CngxTooltip, provideFloatingFallback, providePopoverPanel, withArrow, withArrowTemplate, withAutoDismiss, withCloseButton, withCloseOnSuccess, withDefaultVariant };
|
|
1203
|
-
export type { ArrowEdge, CngxPopoverArrowBounds, CngxPopoverArrowContext, CngxPopoverPanelConfig, ComputePositionFn, FloatingFallbackConfig, PopoverActionVariant, PopoverHaspopup, PopoverMode, PopoverPanelFeature, PopoverPanelRole, PopoverPlacement, PopoverPositionTryFallback, PopoverState, TooltipTriggerMode };
|
|
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, PopoverActionVariant, PopoverHaspopup, PopoverMode, PopoverPanelFeature, PopoverPanelRole, PopoverPlacement, PopoverPositionTryFallback, PopoverState, TooltipTriggerMode };
|