@cngx/common 0.1.0-rc.6 → 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.
Files changed (72) hide show
  1. package/card/README.md +2 -1
  2. package/chart/README.md +85 -0
  3. package/command/README.md +157 -0
  4. package/data/README.md +33 -1
  5. package/dialog/README.md +23 -1
  6. package/fesm2022/cngx-common-a11y.mjs +356 -180
  7. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  8. package/fesm2022/cngx-common-audio.mjs +84 -42
  9. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  10. package/fesm2022/cngx-common-card.mjs +311 -53
  11. package/fesm2022/cngx-common-card.mjs.map +1 -1
  12. package/fesm2022/cngx-common-chart.mjs +4360 -1625
  13. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  14. package/fesm2022/cngx-common-command.mjs +171 -0
  15. package/fesm2022/cngx-common-command.mjs.map +1 -0
  16. package/fesm2022/cngx-common-data.mjs +1556 -616
  17. package/fesm2022/cngx-common-data.mjs.map +1 -1
  18. package/fesm2022/cngx-common-dialog.mjs +518 -112
  19. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  20. package/fesm2022/cngx-common-display.mjs +468 -87
  21. package/fesm2022/cngx-common-display.mjs.map +1 -1
  22. package/fesm2022/cngx-common-interactive.mjs +2725 -1303
  23. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  24. package/fesm2022/cngx-common-layout.mjs +943 -164
  25. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  26. package/fesm2022/cngx-common-popover.mjs +769 -103
  27. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  28. package/fesm2022/cngx-common-stepper.mjs +816 -348
  29. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  30. package/fesm2022/cngx-common-tabs.mjs +2330 -1554
  31. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  32. package/fesm2022/cngx-common-timeline.mjs +1170 -0
  33. package/fesm2022/cngx-common-timeline.mjs.map +1 -0
  34. package/fesm2022/cngx-common.mjs +2 -2
  35. package/fesm2022/cngx-common.mjs.map +1 -1
  36. package/interactive/README.md +15 -4
  37. package/layout/README.md +21 -1
  38. package/package.json +11 -1
  39. package/popover/README.md +18 -2
  40. package/stepper/README.md +7 -5
  41. package/theming/components/cngx-accordion.css +4 -1
  42. package/theming/components/cngx-backdrop.css +12 -0
  43. package/theming/components/cngx-badge.css +22 -0
  44. package/theming/components/cngx-bottom-sheet.css +14 -2
  45. package/theming/components/cngx-breadcrumb.css +8 -0
  46. package/theming/components/cngx-button-toggle.css +73 -5
  47. package/theming/components/cngx-data-grid.css +234 -1
  48. package/theming/components/cngx-dialog.css +25 -0
  49. package/theming/components/cngx-divider.css +12 -0
  50. package/theming/components/cngx-listbox.css +48 -12
  51. package/theming/components/cngx-menu.css +91 -15
  52. package/theming/components/cngx-popover.css +24 -0
  53. package/theming/components/cngx-recycler-placeholder.css +196 -0
  54. package/theming/components/cngx-ripple.css +2 -2
  55. package/theming/components/cngx-slider.css +32 -1
  56. package/theming/components/cngx-tooltip.css +23 -0
  57. package/timeline/README.md +155 -0
  58. package/types/cngx-common-a11y.d.ts +101 -31
  59. package/types/cngx-common-audio.d.ts +32 -32
  60. package/types/cngx-common-card.d.ts +211 -20
  61. package/types/cngx-common-chart.d.ts +1605 -169
  62. package/types/cngx-common-command.d.ts +190 -0
  63. package/types/cngx-common-data.d.ts +842 -163
  64. package/types/cngx-common-dialog.d.ts +372 -28
  65. package/types/cngx-common-display.d.ts +432 -148
  66. package/types/cngx-common-interactive.d.ts +1553 -370
  67. package/types/cngx-common-layout.d.ts +613 -27
  68. package/types/cngx-common-popover.d.ts +376 -36
  69. package/types/cngx-common-stepper.d.ts +414 -114
  70. package/types/cngx-common-tabs.d.ts +597 -72
  71. package/types/cngx-common-timeline.d.ts +1125 -0
  72. package/types/cngx-common.d.ts +1 -1
@@ -1,7 +1,7 @@
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
- import { CngxAsyncState } from '@cngx/core/utils';
4
+ import { CngxAsyncState, AsyncStatus } from '@cngx/core/utils';
5
5
  import { AsyncAction, CngxPending, CngxSucceeded, CngxFailed } from '@cngx/common/interactive';
6
6
  import * as i1$1 from '@cngx/common/display';
7
7
 
@@ -154,6 +154,8 @@ declare class CngxPopover {
154
154
  private readonly doc;
155
155
  private readonly floatingFallback;
156
156
  private readonly _injector;
157
+ private readonly direction;
158
+ private pendingClose;
157
159
  /**
158
160
  * Arrow-bounds contract resolved lazily on first use.
159
161
  * Eager inject() would loop: CngxPopover (host directive on the panel)
@@ -171,7 +173,11 @@ declare class CngxPopover {
171
173
  * order. Spec-compatible vocabulary only (no cngx placement tokens).
172
174
  */
173
175
  readonly positionTryFallbacks: _angular_core.InputSignal<readonly PopoverPositionTryFallback[]>;
174
- /** Gap between anchor and popover in px. */
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
+ */
175
181
  readonly offset: _angular_core.InputSignal<number>;
176
182
  /** Whether Escape key dismisses the popover. */
177
183
  readonly closeOnEscape: _angular_core.InputSignal<boolean>;
@@ -194,22 +200,116 @@ declare class CngxPopover {
194
200
  * When `true` (default), opening this popover closes any other open
195
201
  * `CngxPopover` instance. Set to `false` to allow multiple popovers
196
202
  * open simultaneously.
203
+ *
204
+ * Exclusivity governs sibling popovers only: a popover nested inside
205
+ * another open popover (a select panel or submenu opening within a
206
+ * popover-hosted surface) is that container's child, not a rival, and
207
+ * never evicts its ancestor.
197
208
  */
198
209
  readonly exclusive: _angular_core.InputSignal<boolean>;
210
+ /**
211
+ * Programmatic override of {@link exclusive}. `null` (default) defers to the
212
+ * `[exclusive]` input; a boolean wins over it. Lets a composing organism
213
+ * (e.g. a submenu wiring in `@cngx/ui/context-menu`) open a nested panel
214
+ * non-exclusively without a consumer-side `[exclusive]="false"` handgrip.
215
+ * Controlled+uncontrolled derivation: {@link effectiveExclusive} resolves
216
+ * the override first, then the input.
217
+ */
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>;
224
+ /** Effective exclusivity - override wins, else the `[exclusive]` input. */
225
+ private readonly effectiveExclusive;
226
+ /**
227
+ * Programmatic override of {@link placement}. `null` (default) defers to the
228
+ * `[placement]` input; a value wins over it. Lets a composing organism (the
229
+ * submenu wiring in `@cngx/ui/context-menu`) flank a nested panel to the
230
+ * inline-end without a consumer-side `[placement]` handgrip. Mirrors
231
+ * {@link exclusiveOverride}; {@link effectivePlacement} resolves the override
232
+ * first, then the input.
233
+ */
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>;
240
+ /**
241
+ * Effective placement for the CSS-anchor path - override wins, else the
242
+ * `[placement]` input, then fully mirrored against the ambient writing
243
+ * direction. Feeds the `POSITION_AREA` write, the token-split arrow edge,
244
+ * and `resolveActualEdge`: `POSITION_AREA` uses physical keywords with no
245
+ * direction awareness, so the whole mirror happens here. A submenu that
246
+ * flanks inline-end under `ltr` flanks the physically-opposite side under
247
+ * `rtl`, matching the shipped keyboard direction-awareness.
248
+ */
249
+ private readonly effectivePlacement;
250
+ /**
251
+ * Effective placement for the floating-ui fallback path - the same source
252
+ * as {@link effectivePlacement} but mirrored side-only. `@floating-ui/dom`
253
+ * flips the inline alignment of vertical placements under `rtl` itself, so
254
+ * feeding it the fully-mirrored token would double-flip `top-start` /
255
+ * `bottom-end`. This path mirrors the side and defers alignment to
256
+ * floating-ui.
257
+ */
258
+ private readonly floatingPlacement;
259
+ /**
260
+ * Programmatic override of {@link positionTryFallbacks}, paired with
261
+ * {@link placementOverride} so a submenu wiring installs the flip chain too.
262
+ * `null` (default) defers to the `[positionTryFallbacks]` input.
263
+ */
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>;
270
+ /** Effective try-fallbacks - override wins, else the `[positionTryFallbacks]` input. */
271
+ private readonly effectivePositionTryFallbacks;
199
272
  private readonly stateSignal;
200
273
  private readonly idSignal;
201
274
  /** Current lifecycle state. */
202
275
  readonly state: _angular_core.Signal<PopoverState>;
203
276
  /** Unique auto-generated ID for this popover instance. */
204
277
  readonly id: _angular_core.Signal<string>;
278
+ /** Backing state for {@link focusOrigin}. */
279
+ private readonly focusOriginState;
280
+ /**
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.
286
+ */
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>;
205
302
  /**
206
- * The anchor element for Floating UI fallback positioning.
207
- * Set by `CngxPopoverTrigger` or `CngxTooltip`.
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).
208
308
  */
209
- readonly anchorElement: _angular_core.WritableSignal<HTMLElement | null>;
309
+ readonly anchorElement: _angular_core.Signal<HTMLElement | null>;
210
310
  /**
211
311
  * Inline-axis position the arrow ornament should sit at, expressed as
212
- * a CSS length pinned to the trigger's centre. Computed from
312
+ * a CSS length pinned to the anchor's centre. Computed from
213
313
  * `anchorElement()` + the panel's own bounding box on every show /
214
314
  * reposition / window resize.
215
315
  *
@@ -229,14 +329,16 @@ declare class CngxPopover {
229
329
  * the same coordinate the default arrow ornament would.
230
330
  */
231
331
  readonly arrowOffset: _angular_core.Signal<string | null>;
332
+ /** Backing state for {@link haspopup}. */
333
+ private readonly haspopupState;
232
334
  /**
233
335
  * Hint for the `CngxPopoverTrigger`'s `aria-haspopup` value. Composers
234
- * such as `CngxPopoverPanel` write this signal so any trigger pointing
235
- * at the popover defaults to the right role without the consumer
236
- * having to set `haspopup` on every trigger element. Consumer-supplied
237
- * `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.
238
340
  */
239
- readonly haspopup: _angular_core.WritableSignal<PopoverHaspopup | undefined>;
341
+ readonly haspopup: _angular_core.Signal<PopoverHaspopup | undefined>;
240
342
  protected readonly isOpening: _angular_core.Signal<boolean>;
241
343
  protected readonly isOpen: _angular_core.Signal<boolean>;
242
344
  protected readonly isClosing: _angular_core.Signal<boolean>;
@@ -274,24 +376,79 @@ declare class CngxPopover {
274
376
  hide(): void;
275
377
  /** Toggle between open and closed. */
276
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;
277
427
  protected handleToggle(e: ToggleEvent): void;
278
428
  /**
279
429
  * @internal Called by the global outside-click listener for every open
280
430
  * popover. Hides this one when it opted into `closeOnOutsideClick` and the
281
- * pointerdown landed outside both its panel and its anchor (trigger).
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).
282
434
  */
283
435
  closeIfOutsidePointerDown(target: EventTarget | null): void;
436
+ /**
437
+ * Shared fallback engine - offset middleware, scroll/resize re-run while
438
+ * open, state-guarded writes. `null` when no fallback is provided.
439
+ */
440
+ private readonly floatingPositioner;
284
441
  /**
285
442
  * Apply Floating UI positioning when CSS Anchor is not supported
286
443
  * and the consumer has provided the fallback via `provideFloatingFallback()`.
287
444
  */
288
445
  private applyFloatingPosition;
289
446
  /**
290
- * Recompute the arrow's edge and inline offset from the live trigger and
447
+ * Recompute the arrow's edge and inline offset from the live anchor and
291
448
  * panel rects. The resolved edge captures any browser-driven flip; the
292
449
  * offset is clamped inside the panel's rounded-corner bounds so the
293
450
  * arrow's base stays flush with the panel's straight edge even when the
294
- * trigger sits outside the panel's inline extent.
451
+ * anchor sits outside the panel's inline extent.
295
452
  */
296
453
  private updateArrowOffset;
297
454
  private get popoverElement();
@@ -307,7 +464,10 @@ declare class CngxPopover {
307
464
  * Sets `aria-expanded`, `aria-controls`, and `aria-haspopup` based on the
308
465
  * referenced popover's state. Also sets `anchor-name` for CSS Anchor
309
466
  * Positioning and registers the anchor element on the popover for fallback
310
- * 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.
311
471
  *
312
472
  * Contains **no event handlers** - the consumer binds interactions directly:
313
473
  *
@@ -317,24 +477,27 @@ declare class CngxPopover {
317
477
  * ```
318
478
  *
319
479
  * ### Focus restoration
320
- * Opt in with `[restoreFocus]="true"` to capture the active element when
321
- * the popover opens and restore focus to it on close. Useful for menus,
322
- * confirm panels, and dialogs that steal focus from the trigger.
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.
323
485
  *
324
486
  * @category common/popover
325
487
  * @docsKind primary
326
488
  * @wcag AA
327
489
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-trigger.directive.ts
328
490
  * @since 0.1.0
329
- * @relatedTo CngxPopover, CngxPopoverPanel, CngxTooltip
491
+ * @relatedTo CngxPopover, CngxPopoverAnchor, CngxPopoverPanel, CngxTooltip
330
492
  * <example-url>http://localhost:4200/#/common/popover/click-popover</example-url>
331
493
  * <example-url>http://localhost:4200/#/common/popover/controlled-open</example-url>
332
494
  * <example-url>http://localhost:4200/#/common/popover/escape-mode</example-url>
333
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>
334
497
  */
335
498
  declare class CngxPopoverTrigger {
336
499
  private readonly elRef;
337
- private readonly doc;
500
+ private readonly destroyRef;
338
501
  /** Explicit reference to the popover this trigger controls. */
339
502
  readonly popoverRef: _angular_core.InputSignal<CngxPopover>;
340
503
  /**
@@ -352,11 +515,12 @@ declare class CngxPopoverTrigger {
352
515
  */
353
516
  readonly haspopupInput: _angular_core.InputSignal<PopoverHaspopup | "none" | undefined>;
354
517
  /**
355
- * When `true`, captures `document.activeElement` the moment the
356
- * popover transitions to a visible state and restores focus to that
357
- * element when the popover closes. Defaults to `false` so the trigger
358
- * stays a passive ARIA atom; opt in for menus, confirm panels, and
359
- * dialogs that move focus away from the trigger.
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.
360
524
  */
361
525
  readonly restoreFocus: _angular_core.InputSignal<boolean>;
362
526
  /**
@@ -367,6 +531,10 @@ declare class CngxPopoverTrigger {
367
531
  * binding drops the attribute entirely.
368
532
  */
369
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
+ */
370
538
  protected readonly cssAnchorName: _angular_core.Signal<string | null>;
371
539
  private savedFocus;
372
540
  constructor();
@@ -374,6 +542,52 @@ declare class CngxPopoverTrigger {
374
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>;
375
543
  }
376
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
+
377
591
  /**
378
592
  * String-input tooltip directive applied to the trigger element.
379
593
  *
@@ -413,10 +627,26 @@ declare class CngxTooltip {
413
627
  private readonly elRef;
414
628
  private readonly destroyRef;
415
629
  private readonly floatingFallback;
630
+ private readonly direction;
416
631
  /** Tooltip text content. */
417
632
  readonly text: _angular_core.InputSignal<string>;
418
633
  /** Anchor-relative placement. */
419
634
  readonly placement: _angular_core.InputSignal<PopoverPlacement>;
635
+ /**
636
+ * @internal
637
+ * `placement` fully mirrored against the ambient writing direction, for the
638
+ * CSS-anchor path (`POSITION_AREA`, physical keywords, no direction
639
+ * awareness).
640
+ */
641
+ private readonly directionalPlacement;
642
+ /**
643
+ * @internal
644
+ * `placement` mirrored side-only, for the floating-ui fallback path.
645
+ * `@floating-ui/dom` flips the inline alignment of vertical placements under
646
+ * `rtl` itself, so a full mirror would double-flip `top-start` / `bottom-end`
647
+ * here. This path mirrors the side and defers alignment to floating-ui.
648
+ */
649
+ private readonly floatingPlacement;
420
650
  /** Gap between trigger and tooltip in px. */
421
651
  readonly offset: _angular_core.InputSignal<number>;
422
652
  /** Delay in ms before opening on mouseenter. */
@@ -457,7 +687,21 @@ declare class CngxTooltip {
457
687
  protected handleMouseLeave(): void;
458
688
  protected handleFocus(): void;
459
689
  protected handleBlur(): void;
460
- protected handleEscape(event: Event): void;
690
+ /**
691
+ * Document-level Escape while open (capture phase). A hover-opened tooltip
692
+ * has no focus relationship with its trigger, so a host keydown binding
693
+ * never fires - WCAG 1.4.13 requires Escape to dismiss regardless of where
694
+ * the keyboard focus sits. stopPropagation keeps parent overlays (dialog,
695
+ * popover) open: Escape dismisses the innermost surface only.
696
+ */
697
+ private readonly handleDocumentEscape;
698
+ /**
699
+ * Shared fallback engine (same as `CngxPopover`) - offset middleware,
700
+ * scroll/resize re-run while open, state-guarded writes. First step of
701
+ * folding the tooltip onto the popover state machine. `null` when no
702
+ * fallback is provided.
703
+ */
704
+ private readonly floatingPositioner;
461
705
  private applyFloatingPosition;
462
706
  private createTooltipElement;
463
707
  private finalize;
@@ -490,7 +734,10 @@ type ComputePositionFn = (reference: HTMLElement, floating: HTMLElement, options
490
734
  interface FloatingFallbackConfig {
491
735
  /** The `computePosition` function from `@floating-ui/dom`. */
492
736
  computePosition: ComputePositionFn;
493
- /** Middleware array (e.g. `[offset(8), flip(), shift()]`). */
737
+ /**
738
+ * Middleware array (e.g. `[flip(), shift()]`). The popover prepends its own
739
+ * offset middleware, so do not pass `offset()` here.
740
+ */
494
741
  middleware?: unknown[];
495
742
  }
496
743
  /**
@@ -510,11 +757,11 @@ declare const CNGX_FLOATING_FALLBACK: InjectionToken<FloatingFallbackConfig | nu
510
757
  * never imports it directly, keeping the bundle at zero cost for modern browsers.
511
758
  *
512
759
  * ```typescript
513
- * import { computePosition, flip, offset, shift } from '@floating-ui/dom';
760
+ * import { computePosition, flip, shift } from '@floating-ui/dom';
514
761
  *
515
762
  * // In app.config.ts or component providers:
516
763
  * providers: [
517
- * provideFloatingFallback(computePosition, [offset(8), flip(), shift()]),
764
+ * provideFloatingFallback(computePosition, [flip(), shift()]),
518
765
  * ]
519
766
  * ```
520
767
  *
@@ -522,6 +769,34 @@ declare const CNGX_FLOATING_FALLBACK: InjectionToken<FloatingFallbackConfig | nu
522
769
  */
523
770
  declare function provideFloatingFallback(computePosition: ComputePositionFn, middleware?: unknown[]): Provider;
524
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
+
525
800
  /**
526
801
  * Context object passed to a `*cngxPopoverArrow` template.
527
802
  *
@@ -692,7 +967,7 @@ interface CngxPopoverPanelConfig {
692
967
  showArrow?: boolean;
693
968
  /**
694
969
  * App-wide template overrides for the panel's visible regions. Each
695
- * entry is the third tier of the slot cascade — per-instance
970
+ * entry is the third tier of the slot cascade - per-instance
696
971
  * `contentChild` directives still win, the library defaults still
697
972
  * lose. Set via `withArrowTemplate(...)` and friends.
698
973
  */
@@ -704,7 +979,22 @@ interface CngxPopoverPanelConfig {
704
979
  */
705
980
  arrow?: TemplateRef<CngxPopoverArrowContext>;
706
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>>;
707
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;
708
998
  /**
709
999
  * Feature function signature for `providePopoverPanel()`.
710
1000
  *
@@ -790,6 +1080,22 @@ declare function withArrow(show?: boolean): PopoverPanelFeature;
790
1080
  * @category common/popover
791
1081
  */
792
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;
793
1099
 
794
1100
  /**
795
1101
  * Geometry contract for the popover panel's arrow ornament.
@@ -830,8 +1136,9 @@ declare const CNGX_POPOVER_ARROW_BOUNDS: InjectionToken<CngxPopoverArrowBounds>;
830
1136
  * styling, arrow, close button, and content state templates.
831
1137
  *
832
1138
  * Composes `CngxPopover` via `hostDirectives` - all popover inputs
833
- * (`placement`, `offset`, `closeOnEscape`, `mode`, `exclusive`,
834
- * `cngxPopoverOpen`) are forwarded.
1139
+ * (`placement`, `positionTryFallbacks`, `offset`, `closeOnEscape`,
1140
+ * `closeOnOutsideClick`, `mode`, `exclusive`, `cngxPopoverOpen`) are
1141
+ * forwarded.
835
1142
  *
836
1143
  * The `variant` input is a free-form string mapped to a CSS class
837
1144
  * (`cngx-popover-panel--{variant}`). Five variants are pre-themed
@@ -868,6 +1175,11 @@ declare const CNGX_POPOVER_ARROW_BOUNDS: InjectionToken<CngxPopoverArrowBounds>;
868
1175
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel.component.ts
869
1176
  * @since 0.1.0
870
1177
  * @relatedTo CngxPopover, CngxPopoverAction, CngxPopoverHeader, CngxPopoverBody, CngxPopoverFooter
1178
+ * @slot cngxPopoverArrow Replaces the pointer that ties the panel to its trigger.
1179
+ * @slot cngxPopoverClose Replaces the dismiss control.
1180
+ * @slot cngxPopoverLoading Rendered while the panel's content is loading.
1181
+ * @slot cngxPopoverEmpty Rendered when the panel has nothing to show.
1182
+ * @slot cngxPopoverError Rendered when the panel's content failed to load.
871
1183
  * <example-url>http://localhost:4200/#/common/popover/popover-panel/content-states</example-url>
872
1184
  * <example-url>http://localhost:4200/#/common/popover/popover-panel/variants</example-url>
873
1185
  * <example-url>http://localhost:4200/#/common/popover/popover-panel/with-footer-actions</example-url>
@@ -910,6 +1222,13 @@ declare class CngxPopoverPanel implements CngxPopoverArrowBounds {
910
1222
  readonly showCloseInput: _angular_core.InputSignal<boolean | undefined>;
911
1223
  /** Show an arrow. Falls back to global config from `providePopoverPanel(withArrow())`. */
912
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>;
913
1232
  /** Resolved showClose - input takes precedence over config. */
914
1233
  readonly showClose: _angular_core.Signal<boolean>;
915
1234
  /** Resolved showArrow - input takes precedence over config. */
@@ -960,13 +1279,19 @@ declare class CngxPopoverPanel implements CngxPopoverArrowBounds {
960
1279
  private readonly uid;
961
1280
  protected readonly headerId: string;
962
1281
  protected readonly bodyId: string;
1282
+ /**
1283
+ * Only point to the header when one is projected - a bare id reference
1284
+ * resolves even against an element that never renders (the header row is
1285
+ * gated on `hasHeader()`), leaving AT with an empty accessible name.
1286
+ */
1287
+ protected readonly ariaLabelledBy: _angular_core.Signal<string | null>;
963
1288
  /** Only point to body when default content is showing (not loading/error/empty). */
964
1289
  protected readonly ariaDescribedBy: _angular_core.Signal<string | null>;
965
1290
  protected readonly hostClass: _angular_core.Signal<string>;
966
1291
  private autoDismissTimer;
967
1292
  constructor();
968
1293
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverPanel, never>;
969
- 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: {}; }]>;
970
1295
  }
971
1296
 
972
1297
  /**
@@ -1018,12 +1343,17 @@ type PopoverActionVariant = 'primary' | 'secondary' | 'danger' | 'ghost';
1018
1343
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-action.component.ts
1019
1344
  * @since 0.1.0
1020
1345
  * @relatedTo CngxPopoverPanel, CngxPopoverFooter
1346
+ * @slot cngxPending Rendered while the action is running.
1347
+ * @slot cngxSucceeded Rendered after the action succeeds.
1348
+ * @slot cngxFailed Rendered when the action fails; gets the error.
1021
1349
  * <example-url>http://localhost:4200/#/common/popover/popover-panel/content-states</example-url>
1022
1350
  * <example-url>http://localhost:4200/#/common/popover/popover-panel/variants</example-url>
1023
1351
  * <example-url>http://localhost:4200/#/common/popover/popover-panel/with-footer-actions</example-url>
1024
1352
  */
1025
1353
  declare class CngxPopoverAction {
1026
1354
  private readonly popover;
1355
+ private readonly config;
1356
+ private readonly destroyRef;
1027
1357
  /** Button role: `'dismiss'` closes immediately, `'confirm'` runs an async action. */
1028
1358
  readonly role: _angular_core.InputSignal<"dismiss" | "confirm">;
1029
1359
  /** The async action to execute (only for `role="confirm"`). */
@@ -1035,7 +1365,17 @@ declare class CngxPopoverAction {
1035
1365
  protected readonly pendingTpl: _angular_core.Signal<CngxPending | undefined>;
1036
1366
  protected readonly succeededTpl: _angular_core.Signal<CngxSucceeded | undefined>;
1037
1367
  protected readonly failedTpl: _angular_core.Signal<CngxFailed | undefined>;
1368
+ private readonly asyncClick;
1369
+ /**
1370
+ * Lifecycle status of the confirm action - `'idle' | 'pending' | 'success'
1371
+ * | 'error'`, mirroring the internal `CngxAsyncClick`. Always `'idle'` for
1372
+ * `role="dismiss"` (there is no async lifecycle to report).
1373
+ */
1374
+ readonly status: _angular_core.Signal<AsyncStatus>;
1375
+ private closeOnSuccessTimer;
1376
+ constructor();
1038
1377
  protected handleDismiss(): void;
1378
+ private clearCloseOnSuccessTimer;
1039
1379
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverAction, never>;
1040
1380
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxPopoverAction, "cngx-popover-action", ["cngxPopoverAction"], { "role": { "alias": "role"; "required": false; "isSignal": true; }; "action": { "alias": "action"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "feedbackDuration": { "alias": "feedbackDuration"; "required": false; "isSignal": true; }; }, {}, ["pendingTpl", "succeededTpl", "failedTpl"], ["*"], true, never>;
1041
1381
  }
@@ -1082,5 +1422,5 @@ declare class CngxPopoverDivider {
1082
1422
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverDivider, "[cngxPopoverDivider]", ["cngxPopoverDivider"], {}, {}, never, never, true, [{ directive: typeof i1$1.CngxDivider; inputs: { "orientation": "orientation"; "inset": "inset"; }; outputs: {}; }]>;
1083
1423
  }
1084
1424
 
1085
- 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 };
1086
- 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 };