@cngx/common 0.0.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +18 -0
- package/a11y/README.md +77 -0
- package/card/README.md +79 -0
- package/chart/README.md +31 -0
- package/data/README.md +883 -0
- package/dialog/README.md +84 -0
- package/display/README.md +30 -0
- package/fesm2022/cngx-common-a11y.mjs +1260 -0
- package/fesm2022/cngx-common-a11y.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +765 -0
- package/fesm2022/cngx-common-card.mjs.map +1 -0
- package/fesm2022/cngx-common-chart.mjs +2943 -0
- package/fesm2022/cngx-common-chart.mjs.map +1 -0
- package/fesm2022/cngx-common-data.mjs +2886 -0
- package/fesm2022/cngx-common-data.mjs.map +1 -0
- package/fesm2022/cngx-common-dialog.mjs +1366 -0
- package/fesm2022/cngx-common-dialog.mjs.map +1 -0
- package/fesm2022/cngx-common-display.mjs +1603 -0
- package/fesm2022/cngx-common-display.mjs.map +1 -0
- package/fesm2022/cngx-common-interactive.mjs +8185 -0
- package/fesm2022/cngx-common-interactive.mjs.map +1 -0
- package/fesm2022/cngx-common-layout.mjs +1335 -0
- package/fesm2022/cngx-common-layout.mjs.map +1 -0
- package/fesm2022/cngx-common-popover.mjs +1200 -0
- package/fesm2022/cngx-common-popover.mjs.map +1 -0
- package/fesm2022/cngx-common-stepper.mjs +1350 -0
- package/fesm2022/cngx-common-stepper.mjs.map +1 -0
- package/fesm2022/cngx-common-tabs.mjs +1551 -0
- package/fesm2022/cngx-common-tabs.mjs.map +1 -0
- package/fesm2022/cngx-common.mjs +34 -0
- package/fesm2022/cngx-common.mjs.map +1 -0
- package/interactive/README.md +211 -0
- package/layout/README.md +117 -0
- package/package.json +100 -0
- package/popover/README.md +218 -0
- package/stepper/README.md +102 -0
- package/tabs/README.md +32 -0
- package/types/cngx-common-a11y.d.ts +616 -0
- package/types/cngx-common-card.d.ts +413 -0
- package/types/cngx-common-chart.d.ts +1081 -0
- package/types/cngx-common-data.d.ts +1460 -0
- package/types/cngx-common-dialog.d.ts +772 -0
- package/types/cngx-common-display.d.ts +1136 -0
- package/types/cngx-common-interactive.d.ts +5013 -0
- package/types/cngx-common-layout.d.ts +737 -0
- package/types/cngx-common-popover.d.ts +520 -0
- package/types/cngx-common-stepper.d.ts +982 -0
- package/types/cngx-common-tabs.d.ts +1237 -0
- package/types/cngx-common.d.ts +13 -0
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ElementRef, InjectionToken, Provider, TemplateRef } from '@angular/core';
|
|
3
|
+
import * as i1 from '@cngx/common/a11y';
|
|
4
|
+
import { CngxAsyncState } from '@cngx/core/utils';
|
|
5
|
+
import { AsyncAction, CngxPending, CngxSucceeded, CngxFailed } from '@cngx/common/interactive';
|
|
6
|
+
|
|
7
|
+
/** Lifecycle state of a popover element. */
|
|
8
|
+
type PopoverState = 'closed' | 'opening' | 'open' | 'closing';
|
|
9
|
+
/** Native popover attribute mode. */
|
|
10
|
+
type PopoverMode = 'manual' | 'auto';
|
|
11
|
+
/** Anchor-relative placement of a popover. */
|
|
12
|
+
type PopoverPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Signal-driven state machine for the native Popover API.
|
|
16
|
+
*
|
|
17
|
+
* Wraps the browser's `popover` attribute with reactive state,
|
|
18
|
+
* CSS-transition-aware lifecycle, and CSS Anchor Positioning.
|
|
19
|
+
* Pure state machine — contains no trigger logic, no delays.
|
|
20
|
+
*
|
|
21
|
+
* State lifecycle: `closed` → `opening` → `open` → `closing` → `closed`.
|
|
22
|
+
* CSS classes `cngx-popover--opening`, `cngx-popover--open`, and
|
|
23
|
+
* `cngx-popover--closing` are applied to the host for transition hooks.
|
|
24
|
+
*
|
|
25
|
+
* ### Declarative click popover
|
|
26
|
+
* ```html
|
|
27
|
+
* <button [cngxPopoverTrigger]="pop" (click)="pop.toggle()">Menu</button>
|
|
28
|
+
* <div cngxPopover #pop="cngxPopover" placement="bottom-start">
|
|
29
|
+
* <menu><li>Edit</li><li>Delete</li></menu>
|
|
30
|
+
* </div>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* ### Controlled open state
|
|
34
|
+
* ```html
|
|
35
|
+
* <div cngxPopover [cngxPopoverOpen]="showErrors()" role="alert">
|
|
36
|
+
* {{ errorSummary() }}
|
|
37
|
+
* </div>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare class CngxPopover {
|
|
41
|
+
/**
|
|
42
|
+
* Host ElementRef. Public for consumers that need to pass the
|
|
43
|
+
* popover's native element to APIs expecting an `ElementRef`
|
|
44
|
+
* (scroll observers, intersection observers, focus managers, …).
|
|
45
|
+
* Notable consumer: `injectRecycler({ scrollElement: pop.elementRef })`
|
|
46
|
+
* for `@cngx/forms/select` virtualisation — the popover IS the
|
|
47
|
+
* scroll container when `select-base.css`'s `max-height + overflow-y`
|
|
48
|
+
* rules apply.
|
|
49
|
+
*/
|
|
50
|
+
readonly elementRef: ElementRef<HTMLElement>;
|
|
51
|
+
private readonly elRef;
|
|
52
|
+
private readonly destroyRef;
|
|
53
|
+
private readonly doc;
|
|
54
|
+
private readonly floatingFallback;
|
|
55
|
+
/** Anchor-relative placement. */
|
|
56
|
+
readonly placement: _angular_core.InputSignal<PopoverPlacement>;
|
|
57
|
+
/** Gap between anchor and popover in px. */
|
|
58
|
+
readonly offset: _angular_core.InputSignal<number>;
|
|
59
|
+
/** Whether Escape key dismisses the popover. */
|
|
60
|
+
readonly closeOnEscape: _angular_core.InputSignal<boolean>;
|
|
61
|
+
/** Native popover mode. `'manual'` for full control, `'auto'` for browser light dismiss. */
|
|
62
|
+
readonly mode: _angular_core.InputSignal<PopoverMode>;
|
|
63
|
+
/**
|
|
64
|
+
* Controlled open state. When set, drives the popover reactively.
|
|
65
|
+
* `undefined` = uncontrolled (default).
|
|
66
|
+
*/
|
|
67
|
+
readonly controlledOpen: _angular_core.InputSignal<boolean | undefined>;
|
|
68
|
+
/**
|
|
69
|
+
* When `true` (default), opening this popover closes any other open
|
|
70
|
+
* `CngxPopover` instance. Set to `false` to allow multiple popovers
|
|
71
|
+
* open simultaneously.
|
|
72
|
+
*/
|
|
73
|
+
readonly exclusive: _angular_core.InputSignal<boolean>;
|
|
74
|
+
private readonly stateSignal;
|
|
75
|
+
private readonly idSignal;
|
|
76
|
+
/** Current lifecycle state. */
|
|
77
|
+
readonly state: _angular_core.Signal<PopoverState>;
|
|
78
|
+
/** Unique auto-generated ID for this popover instance. */
|
|
79
|
+
readonly id: _angular_core.Signal<string>;
|
|
80
|
+
/**
|
|
81
|
+
* The anchor element for Floating UI fallback positioning.
|
|
82
|
+
* Set by `CngxPopoverTrigger` or `CngxTooltip`.
|
|
83
|
+
*/
|
|
84
|
+
readonly anchorElement: _angular_core.WritableSignal<HTMLElement | null>;
|
|
85
|
+
protected readonly isOpening: _angular_core.Signal<boolean>;
|
|
86
|
+
protected readonly isOpen: _angular_core.Signal<boolean>;
|
|
87
|
+
protected readonly isClosing: _angular_core.Signal<boolean>;
|
|
88
|
+
readonly isVisible: _angular_core.Signal<boolean>;
|
|
89
|
+
protected readonly cssAnchorRef: _angular_core.Signal<string | null>;
|
|
90
|
+
protected readonly cssMargin: _angular_core.Signal<string | null>;
|
|
91
|
+
constructor();
|
|
92
|
+
/** Open the popover. No-op if not `closed`. */
|
|
93
|
+
show(): void;
|
|
94
|
+
/** Close the popover. No-op if already `closed` or `closing`. */
|
|
95
|
+
hide(): void;
|
|
96
|
+
/** Toggle between open and closed. */
|
|
97
|
+
toggle(): void;
|
|
98
|
+
protected handleToggle(e: ToggleEvent): void;
|
|
99
|
+
/**
|
|
100
|
+
* Apply Floating UI positioning when CSS Anchor is not supported
|
|
101
|
+
* and the consumer has provided the fallback via `provideFloatingFallback()`.
|
|
102
|
+
*/
|
|
103
|
+
private applyFloatingPosition;
|
|
104
|
+
private get popoverElement();
|
|
105
|
+
private startClosing;
|
|
106
|
+
private finalize;
|
|
107
|
+
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>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* ARIA wiring atom for elements that trigger a `CngxPopover`.
|
|
113
|
+
*
|
|
114
|
+
* Sets `aria-expanded`, `aria-controls`, and `aria-haspopup` based on the
|
|
115
|
+
* referenced popover's state. Also sets `anchor-name` for CSS Anchor
|
|
116
|
+
* Positioning and registers the anchor element on the popover for fallback
|
|
117
|
+
* positioning.
|
|
118
|
+
*
|
|
119
|
+
* Contains **no event handlers** — the consumer binds interactions directly:
|
|
120
|
+
*
|
|
121
|
+
* ```html
|
|
122
|
+
* <button [cngxPopoverTrigger]="pop" (click)="pop.toggle()">Menu</button>
|
|
123
|
+
* <div cngxPopover #pop="cngxPopover" placement="bottom-start">…</div>
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
declare class CngxPopoverTrigger {
|
|
127
|
+
private readonly elRef;
|
|
128
|
+
/** Explicit reference to the popover this trigger controls. */
|
|
129
|
+
readonly popoverRef: _angular_core.InputSignal<CngxPopover>;
|
|
130
|
+
/**
|
|
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.
|
|
136
|
+
*/
|
|
137
|
+
readonly haspopup: _angular_core.InputSignal<"dialog" | "listbox" | "menu" | "tree" | "true">;
|
|
138
|
+
protected readonly cssAnchorName: _angular_core.Signal<string | null>;
|
|
139
|
+
constructor();
|
|
140
|
+
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>;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* String-input tooltip directive applied to the trigger element.
|
|
146
|
+
*
|
|
147
|
+
* Creates the tooltip popover element internally via `Renderer2` and manages
|
|
148
|
+
* the full lifecycle: hover/focus triggers, open/close delays, Escape dismiss,
|
|
149
|
+
* CSS Anchor Positioning, and ARIA wiring (`aria-describedby` + `role="tooltip"`).
|
|
150
|
+
*
|
|
151
|
+
* The consumer sees only the attribute — no extra elements in the template.
|
|
152
|
+
*
|
|
153
|
+
* ### Basic
|
|
154
|
+
* ```html
|
|
155
|
+
* <button cngxTooltip="Ctrl+S">Save</button>
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* ### With configuration
|
|
159
|
+
* ```html
|
|
160
|
+
* <button cngxTooltip="Ctrl+S" tooltipPlacement="top" [tooltipDelay]="500">
|
|
161
|
+
* Save
|
|
162
|
+
* </button>
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
declare class CngxTooltip {
|
|
166
|
+
private readonly renderer;
|
|
167
|
+
private readonly elRef;
|
|
168
|
+
private readonly destroyRef;
|
|
169
|
+
private readonly floatingFallback;
|
|
170
|
+
/** Tooltip text content. */
|
|
171
|
+
readonly text: _angular_core.InputSignal<string>;
|
|
172
|
+
/** Anchor-relative placement. */
|
|
173
|
+
readonly placement: _angular_core.InputSignal<PopoverPlacement>;
|
|
174
|
+
/** Gap between trigger and tooltip in px. */
|
|
175
|
+
readonly offset: _angular_core.InputSignal<number>;
|
|
176
|
+
/** Delay in ms before opening on mouseenter. */
|
|
177
|
+
readonly openDelay: _angular_core.InputSignal<number>;
|
|
178
|
+
/** Delay in ms before closing on mouseleave. */
|
|
179
|
+
readonly closeDelay: _angular_core.InputSignal<number>;
|
|
180
|
+
/** Whether the tooltip is active. When `false`, no tooltip appears and ARIA is cleared. */
|
|
181
|
+
readonly enabled: _angular_core.InputSignal<boolean>;
|
|
182
|
+
private readonly stateSignal;
|
|
183
|
+
private readonly idSignal;
|
|
184
|
+
/** Current lifecycle state. */
|
|
185
|
+
readonly state: _angular_core.Signal<PopoverState>;
|
|
186
|
+
private tooltipEl;
|
|
187
|
+
private openTimer;
|
|
188
|
+
private closeTimer;
|
|
189
|
+
protected readonly ariaDescribedBy: _angular_core.Signal<string | null>;
|
|
190
|
+
protected readonly cssAnchorName: _angular_core.Signal<string | null>;
|
|
191
|
+
constructor();
|
|
192
|
+
/** Show the tooltip immediately (bypassing delay). */
|
|
193
|
+
show(): void;
|
|
194
|
+
/** Hide the tooltip immediately (bypassing delay). */
|
|
195
|
+
hide(): void;
|
|
196
|
+
protected handleMouseEnter(): void;
|
|
197
|
+
protected handleMouseLeave(): void;
|
|
198
|
+
protected handleFocus(): void;
|
|
199
|
+
protected handleBlur(): void;
|
|
200
|
+
protected handleEscape(event: Event): void;
|
|
201
|
+
private applyFloatingPosition;
|
|
202
|
+
private createTooltipElement;
|
|
203
|
+
private finalize;
|
|
204
|
+
private clearTimers;
|
|
205
|
+
private clearOpenTimer;
|
|
206
|
+
private clearCloseTimer;
|
|
207
|
+
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: {}; }]>;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Signature matching `@floating-ui/dom` `computePosition`.
|
|
213
|
+
* The consumer provides the actual function — the library never imports it directly.
|
|
214
|
+
*/
|
|
215
|
+
type ComputePositionFn = (reference: HTMLElement, floating: HTMLElement, options?: {
|
|
216
|
+
placement?: string;
|
|
217
|
+
middleware?: unknown[];
|
|
218
|
+
}) => Promise<{
|
|
219
|
+
x: number;
|
|
220
|
+
y: number;
|
|
221
|
+
placement: string;
|
|
222
|
+
}>;
|
|
223
|
+
/** Configuration for the Floating UI positioning fallback. */
|
|
224
|
+
interface FloatingFallbackConfig {
|
|
225
|
+
/** The `computePosition` function from `@floating-ui/dom`. */
|
|
226
|
+
computePosition: ComputePositionFn;
|
|
227
|
+
/** Middleware array (e.g. `[offset(8), flip(), shift()]`). */
|
|
228
|
+
middleware?: unknown[];
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Injection token for the Floating UI fallback.
|
|
232
|
+
* `null` when not provided — CSS Anchor Positioning is used instead.
|
|
233
|
+
*/
|
|
234
|
+
declare const CNGX_FLOATING_FALLBACK: InjectionToken<FloatingFallbackConfig | null>;
|
|
235
|
+
/**
|
|
236
|
+
* Provides the Floating UI positioning fallback for browsers without
|
|
237
|
+
* CSS Anchor Positioning support.
|
|
238
|
+
*
|
|
239
|
+
* The consumer must install `@floating-ui/dom` themselves — this library
|
|
240
|
+
* never imports it directly, keeping the bundle at zero cost for modern browsers.
|
|
241
|
+
*
|
|
242
|
+
* ```typescript
|
|
243
|
+
* import { computePosition, flip, offset, shift } from '@floating-ui/dom';
|
|
244
|
+
*
|
|
245
|
+
* // In app.config.ts or component providers:
|
|
246
|
+
* providers: [
|
|
247
|
+
* provideFloatingFallback(computePosition, [offset(8), flip(), shift()]),
|
|
248
|
+
* ]
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
declare function provideFloatingFallback(computePosition: ComputePositionFn, middleware?: unknown[]): Provider;
|
|
252
|
+
|
|
253
|
+
/** Configuration for `CngxPopoverPanel` provided via `providePopoverPanel()`. */
|
|
254
|
+
interface CngxPopoverPanelConfig {
|
|
255
|
+
/**
|
|
256
|
+
* Auto-dismiss timing per variant in ms.
|
|
257
|
+
* `undefined` = no auto-dismiss (default).
|
|
258
|
+
* Example: `{ info: 5000, success: 3000 }`
|
|
259
|
+
*/
|
|
260
|
+
autoDismiss?: Record<string, number>;
|
|
261
|
+
/**
|
|
262
|
+
* Delay in ms before closing the panel after an action succeeds.
|
|
263
|
+
* `0` = close immediately on success. `undefined` = don't auto-close.
|
|
264
|
+
*/
|
|
265
|
+
closeOnSuccessDelay?: number;
|
|
266
|
+
/** Default variant string applied when none is set on the component. */
|
|
267
|
+
defaultVariant?: string;
|
|
268
|
+
/** Default for `showClose`. `undefined` = per-component default (`false`). */
|
|
269
|
+
showClose?: boolean;
|
|
270
|
+
/** Default for `showArrow`. `undefined` = per-component default (`false`). */
|
|
271
|
+
showArrow?: boolean;
|
|
272
|
+
}
|
|
273
|
+
/** Feature function signature for `providePopoverPanel()`. */
|
|
274
|
+
type PopoverPanelFeature = (config: CngxPopoverPanelConfig) => CngxPopoverPanelConfig;
|
|
275
|
+
|
|
276
|
+
/** Injection token for popover panel configuration. */
|
|
277
|
+
declare const CNGX_POPOVER_PANEL_CONFIG: InjectionToken<CngxPopoverPanelConfig>;
|
|
278
|
+
/**
|
|
279
|
+
* Provides configuration for `CngxPopoverPanel` instances.
|
|
280
|
+
*
|
|
281
|
+
* ```typescript
|
|
282
|
+
* providers: [
|
|
283
|
+
* providePopoverPanel(
|
|
284
|
+
* withAutoDismiss({ info: 5000, success: 3000 }),
|
|
285
|
+
* withCloseOnSuccess(300),
|
|
286
|
+
* ),
|
|
287
|
+
* ]
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
declare function providePopoverPanel(...features: PopoverPanelFeature[]): Provider;
|
|
291
|
+
/**
|
|
292
|
+
* Auto-dismiss the panel after a timeout, per variant.
|
|
293
|
+
*
|
|
294
|
+
* @param timing - Map of variant name to dismiss duration in ms.
|
|
295
|
+
* ```typescript
|
|
296
|
+
* withAutoDismiss({ info: 5000, success: 3000 })
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
299
|
+
declare function withAutoDismiss(timing: Record<string, number>): PopoverPanelFeature;
|
|
300
|
+
/**
|
|
301
|
+
* Auto-close the panel after an async action in the footer succeeds.
|
|
302
|
+
*
|
|
303
|
+
* @param delay - Delay in ms before closing. Defaults to `300`.
|
|
304
|
+
*/
|
|
305
|
+
declare function withCloseOnSuccess(delay?: number): PopoverPanelFeature;
|
|
306
|
+
/**
|
|
307
|
+
* Set the default variant applied when no `variant` input is set.
|
|
308
|
+
*/
|
|
309
|
+
declare function withDefaultVariant(variant: string): PopoverPanelFeature;
|
|
310
|
+
/**
|
|
311
|
+
* Show the close button on all panels by default.
|
|
312
|
+
*/
|
|
313
|
+
declare function withCloseButton(show?: boolean): PopoverPanelFeature;
|
|
314
|
+
/**
|
|
315
|
+
* Show the arrow on all panels by default.
|
|
316
|
+
*/
|
|
317
|
+
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
|
+
/**
|
|
335
|
+
* Custom close button template. Overrides the default close button.
|
|
336
|
+
*
|
|
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>
|
|
343
|
+
* ```
|
|
344
|
+
*/
|
|
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>;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Rich popover panel molecule with header/body/footer slots, variant
|
|
371
|
+
* styling, arrow, close button, and content state templates.
|
|
372
|
+
*
|
|
373
|
+
* Composes `CngxPopover` via `hostDirectives` — all popover inputs
|
|
374
|
+
* (`placement`, `offset`, `closeOnEscape`, `mode`, `exclusive`,
|
|
375
|
+
* `cngxPopoverOpen`) are forwarded.
|
|
376
|
+
*
|
|
377
|
+
* The `variant` input is a free-form string mapped to a CSS class
|
|
378
|
+
* (`cngx-popover-panel--{variant}`). Five variants are pre-themed
|
|
379
|
+
* in `popover-panel-theme.scss`: `default`, `info`, `warning`,
|
|
380
|
+
* `danger`, `success`. Add custom variants via CSS.
|
|
381
|
+
*
|
|
382
|
+
* ### Basic with header/body/footer
|
|
383
|
+
* ```html
|
|
384
|
+
* <button [cngxPopoverTrigger]="panel" (click)="panel.popover.toggle()">Menu</button>
|
|
385
|
+
* <cngx-popover-panel #panel variant="danger" [showClose]="true" [showArrow]="true">
|
|
386
|
+
* <span cngxPopoverHeader>Delete Item?</span>
|
|
387
|
+
* <p cngxPopoverBody>This action cannot be undone.</p>
|
|
388
|
+
* <div cngxPopoverFooter>
|
|
389
|
+
* <cngx-popover-action role="dismiss">Cancel</cngx-popover-action>
|
|
390
|
+
* <cngx-popover-action role="confirm" [action]="delete" variant="danger">
|
|
391
|
+
* Delete
|
|
392
|
+
* </cngx-popover-action>
|
|
393
|
+
* </div>
|
|
394
|
+
* </cngx-popover-panel>
|
|
395
|
+
* ```
|
|
396
|
+
*
|
|
397
|
+
* ### With loading state
|
|
398
|
+
* ```html
|
|
399
|
+
* <cngx-popover-panel [loading]="isLoading()" [error]="loadError()">
|
|
400
|
+
* <p cngxPopoverBody>Loaded content here</p>
|
|
401
|
+
* <ng-template cngxPopoverLoading>Loading...</ng-template>
|
|
402
|
+
* <ng-template cngxPopoverError let-err>Failed: {{ err }}</ng-template>
|
|
403
|
+
* </cngx-popover-panel>
|
|
404
|
+
* ```
|
|
405
|
+
*/
|
|
406
|
+
declare class CngxPopoverPanel {
|
|
407
|
+
/** The underlying popover state machine. */
|
|
408
|
+
readonly popover: CngxPopover;
|
|
409
|
+
private readonly config;
|
|
410
|
+
private readonly destroyRef;
|
|
411
|
+
/**
|
|
412
|
+
* Variant string — mapped to CSS class `cngx-popover-panel--{variant}`.
|
|
413
|
+
* Pre-themed: `default`, `info`, `warning`, `danger`, `success`.
|
|
414
|
+
* Add custom variants via CSS.
|
|
415
|
+
*/
|
|
416
|
+
readonly variant: _angular_core.InputSignal<string | undefined>;
|
|
417
|
+
/** Show a close button. Falls back to global config from `providePopoverPanel(withCloseButton())`. */
|
|
418
|
+
readonly showCloseInput: _angular_core.InputSignal<boolean | undefined>;
|
|
419
|
+
/** Show an arrow. Falls back to global config from `providePopoverPanel(withArrow())`. */
|
|
420
|
+
readonly showArrowInput: _angular_core.InputSignal<boolean | undefined>;
|
|
421
|
+
/** Resolved showClose — input takes precedence over config. */
|
|
422
|
+
readonly showClose: _angular_core.Signal<boolean>;
|
|
423
|
+
/** Resolved showArrow — input takes precedence over config. */
|
|
424
|
+
readonly showArrow: _angular_core.Signal<boolean>;
|
|
425
|
+
/**
|
|
426
|
+
* Bind an async state — drives loading, error, and empty slots from a single source.
|
|
427
|
+
* When set, takes precedence over individual `[loading]`, `[error]`, `[empty]` inputs.
|
|
428
|
+
*/
|
|
429
|
+
readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
|
|
430
|
+
/** Whether the panel content is in a loading state. Fallback when `[state]` is not set. */
|
|
431
|
+
readonly loading: _angular_core.InputSignal<boolean>;
|
|
432
|
+
/** Error value when content loading failed. Fallback when `[state]` is not set. */
|
|
433
|
+
readonly error: _angular_core.InputSignal<unknown>;
|
|
434
|
+
/** Whether the panel content is empty. Fallback when `[state]` is not set. */
|
|
435
|
+
readonly empty: _angular_core.InputSignal<boolean>;
|
|
436
|
+
/** @internal Resolved loading — state takes precedence over boolean input. */
|
|
437
|
+
protected readonly effectiveLoading: _angular_core.Signal<boolean>;
|
|
438
|
+
/** @internal Resolved error — state takes precedence over direct input. */
|
|
439
|
+
protected readonly effectiveError: _angular_core.Signal<unknown>;
|
|
440
|
+
/** @internal Resolved empty — state takes precedence over boolean input. */
|
|
441
|
+
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>;
|
|
446
|
+
protected readonly closeTpl: _angular_core.Signal<CngxPopoverClose | undefined>;
|
|
447
|
+
protected readonly loadingTpl: _angular_core.Signal<CngxPopoverLoading | undefined>;
|
|
448
|
+
protected readonly emptyTpl: _angular_core.Signal<CngxPopoverEmpty | undefined>;
|
|
449
|
+
protected readonly errorTpl: _angular_core.Signal<CngxPopoverError | undefined>;
|
|
450
|
+
private readonly uid;
|
|
451
|
+
protected readonly headerId: string;
|
|
452
|
+
protected readonly bodyId: string;
|
|
453
|
+
/** Only point to body when default content is showing (not loading/error/empty). */
|
|
454
|
+
protected readonly ariaDescribedBy: _angular_core.Signal<string | null>;
|
|
455
|
+
protected readonly hostClass: _angular_core.Signal<string>;
|
|
456
|
+
private autoDismissTimer;
|
|
457
|
+
constructor();
|
|
458
|
+
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: {}; }]>;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/** Visual variant for the action button. */
|
|
463
|
+
type PopoverActionVariant = 'primary' | 'secondary' | 'danger' | 'ghost';
|
|
464
|
+
/**
|
|
465
|
+
* Action button for use inside `cngx-popover-panel` footer.
|
|
466
|
+
*
|
|
467
|
+
* Two roles:
|
|
468
|
+
* - `'dismiss'` — closes the panel on click (no async action).
|
|
469
|
+
* - `'confirm'` — executes an async action, shows status templates,
|
|
470
|
+
* optionally auto-closes the panel on success.
|
|
471
|
+
*
|
|
472
|
+
* Supports the same `cngxPending`/`cngxSucceeded`/`cngxFailed` templates
|
|
473
|
+
* as `CngxActionButton`, or use `status()` + `@switch` for full control.
|
|
474
|
+
*
|
|
475
|
+
* ### Dismiss button
|
|
476
|
+
* ```html
|
|
477
|
+
* <cngx-popover-action role="dismiss">Cancel</cngx-popover-action>
|
|
478
|
+
* ```
|
|
479
|
+
*
|
|
480
|
+
* ### Confirm with templates
|
|
481
|
+
* ```html
|
|
482
|
+
* <cngx-popover-action role="confirm" [action]="save" variant="primary">
|
|
483
|
+
* Save
|
|
484
|
+
* <ng-template cngxPending>Saving...</ng-template>
|
|
485
|
+
* <ng-template cngxSucceeded>Saved!</ng-template>
|
|
486
|
+
* <ng-template cngxFailed let-err>{{ err }}</ng-template>
|
|
487
|
+
* </cngx-popover-action>
|
|
488
|
+
* ```
|
|
489
|
+
*
|
|
490
|
+
* ### With @switch
|
|
491
|
+
* ```html
|
|
492
|
+
* <cngx-popover-action role="confirm" [action]="save" #act="cngxPopoverAction">
|
|
493
|
+
* @switch (act.status()) {
|
|
494
|
+
* @case ('pending') { Saving... }
|
|
495
|
+
* @case ('success') { Done }
|
|
496
|
+
* @default { Save }
|
|
497
|
+
* }
|
|
498
|
+
* </cngx-popover-action>
|
|
499
|
+
* ```
|
|
500
|
+
*/
|
|
501
|
+
declare class CngxPopoverAction {
|
|
502
|
+
private readonly popover;
|
|
503
|
+
/** Button role: `'dismiss'` closes immediately, `'confirm'` runs an async action. */
|
|
504
|
+
readonly role: _angular_core.InputSignal<"dismiss" | "confirm">;
|
|
505
|
+
/** The async action to execute (only for `role="confirm"`). */
|
|
506
|
+
readonly action: _angular_core.InputSignal<AsyncAction | undefined>;
|
|
507
|
+
/** Visual variant for the button. */
|
|
508
|
+
readonly variant: _angular_core.InputSignal<PopoverActionVariant>;
|
|
509
|
+
/** Duration in ms to show success/error feedback. */
|
|
510
|
+
readonly feedbackDuration: _angular_core.InputSignal<number>;
|
|
511
|
+
protected readonly pendingTpl: _angular_core.Signal<CngxPending | undefined>;
|
|
512
|
+
protected readonly succeededTpl: _angular_core.Signal<CngxSucceeded | undefined>;
|
|
513
|
+
protected readonly failedTpl: _angular_core.Signal<CngxFailed | undefined>;
|
|
514
|
+
protected handleDismiss(): void;
|
|
515
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPopoverAction, never>;
|
|
516
|
+
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
|
+
}
|
|
518
|
+
|
|
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 };
|