forty-cdk 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/README.md +122 -0
- package/aspect-ratio/README.md +76 -0
- package/avatar/README.md +100 -0
- package/breadcrumbs/README.md +49 -0
- package/breakpoints/README.md +81 -0
- package/button/README.md +49 -0
- package/calendar/README.md +458 -0
- package/carousel/README.md +358 -0
- package/checkbox/README.md +146 -0
- package/combobox/README.md +535 -0
- package/context-menu/README.md +139 -0
- package/date-field/README.md +184 -0
- package/date-picker/README.md +338 -0
- package/dialog/README.md +388 -0
- package/disclosure/README.md +114 -0
- package/drag-drop/README.md +359 -0
- package/drawer/README.md +560 -0
- package/dropdown-menu/README.md +176 -0
- package/fesm2022/forty-cdk-accordion.mjs +348 -0
- package/fesm2022/forty-cdk-accordion.mjs.map +1 -0
- package/fesm2022/forty-cdk-aspect-ratio.mjs +74 -0
- package/fesm2022/forty-cdk-aspect-ratio.mjs.map +1 -0
- package/fesm2022/forty-cdk-avatar.mjs +308 -0
- package/fesm2022/forty-cdk-avatar.mjs.map +1 -0
- package/fesm2022/forty-cdk-breadcrumbs.mjs +125 -0
- package/fesm2022/forty-cdk-breadcrumbs.mjs.map +1 -0
- package/fesm2022/forty-cdk-breakpoints.mjs +117 -0
- package/fesm2022/forty-cdk-breakpoints.mjs.map +1 -0
- package/fesm2022/forty-cdk-button.mjs +134 -0
- package/fesm2022/forty-cdk-button.mjs.map +1 -0
- package/fesm2022/forty-cdk-calendar.mjs +2034 -0
- package/fesm2022/forty-cdk-calendar.mjs.map +1 -0
- package/fesm2022/forty-cdk-carousel.mjs +968 -0
- package/fesm2022/forty-cdk-carousel.mjs.map +1 -0
- package/fesm2022/forty-cdk-checkbox.mjs +226 -0
- package/fesm2022/forty-cdk-checkbox.mjs.map +1 -0
- package/fesm2022/forty-cdk-combobox.mjs +2596 -0
- package/fesm2022/forty-cdk-combobox.mjs.map +1 -0
- package/fesm2022/forty-cdk-context-menu.mjs +413 -0
- package/fesm2022/forty-cdk-context-menu.mjs.map +1 -0
- package/fesm2022/forty-cdk-core.mjs +9022 -0
- package/fesm2022/forty-cdk-core.mjs.map +1 -0
- package/fesm2022/forty-cdk-date-field.mjs +744 -0
- package/fesm2022/forty-cdk-date-field.mjs.map +1 -0
- package/fesm2022/forty-cdk-date-picker.mjs +1011 -0
- package/fesm2022/forty-cdk-date-picker.mjs.map +1 -0
- package/fesm2022/forty-cdk-dialog.mjs +707 -0
- package/fesm2022/forty-cdk-dialog.mjs.map +1 -0
- package/fesm2022/forty-cdk-disclosure.mjs +190 -0
- package/fesm2022/forty-cdk-disclosure.mjs.map +1 -0
- package/fesm2022/forty-cdk-drag-drop.mjs +1180 -0
- package/fesm2022/forty-cdk-drag-drop.mjs.map +1 -0
- package/fesm2022/forty-cdk-drawer.mjs +1641 -0
- package/fesm2022/forty-cdk-drawer.mjs.map +1 -0
- package/fesm2022/forty-cdk-dropdown-menu.mjs +350 -0
- package/fesm2022/forty-cdk-dropdown-menu.mjs.map +1 -0
- package/fesm2022/forty-cdk-field.mjs +425 -0
- package/fesm2022/forty-cdk-field.mjs.map +1 -0
- package/fesm2022/forty-cdk-fieldset.mjs +164 -0
- package/fesm2022/forty-cdk-fieldset.mjs.map +1 -0
- package/fesm2022/forty-cdk-file-upload.mjs +221 -0
- package/fesm2022/forty-cdk-file-upload.mjs.map +1 -0
- package/fesm2022/forty-cdk-hover-card.mjs +496 -0
- package/fesm2022/forty-cdk-hover-card.mjs.map +1 -0
- package/fesm2022/forty-cdk-input.mjs +274 -0
- package/fesm2022/forty-cdk-input.mjs.map +1 -0
- package/fesm2022/forty-cdk-internationalized-date.mjs +1 -1
- package/fesm2022/forty-cdk-internationalized-date.mjs.map +1 -1
- package/fesm2022/forty-cdk-listbox.mjs +1279 -0
- package/fesm2022/forty-cdk-listbox.mjs.map +1 -0
- package/fesm2022/forty-cdk-menu.mjs +1439 -0
- package/fesm2022/forty-cdk-menu.mjs.map +1 -0
- package/fesm2022/forty-cdk-menubar.mjs +787 -0
- package/fesm2022/forty-cdk-menubar.mjs.map +1 -0
- package/fesm2022/forty-cdk-meter.mjs +211 -0
- package/fesm2022/forty-cdk-meter.mjs.map +1 -0
- package/fesm2022/forty-cdk-navigation-menu.mjs +1145 -0
- package/fesm2022/forty-cdk-navigation-menu.mjs.map +1 -0
- package/fesm2022/forty-cdk-number-input.mjs +559 -0
- package/fesm2022/forty-cdk-number-input.mjs.map +1 -0
- package/fesm2022/forty-cdk-otp-input.mjs +527 -0
- package/fesm2022/forty-cdk-otp-input.mjs.map +1 -0
- package/fesm2022/forty-cdk-pagination.mjs +323 -0
- package/fesm2022/forty-cdk-pagination.mjs.map +1 -0
- package/fesm2022/forty-cdk-pane-resizer.mjs +297 -0
- package/fesm2022/forty-cdk-pane-resizer.mjs.map +1 -0
- package/fesm2022/forty-cdk-popover.mjs +698 -0
- package/fesm2022/forty-cdk-popover.mjs.map +1 -0
- package/fesm2022/forty-cdk-progress.mjs +226 -0
- package/fesm2022/forty-cdk-progress.mjs.map +1 -0
- package/fesm2022/forty-cdk-radio-group.mjs +378 -0
- package/fesm2022/forty-cdk-radio-group.mjs.map +1 -0
- package/fesm2022/forty-cdk-scroll-area.mjs +640 -0
- package/fesm2022/forty-cdk-scroll-area.mjs.map +1 -0
- package/fesm2022/forty-cdk-search.mjs +205 -0
- package/fesm2022/forty-cdk-search.mjs.map +1 -0
- package/fesm2022/forty-cdk-select.mjs +1661 -0
- package/fesm2022/forty-cdk-select.mjs.map +1 -0
- package/fesm2022/forty-cdk-separator.mjs +82 -0
- package/fesm2022/forty-cdk-separator.mjs.map +1 -0
- package/fesm2022/forty-cdk-signal-forms.mjs +97 -0
- package/fesm2022/forty-cdk-signal-forms.mjs.map +1 -0
- package/fesm2022/forty-cdk-slider.mjs +803 -0
- package/fesm2022/forty-cdk-slider.mjs.map +1 -0
- package/fesm2022/forty-cdk-stepper.mjs +886 -0
- package/fesm2022/forty-cdk-stepper.mjs.map +1 -0
- package/fesm2022/forty-cdk-switch.mjs +137 -0
- package/fesm2022/forty-cdk-switch.mjs.map +1 -0
- package/fesm2022/forty-cdk-table.mjs +1518 -0
- package/fesm2022/forty-cdk-table.mjs.map +1 -0
- package/fesm2022/forty-cdk-tabs.mjs +400 -0
- package/fesm2022/forty-cdk-tabs.mjs.map +1 -0
- package/fesm2022/forty-cdk-time-field.mjs +593 -0
- package/fesm2022/forty-cdk-time-field.mjs.map +1 -0
- package/fesm2022/forty-cdk-time-picker.mjs +1013 -0
- package/fesm2022/forty-cdk-time-picker.mjs.map +1 -0
- package/fesm2022/forty-cdk-toast.mjs +1153 -0
- package/fesm2022/forty-cdk-toast.mjs.map +1 -0
- package/fesm2022/forty-cdk-toggle.mjs +516 -0
- package/fesm2022/forty-cdk-toggle.mjs.map +1 -0
- package/fesm2022/forty-cdk-toolbar.mjs +374 -0
- package/fesm2022/forty-cdk-toolbar.mjs.map +1 -0
- package/fesm2022/forty-cdk-tooltip.mjs +672 -0
- package/fesm2022/forty-cdk-tooltip.mjs.map +1 -0
- package/fesm2022/forty-cdk-tree.mjs +2007 -0
- package/fesm2022/forty-cdk-tree.mjs.map +1 -0
- package/fesm2022/forty-cdk-virtualization.mjs +1 -1
- package/fesm2022/forty-cdk-virtualization.mjs.map +1 -1
- package/fesm2022/forty-cdk.mjs +0 -43310
- package/fesm2022/forty-cdk.mjs.map +1 -1
- package/field/README.md +97 -0
- package/fieldset/README.md +86 -0
- package/file-upload/README.md +73 -0
- package/hover-card/README.md +171 -0
- package/input/README.md +156 -0
- package/listbox/README.md +424 -0
- package/menu/README.md +181 -0
- package/menubar/README.md +140 -0
- package/meter/README.md +128 -0
- package/navigation-menu/README.md +253 -0
- package/number-input/README.md +171 -0
- package/otp-input/README.md +198 -0
- package/package.json +213 -1
- package/pagination/README.md +61 -0
- package/pane-resizer/README.md +136 -0
- package/popover/README.md +262 -0
- package/progress/README.md +115 -0
- package/radio-group/README.md +129 -0
- package/scroll-area/README.md +184 -0
- package/search/README.md +42 -0
- package/select/README.md +488 -0
- package/separator/README.md +84 -0
- package/signal-forms/README.md +72 -0
- package/slider/README.md +152 -0
- package/stepper/README.md +292 -0
- package/switch/README.md +116 -0
- package/table/README.md +769 -0
- package/tabs/README.md +130 -0
- package/time-field/README.md +157 -0
- package/time-picker/README.md +172 -0
- package/toast/README.md +398 -0
- package/toggle/README.md +224 -0
- package/toolbar/README.md +109 -0
- package/tooltip/README.md +274 -0
- package/tree/README.md +708 -0
- package/types/forty-cdk-accordion.d.ts +242 -0
- package/types/forty-cdk-aspect-ratio.d.ts +59 -0
- package/types/forty-cdk-avatar.d.ts +133 -0
- package/types/forty-cdk-breadcrumbs.d.ts +92 -0
- package/types/forty-cdk-breakpoints.d.ts +141 -0
- package/types/forty-cdk-button.d.ts +80 -0
- package/types/forty-cdk-calendar.d.ts +914 -0
- package/types/forty-cdk-carousel.d.ts +530 -0
- package/types/forty-cdk-checkbox.d.ts +141 -0
- package/types/forty-cdk-combobox.d.ts +1259 -0
- package/types/forty-cdk-context-menu.d.ts +313 -0
- package/types/forty-cdk-core.d.ts +5774 -0
- package/types/forty-cdk-date-field.d.ts +307 -0
- package/types/forty-cdk-date-picker.d.ts +622 -0
- package/types/forty-cdk-dialog.d.ts +546 -0
- package/types/forty-cdk-disclosure.d.ts +127 -0
- package/types/forty-cdk-drag-drop.d.ts +456 -0
- package/types/forty-cdk-drawer.d.ts +871 -0
- package/types/forty-cdk-dropdown-menu.d.ts +242 -0
- package/types/forty-cdk-field.d.ts +236 -0
- package/types/forty-cdk-fieldset.d.ts +119 -0
- package/types/forty-cdk-file-upload.d.ts +124 -0
- package/types/forty-cdk-hover-card.d.ts +320 -0
- package/types/forty-cdk-input.d.ts +169 -0
- package/types/forty-cdk-internationalized-date.d.ts +1 -1
- package/types/forty-cdk-listbox.d.ts +513 -0
- package/types/forty-cdk-menu.d.ts +629 -0
- package/types/forty-cdk-menubar.d.ts +451 -0
- package/types/forty-cdk-meter.d.ts +122 -0
- package/types/forty-cdk-navigation-menu.d.ts +514 -0
- package/types/forty-cdk-number-input.d.ts +319 -0
- package/types/forty-cdk-otp-input.d.ts +248 -0
- package/types/forty-cdk-pagination.d.ts +214 -0
- package/types/forty-cdk-pane-resizer.d.ts +145 -0
- package/types/forty-cdk-popover.d.ts +509 -0
- package/types/forty-cdk-progress.d.ts +143 -0
- package/types/forty-cdk-radio-group.d.ts +222 -0
- package/types/forty-cdk-scroll-area.d.ts +258 -0
- package/types/forty-cdk-search.d.ts +142 -0
- package/types/forty-cdk-select.d.ts +899 -0
- package/types/forty-cdk-separator.d.ts +59 -0
- package/types/forty-cdk-signal-forms.d.ts +58 -0
- package/types/forty-cdk-slider.d.ts +379 -0
- package/types/forty-cdk-stepper.d.ts +650 -0
- package/types/forty-cdk-switch.d.ts +87 -0
- package/types/forty-cdk-table.d.ts +723 -0
- package/types/forty-cdk-tabs.d.ts +235 -0
- package/types/forty-cdk-time-field.d.ts +307 -0
- package/types/forty-cdk-time-picker.d.ts +578 -0
- package/types/forty-cdk-toast.d.ts +598 -0
- package/types/forty-cdk-toggle.d.ts +310 -0
- package/types/forty-cdk-toolbar.d.ts +217 -0
- package/types/forty-cdk-tooltip.d.ts +436 -0
- package/types/forty-cdk-tree.d.ts +688 -0
- package/types/forty-cdk.d.ts +1 -19743
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { InjectionToken, Signal, Type, Injector, Provider } from '@angular/core';
|
|
3
|
+
import { VetoableNativeEvent, VetoableEvent, OverlayRef, OverlayManagerEntry, OverlayManagerCore } from 'forty-cdk/core';
|
|
4
|
+
import * as forty_cdk_dialog from 'forty-cdk/dialog';
|
|
5
|
+
|
|
6
|
+
type ForDialogCloseReason = 'escape' | 'backdrop' | 'pointerDownOutside' | 'focusOutside' | 'closeButton' | 'programmatic';
|
|
7
|
+
/**
|
|
8
|
+
* Coordination contract owned by `ForDialog` (declarative) or by the
|
|
9
|
+
* programmatic `ForDialogManager.open()` machinery. Title / Description register
|
|
10
|
+
* their generated ids so the dialog wires `aria-labelledby` /
|
|
11
|
+
* `aria-describedby` reactively. Close button and backdrop request close
|
|
12
|
+
* via `requestClose` — the implementation decides whether to honor the
|
|
13
|
+
* request based on `dismissible` and on programmatic semantics.
|
|
14
|
+
*
|
|
15
|
+
* The dialog's "openness" isn't part of this contract: the directive is
|
|
16
|
+
* mounted iff the dialog is open, so descendants don't need an open
|
|
17
|
+
* signal to coordinate.
|
|
18
|
+
*/
|
|
19
|
+
interface ForDialogContext {
|
|
20
|
+
readonly dismissible: Signal<boolean>;
|
|
21
|
+
readonly modal: Signal<boolean>;
|
|
22
|
+
readonly alert: Signal<boolean>;
|
|
23
|
+
readonly labelledBy: Signal<string | null>;
|
|
24
|
+
readonly describedBy: Signal<string | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Portal target shared with the backdrop so both resolve the same
|
|
27
|
+
* container. `null` ⇒ `document.body`. Set via the dialog's `container`
|
|
28
|
+
* input; read once per mount.
|
|
29
|
+
*/
|
|
30
|
+
readonly container: Signal<HTMLElement | null>;
|
|
31
|
+
registerLabel(id: string): void;
|
|
32
|
+
unregisterLabel(id: string): void;
|
|
33
|
+
registerDescription(id: string): void;
|
|
34
|
+
unregisterDescription(id: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Request that the dialog close. Reasons:
|
|
37
|
+
* - `'escape'` / `'backdrop'` / `'pointerDownOutside'` / `'focusOutside'`:
|
|
38
|
+
* honored only when `dismissible()` is true.
|
|
39
|
+
* - `'closeButton'`: always honored.
|
|
40
|
+
* - `'programmatic'`: always honored, used by `ForDialogManager.open()` consumers
|
|
41
|
+
* that drive close imperatively from a child component.
|
|
42
|
+
*
|
|
43
|
+
* `value` is the close result, propagated to `ForDialogRef.close(value)`
|
|
44
|
+
* in programmatic mode. Ignored in declarative mode.
|
|
45
|
+
*/
|
|
46
|
+
requestClose(reason: ForDialogCloseReason, value?: unknown): void;
|
|
47
|
+
}
|
|
48
|
+
declare const FOR_DIALOG_CONTEXT: InjectionToken<ForDialogContext>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Headless implementation of the [WAI-ARIA Modal Dialog pattern](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/).
|
|
52
|
+
*
|
|
53
|
+
* Apply `[forDialog]` on the dialog box itself — not on a wrapper. The
|
|
54
|
+
* directive moves the host to `document.body` (portal), traps focus, locks
|
|
55
|
+
* body scroll, and listens for Escape while mounted. `aria-labelledby`
|
|
56
|
+
* and `aria-describedby` wire automatically via `[forDialogTitle]` /
|
|
57
|
+
* `[forDialogDescription]`; pass `ariaLabel` instead if you don't render
|
|
58
|
+
* a visible title.
|
|
59
|
+
*
|
|
60
|
+
* Mount/unmount is the consumer's responsibility — the directive does
|
|
61
|
+
* not manage `[hidden]`. Wrap with `@if (open())` and let
|
|
62
|
+
* `animate.enter` / `animate.leave` handle transitions:
|
|
63
|
+
*
|
|
64
|
+
* ```html
|
|
65
|
+
* @if (dialogOpen()) {
|
|
66
|
+
* <div forDialog (dismiss)="dialogOpen.set(false)" animate.leave="fade-out">
|
|
67
|
+
* <h2 forDialogTitle>Confirm</h2>
|
|
68
|
+
* <button forDialogClose>Cancel</button>
|
|
69
|
+
* </div>
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* For programmatic use (open arbitrary components imperatively), see
|
|
74
|
+
* `ForDialogManager.open()`.
|
|
75
|
+
*
|
|
76
|
+
* `data-state` is a static `"open"`: because mount is the consumer's
|
|
77
|
+
* responsibility (the host only exists inside `@if (open())`), the element is
|
|
78
|
+
* present iff the dialog is open, so the attribute can never be `"closed"`.
|
|
79
|
+
* This is a deliberate choice: rather than keeping the node mounted and
|
|
80
|
+
* flipping `data-state="closed"` to drive an exit transition, exit styling
|
|
81
|
+
* is the consumer's `animate.leave` (see the usage example above), not a
|
|
82
|
+
* `data-state="closed"` selector — so a `[data-state="closed"]` rule would
|
|
83
|
+
* never match and is not a bug.
|
|
84
|
+
*/
|
|
85
|
+
declare class ForDialog implements ForDialogContext {
|
|
86
|
+
#private;
|
|
87
|
+
/**
|
|
88
|
+
* When true (default), Escape, backdrop click, pointer-down outside, and
|
|
89
|
+
* focus outside emit `(dismiss)`. Disable for critical confirm flows that
|
|
90
|
+
* must be answered explicitly via `[forDialogClose]`.
|
|
91
|
+
*/
|
|
92
|
+
readonly dismissible: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
93
|
+
/**
|
|
94
|
+
* When true (default), sets `aria-modal="true"`, locks body scroll, and
|
|
95
|
+
* traps focus. Set to `false` for non-modal popups (rare for dialogs).
|
|
96
|
+
*/
|
|
97
|
+
readonly modal: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
98
|
+
/** When true, role becomes `alertdialog` (interrupts assistive tech). */
|
|
99
|
+
readonly alert: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
100
|
+
/** When true (default), focus returns to the previously focused element on close. */
|
|
101
|
+
readonly returnFocus: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
102
|
+
/**
|
|
103
|
+
* Where to send focus on mount. `'first'` (default) finds the first
|
|
104
|
+
* focusable descendant; `'container'` focuses the dialog box itself
|
|
105
|
+
* (useful when there's nothing focusable inside).
|
|
106
|
+
*/
|
|
107
|
+
readonly initialFocus: _angular_core.InputSignal<"first" | "container">;
|
|
108
|
+
/** Manual `aria-label`. Use this when no visible title element exists. */
|
|
109
|
+
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
110
|
+
/**
|
|
111
|
+
* Portal target for the dialog surface. Defaults to `document.body`. Pair
|
|
112
|
+
* with `[modal]="false"` for a dialog scoped to a positioned region
|
|
113
|
+
* instead of the viewport. Read once at mount. The backdrop portals to the
|
|
114
|
+
* same container.
|
|
115
|
+
*/
|
|
116
|
+
readonly container: _angular_core.InputSignal<HTMLElement | null>;
|
|
117
|
+
/**
|
|
118
|
+
* Emitted when the dialog wants to close. Consumers wire this to flip
|
|
119
|
+
* the signal that gates the surrounding `@if`. Reasons: `'escape'`,
|
|
120
|
+
* `'backdrop'`, `'pointerDownOutside'`, `'focusOutside'`,
|
|
121
|
+
* `'closeButton'`, `'programmatic'`.
|
|
122
|
+
*/
|
|
123
|
+
readonly dismiss: _angular_core.OutputEmitterRef<ForDialogCloseReason>;
|
|
124
|
+
/**
|
|
125
|
+
* Fires when the user presses Escape while this dialog is the topmost
|
|
126
|
+
* dismissable layer. Call `preventDefault()` on the emitted veto to
|
|
127
|
+
* suppress the subsequent `(dismiss)` emission (e.g. to ask for
|
|
128
|
+
* confirmation first). The original `KeyboardEvent` is available on
|
|
129
|
+
* `.event` for inspection.
|
|
130
|
+
*/
|
|
131
|
+
readonly escapeKeyDown: _angular_core.OutputEmitterRef<VetoableNativeEvent<KeyboardEvent>>;
|
|
132
|
+
/**
|
|
133
|
+
* Fires when a pointer goes down outside the dialog. Call
|
|
134
|
+
* `preventDefault()` on the emitted veto to suppress the auto `(dismiss)`.
|
|
135
|
+
* The native `PointerEvent` is available on `.event`.
|
|
136
|
+
*/
|
|
137
|
+
readonly pointerDownOutside: _angular_core.OutputEmitterRef<VetoableNativeEvent<PointerEvent>>;
|
|
138
|
+
/**
|
|
139
|
+
* Fires when focus moves outside the dialog (e.g. user tabs out of a
|
|
140
|
+
* non-modal dialog). `preventDefault()` on the veto suppresses the auto
|
|
141
|
+
* `(dismiss)`. The native `FocusEvent` is available on `.event`.
|
|
142
|
+
*/
|
|
143
|
+
readonly focusOutside: _angular_core.OutputEmitterRef<VetoableNativeEvent<FocusEvent>>;
|
|
144
|
+
/**
|
|
145
|
+
* Composite event: fires alongside `pointerDownOutside` and
|
|
146
|
+
* `focusOutside` and shares their veto state — `preventDefault()` on
|
|
147
|
+
* either one suppresses the auto `(dismiss)`.
|
|
148
|
+
*/
|
|
149
|
+
readonly interactOutside: _angular_core.OutputEmitterRef<VetoableNativeEvent<PointerEvent | FocusEvent>>;
|
|
150
|
+
/**
|
|
151
|
+
* Callback invoked just before the dialog moves focus into itself on
|
|
152
|
+
* mount. Receives a `VetoableEvent`; call `event.preventDefault()` to
|
|
153
|
+
* skip the imperative focus move — useful when opening a dialog from
|
|
154
|
+
* an input you want to keep focused. The focus trap (modal mode) still
|
|
155
|
+
* cycles Tab inside the dialog once focus enters it.
|
|
156
|
+
*
|
|
157
|
+
* Bound as a function reference (`[autoFocusOnOpen]="onOpen"`), not as
|
|
158
|
+
* an event binding. Symmetric with `ForDialogManager`'s
|
|
159
|
+
* `config.autoFocusOnOpen`. The callback shape (rather than an
|
|
160
|
+
* `output()`) lets the directive invoke it during the destroy hook
|
|
161
|
+
* without depending on Angular's `OutputEmitterRef` lifecycle.
|
|
162
|
+
*/
|
|
163
|
+
readonly autoFocusOnOpen: _angular_core.InputSignal<((event: VetoableEvent) => void) | undefined>;
|
|
164
|
+
/**
|
|
165
|
+
* Callback invoked just before focus returns to the previously
|
|
166
|
+
* focused element on unmount. Receives a `VetoableEvent`; call
|
|
167
|
+
* `event.preventDefault()` to skip the return-focus — useful when
|
|
168
|
+
* the consumer wants to send focus elsewhere imperatively (e.g. a
|
|
169
|
+
* confirmation toast).
|
|
170
|
+
*
|
|
171
|
+
* Bound as a function reference (`[autoFocusOnClose]="onClose"`), not
|
|
172
|
+
* as an event binding. Fires reliably on both close paths: the
|
|
173
|
+
* `(dismiss)` output flow AND a direct `open.set(false)` from the
|
|
174
|
+
* consumer. Symmetric with `ForDialogManager`'s
|
|
175
|
+
* `config.autoFocusOnClose`.
|
|
176
|
+
*/
|
|
177
|
+
readonly autoFocusOnClose: _angular_core.InputSignal<((event: VetoableEvent) => void) | undefined>;
|
|
178
|
+
readonly labelledBy: _angular_core.Signal<string | null>;
|
|
179
|
+
readonly describedBy: _angular_core.Signal<string | null>;
|
|
180
|
+
constructor();
|
|
181
|
+
registerLabel(id: string): void;
|
|
182
|
+
unregisterLabel(id: string): void;
|
|
183
|
+
registerDescription(id: string): void;
|
|
184
|
+
unregisterDescription(id: string): void;
|
|
185
|
+
requestClose(reason: ForDialogCloseReason, value?: unknown): void;
|
|
186
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForDialog, never>;
|
|
187
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForDialog, "[forDialog]", ["forDialog"], { "dismissible": { "alias": "dismissible"; "required": false; "isSignal": true; }; "modal": { "alias": "modal"; "required": false; "isSignal": true; }; "alert": { "alias": "alert"; "required": false; "isSignal": true; }; "returnFocus": { "alias": "returnFocus"; "required": false; "isSignal": true; }; "initialFocus": { "alias": "initialFocus"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "container": { "alias": "container"; "required": false; "isSignal": true; }; "autoFocusOnOpen": { "alias": "autoFocusOnOpen"; "required": false; "isSignal": true; }; "autoFocusOnClose": { "alias": "autoFocusOnClose"; "required": false; "isSignal": true; }; }, { "dismiss": "dismiss"; "escapeKeyDown": "escapeKeyDown"; "pointerDownOutside": "pointerDownOutside"; "focusOutside": "focusOutside"; "interactOutside": "interactOutside"; }, never, never, true, never>;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Button that toggles the dialog when clicked. Apply on a focusable element —
|
|
192
|
+
* preferably a `<button>` — so keyboard users can reach it.
|
|
193
|
+
*
|
|
194
|
+
* Wires `aria-haspopup="dialog"`, `aria-expanded`, `aria-controls`, and
|
|
195
|
+
* `data-state` on the host. Two-way bind `[(open)]` to the same signal that
|
|
196
|
+
* gates the surrounding `@if` around `[forDialog]`. Focus return on close is
|
|
197
|
+
* handled by `[forDialog]` automatically — its focus trap captures the
|
|
198
|
+
* previously-focused element on mount and restores it on destroy, which is
|
|
199
|
+
* the trigger when the user clicked it.
|
|
200
|
+
*
|
|
201
|
+
* ```html
|
|
202
|
+
* <button forDialogTrigger [(open)]="dialogOpen" controls="my-dialog">Open</button>
|
|
203
|
+
* @if (dialogOpen()) {
|
|
204
|
+
* <div forDialog id="my-dialog" (dismiss)="dialogOpen.set(false)">…</div>
|
|
205
|
+
* }
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
declare class ForDialogTrigger {
|
|
209
|
+
#private;
|
|
210
|
+
/**
|
|
211
|
+
* Two-way bindable. Bind to the same signal that gates the surrounding
|
|
212
|
+
* `@if` around `[forDialog]`. The `model()` change emitter (`(openChange)`)
|
|
213
|
+
* fires only on internal transitions (trigger click), never on consumer
|
|
214
|
+
* writes via `[(open)]`.
|
|
215
|
+
*/
|
|
216
|
+
readonly open: _angular_core.ModelSignal<boolean>;
|
|
217
|
+
/**
|
|
218
|
+
* Id of the controlled dialog box. Mirrored to `aria-controls` while the
|
|
219
|
+
* dialog is open. The consumer is responsible for setting the same `id` on
|
|
220
|
+
* `[forDialog]`. Has no effect on focus or behavior — purely the
|
|
221
|
+
* accessibility relationship between trigger and box. Leaving it unset when
|
|
222
|
+
* the dialog opens drops `aria-controls` silently; a dev-mode warning fires
|
|
223
|
+
* so the missing linkage is visible during development.
|
|
224
|
+
*/
|
|
225
|
+
readonly controls: _angular_core.InputSignal<string | null>;
|
|
226
|
+
/**
|
|
227
|
+
* When true, click is ignored and the host reflects `data-disabled=""`,
|
|
228
|
+
* `aria-disabled="true"`, and the native `disabled` attribute so the
|
|
229
|
+
* trigger is announced as disabled by assistive tech and dropped from
|
|
230
|
+
* the tab order.
|
|
231
|
+
*/
|
|
232
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
233
|
+
constructor();
|
|
234
|
+
protected onClick(): void;
|
|
235
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForDialogTrigger, never>;
|
|
236
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForDialogTrigger, "[forDialogTrigger]", ["forDialogTrigger"], { "open": { "alias": "open"; "required": false; "isSignal": true; }; "controls": { "alias": "controls"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "open": "openChange"; }, never, never, true, never>;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Convenience: gives the host element a stable id and registers it as the
|
|
241
|
+
* dialog's accessible name (`aria-labelledby`). Apply on a heading element
|
|
242
|
+
* (`<h2>`, `<h3>`...) inside `[forDialog]`.
|
|
243
|
+
*
|
|
244
|
+
* If you don't render visible title text, omit this and pass `ariaLabel`
|
|
245
|
+
* on the dialog itself instead.
|
|
246
|
+
*/
|
|
247
|
+
declare class ForDialogTitle {
|
|
248
|
+
protected readonly id: _angular_core.Signal<string>;
|
|
249
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForDialogTitle, never>;
|
|
250
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForDialogTitle, "[forDialogTitle]", ["forDialogTitle"], {}, {}, never, never, true, never>;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Convenience: gives the host element a stable id and registers it as the
|
|
255
|
+
* dialog's accessible description (`aria-describedby`). Apply on a `<p>` or
|
|
256
|
+
* other element inside `[forDialog]`. Optional — only use when there's
|
|
257
|
+
* non-title supporting copy (the question of a confirm, the rationale of
|
|
258
|
+
* an alert).
|
|
259
|
+
*/
|
|
260
|
+
declare class ForDialogDescription {
|
|
261
|
+
protected readonly id: _angular_core.Signal<string>;
|
|
262
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForDialogDescription, never>;
|
|
263
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForDialogDescription, "[forDialogDescription]", ["forDialogDescription"], {}, {}, never, never, true, never>;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Button that closes the surrounding dialog when clicked. Apply on a
|
|
268
|
+
* `<button>` inside `[forDialog]`. Pass `[closeWith]` to propagate a return
|
|
269
|
+
* value to `ForDialogRef.close()` in programmatic usage; ignored in
|
|
270
|
+
* declarative usage.
|
|
271
|
+
*/
|
|
272
|
+
declare class ForDialogClose {
|
|
273
|
+
#private;
|
|
274
|
+
/** Optional value passed to `ForDialogRef.close()` (programmatic mode). */
|
|
275
|
+
readonly closeWith: _angular_core.InputSignal<unknown>;
|
|
276
|
+
protected onClick(): void;
|
|
277
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForDialogClose, never>;
|
|
278
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForDialogClose, "[forDialogClose]", ["forDialogClose"], { "closeWith": { "alias": "closeWith"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Optional backdrop overlay. Portaled to the dialog's `container` (the same
|
|
283
|
+
* target the surface uses) — `document.body` by default. While mounted the
|
|
284
|
+
* backdrop is visible; mount/unmount it alongside the dialog with the same
|
|
285
|
+
* `@if` so `animate.enter` / `animate.leave` works on both.
|
|
286
|
+
*
|
|
287
|
+
* The directive applies no visual styles — set `position: fixed; inset: 0;
|
|
288
|
+
* background: rgba(0,0,0,0.5)` (or whatever) yourself. For a backdrop inside a
|
|
289
|
+
* scoped `container`, use `position: absolute` so it is bounded to that box.
|
|
290
|
+
*/
|
|
291
|
+
declare class ForDialogBackdrop {
|
|
292
|
+
protected readonly ctx: forty_cdk_dialog.ForDialogContext;
|
|
293
|
+
/**
|
|
294
|
+
* Per-instance dialog id when opened through `ForDialogManager` (reflected
|
|
295
|
+
* as `data-for-dialog-id` so the manager can pair this portaled backdrop
|
|
296
|
+
* with its dialog and drive its exit animation). `null` in the declarative
|
|
297
|
+
* path, where the host binding emits no attribute.
|
|
298
|
+
*/
|
|
299
|
+
protected readonly instanceId: string | null;
|
|
300
|
+
constructor();
|
|
301
|
+
protected onClick(event: MouseEvent): void;
|
|
302
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForDialogBackdrop, never>;
|
|
303
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForDialogBackdrop, "[forDialogBackdrop]", ["forDialogBackdrop"], {}, {}, never, never, true, never>;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Handle returned by `ForDialogManager.open()`. Inject inside the opened
|
|
308
|
+
* component to drive close imperatively. Both reactive (`isClosed`, `result`)
|
|
309
|
+
* and awaitable (`closed`) APIs are exposed — pick what fits the call site.
|
|
310
|
+
*
|
|
311
|
+
* `R` is the close-result type. Default `unknown`; specify it on
|
|
312
|
+
* `manager.open<C, R>(...)` to get type safety.
|
|
313
|
+
*/
|
|
314
|
+
declare class ForDialogRef<R = unknown> extends OverlayRef<R> {
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Shape of a single open dialog entry stored in the manager.
|
|
319
|
+
*
|
|
320
|
+
* Internal — not re-exported from `public-api.ts`.
|
|
321
|
+
*/
|
|
322
|
+
interface ForDialogEntry extends OverlayManagerEntry {
|
|
323
|
+
readonly component: Type<unknown>;
|
|
324
|
+
readonly hostClass: string;
|
|
325
|
+
readonly dismissible: boolean | undefined;
|
|
326
|
+
readonly modal: boolean | undefined;
|
|
327
|
+
readonly alert: boolean | undefined;
|
|
328
|
+
readonly returnFocus: boolean | undefined;
|
|
329
|
+
readonly initialFocus: 'first' | 'container' | undefined;
|
|
330
|
+
readonly ariaLabel: string | undefined;
|
|
331
|
+
readonly container: HTMLElement | null | undefined;
|
|
332
|
+
readonly animateEnter: string | undefined;
|
|
333
|
+
readonly autoFocusOnOpen: ((e: VetoableEvent) => void) | undefined;
|
|
334
|
+
readonly autoFocusOnClose: ((e: VetoableEvent) => void) | undefined;
|
|
335
|
+
readonly escapeKeyDown: ((e: VetoableNativeEvent<KeyboardEvent>) => void) | undefined;
|
|
336
|
+
readonly pointerDownOutside: ((e: VetoableNativeEvent<PointerEvent>) => void) | undefined;
|
|
337
|
+
readonly focusOutside: ((e: VetoableNativeEvent<FocusEvent>) => void) | undefined;
|
|
338
|
+
readonly interactOutside: ((e: VetoableNativeEvent<PointerEvent | FocusEvent>) => void) | undefined;
|
|
339
|
+
handleClose(value: unknown): void;
|
|
340
|
+
injectorFor(parent: Injector): Injector;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Injection token for the `data` payload passed to `ForDialogManager.open(component, { data })`.
|
|
345
|
+
* The manager always provides this token, falling back to `null` when no `data`
|
|
346
|
+
* was configured, so inject it inside the opened component:
|
|
347
|
+
*
|
|
348
|
+
* ```ts
|
|
349
|
+
* readonly data = inject(FOR_DIALOG_DATA) as MyShape | null;
|
|
350
|
+
* ```
|
|
351
|
+
*
|
|
352
|
+
* Prefer `injectDialogData<T>()` for typed access without manual casts.
|
|
353
|
+
*/
|
|
354
|
+
declare const FOR_DIALOG_DATA: InjectionToken<unknown>;
|
|
355
|
+
/**
|
|
356
|
+
* Typed accessor for the `data` payload. Returns `T | null` because the manager
|
|
357
|
+
* provides `null` when `open()` is called without `data` — guard for `null`
|
|
358
|
+
* before dereferencing the payload.
|
|
359
|
+
*/
|
|
360
|
+
declare function injectDialogData<T = unknown>(): T | null;
|
|
361
|
+
interface ForDialogOpenConfig<D = unknown> {
|
|
362
|
+
/** Payload available inside the dialog component via `injectDialogData<T>()`. */
|
|
363
|
+
data?: D;
|
|
364
|
+
/** When true (default), Escape closes the dialog. */
|
|
365
|
+
dismissible?: boolean;
|
|
366
|
+
/** When true (default), set `aria-modal`, lock body scroll, trap focus. */
|
|
367
|
+
modal?: boolean;
|
|
368
|
+
/** When true, role becomes `alertdialog` instead of `dialog`. Default `false`. */
|
|
369
|
+
alert?: boolean;
|
|
370
|
+
/** When true (default), focus returns to the previously focused element on close. */
|
|
371
|
+
returnFocus?: boolean;
|
|
372
|
+
/** Where to send focus on open. Default `'first'`. */
|
|
373
|
+
initialFocus?: 'first' | 'container';
|
|
374
|
+
/** Manual `aria-label`. Use when no visible title element is rendered. */
|
|
375
|
+
ariaLabel?: string;
|
|
376
|
+
/**
|
|
377
|
+
* Portal target for the surface + backdrop. Defaults to `document.body`.
|
|
378
|
+
* Pair with `modal: false` for a dialog scoped to a positioned region
|
|
379
|
+
* instead of the viewport.
|
|
380
|
+
*/
|
|
381
|
+
container?: HTMLElement | null;
|
|
382
|
+
/**
|
|
383
|
+
* CSS class applied (via `animate.enter`) to the overlay root the moment it
|
|
384
|
+
* mounts, so a programmatic dialog plays an enter animation just like a
|
|
385
|
+
* declarative `<div forDialog animate.enter="…">`. The class lands on the
|
|
386
|
+
* same `[forDialog]` host as {@link class}. Falls back to
|
|
387
|
+
* `provideForDialogDefaults({ animateEnter })`.
|
|
388
|
+
*/
|
|
389
|
+
animateEnter?: string;
|
|
390
|
+
/**
|
|
391
|
+
* CSS class applied to the overlay root when `close()` is called. The
|
|
392
|
+
* manager keeps the host mounted with this class until its CSS animations /
|
|
393
|
+
* transitions finish, then tears the dialog down — so a programmatic dialog
|
|
394
|
+
* plays an exit animation. `close()` still resolves its promise and flips
|
|
395
|
+
* `isClosed()` immediately; only the visual teardown waits. With no class (or
|
|
396
|
+
* no animation, or under `prefers-reduced-motion`), close is immediate. Falls
|
|
397
|
+
* back to `provideForDialogDefaults({ animateLeave })`.
|
|
398
|
+
*/
|
|
399
|
+
animateLeave?: string;
|
|
400
|
+
/**
|
|
401
|
+
* Exit-animation class for the portaled `[forDialogBackdrop]`: the manager
|
|
402
|
+
* adds it when `close()` is called and keeps the backdrop mounted until the
|
|
403
|
+
* animation finishes, so the backdrop fades out in lockstep with the host.
|
|
404
|
+
*
|
|
405
|
+
* The split with the enter animation is intentional, not an oversight.
|
|
406
|
+
* Declare the backdrop's **enter** with `animate.enter="…"` on the element
|
|
407
|
+
* itself — it fires on mount, which Angular runs normally even inside the
|
|
408
|
+
* manager's `ngComponentOutlet` — and declare only its **leave** here. A
|
|
409
|
+
* template `animate.leave` on the backdrop never fires under the manager:
|
|
410
|
+
* Angular does not run leave animations across the `ngComponentOutlet` the
|
|
411
|
+
* opened component is mounted through. (The host box is symmetric — both
|
|
412
|
+
* `animateEnter` and `animateLeave` are config, since the manager owns that
|
|
413
|
+
* element.) Falls back to `provideForDialogDefaults({ backdropAnimateLeave })`.
|
|
414
|
+
*/
|
|
415
|
+
backdropAnimateLeave?: string;
|
|
416
|
+
/**
|
|
417
|
+
* Consumer CSS class(es) applied to the overlay root (the `[forDialog]`
|
|
418
|
+
* host). Pass a single class (`'my-dialog'`) or a space-separated string
|
|
419
|
+
* (`'my-dialog my-dialog--pop'`). Merged with the directive's own host
|
|
420
|
+
* attributes — it never clobbers `data-state` / `role` / `aria-modal`.
|
|
421
|
+
*
|
|
422
|
+
* Use this to carry design-system classes onto a programmatic dialog: the
|
|
423
|
+
* host is created class-less and the literal `[forDialog]` attribute is
|
|
424
|
+
* absent, so without this the consumer has no node to style. For multiple
|
|
425
|
+
* classes as an array, prefer {@link classList}.
|
|
426
|
+
*/
|
|
427
|
+
class?: string;
|
|
428
|
+
/**
|
|
429
|
+
* Consumer CSS class(es) applied to the overlay root, as an array
|
|
430
|
+
* (`['my-dialog', 'my-dialog--pop']`) or a space-separated string. Merged
|
|
431
|
+
* with {@link class} and with the directive's own host attributes.
|
|
432
|
+
*/
|
|
433
|
+
classList?: string | readonly string[];
|
|
434
|
+
/** Extra providers for the opened component's injector (alongside `FOR_DIALOG_DATA` + `ForDialogRef`). */
|
|
435
|
+
providers?: Provider[];
|
|
436
|
+
/**
|
|
437
|
+
* Fires just before the dialog moves focus into itself on mount.
|
|
438
|
+
* Call `event.preventDefault()` to skip the imperative focus move
|
|
439
|
+
* — useful when opening a dialog from an input you want to keep
|
|
440
|
+
* focused. The focus trap (modal mode) still cycles Tab once focus
|
|
441
|
+
* enters the dialog.
|
|
442
|
+
*/
|
|
443
|
+
autoFocusOnOpen?: (event: VetoableEvent) => void;
|
|
444
|
+
/**
|
|
445
|
+
* Fires just before focus returns to the previously focused element
|
|
446
|
+
* on unmount. Call `event.preventDefault()` to skip the return-focus.
|
|
447
|
+
*/
|
|
448
|
+
autoFocusOnClose?: (event: VetoableEvent) => void;
|
|
449
|
+
/**
|
|
450
|
+
* Per-channel dismiss hook mirroring the declarative `(escapeKeyDown)`
|
|
451
|
+
* output. Fires when Escape is pressed while this dialog is the topmost
|
|
452
|
+
* dismissable layer. Call `event.preventDefault()` on the veto to suppress
|
|
453
|
+
* the implicit close while keeping the other dismiss channels live — the
|
|
454
|
+
* programmatic equivalent of `(escapeKeyDown)="$event.preventDefault()"`.
|
|
455
|
+
* The original `KeyboardEvent` is on `.event`.
|
|
456
|
+
*/
|
|
457
|
+
escapeKeyDown?: (event: VetoableNativeEvent<KeyboardEvent>) => void;
|
|
458
|
+
/**
|
|
459
|
+
* Per-channel dismiss hook mirroring the declarative `(pointerDownOutside)`
|
|
460
|
+
* output. Fires when a pointer goes down outside the dialog. Call
|
|
461
|
+
* `event.preventDefault()` on the veto to suppress the implicit close. The
|
|
462
|
+
* native `PointerEvent` is on `.event`.
|
|
463
|
+
*/
|
|
464
|
+
pointerDownOutside?: (event: VetoableNativeEvent<PointerEvent>) => void;
|
|
465
|
+
/**
|
|
466
|
+
* Per-channel dismiss hook mirroring the declarative `(focusOutside)`
|
|
467
|
+
* output. Fires when focus moves outside the dialog. Call
|
|
468
|
+
* `event.preventDefault()` on the veto to suppress the implicit close. The
|
|
469
|
+
* native `FocusEvent` is on `.event`.
|
|
470
|
+
*/
|
|
471
|
+
focusOutside?: (event: VetoableNativeEvent<FocusEvent>) => void;
|
|
472
|
+
/**
|
|
473
|
+
* Composite dismiss hook mirroring the declarative `(interactOutside)`
|
|
474
|
+
* output. Fires alongside `pointerDownOutside` / `focusOutside` and shares
|
|
475
|
+
* their veto state — `event.preventDefault()` on either suppresses the
|
|
476
|
+
* implicit close. Use this to keep a programmatic floater open on outside
|
|
477
|
+
* interaction while leaving Escape live (set `dismissible: true` and veto
|
|
478
|
+
* here). The native `PointerEvent | FocusEvent` is on `.event`.
|
|
479
|
+
*/
|
|
480
|
+
interactOutside?: (event: VetoableNativeEvent<PointerEvent | FocusEvent>) => void;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Programmatic dialog opener — open a component as a modal dialog from
|
|
484
|
+
* TypeScript. Inject anywhere, call `open(MyComponent, { data, ... })` and get a
|
|
485
|
+
* `ForDialogRef<R>` back. Internally the manager renders the user component
|
|
486
|
+
* inside a manager-owned `@for` outlet, so Angular's control-flow unmount
|
|
487
|
+
* fires `animate.leave` before the node leaves the DOM — identical to the
|
|
488
|
+
* declarative `@if (open()) { <div forDialog animate.leave="…"> }` path.
|
|
489
|
+
*
|
|
490
|
+
* Inside the opened component the usual dialog pieces work without any extra
|
|
491
|
+
* wiring: `[forDialogTitle]`, `[forDialogDescription]`, `[forDialogBackdrop]`,
|
|
492
|
+
* `[forDialogClose]`. `[forDialogClose] [closeWith]` propagates through to
|
|
493
|
+
* `ForDialogRef.close(value)`.
|
|
494
|
+
*
|
|
495
|
+
* Inject `ForDialogRef` to drive close imperatively and `FOR_DIALOG_DATA` (or
|
|
496
|
+
* `injectDialogData<T>()`) for the payload.
|
|
497
|
+
*/
|
|
498
|
+
declare class ForDialogManager extends OverlayManagerCore<ForDialogEntry> {
|
|
499
|
+
#private;
|
|
500
|
+
constructor();
|
|
501
|
+
open<C, R = unknown, D = unknown>(component: Type<C>, config?: ForDialogOpenConfig<D>): ForDialogRef<R>;
|
|
502
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForDialogManager, never>;
|
|
503
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ForDialogManager>;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Defaults inherited by descendant dialogs in the surrounding injector
|
|
508
|
+
* scope. Configure with `provideForDialogDefaults`. Applies to both
|
|
509
|
+
* declarative dialogs and `ForDialogManager.open()`; the manager resolves
|
|
510
|
+
* `config[key] ?? defaults[key]` so a per-`open()` value always wins over the
|
|
511
|
+
* scope default.
|
|
512
|
+
*/
|
|
513
|
+
interface ForDialogDefaults {
|
|
514
|
+
/**
|
|
515
|
+
* CSS class applied (via `animate.enter`) to the programmatic overlay host
|
|
516
|
+
* when it mounts, so it plays an enter animation. The class lands on the
|
|
517
|
+
* `[forDialog]` host that also carries the consumer `class`. No default.
|
|
518
|
+
*/
|
|
519
|
+
animateEnter?: string;
|
|
520
|
+
/**
|
|
521
|
+
* CSS class applied to the programmatic overlay host when `close()` is
|
|
522
|
+
* called, kept on the still-mounted host until its CSS animations finish so
|
|
523
|
+
* an exit transition plays before teardown. No default (close is immediate).
|
|
524
|
+
*/
|
|
525
|
+
animateLeave?: string;
|
|
526
|
+
/**
|
|
527
|
+
* CSS class applied to the portaled `[forDialogBackdrop]` when `close()` is
|
|
528
|
+
* called, so the backdrop plays an exit animation in lockstep with the
|
|
529
|
+
* host. Needed because a backdrop declared inside the opened component plays
|
|
530
|
+
* its `animate.enter` on mount but cannot run its template `animate.leave` —
|
|
531
|
+
* Angular does not process leave animations across the `ngComponentOutlet`
|
|
532
|
+
* boundary the manager mounts the component through. No default.
|
|
533
|
+
*/
|
|
534
|
+
backdropAnimateLeave?: string;
|
|
535
|
+
}
|
|
536
|
+
/** Token holding the resolved dialog defaults for the current scope. */
|
|
537
|
+
declare const FOR_DIALOG_DEFAULTS: _angular_core.InjectionToken<ForDialogDefaults>;
|
|
538
|
+
/**
|
|
539
|
+
* Configures forty-cdk dialog defaults for this injector scope. Partial
|
|
540
|
+
* overrides inherit unspecified keys from the parent scope (or library
|
|
541
|
+
* defaults at the root).
|
|
542
|
+
*/
|
|
543
|
+
declare function provideForDialogDefaults(defaults?: Partial<ForDialogDefaults>): Provider[];
|
|
544
|
+
|
|
545
|
+
export { FOR_DIALOG_CONTEXT, FOR_DIALOG_DATA, FOR_DIALOG_DEFAULTS, ForDialog, ForDialogBackdrop, ForDialogClose, ForDialogDescription, ForDialogManager, ForDialogRef, ForDialogTitle, ForDialogTrigger, injectDialogData, provideForDialogDefaults };
|
|
546
|
+
export type { ForDialogCloseReason, ForDialogContext, ForDialogDefaults, ForDialogOpenConfig };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { InjectionToken, Signal, Provider } from '@angular/core';
|
|
3
|
+
import * as forty_cdk_disclosure from 'forty-cdk/disclosure';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Shared state contract between the pieces of a Disclosure primitive.
|
|
7
|
+
* Provided by `ForDisclosure`, consumed by `ForDisclosureTrigger` and
|
|
8
|
+
* `ForDisclosureContent`.
|
|
9
|
+
*/
|
|
10
|
+
interface ForDisclosureContext {
|
|
11
|
+
readonly open: Signal<boolean>;
|
|
12
|
+
readonly disabled: Signal<boolean>;
|
|
13
|
+
readonly triggerId: Signal<string>;
|
|
14
|
+
readonly contentId: Signal<string>;
|
|
15
|
+
/** Adopts a consumer-set static `id` on the trigger host into `triggerId`. */
|
|
16
|
+
adoptTriggerId(el: HTMLElement): void;
|
|
17
|
+
/** Adopts a consumer-set static `id` on the content host into `contentId`. */
|
|
18
|
+
adoptContentId(el: HTMLElement): void;
|
|
19
|
+
toggle(): void;
|
|
20
|
+
}
|
|
21
|
+
declare const FOR_DISCLOSURE_CONTEXT: InjectionToken<ForDisclosureContext>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Root of the Disclosure primitive. Holds the open/disabled state and
|
|
25
|
+
* the IDs that wire the trigger to its content.
|
|
26
|
+
*
|
|
27
|
+
* Implements the [WAI-ARIA Disclosure pattern](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/).
|
|
28
|
+
*
|
|
29
|
+
* Compose it on any wrapper element with `[forDisclosureTrigger]` and
|
|
30
|
+
* `[forDisclosureContent]` as descendants.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```html
|
|
34
|
+
* <div forDisclosure [(open)]="isOpen">
|
|
35
|
+
* <button type="button" forDisclosureTrigger>Toggle</button>
|
|
36
|
+
* <div forDisclosureContent>...</div>
|
|
37
|
+
* </div>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare class ForDisclosure implements ForDisclosureContext {
|
|
41
|
+
#private;
|
|
42
|
+
/**
|
|
43
|
+
* Two-way bindable open state. Use `[(open)]` for both read & write, or
|
|
44
|
+
* `(openChange)` alone to observe transitions when the directive itself
|
|
45
|
+
* toggles state (trigger click). The `model()` change emitter does NOT fire
|
|
46
|
+
* for consumer-driven writes via `[(open)]`, so subscribing to
|
|
47
|
+
* `(openChange)` is safe and only sees internal transitions.
|
|
48
|
+
*/
|
|
49
|
+
readonly open: _angular_core.ModelSignal<boolean>;
|
|
50
|
+
/** When true, click on the trigger is ignored and `data-disabled` is reflected. */
|
|
51
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
52
|
+
readonly triggerId: _angular_core.Signal<string>;
|
|
53
|
+
readonly contentId: _angular_core.Signal<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Adopts a consumer-set static `id` on the `[forDisclosureTrigger]` host into
|
|
56
|
+
* `triggerId` (preserving anchors / external `aria-labelledby` references /
|
|
57
|
+
* label `for`) instead of letting the `[id]` host binding clobber it.
|
|
58
|
+
*/
|
|
59
|
+
adoptTriggerId(el: HTMLElement): void;
|
|
60
|
+
/** Adopts a consumer-set static `id` on the content host into `contentId`. */
|
|
61
|
+
adoptContentId(el: HTMLElement): void;
|
|
62
|
+
toggle(): void;
|
|
63
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForDisclosure, never>;
|
|
64
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForDisclosure, "[forDisclosure]", ["forDisclosure"], { "open": { "alias": "open"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "open": "openChange"; }, never, never, true, never>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Trigger button for a `ForDisclosure`. Apply on a `<button>` so Enter/Space
|
|
69
|
+
* toggling come from native button behavior. The directive host-binds
|
|
70
|
+
* `type="button"` so a trigger inside a `<form>` never submits it on toggle.
|
|
71
|
+
*
|
|
72
|
+
* `aria-controls` is emitted only while open — mirroring the overlay triggers'
|
|
73
|
+
* open-only gating — so the reference never dangles at an unmounted panel
|
|
74
|
+
* under the recommended `@if (open())` mount pattern.
|
|
75
|
+
*
|
|
76
|
+
* Disabling: the trigger merges its own `disabled` input OR the root's
|
|
77
|
+
* `disabled` into `effectiveDisabled`, which drives the native `disabled`
|
|
78
|
+
* attribute, `aria-disabled`, `data-disabled`, and the click guard.
|
|
79
|
+
*/
|
|
80
|
+
declare class ForDisclosureTrigger {
|
|
81
|
+
protected readonly ctx: forty_cdk_disclosure.ForDisclosureContext;
|
|
82
|
+
/** Disables this trigger only, in addition to the root's `disabled`. */
|
|
83
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
84
|
+
/** Whether the trigger is disabled — its own `disabled` input OR the root's. */
|
|
85
|
+
readonly effectiveDisabled: _angular_core.Signal<boolean>;
|
|
86
|
+
constructor();
|
|
87
|
+
protected onClick(): void;
|
|
88
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForDisclosureTrigger, never>;
|
|
89
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForDisclosureTrigger, "[forDisclosureTrigger]", ["forDisclosureTrigger"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Disclosed content panel for a `ForDisclosure`. The directive does not
|
|
94
|
+
* manage DOM presence — wrap with `@if (open())` so the panel mounts and
|
|
95
|
+
* unmounts with the disclosure state, and use `animate.enter` /
|
|
96
|
+
* `animate.leave` for transitions if desired. If the consumer prefers to
|
|
97
|
+
* keep the panel mounted (for CSS-only transitions or to preserve internal
|
|
98
|
+
* state), the directive reflects `aria-hidden="true"` and `inert` while
|
|
99
|
+
* closed so the panel is removed from the accessibility tree and focus
|
|
100
|
+
* order automatically.
|
|
101
|
+
*/
|
|
102
|
+
declare class ForDisclosureContent {
|
|
103
|
+
protected readonly ctx: forty_cdk_disclosure.ForDisclosureContext;
|
|
104
|
+
constructor();
|
|
105
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForDisclosureContent, never>;
|
|
106
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForDisclosureContent, "[forDisclosureContent]", ["forDisclosureContent"], {}, {}, never, never, true, never>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Defaults inherited by descendant disclosures in the surrounding injector
|
|
111
|
+
* scope. Configure with `provideForDisclosureDefaults`. The shape is a stub
|
|
112
|
+
* today — present so future per-scope tuning can land without churning the
|
|
113
|
+
* public surface.
|
|
114
|
+
*/
|
|
115
|
+
interface ForDisclosureDefaults {
|
|
116
|
+
}
|
|
117
|
+
/** Token holding the resolved disclosure defaults for the current scope. */
|
|
118
|
+
declare const FOR_DISCLOSURE_DEFAULTS: _angular_core.InjectionToken<ForDisclosureDefaults>;
|
|
119
|
+
/**
|
|
120
|
+
* Configures forty-cdk disclosure defaults for this injector scope. Partial
|
|
121
|
+
* overrides inherit unspecified keys from the parent scope (or library
|
|
122
|
+
* defaults at the root).
|
|
123
|
+
*/
|
|
124
|
+
declare function provideForDisclosureDefaults(defaults?: Partial<ForDisclosureDefaults>): Provider[];
|
|
125
|
+
|
|
126
|
+
export { FOR_DISCLOSURE_CONTEXT, FOR_DISCLOSURE_DEFAULTS, ForDisclosure, ForDisclosureContent, ForDisclosureTrigger, provideForDisclosureDefaults };
|
|
127
|
+
export type { ForDisclosureContext, ForDisclosureDefaults };
|