@cngx/common 0.0.1-rc.0 → 0.1.0-rc.1

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 (61) hide show
  1. package/a11y/README.md +13 -16
  2. package/card/README.md +2 -21
  3. package/chart/README.md +5 -8
  4. package/data/README.md +45 -47
  5. package/dialog/README.md +12 -15
  6. package/display/README.md +5 -9
  7. package/fesm2022/cngx-common-a11y.mjs +164 -51
  8. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  9. package/fesm2022/cngx-common-card.mjs +157 -69
  10. package/fesm2022/cngx-common-card.mjs.map +1 -1
  11. package/fesm2022/cngx-common-chart.mjs +389 -92
  12. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  13. package/fesm2022/cngx-common-data.mjs +311 -151
  14. package/fesm2022/cngx-common-data.mjs.map +1 -1
  15. package/fesm2022/cngx-common-dialog.mjs +167 -29
  16. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  17. package/fesm2022/cngx-common-display.mjs +445 -110
  18. package/fesm2022/cngx-common-display.mjs.map +1 -1
  19. package/fesm2022/cngx-common-interactive.mjs +2059 -435
  20. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  21. package/fesm2022/cngx-common-layout.mjs +188 -31
  22. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  23. package/fesm2022/cngx-common-popover.mjs +711 -90
  24. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  25. package/fesm2022/cngx-common-stepper.mjs +1479 -73
  26. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  27. package/fesm2022/cngx-common-tabs.mjs +1144 -85
  28. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  29. package/fesm2022/cngx-common.mjs +2 -2
  30. package/fesm2022/cngx-common.mjs.map +1 -1
  31. package/interactive/README.md +5 -5
  32. package/layout/README.md +2 -2
  33. package/package.json +7 -6
  34. package/popover/README.md +8 -34
  35. package/stepper/README.md +69 -8
  36. package/tabs/README.md +6 -6
  37. package/theming/components/cngx-async.css +74 -0
  38. package/theming/components/cngx-backdrop.css +73 -0
  39. package/theming/components/cngx-badge.css +340 -0
  40. package/theming/components/cngx-bottom-sheet.css +201 -0
  41. package/theming/components/cngx-button-toggle.css +99 -0
  42. package/theming/components/cngx-dialog.css +358 -0
  43. package/theming/components/cngx-divider.css +145 -0
  44. package/theming/components/cngx-listbox.css +220 -0
  45. package/theming/components/cngx-menu.css +371 -0
  46. package/theming/components/cngx-ripple.css +116 -0
  47. package/theming/components/cngx-tooltip.css +265 -0
  48. package/theming/system-tokens.css +24 -0
  49. package/types/cngx-common-a11y.d.ts +159 -38
  50. package/types/cngx-common-card.d.ts +137 -22
  51. package/types/cngx-common-chart.d.ts +337 -40
  52. package/types/cngx-common-data.d.ts +277 -45
  53. package/types/cngx-common-dialog.d.ts +162 -22
  54. package/types/cngx-common-display.d.ts +422 -78
  55. package/types/cngx-common-interactive.d.ts +1880 -305
  56. package/types/cngx-common-layout.d.ts +191 -28
  57. package/types/cngx-common-popover.d.ts +632 -87
  58. package/types/cngx-common-stepper.d.ts +1360 -45
  59. package/types/cngx-common-tabs.d.ts +1139 -56
  60. package/types/cngx-common.d.ts +1 -1
  61. package/README.md +0 -18
@@ -3,20 +3,90 @@ import { ElementRef, InjectionToken, Provider, TemplateRef } from '@angular/core
3
3
  import * as i1 from '@cngx/common/a11y';
4
4
  import { CngxAsyncState } from '@cngx/core/utils';
5
5
  import { AsyncAction, CngxPending, CngxSucceeded, CngxFailed } from '@cngx/common/interactive';
6
+ import * as i1$1 from '@cngx/common/display';
6
7
 
7
- /** Lifecycle state of a popover element. */
8
+ /**
9
+ * Lifecycle state of a popover element.
10
+ *
11
+ * @category common/popover
12
+ */
8
13
  type PopoverState = 'closed' | 'opening' | 'open' | 'closing';
9
- /** Native popover attribute mode. */
14
+ /**
15
+ * Native popover attribute mode.
16
+ *
17
+ * @category common/popover
18
+ */
10
19
  type PopoverMode = 'manual' | 'auto';
11
- /** Anchor-relative placement of a popover. */
20
+ /**
21
+ * Permitted values for `aria-haspopup` on a popover trigger. Mirrors the
22
+ * W3C-spec union for popup-container roles plus the bare `'true'`
23
+ * compatibility value. Composers (such as `CngxPopoverPanel`) write the
24
+ * popover's `haspopup` signal to hint the trigger toward the right value
25
+ * without forcing the consumer to repeat it.
26
+ *
27
+ * @category common/popover
28
+ */
29
+ type PopoverHaspopup = 'dialog' | 'listbox' | 'menu' | 'tree' | 'true';
30
+ /**
31
+ * ARIA roles applicable to a `CngxPopoverPanel` host element.
32
+ *
33
+ * @category common/popover
34
+ */
35
+ type PopoverPanelRole = 'dialog' | 'alertdialog' | 'tooltip' | 'menu' | 'group' | 'region';
36
+ /**
37
+ * Primary edge of the popover panel that faces the trigger after browser-
38
+ * driven shift / flip recovery. Driven by `CngxPopover.resolvedEdge`;
39
+ * consumers projecting a `cngxPopoverArrow` template receive this value in
40
+ * the slot context so they can rotate or position their glyph accordingly.
41
+ *
42
+ * @category common/popover
43
+ */
44
+ type ArrowEdge = 'top' | 'bottom' | 'left' | 'right';
45
+ /**
46
+ * Which event sources may open `CngxTooltip`.
47
+ *
48
+ * - `'auto'` (default) - hover and focus open the tooltip with the
49
+ * configured `tooltipDelay` / `closeDelay`. `show()` and `hide()`
50
+ * remain available for programmatic overrides.
51
+ * - `'manual'` - hover and focus are inert. Only `show()` / `hide()`
52
+ * open or close the tooltip. Escape still dismisses an open tooltip
53
+ * for keyboard accessibility.
54
+ *
55
+ * @category common/popover
56
+ */
57
+ type TooltipTriggerMode = 'auto' | 'manual';
58
+ /**
59
+ * Anchor-relative placement of a popover.
60
+ *
61
+ * @category common/popover
62
+ */
12
63
  type PopoverPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
64
+ /**
65
+ * CSS `<try-tactic>` keywords for the `position-try-fallbacks` property
66
+ * (CSS Anchor Positioning Level 1). Each entry is written verbatim into
67
+ * the host's `position-try-fallbacks` style; entries are not resolved
68
+ * through any cngx mapping table.
69
+ *
70
+ * The union enumerates both orderings of two-keyword composites
71
+ * (`flip-block flip-inline` vs `flip-inline flip-block`) so consumers
72
+ * can match the canonical ordering Chrome resolves to when it normalises
73
+ * the cascaded value. Three-keyword composites are commutative enough
74
+ * that one form suffices.
75
+ *
76
+ * Mirrors the precedent in `projects/forms/select/shared/select-base.css`
77
+ * which already ships `position-try-fallbacks: flip-block, flip-inline,
78
+ * flip-block flip-inline;` on select panels.
79
+ *
80
+ * @category common/popover
81
+ */
82
+ 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';
13
83
 
14
84
  /**
15
85
  * Signal-driven state machine for the native Popover API.
16
86
  *
17
87
  * Wraps the browser's `popover` attribute with reactive state,
18
88
  * CSS-transition-aware lifecycle, and CSS Anchor Positioning.
19
- * Pure state machine — contains no trigger logic, no delays.
89
+ * Pure state machine - contains no trigger logic, no delays.
20
90
  *
21
91
  * State lifecycle: `closed` → `opening` → `open` → `closing` → `closed`.
22
92
  * CSS classes `cngx-popover--opening`, `cngx-popover--open`, and
@@ -36,6 +106,37 @@ type PopoverPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-sta
36
106
  * {{ errorSummary() }}
37
107
  * </div>
38
108
  * ```
109
+ * <example-url>http://localhost:4200/#/common/interactive/listbox/trigger/select-dropdown</example-url>
110
+ * <example-url>http://localhost:4200/#/common/popover/click-popover</example-url>
111
+ * <example-url>http://localhost:4200/#/common/popover/controlled-open</example-url>
112
+ * <example-url>http://localhost:4200/#/common/popover/escape-mode</example-url>
113
+ * <example-url>http://localhost:4200/#/common/popover/placement-variants</example-url>
114
+ *
115
+ * ### Collision recovery with `<try-tactic>` fallbacks
116
+ * Apply CSS Anchor Positioning's `position-try-fallbacks` declaratively
117
+ * by binding the new `positionTryFallbacks` input. Each entry is a CSS
118
+ * `<try-tactic>` keyword (or composed pair) written verbatim into the
119
+ * host's `position-try-fallbacks` property. Mirrors the precedent in
120
+ * `@cngx/forms/select` panels.
121
+ *
122
+ * ```html
123
+ * <div cngxPopover
124
+ * placement="right-start"
125
+ * [positionTryFallbacks]="['flip-inline', 'flip-block', 'flip-block flip-inline']">
126
+ * <!-- popover content -->
127
+ * </div>
128
+ * ```
129
+ *
130
+ * When the array is empty (default), the host does not write a
131
+ * `position-try-fallbacks` style - the browser positions the popover at
132
+ * the declared `placement` regardless of viewport clipping.
133
+ *
134
+ * @category common/popover
135
+ * @docsKind primary
136
+ * @wcag AA
137
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover.directive.ts
138
+ * @since 0.1.0
139
+ * @relatedTo CngxPopoverTrigger, CngxPopoverPanel, CngxTooltip
39
140
  */
40
141
  declare class CngxPopover {
41
142
  /**
@@ -43,7 +144,7 @@ declare class CngxPopover {
43
144
  * popover's native element to APIs expecting an `ElementRef`
44
145
  * (scroll observers, intersection observers, focus managers, …).
45
146
  * Notable consumer: `injectRecycler({ scrollElement: pop.elementRef })`
46
- * for `@cngx/forms/select` virtualisation — the popover IS the
147
+ * for `@cngx/forms/select` virtualisation - the popover IS the
47
148
  * scroll container when `select-base.css`'s `max-height + overflow-y`
48
149
  * rules apply.
49
150
  */
@@ -52,8 +153,24 @@ declare class CngxPopover {
52
153
  private readonly destroyRef;
53
154
  private readonly doc;
54
155
  private readonly floatingFallback;
156
+ private readonly _injector;
157
+ /**
158
+ * Arrow-bounds contract resolved lazily on first use.
159
+ * Eager inject() would loop: CngxPopover (host directive on the panel)
160
+ * is constructed BEFORE the panel itself, so `useExisting: CngxPopoverPanel`
161
+ * cannot resolve at directive-construction time.
162
+ */
163
+ private _arrowBounds;
164
+ private getArrowBounds;
55
165
  /** Anchor-relative placement. */
56
166
  readonly placement: _angular_core.InputSignal<PopoverPlacement>;
167
+ /**
168
+ * CSS `<try-tactic>` fallbacks for `position-try-fallbacks`. Empty
169
+ * array (default) means the host does not write the property at all.
170
+ * Non-empty entries are written verbatim, comma-joined, in declaration
171
+ * order. Spec-compatible vocabulary only (no cngx placement tokens).
172
+ */
173
+ readonly positionTryFallbacks: _angular_core.InputSignal<readonly PopoverPositionTryFallback[]>;
57
174
  /** Gap between anchor and popover in px. */
58
175
  readonly offset: _angular_core.InputSignal<number>;
59
176
  /** Whether Escape key dismisses the popover. */
@@ -82,12 +199,66 @@ declare class CngxPopover {
82
199
  * Set by `CngxPopoverTrigger` or `CngxTooltip`.
83
200
  */
84
201
  readonly anchorElement: _angular_core.WritableSignal<HTMLElement | null>;
202
+ /**
203
+ * Inline-axis position the arrow ornament should sit at, expressed as
204
+ * a CSS length pinned to the trigger's centre. Computed from
205
+ * `anchorElement()` + the panel's own bounding box on every show /
206
+ * reposition / window resize.
207
+ *
208
+ * Why a JS-computed CSS variable instead of `anchor(center)` in the
209
+ * arrow's stylesheet: CSS Anchor Positioning's `anchor()` function does
210
+ * not resolve from descendants of a top-layer element back to anchors
211
+ * in the regular document flow. The panel itself can anchor to the
212
+ * trigger, but the arrow inside the panel cannot. Writing the offset
213
+ * from JS sidesteps that limitation and works identically in the
214
+ * CSS-Anchor path and the Floating-UI fallback path.
215
+ */
216
+ private readonly _arrowOffset;
217
+ /**
218
+ * Public read-only view of the arrow's inline-axis offset (`<px>` or
219
+ * `null` before the first geometry read). Consumers projecting a
220
+ * `cngxPopoverArrow` template use this to render their own glyph at
221
+ * the same coordinate the default arrow ornament would.
222
+ */
223
+ readonly arrowOffset: _angular_core.Signal<string | null>;
224
+ /**
225
+ * Hint for the `CngxPopoverTrigger`'s `aria-haspopup` value. Composers
226
+ * such as `CngxPopoverPanel` write this signal so any trigger pointing
227
+ * at the popover defaults to the right role without the consumer
228
+ * having to set `haspopup` on every trigger element. Consumer-supplied
229
+ * `haspopup` on the trigger still wins.
230
+ */
231
+ readonly haspopup: _angular_core.WritableSignal<PopoverHaspopup | undefined>;
85
232
  protected readonly isOpening: _angular_core.Signal<boolean>;
86
233
  protected readonly isOpen: _angular_core.Signal<boolean>;
87
234
  protected readonly isClosing: _angular_core.Signal<boolean>;
88
235
  readonly isVisible: _angular_core.Signal<boolean>;
89
236
  protected readonly cssAnchorRef: _angular_core.Signal<string | null>;
237
+ /**
238
+ * Primary edge of the placement, written from the live trigger and panel
239
+ * rects so the arrow lands on the side that actually faces the trigger.
240
+ * Falls back to the requested placement's edge before the first geometry
241
+ * read so the arrow CSS rules still match on the very first paint.
242
+ * Browsers normalise compound `position-area` values to a
243
+ * non-deterministic keyword order; an explicit attribute is the stable
244
+ * hook for the arrow stylesheet.
245
+ */
246
+ private readonly resolvedEdgeSignal;
247
+ /**
248
+ * Primary edge of the panel facing the trigger after browser-driven
249
+ * shift / flip recovery. `top` | `bottom` | `left` | `right`. Public
250
+ * so consumers projecting a `cngxPopoverArrow` template can rotate
251
+ * their own glyph to match the rendered placement.
252
+ */
253
+ readonly resolvedEdge: _angular_core.Signal<ArrowEdge>;
90
254
  protected readonly cssMargin: _angular_core.Signal<string | null>;
255
+ /**
256
+ * Comma-joined `position-try-fallbacks` value, or `null` to skip the
257
+ * style write. Bound via host binding so empty / cleared lists drop the
258
+ * property cleanly. Unsupported browsers ignore the unknown property -
259
+ * gating on `SUPPORTS_ANCHOR` would only suppress a harmless write.
260
+ */
261
+ protected readonly cssPositionTryFallbacks: _angular_core.Signal<string | null>;
91
262
  constructor();
92
263
  /** Open the popover. No-op if not `closed`. */
93
264
  show(): void;
@@ -101,11 +272,19 @@ declare class CngxPopover {
101
272
  * and the consumer has provided the fallback via `provideFloatingFallback()`.
102
273
  */
103
274
  private applyFloatingPosition;
275
+ /**
276
+ * Recompute the arrow's edge and inline offset from the live trigger and
277
+ * panel rects. The resolved edge captures any browser-driven flip; the
278
+ * offset is clamped inside the panel's rounded-corner bounds so the
279
+ * arrow's base stays flush with the panel's straight edge even when the
280
+ * trigger sits outside the panel's inline extent.
281
+ */
282
+ private updateArrowOffset;
104
283
  private get popoverElement();
105
284
  private startClosing;
106
285
  private finalize;
107
286
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopover, never>;
108
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopover, "[cngxPopover]", ["cngxPopover"], { "placement": { "alias": "placement"; "required": false; "isSignal": true; }; "offset": { "alias": "offset"; "required": false; "isSignal": true; }; "closeOnEscape": { "alias": "closeOnEscape"; "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>;
287
+ 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; }; "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>;
109
288
  }
110
289
 
111
290
  /**
@@ -116,29 +295,62 @@ declare class CngxPopover {
116
295
  * Positioning and registers the anchor element on the popover for fallback
117
296
  * positioning.
118
297
  *
119
- * Contains **no event handlers** — the consumer binds interactions directly:
298
+ * Contains **no event handlers** - the consumer binds interactions directly:
120
299
  *
121
300
  * ```html
122
301
  * <button [cngxPopoverTrigger]="pop" (click)="pop.toggle()">Menu</button>
123
302
  * <div cngxPopover #pop="cngxPopover" placement="bottom-start">…</div>
124
303
  * ```
304
+ *
305
+ * ### Focus restoration
306
+ * Opt in with `[restoreFocus]="true"` to capture the active element when
307
+ * the popover opens and restore focus to it on close. Useful for menus,
308
+ * confirm panels, and dialogs that steal focus from the trigger.
309
+ *
310
+ * @category common/popover
311
+ * @docsKind primary
312
+ * @wcag AA
313
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-trigger.directive.ts
314
+ * @since 0.1.0
315
+ * @relatedTo CngxPopover, CngxPopoverPanel, CngxTooltip
316
+ * <example-url>http://localhost:4200/#/common/popover/click-popover</example-url>
317
+ * <example-url>http://localhost:4200/#/common/popover/controlled-open</example-url>
318
+ * <example-url>http://localhost:4200/#/common/popover/escape-mode</example-url>
319
+ * <example-url>http://localhost:4200/#/common/popover/placement-variants</example-url>
125
320
  */
126
321
  declare class CngxPopoverTrigger {
127
322
  private readonly elRef;
323
+ private readonly doc;
128
324
  /** Explicit reference to the popover this trigger controls. */
129
325
  readonly popoverRef: _angular_core.InputSignal<CngxPopover>;
130
326
  /**
131
- * ARIA haspopup value. Adjust to match the popover's role. Accepts
132
- * the W3C-spec values for all supported popup-container roles:
133
- * `'dialog'` for dialog popups, `'listbox'` for single/multi select
134
- * panels, `'menu'` for menu surfaces, `'tree'` for treeview popups
135
- * (CngxTreeSelect), or `'true'` when the role isn't meaningful.
327
+ * ARIA haspopup override. When set, wins over the popover-supplied
328
+ * hint (`popoverRef().haspopup()`, populated by composers such as
329
+ * `CngxPopoverPanel`). Final fallback when neither is set is `'true'`.
330
+ * Accepts the W3C-spec values for supported popup-container roles:
331
+ * `'dialog'`, `'listbox'`, `'menu'`, `'tree'`, or `'true'`.
136
332
  */
137
- readonly haspopup: _angular_core.InputSignal<"dialog" | "listbox" | "menu" | "tree" | "true">;
333
+ readonly haspopupInput: _angular_core.InputSignal<PopoverHaspopup | undefined>;
334
+ /**
335
+ * When `true`, captures `document.activeElement` the moment the
336
+ * popover transitions to a visible state and restores focus to that
337
+ * element when the popover closes. Defaults to `false` so the trigger
338
+ * stays a passive ARIA atom; opt in for menus, confirm panels, and
339
+ * dialogs that move focus away from the trigger.
340
+ */
341
+ readonly restoreFocus: _angular_core.InputSignal<boolean>;
342
+ /**
343
+ * Resolved `aria-haspopup`. Consumer override (`haspopup` on the
344
+ * trigger element) wins; otherwise the popover's `haspopup` signal
345
+ * (set by composers like `CngxPopoverPanel`) decides; final fallback
346
+ * is `'true'`.
347
+ */
348
+ protected readonly haspopup: _angular_core.Signal<PopoverHaspopup>;
138
349
  protected readonly cssAnchorName: _angular_core.Signal<string | null>;
350
+ private savedFocus;
139
351
  constructor();
140
352
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverTrigger, never>;
141
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverTrigger, "[cngxPopoverTrigger]", ["cngxPopoverTrigger"], { "popoverRef": { "alias": "cngxPopoverTrigger"; "required": true; "isSignal": true; }; "haspopup": { "alias": "haspopup"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
353
+ 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>;
142
354
  }
143
355
 
144
356
  /**
@@ -148,7 +360,7 @@ declare class CngxPopoverTrigger {
148
360
  * the full lifecycle: hover/focus triggers, open/close delays, Escape dismiss,
149
361
  * CSS Anchor Positioning, and ARIA wiring (`aria-describedby` + `role="tooltip"`).
150
362
  *
151
- * The consumer sees only the attribute — no extra elements in the template.
363
+ * The consumer sees only the attribute - no extra elements in the template.
152
364
  *
153
365
  * ### Basic
154
366
  * ```html
@@ -161,6 +373,19 @@ declare class CngxPopoverTrigger {
161
373
  * Save
162
374
  * </button>
163
375
  * ```
376
+ *
377
+ * @category common/popover
378
+ * @docsKind primary
379
+ * @wcag AA
380
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/tooltip.directive.ts
381
+ * @since 0.1.0
382
+ * @relatedTo CngxPopover, CngxPopoverTrigger
383
+ * <example-url>http://localhost:4200/#/common/popover/tooltip/basic-tooltip</example-url>
384
+ * <example-url>http://localhost:4200/#/common/popover/tooltip/custom-delay</example-url>
385
+ * <example-url>http://localhost:4200/#/common/popover/tooltip/disabled-state</example-url>
386
+ * <example-url>http://localhost:4200/#/common/popover/tooltip/keyboard-navigation</example-url>
387
+ * <example-url>http://localhost:4200/#/common/popover/tooltip/placement</example-url>
388
+ * <example-url>http://localhost:4200/#/common/popover/tooltip/programmatic-control</example-url>
164
389
  */
165
390
  declare class CngxTooltip {
166
391
  private readonly renderer;
@@ -179,6 +404,20 @@ declare class CngxTooltip {
179
404
  readonly closeDelay: _angular_core.InputSignal<number>;
180
405
  /** Whether the tooltip is active. When `false`, no tooltip appears and ARIA is cleared. */
181
406
  readonly enabled: _angular_core.InputSignal<boolean>;
407
+ /**
408
+ * Trigger mode. `'auto'` (default) opens on hover/focus with the
409
+ * configured delays; `'manual'` opts the host out of the hover/focus
410
+ * listeners so only `show()` / `hide()` open or close the tooltip.
411
+ * Escape still dismisses an open tooltip in either mode.
412
+ */
413
+ readonly triggers: _angular_core.InputSignal<TooltipTriggerMode>;
414
+ /**
415
+ * CSS `<try-tactic>` fallbacks for `position-try-fallbacks`. Empty array
416
+ * (default) means no fallback CSS is written; the tooltip stays at the
417
+ * declared `tooltipPlacement` regardless of viewport clipping. Tooltips
418
+ * are decorative - collision recovery is opt-in per-tooltip.
419
+ */
420
+ readonly positionTryFallbacks: _angular_core.InputSignal<readonly PopoverPositionTryFallback[]>;
182
421
  private readonly stateSignal;
183
422
  private readonly idSignal;
184
423
  /** Current lifecycle state. */
@@ -205,12 +444,14 @@ declare class CngxTooltip {
205
444
  private clearOpenTimer;
206
445
  private clearCloseTimer;
207
446
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTooltip, never>;
208
- 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; }; }, {}, never, never, true, [{ directive: typeof i1.CngxReducedMotion; inputs: {}; outputs: {}; }]>;
447
+ 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, [{ directive: typeof i1.CngxReducedMotion; inputs: {}; outputs: {}; }]>;
209
448
  }
210
449
 
211
450
  /**
212
451
  * Signature matching `@floating-ui/dom` `computePosition`.
213
- * The consumer provides the actual function — the library never imports it directly.
452
+ * The consumer provides the actual function - the library never imports it directly.
453
+ *
454
+ * @category common/popover
214
455
  */
215
456
  type ComputePositionFn = (reference: HTMLElement, floating: HTMLElement, options?: {
216
457
  placement?: string;
@@ -220,7 +461,11 @@ type ComputePositionFn = (reference: HTMLElement, floating: HTMLElement, options
220
461
  y: number;
221
462
  placement: string;
222
463
  }>;
223
- /** Configuration for the Floating UI positioning fallback. */
464
+ /**
465
+ * Configuration for the Floating UI positioning fallback.
466
+ *
467
+ * @category common/popover
468
+ */
224
469
  interface FloatingFallbackConfig {
225
470
  /** The `computePosition` function from `@floating-ui/dom`. */
226
471
  computePosition: ComputePositionFn;
@@ -229,14 +474,18 @@ interface FloatingFallbackConfig {
229
474
  }
230
475
  /**
231
476
  * Injection token for the Floating UI fallback.
232
- * `null` when not provided — CSS Anchor Positioning is used instead.
477
+ * `null` when not provided - CSS Anchor Positioning is used instead.
478
+ *
479
+ * @category common/popover
480
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/floating-fallback.ts
481
+ * @since 0.1.0
233
482
  */
234
483
  declare const CNGX_FLOATING_FALLBACK: InjectionToken<FloatingFallbackConfig | null>;
235
484
  /**
236
485
  * Provides the Floating UI positioning fallback for browsers without
237
486
  * CSS Anchor Positioning support.
238
487
  *
239
- * The consumer must install `@floating-ui/dom` themselves — this library
488
+ * The consumer must install `@floating-ui/dom` themselves - this library
240
489
  * never imports it directly, keeping the bundle at zero cost for modern browsers.
241
490
  *
242
491
  * ```typescript
@@ -247,10 +496,161 @@ declare const CNGX_FLOATING_FALLBACK: InjectionToken<FloatingFallbackConfig | nu
247
496
  * provideFloatingFallback(computePosition, [offset(8), flip(), shift()]),
248
497
  * ]
249
498
  * ```
499
+ *
500
+ * @category common/popover
250
501
  */
251
502
  declare function provideFloatingFallback(computePosition: ComputePositionFn, middleware?: unknown[]): Provider;
252
503
 
253
- /** Configuration for `CngxPopoverPanel` provided via `providePopoverPanel()`. */
504
+ /**
505
+ * Context object passed to a `*cngxPopoverArrow` template.
506
+ *
507
+ * The consumer's glyph receives the resolved panel edge (`top` / `bottom` /
508
+ * `left` / `right`) and the inline-axis offset in CSS pixels that the
509
+ * library would have placed the default diamond at. Either can be used to
510
+ * rotate, translate, or theme the custom glyph so it tracks the trigger.
511
+ *
512
+ * @category common/popover
513
+ */
514
+ interface CngxPopoverArrowContext {
515
+ /** Primary edge of the panel facing the trigger. */
516
+ readonly edge: ArrowEdge;
517
+ /**
518
+ * Inline-axis offset from the panel edge to the trigger's centre, in
519
+ * CSS pixels. `null` before the first geometry read (the consumer
520
+ * should treat `null` as "centre the glyph" - the default diamond
521
+ * falls back to `50%` in the same case).
522
+ */
523
+ readonly offsetPx: number | null;
524
+ }
525
+ /**
526
+ * Marks the header content inside `cngx-popover-panel`.
527
+ *
528
+ * @category common/popover
529
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
530
+ * @since 0.1.0
531
+ * @relatedTo CngxPopoverPanel, CngxPopoverBody, CngxPopoverFooter
532
+ */
533
+ declare class CngxPopoverHeader {
534
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverHeader, never>;
535
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverHeader, "[cngxPopoverHeader]", never, {}, {}, never, never, true, never>;
536
+ }
537
+ /**
538
+ * Marks the body content inside `cngx-popover-panel`.
539
+ *
540
+ * @category common/popover
541
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
542
+ * @since 0.1.0
543
+ * @relatedTo CngxPopoverPanel, CngxPopoverHeader, CngxPopoverFooter
544
+ */
545
+ declare class CngxPopoverBody {
546
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverBody, never>;
547
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverBody, "[cngxPopoverBody]", never, {}, {}, never, never, true, never>;
548
+ }
549
+ /**
550
+ * Marks the footer content inside `cngx-popover-panel`.
551
+ *
552
+ * @category common/popover
553
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
554
+ * @since 0.1.0
555
+ * @relatedTo CngxPopoverPanel, CngxPopoverHeader, CngxPopoverBody, CngxPopoverAction
556
+ */
557
+ declare class CngxPopoverFooter {
558
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverFooter, never>;
559
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverFooter, "[cngxPopoverFooter]", never, {}, {}, never, never, true, never>;
560
+ }
561
+ /**
562
+ * Custom close button template. Overrides the default close button.
563
+ *
564
+ * ```html
565
+ * <ng-template cngxPopoverClose>
566
+ * <button mat-icon-button (click)="panel.popover.hide()">
567
+ * <mat-icon>close</mat-icon>
568
+ * </button>
569
+ * </ng-template>
570
+ * ```
571
+ *
572
+ * @category common/popover
573
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
574
+ * @since 0.1.0
575
+ * @relatedTo CngxPopoverPanel
576
+ */
577
+ declare class CngxPopoverClose {
578
+ readonly templateRef: TemplateRef<any>;
579
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverClose, never>;
580
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverClose, "ng-template[cngxPopoverClose]", never, {}, {}, never, never, true, never>;
581
+ }
582
+ /**
583
+ * Template shown while panel content is loading.
584
+ *
585
+ * @category common/popover
586
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
587
+ * @since 0.1.0
588
+ * @relatedTo CngxPopoverPanel, CngxPopoverEmpty, CngxPopoverError
589
+ */
590
+ declare class CngxPopoverLoading {
591
+ readonly templateRef: TemplateRef<any>;
592
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverLoading, never>;
593
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverLoading, "ng-template[cngxPopoverLoading]", never, {}, {}, never, never, true, never>;
594
+ }
595
+ /**
596
+ * Template shown when panel content is empty.
597
+ *
598
+ * @category common/popover
599
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
600
+ * @since 0.1.0
601
+ * @relatedTo CngxPopoverPanel, CngxPopoverLoading, CngxPopoverError
602
+ */
603
+ declare class CngxPopoverEmpty {
604
+ readonly templateRef: TemplateRef<any>;
605
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverEmpty, never>;
606
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverEmpty, "ng-template[cngxPopoverEmpty]", never, {}, {}, never, never, true, never>;
607
+ }
608
+ /**
609
+ * Template shown when panel content failed to load. Context: `$implicit` = error.
610
+ *
611
+ * @category common/popover
612
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
613
+ * @since 0.1.0
614
+ * @relatedTo CngxPopoverPanel, CngxPopoverLoading, CngxPopoverEmpty
615
+ */
616
+ declare class CngxPopoverError {
617
+ readonly templateRef: TemplateRef<any>;
618
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverError, never>;
619
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverError, "ng-template[cngxPopoverError]", never, {}, {}, never, never, true, never>;
620
+ }
621
+ /**
622
+ * Custom arrow ornament template. Overrides the default rotated-diamond
623
+ * arrow when projected as a child of `<cngx-popover-panel>`. The library
624
+ * routes the resolved panel edge and the live inline-axis offset to the
625
+ * template via `CngxPopoverArrowContext`.
626
+ *
627
+ * ```html
628
+ * <cngx-popover-panel #pop [showArrow]="true">
629
+ * <ng-template cngxPopoverArrow let-edge="edge" let-offsetPx="offsetPx">
630
+ * <svg class="brand-arrow" [attr.data-edge]="edge"
631
+ * [style.--offset]="offsetPx ? offsetPx + 'px' : '50%'">
632
+ * <use href="#arrow-glyph" />
633
+ * </svg>
634
+ * </ng-template>
635
+ * </cngx-popover-panel>
636
+ * ```
637
+ *
638
+ * @category common/popover
639
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel-slots.ts
640
+ * @since 0.1.0
641
+ * @relatedTo CngxPopoverPanel, CngxPopover
642
+ */
643
+ declare class CngxPopoverArrow {
644
+ readonly templateRef: TemplateRef<CngxPopoverArrowContext>;
645
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverArrow, never>;
646
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverArrow, "ng-template[cngxPopoverArrow]", never, {}, {}, never, never, true, never>;
647
+ }
648
+
649
+ /**
650
+ * Configuration for `CngxPopoverPanel` provided via `providePopoverPanel()`.
651
+ *
652
+ * @category common/popover
653
+ */
254
654
  interface CngxPopoverPanelConfig {
255
655
  /**
256
656
  * Auto-dismiss timing per variant in ms.
@@ -269,11 +669,35 @@ interface CngxPopoverPanelConfig {
269
669
  showClose?: boolean;
270
670
  /** Default for `showArrow`. `undefined` = per-component default (`false`). */
271
671
  showArrow?: boolean;
672
+ /**
673
+ * App-wide template overrides for the panel's visible regions. Each
674
+ * entry is the third tier of the slot cascade — per-instance
675
+ * `contentChild` directives still win, the library defaults still
676
+ * lose. Set via `withArrowTemplate(...)` and friends.
677
+ */
678
+ templates?: {
679
+ /**
680
+ * Default `*cngxPopoverArrow` template for every `<cngx-popover-panel>`
681
+ * in the application. Per-instance `ng-template cngxPopoverArrow`
682
+ * still wins.
683
+ */
684
+ arrow?: TemplateRef<CngxPopoverArrowContext>;
685
+ };
272
686
  }
273
- /** Feature function signature for `providePopoverPanel()`. */
687
+ /**
688
+ * Feature function signature for `providePopoverPanel()`.
689
+ *
690
+ * @category common/popover
691
+ */
274
692
  type PopoverPanelFeature = (config: CngxPopoverPanelConfig) => CngxPopoverPanelConfig;
275
693
 
276
- /** Injection token for popover panel configuration. */
694
+ /**
695
+ * Injection token for popover panel configuration.
696
+ *
697
+ * @category common/popover
698
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel.config.ts
699
+ * @since 0.1.0
700
+ */
277
701
  declare const CNGX_POPOVER_PANEL_CONFIG: InjectionToken<CngxPopoverPanelConfig>;
278
702
  /**
279
703
  * Provides configuration for `CngxPopoverPanel` instances.
@@ -286,6 +710,8 @@ declare const CNGX_POPOVER_PANEL_CONFIG: InjectionToken<CngxPopoverPanelConfig>;
286
710
  * ),
287
711
  * ]
288
712
  * ```
713
+ *
714
+ * @category common/popover
289
715
  */
290
716
  declare function providePopoverPanel(...features: PopoverPanelFeature[]): Provider;
291
717
  /**
@@ -295,82 +721,94 @@ declare function providePopoverPanel(...features: PopoverPanelFeature[]): Provid
295
721
  * ```typescript
296
722
  * withAutoDismiss({ info: 5000, success: 3000 })
297
723
  * ```
724
+ *
725
+ * @category common/popover
298
726
  */
299
727
  declare function withAutoDismiss(timing: Record<string, number>): PopoverPanelFeature;
300
728
  /**
301
729
  * Auto-close the panel after an async action in the footer succeeds.
302
730
  *
303
731
  * @param delay - Delay in ms before closing. Defaults to `300`.
732
+ *
733
+ * @category common/popover
304
734
  */
305
735
  declare function withCloseOnSuccess(delay?: number): PopoverPanelFeature;
306
736
  /**
307
737
  * Set the default variant applied when no `variant` input is set.
738
+ *
739
+ * @category common/popover
308
740
  */
309
741
  declare function withDefaultVariant(variant: string): PopoverPanelFeature;
310
742
  /**
311
743
  * Show the close button on all panels by default.
744
+ *
745
+ * @category common/popover
312
746
  */
313
747
  declare function withCloseButton(show?: boolean): PopoverPanelFeature;
314
748
  /**
315
749
  * Show the arrow on all panels by default.
750
+ *
751
+ * @category common/popover
316
752
  */
317
753
  declare function withArrow(show?: boolean): PopoverPanelFeature;
318
-
319
- /** Marks the header content inside `cngx-popover-panel`. */
320
- declare class CngxPopoverHeader {
321
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverHeader, never>;
322
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverHeader, "[cngxPopoverHeader]", never, {}, {}, never, never, true, never>;
323
- }
324
- /** Marks the body content inside `cngx-popover-panel`. */
325
- declare class CngxPopoverBody {
326
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverBody, never>;
327
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverBody, "[cngxPopoverBody]", never, {}, {}, never, never, true, never>;
328
- }
329
- /** Marks the footer content inside `cngx-popover-panel`. */
330
- declare class CngxPopoverFooter {
331
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverFooter, never>;
332
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverFooter, "[cngxPopoverFooter]", never, {}, {}, never, never, true, never>;
333
- }
334
754
  /**
335
- * Custom close button template. Overrides the default close button.
755
+ * Register an app-wide default template for the panel's arrow ornament.
756
+ * The template receives a `CngxPopoverArrowContext` with `edge` and
757
+ * `offsetPx` so the consumer's glyph can match the resolved placement.
336
758
  *
337
- * ```html
338
- * <ng-template cngxPopoverClose>
339
- * <button mat-icon-button (click)="panel.popover.hide()">
340
- * <mat-icon>close</mat-icon>
341
- * </button>
342
- * </ng-template>
759
+ * Per-instance `*cngxPopoverArrow` still wins over this default; the
760
+ * library's rotated-diamond fallback only renders when neither tier is
761
+ * set.
762
+ *
763
+ * ```typescript
764
+ * providers: [
765
+ * providePopoverPanel(withArrowTemplate(brandArrowTpl)),
766
+ * ]
343
767
  * ```
768
+ *
769
+ * @category common/popover
344
770
  */
345
- declare class CngxPopoverClose {
346
- readonly templateRef: TemplateRef<any>;
347
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverClose, never>;
348
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverClose, "ng-template[cngxPopoverClose]", never, {}, {}, never, never, true, never>;
349
- }
350
- /** Template shown while panel content is loading. */
351
- declare class CngxPopoverLoading {
352
- readonly templateRef: TemplateRef<any>;
353
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverLoading, never>;
354
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverLoading, "ng-template[cngxPopoverLoading]", never, {}, {}, never, never, true, never>;
355
- }
356
- /** Template shown when panel content is empty. */
357
- declare class CngxPopoverEmpty {
358
- readonly templateRef: TemplateRef<any>;
359
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverEmpty, never>;
360
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverEmpty, "ng-template[cngxPopoverEmpty]", never, {}, {}, never, never, true, never>;
361
- }
362
- /** Template shown when panel content failed to load. Context: `$implicit` = error. */
363
- declare class CngxPopoverError {
364
- readonly templateRef: TemplateRef<any>;
365
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverError, never>;
366
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverError, "ng-template[cngxPopoverError]", never, {}, {}, never, never, true, never>;
771
+ declare function withArrowTemplate(tpl: TemplateRef<CngxPopoverArrowContext>): PopoverPanelFeature;
772
+
773
+ /**
774
+ * Geometry contract for the popover panel's arrow ornament.
775
+ *
776
+ * Provided by `CngxPopoverPanel` (via `useExisting`) so that `CngxPopover`
777
+ * can read panel-side layout constants - primarily the border-radius
778
+ * used to clamp the arrow inside the panel's rounded corners - through a
779
+ * typed contract rather than reaching into the panel's CSS custom
780
+ * properties directly. Inverts the atom -> molecule dependency direction
781
+ * that an earlier `getComputedStyle('--cngx-popover-panel-border-radius')`
782
+ * read had introduced on `CngxPopover`.
783
+ *
784
+ * `CngxPopover` injects the token with `{ optional: true }` so it keeps
785
+ * working when used outside a `CngxPopoverPanel` (e.g. bare `[cngxPopover]`
786
+ * on a `<div>`). The fallback value matches the panel's default
787
+ * border-radius initial value (12 px).
788
+ *
789
+ * @category common/popover
790
+ */
791
+ interface CngxPopoverArrowBounds {
792
+ /**
793
+ * Panel border-radius in CSS pixels. Used by `CngxPopover` to clamp
794
+ * the arrow offset inside the panel's rounded-corner extent.
795
+ */
796
+ readonly borderRadius: number;
367
797
  }
798
+ /**
799
+ * Injection token for the arrow-bounds contract.
800
+ *
801
+ * @category common/popover
802
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-arrow-bounds.ts
803
+ * @since 0.1.0
804
+ */
805
+ declare const CNGX_POPOVER_ARROW_BOUNDS: InjectionToken<CngxPopoverArrowBounds>;
368
806
 
369
807
  /**
370
808
  * Rich popover panel molecule with header/body/footer slots, variant
371
809
  * styling, arrow, close button, and content state templates.
372
810
  *
373
- * Composes `CngxPopover` via `hostDirectives` — all popover inputs
811
+ * Composes `CngxPopover` via `hostDirectives` - all popover inputs
374
812
  * (`placement`, `offset`, `closeOnEscape`, `mode`, `exclusive`,
375
813
  * `cngxPopoverOpen`) are forwarded.
376
814
  *
@@ -402,28 +840,61 @@ declare class CngxPopoverError {
402
840
  * <ng-template cngxPopoverError let-err>Failed: {{ err }}</ng-template>
403
841
  * </cngx-popover-panel>
404
842
  * ```
843
+ *
844
+ * @category common/popover
845
+ * @docsKind primary
846
+ * @wcag AA
847
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-panel.component.ts
848
+ * @since 0.1.0
849
+ * @relatedTo CngxPopover, CngxPopoverAction, CngxPopoverHeader, CngxPopoverBody, CngxPopoverFooter
850
+ * <example-url>http://localhost:4200/#/common/popover/popover-panel/content-states</example-url>
851
+ * <example-url>http://localhost:4200/#/common/popover/popover-panel/variants</example-url>
852
+ * <example-url>http://localhost:4200/#/common/popover/popover-panel/with-footer-actions</example-url>
405
853
  */
406
- declare class CngxPopoverPanel {
854
+ declare class CngxPopoverPanel implements CngxPopoverArrowBounds {
407
855
  /** The underlying popover state machine. */
408
856
  readonly popover: CngxPopover;
409
857
  private readonly config;
410
858
  private readonly destroyRef;
859
+ private readonly hostRef;
411
860
  /**
412
- * Variant string — mapped to CSS class `cngx-popover-panel--{variant}`.
861
+ * Cached panel border-radius. Read lazily from the host's computed
862
+ * style on first access so `CngxPopover` can consume it via
863
+ * `CNGX_POPOVER_ARROW_BOUNDS` without forcing a layout flush per
864
+ * resize tick. The custom property is declared on `:scope` so the
865
+ * value is valid from instantiation onward.
866
+ */
867
+ private _cachedBorderRadius;
868
+ /** @internal - implements `CngxPopoverArrowBounds`. */
869
+ get borderRadius(): number;
870
+ /**
871
+ * Variant string - mapped to CSS class `cngx-popover-panel--{variant}`.
413
872
  * Pre-themed: `default`, `info`, `warning`, `danger`, `success`.
414
873
  * Add custom variants via CSS.
415
874
  */
416
875
  readonly variant: _angular_core.InputSignal<string | undefined>;
876
+ /**
877
+ * ARIA role applied to the panel host. Defaults to `'dialog'` because
878
+ * the panel pairs `aria-labelledby` (header) with `aria-describedby`
879
+ * (body) - the standard dialog pattern. Override with `'alertdialog'`
880
+ * for irrecoverable confirmations, `'tooltip'` for passive callouts,
881
+ * or `'menu'` when the panel hosts a menu.
882
+ *
883
+ * The trigger's `aria-haspopup` is hinted to `'dialog'` in tandem via
884
+ * the popover's `haspopup` signal; consumers overriding `role` here
885
+ * should also override `haspopup` on the trigger to match.
886
+ */
887
+ readonly role: _angular_core.InputSignal<PopoverPanelRole>;
417
888
  /** Show a close button. Falls back to global config from `providePopoverPanel(withCloseButton())`. */
418
889
  readonly showCloseInput: _angular_core.InputSignal<boolean | undefined>;
419
890
  /** Show an arrow. Falls back to global config from `providePopoverPanel(withArrow())`. */
420
891
  readonly showArrowInput: _angular_core.InputSignal<boolean | undefined>;
421
- /** Resolved showClose — input takes precedence over config. */
892
+ /** Resolved showClose - input takes precedence over config. */
422
893
  readonly showClose: _angular_core.Signal<boolean>;
423
- /** Resolved showArrow — input takes precedence over config. */
894
+ /** Resolved showArrow - input takes precedence over config. */
424
895
  readonly showArrow: _angular_core.Signal<boolean>;
425
896
  /**
426
- * Bind an async state — drives loading, error, and empty slots from a single source.
897
+ * Bind an async state - drives loading, error, and empty slots from a single source.
427
898
  * When set, takes precedence over individual `[loading]`, `[error]`, `[empty]` inputs.
428
899
  */
429
900
  readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
@@ -433,20 +904,38 @@ declare class CngxPopoverPanel {
433
904
  readonly error: _angular_core.InputSignal<unknown>;
434
905
  /** Whether the panel content is empty. Fallback when `[state]` is not set. */
435
906
  readonly empty: _angular_core.InputSignal<boolean>;
436
- /** @internal Resolved loading — state takes precedence over boolean input. */
907
+ /** @internal Resolved loading - state takes precedence over boolean input. */
437
908
  protected readonly effectiveLoading: _angular_core.Signal<boolean>;
438
- /** @internal Resolved error — state takes precedence over direct input. */
909
+ /** @internal Resolved error - state takes precedence over direct input. */
439
910
  protected readonly effectiveError: _angular_core.Signal<unknown>;
440
- /** @internal Resolved empty — state takes precedence over boolean input. */
911
+ /** @internal Resolved empty - state takes precedence over boolean input. */
441
912
  protected readonly effectiveEmpty: _angular_core.Signal<boolean>;
442
- /** Whether the header slot has projected content. */
443
- readonly hasHeader: _angular_core.InputSignal<boolean>;
444
- /** Whether the footer slot has projected content. */
445
- readonly hasFooter: _angular_core.InputSignal<boolean>;
913
+ protected readonly headerSlot: _angular_core.Signal<CngxPopoverHeader | undefined>;
914
+ protected readonly footerSlot: _angular_core.Signal<CngxPopoverFooter | undefined>;
446
915
  protected readonly closeTpl: _angular_core.Signal<CngxPopoverClose | undefined>;
447
916
  protected readonly loadingTpl: _angular_core.Signal<CngxPopoverLoading | undefined>;
448
917
  protected readonly emptyTpl: _angular_core.Signal<CngxPopoverEmpty | undefined>;
449
918
  protected readonly errorTpl: _angular_core.Signal<CngxPopoverError | undefined>;
919
+ protected readonly arrowTplDirective: _angular_core.Signal<CngxPopoverArrow | undefined>;
920
+ /**
921
+ * Three-stage cascade for the arrow ornament:
922
+ * 1. Per-instance `*cngxPopoverArrow` template (contentChild).
923
+ * 2. App-wide `CNGX_POPOVER_PANEL_CONFIG.templates.arrow`
924
+ * (via `providePopoverPanel(withArrowTemplate(...))`).
925
+ * 3. `null` -> the panel renders the default rotated-diamond markup.
926
+ */
927
+ protected readonly arrowTpl: _angular_core.Signal<_angular_core.TemplateRef<CngxPopoverArrowContext> | null>;
928
+ /**
929
+ * Context surface for projected `*cngxPopoverArrow` templates.
930
+ * `equal` keeps the reference stable across re-evaluations whose
931
+ * inputs round-trip to the same `{ edge, offsetPx }` - required for
932
+ * any object-returning computed per the Equality discipline rule.
933
+ */
934
+ protected readonly arrowContext: _angular_core.Signal<CngxPopoverArrowContext>;
935
+ /** Auto-detected from projected `[cngxPopoverHeader]` content. */
936
+ protected readonly hasHeader: _angular_core.Signal<boolean>;
937
+ /** Auto-detected from projected `[cngxPopoverFooter]` content. */
938
+ protected readonly hasFooter: _angular_core.Signal<boolean>;
450
939
  private readonly uid;
451
940
  protected readonly headerId: string;
452
941
  protected readonly bodyId: string;
@@ -456,17 +945,21 @@ declare class CngxPopoverPanel {
456
945
  private autoDismissTimer;
457
946
  constructor();
458
947
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverPanel, never>;
459
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxPopoverPanel, "cngx-popover-panel", ["cngxPopoverPanel"], { "variant": { "alias": "variant"; "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; }; "hasHeader": { "alias": "hasHeader"; "required": false; "isSignal": true; }; "hasFooter": { "alias": "hasFooter"; "required": false; "isSignal": true; }; }, {}, ["closeTpl", "loadingTpl", "emptyTpl", "errorTpl"], ["[cngxPopoverHeader]", "[cngxPopoverBody]", "*", "[cngxPopoverFooter]"], true, [{ directive: typeof CngxPopover; inputs: { "placement": "placement"; "offset": "offset"; "closeOnEscape": "closeOnEscape"; "mode": "mode"; "exclusive": "exclusive"; "cngxPopoverOpen": "cngxPopoverOpen"; }; outputs: {}; }]>;
948
+ 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: {}; }]>;
460
949
  }
461
950
 
462
- /** Visual variant for the action button. */
951
+ /**
952
+ * Visual variant for the action button.
953
+ *
954
+ * @category common/popover
955
+ */
463
956
  type PopoverActionVariant = 'primary' | 'secondary' | 'danger' | 'ghost';
464
957
  /**
465
958
  * Action button for use inside `cngx-popover-panel` footer.
466
959
  *
467
960
  * Two roles:
468
- * - `'dismiss'` — closes the panel on click (no async action).
469
- * - `'confirm'` — executes an async action, shows status templates,
961
+ * - `'dismiss'` - closes the panel on click (no async action).
962
+ * - `'confirm'` - executes an async action, shows status templates,
470
963
  * optionally auto-closes the panel on success.
471
964
  *
472
965
  * Supports the same `cngxPending`/`cngxSucceeded`/`cngxFailed` templates
@@ -497,6 +990,16 @@ type PopoverActionVariant = 'primary' | 'secondary' | 'danger' | 'ghost';
497
990
  * }
498
991
  * </cngx-popover-action>
499
992
  * ```
993
+ *
994
+ * @category common/popover
995
+ * @docsKind primary
996
+ * @wcag AA
997
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-action.component.ts
998
+ * @since 0.1.0
999
+ * @relatedTo CngxPopoverPanel, CngxPopoverFooter
1000
+ * <example-url>http://localhost:4200/#/common/popover/popover-panel/content-states</example-url>
1001
+ * <example-url>http://localhost:4200/#/common/popover/popover-panel/variants</example-url>
1002
+ * <example-url>http://localhost:4200/#/common/popover/popover-panel/with-footer-actions</example-url>
500
1003
  */
501
1004
  declare class CngxPopoverAction {
502
1005
  private readonly popover;
@@ -516,5 +1019,47 @@ declare class CngxPopoverAction {
516
1019
  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>;
517
1020
  }
518
1021
 
519
- export { CNGX_FLOATING_FALLBACK, CNGX_POPOVER_PANEL_CONFIG, CngxPopover, CngxPopoverAction, CngxPopoverBody, CngxPopoverClose, CngxPopoverEmpty, CngxPopoverError, CngxPopoverFooter, CngxPopoverHeader, CngxPopoverLoading, CngxPopoverPanel, CngxPopoverTrigger, CngxTooltip, provideFloatingFallback, providePopoverPanel, withArrow, withAutoDismiss, withCloseButton, withCloseOnSuccess, withDefaultVariant };
520
- export type { CngxPopoverPanelConfig, ComputePositionFn, FloatingFallbackConfig, PopoverActionVariant, PopoverMode, PopoverPanelFeature, PopoverPlacement, PopoverState };
1022
+ /**
1023
+ * Separator for use inside `cngx-popover-panel` (or a bare `[cngxPopover]`).
1024
+ *
1025
+ * Composes `CngxDivider` via `hostDirectives` so the popover-context
1026
+ * separator carries proper `role="separator"` + `aria-orientation`
1027
+ * semantics without the consumer having to remember the ARIA wiring.
1028
+ * The `orientation` and `inset` inputs forward to the underlying
1029
+ * `CngxDivider` host directive.
1030
+ *
1031
+ * Project anywhere inside the panel content - typically between menu
1032
+ * item groups (destructive vs non-destructive), between body sections,
1033
+ * or between footer action groups.
1034
+ *
1035
+ * ### Menu item group separator (horizontal)
1036
+ * ```html
1037
+ * <menu>
1038
+ * <li><button (click)="pop.hide()">Edit</button></li>
1039
+ * <li><button (click)="pop.hide()">Duplicate</button></li>
1040
+ * <li cngxPopoverDivider></li>
1041
+ * <li><button (click)="pop.hide()">Delete</button></li>
1042
+ * </menu>
1043
+ * ```
1044
+ *
1045
+ * ### Vertical separator between footer action groups
1046
+ * ```html
1047
+ * <div cngxPopoverFooter>
1048
+ * <cngx-popover-action role="dismiss">Cancel</cngx-popover-action>
1049
+ * <span cngxPopoverDivider orientation="vertical"></span>
1050
+ * <cngx-popover-action role="confirm" [action]="save">Save</cngx-popover-action>
1051
+ * </div>
1052
+ * ```
1053
+ *
1054
+ * @category common/popover
1055
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/popover/popover-divider.directive.ts
1056
+ * @since 0.1.0
1057
+ * @relatedTo CngxPopoverPanel, CngxDivider
1058
+ */
1059
+ declare class CngxPopoverDivider {
1060
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverDivider, never>;
1061
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPopoverDivider, "[cngxPopoverDivider]", ["cngxPopoverDivider"], {}, {}, never, never, true, [{ directive: typeof i1$1.CngxDivider; inputs: { "orientation": "orientation"; "inset": "inset"; }; outputs: {}; }]>;
1062
+ }
1063
+
1064
+ 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 };
1065
+ export type { ArrowEdge, CngxPopoverArrowBounds, CngxPopoverArrowContext, CngxPopoverPanelConfig, ComputePositionFn, FloatingFallbackConfig, PopoverActionVariant, PopoverHaspopup, PopoverMode, PopoverPanelFeature, PopoverPanelRole, PopoverPlacement, PopoverPositionTryFallback, PopoverState, TooltipTriggerMode };