@rivinia/modal 0.4.0 → 0.5.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.
- package/README.md +111 -1
- package/fesm2022/rivinia-modal-ui.mjs +1003 -0
- package/fesm2022/rivinia-modal-ui.mjs.map +1 -0
- package/package.json +6 -1
- package/types/rivinia-modal-ui.d.ts +332 -0
|
@@ -0,0 +1,1003 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, DOCUMENT, Directive, Injector, Service, ViewEncapsulation, computed, contentChild, effect, inject, input, model, output, signal, viewChild } from "@angular/core";
|
|
3
|
+
import { NgComponentOutlet, NgTemplateOutlet } from "@angular/common";
|
|
4
|
+
import { RIVINIA_MODAL_CONTEXT } from "@rivinia/modal";
|
|
5
|
+
var RiviniaModalScrollLock = class RiviniaModalScrollLock {
|
|
6
|
+
_doc = inject(DOCUMENT, { optional: true });
|
|
7
|
+
_locks = 0;
|
|
8
|
+
_previousOverflow = null;
|
|
9
|
+
get active() {
|
|
10
|
+
return this._locks;
|
|
11
|
+
}
|
|
12
|
+
acquire() {
|
|
13
|
+
const doc = this.document;
|
|
14
|
+
if (!doc) return;
|
|
15
|
+
this._locks += 1;
|
|
16
|
+
if (this._locks > 1) return;
|
|
17
|
+
const body = doc.body;
|
|
18
|
+
this._previousOverflow = body.style.overflow || null;
|
|
19
|
+
body.style.overflow = "hidden";
|
|
20
|
+
doc.documentElement.style.setProperty("scrollbar-gutter", "stable");
|
|
21
|
+
}
|
|
22
|
+
release() {
|
|
23
|
+
const doc = this.document;
|
|
24
|
+
if (!doc || this._locks === 0) {
|
|
25
|
+
this._locks = 0;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
this._locks -= 1;
|
|
29
|
+
if (this._locks > 0) return;
|
|
30
|
+
const body = doc.body;
|
|
31
|
+
if (this._previousOverflow === null) body.style.removeProperty("overflow");
|
|
32
|
+
else body.style.overflow = this._previousOverflow;
|
|
33
|
+
this._previousOverflow = null;
|
|
34
|
+
doc.documentElement.style.removeProperty("scrollbar-gutter");
|
|
35
|
+
}
|
|
36
|
+
get document() {
|
|
37
|
+
try {
|
|
38
|
+
return this._doc ?? (typeof document === "undefined" ? null : document);
|
|
39
|
+
} catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
44
|
+
minVersion: "12.0.0",
|
|
45
|
+
version: "22.2.2",
|
|
46
|
+
ngImport: i0,
|
|
47
|
+
type: RiviniaModalScrollLock,
|
|
48
|
+
deps: [],
|
|
49
|
+
target: i0.ɵɵFactoryTarget.Service
|
|
50
|
+
});
|
|
51
|
+
static ɵprov = i0.ɵɵngDeclareService({
|
|
52
|
+
minVersion: "22.0.0",
|
|
53
|
+
version: "22.2.2",
|
|
54
|
+
ngImport: i0,
|
|
55
|
+
type: RiviniaModalScrollLock
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
59
|
+
minVersion: "12.0.0",
|
|
60
|
+
version: "22.2.2",
|
|
61
|
+
ngImport: i0,
|
|
62
|
+
type: RiviniaModalScrollLock,
|
|
63
|
+
decorators: [{ type: Service }]
|
|
64
|
+
});
|
|
65
|
+
const EXIT_FALLBACK_MS = 200;
|
|
66
|
+
var RvModalHeader = class RvModalHeader {
|
|
67
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
68
|
+
minVersion: "12.0.0",
|
|
69
|
+
version: "22.2.2",
|
|
70
|
+
ngImport: i0,
|
|
71
|
+
type: RvModalHeader,
|
|
72
|
+
deps: [],
|
|
73
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
74
|
+
});
|
|
75
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
76
|
+
minVersion: "14.0.0",
|
|
77
|
+
version: "22.2.2",
|
|
78
|
+
type: RvModalHeader,
|
|
79
|
+
isStandalone: true,
|
|
80
|
+
selector: "[rvModalHeader]",
|
|
81
|
+
ngImport: i0
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
85
|
+
minVersion: "12.0.0",
|
|
86
|
+
version: "22.2.2",
|
|
87
|
+
ngImport: i0,
|
|
88
|
+
type: RvModalHeader,
|
|
89
|
+
decorators: [{
|
|
90
|
+
type: Directive,
|
|
91
|
+
args: [{
|
|
92
|
+
selector: "[rvModalHeader]",
|
|
93
|
+
standalone: true
|
|
94
|
+
}]
|
|
95
|
+
}]
|
|
96
|
+
});
|
|
97
|
+
var RvModalFooter = class RvModalFooter {
|
|
98
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
99
|
+
minVersion: "12.0.0",
|
|
100
|
+
version: "22.2.2",
|
|
101
|
+
ngImport: i0,
|
|
102
|
+
type: RvModalFooter,
|
|
103
|
+
deps: [],
|
|
104
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
105
|
+
});
|
|
106
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
107
|
+
minVersion: "14.0.0",
|
|
108
|
+
version: "22.2.2",
|
|
109
|
+
type: RvModalFooter,
|
|
110
|
+
isStandalone: true,
|
|
111
|
+
selector: "[rvModalFooter]",
|
|
112
|
+
ngImport: i0
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
116
|
+
minVersion: "12.0.0",
|
|
117
|
+
version: "22.2.2",
|
|
118
|
+
ngImport: i0,
|
|
119
|
+
type: RvModalFooter,
|
|
120
|
+
decorators: [{
|
|
121
|
+
type: Directive,
|
|
122
|
+
args: [{
|
|
123
|
+
selector: "[rvModalFooter]",
|
|
124
|
+
standalone: true
|
|
125
|
+
}]
|
|
126
|
+
}]
|
|
127
|
+
});
|
|
128
|
+
var RiviniaModalDialog = class RiviniaModalDialog {
|
|
129
|
+
open = model(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
|
|
130
|
+
title = input("", ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
|
|
131
|
+
description = input("", ...ngDevMode ? [{ debugName: "description" }] : /* istanbul ignore next */ []);
|
|
132
|
+
ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
133
|
+
size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
134
|
+
position = input("center", ...ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []);
|
|
135
|
+
animation = input("scale", ...ngDevMode ? [{ debugName: "animation" }] : /* istanbul ignore next */ []);
|
|
136
|
+
closeOnEscape = input(true, ...ngDevMode ? [{ debugName: "closeOnEscape" }] : /* istanbul ignore next */ []);
|
|
137
|
+
backdrop = input("close", ...ngDevMode ? [{ debugName: "backdrop" }] : /* istanbul ignore next */ []);
|
|
138
|
+
showCloseButton = input(true, ...ngDevMode ? [{ debugName: "showCloseButton" }] : /* istanbul ignore next */ []);
|
|
139
|
+
managed = input(false, ...ngDevMode ? [{ debugName: "managed" }] : /* istanbul ignore next */ []);
|
|
140
|
+
closing = input(false, ...ngDevMode ? [{ debugName: "closing" }] : /* istanbul ignore next */ []);
|
|
141
|
+
confirmed = output();
|
|
142
|
+
dismissed = output();
|
|
143
|
+
cancelled = output();
|
|
144
|
+
dismissRequested = output();
|
|
145
|
+
exitDone = output();
|
|
146
|
+
dialog = viewChild("dialog", ...ngDevMode ? [{ debugName: "dialog" }] : /* istanbul ignore next */ []);
|
|
147
|
+
headerSlot = contentChild(RvModalHeader, ...ngDevMode ? [{ debugName: "headerSlot" }] : /* istanbul ignore next */ []);
|
|
148
|
+
footerSlot = contentChild(RvModalFooter, ...ngDevMode ? [{ debugName: "footerSlot" }] : /* istanbul ignore next */ []);
|
|
149
|
+
doc = inject(DOCUMENT, { optional: true });
|
|
150
|
+
scrollLock = inject(RiviniaModalScrollLock, { optional: true });
|
|
151
|
+
titleId = `rv-modal-${++dialogSeq}`;
|
|
152
|
+
descriptionId = `rv-modal-desc-${dialogSeq}`;
|
|
153
|
+
phase = signal("closed", ...ngDevMode ? [{ debugName: "phase" }] : /* istanbul ignore next */ []);
|
|
154
|
+
invoker = { current: null };
|
|
155
|
+
exitTimer = null;
|
|
156
|
+
state = computed(() => this.phase(), ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
157
|
+
hasCustomHeader = computed(() => this.headerSlot() !== void 0, ...ngDevMode ? [{ debugName: "hasCustomHeader" }] : /* istanbul ignore next */ []);
|
|
158
|
+
hasCustomFooter = computed(() => this.footerSlot() !== void 0, ...ngDevMode ? [{ debugName: "hasCustomFooter" }] : /* istanbul ignore next */ []);
|
|
159
|
+
computedLabel = computed(() => this.ariaLabel() || null, ...ngDevMode ? [{ debugName: "computedLabel" }] : /* istanbul ignore next */ []);
|
|
160
|
+
constructor() {
|
|
161
|
+
effect(() => {
|
|
162
|
+
if (this.open()) this.show();
|
|
163
|
+
else if (this.phase() === "open") this.hide();
|
|
164
|
+
});
|
|
165
|
+
effect(() => {
|
|
166
|
+
if (this.managed() && this.closing() && this.phase() === "open") this.playExit(() => this.exitDone.emit());
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
confirm(value) {
|
|
170
|
+
if (this.phase() !== "open") return false;
|
|
171
|
+
this.finish("confirmed", value);
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
close(value) {
|
|
175
|
+
return value === void 0 ? this.dismiss() : this.confirm(value);
|
|
176
|
+
}
|
|
177
|
+
dismiss(reason) {
|
|
178
|
+
if (this.phase() !== "open") return false;
|
|
179
|
+
this.finish("dismissed", void 0, reason);
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
cancel(reason) {
|
|
183
|
+
if (this.phase() !== "open") return false;
|
|
184
|
+
this.finish("cancelled", void 0, reason);
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
onCloseButton() {
|
|
188
|
+
if (this.managed()) {
|
|
189
|
+
if (this.phase() === "open") this.dismissRequested.emit("button");
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
this.dismiss("close-button");
|
|
193
|
+
}
|
|
194
|
+
onCancel(event) {
|
|
195
|
+
if (!this.closeOnEscape()) {
|
|
196
|
+
event.preventDefault();
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
event.preventDefault();
|
|
200
|
+
if (this.managed()) {
|
|
201
|
+
if (this.phase() === "open") this.dismissRequested.emit("escape");
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
this.dismiss("escape");
|
|
205
|
+
}
|
|
206
|
+
onBackdropClick(event) {
|
|
207
|
+
const el = this.dialog()?.nativeElement;
|
|
208
|
+
if (!el || event.target !== el) return;
|
|
209
|
+
if (this.backdrop() !== "close") return;
|
|
210
|
+
if (this.managed()) {
|
|
211
|
+
if (this.phase() === "open") this.dismissRequested.emit("backdrop");
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
this.dismiss("backdrop");
|
|
215
|
+
}
|
|
216
|
+
onKeydown(event) {
|
|
217
|
+
if (event.key !== "Tab") return;
|
|
218
|
+
const el = this.dialog()?.nativeElement;
|
|
219
|
+
if (!el) return;
|
|
220
|
+
const items = focusables(el);
|
|
221
|
+
if (items.length === 0) {
|
|
222
|
+
event.preventDefault();
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const first = items[0];
|
|
226
|
+
const last = items[items.length - 1];
|
|
227
|
+
const active = (this.doc ?? document).activeElement;
|
|
228
|
+
if (event.shiftKey && (active === first || !el.contains(active))) {
|
|
229
|
+
event.preventDefault();
|
|
230
|
+
last.focus();
|
|
231
|
+
} else if (!event.shiftKey && active === last) {
|
|
232
|
+
event.preventDefault();
|
|
233
|
+
first.focus();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
get live() {
|
|
237
|
+
return typeof window !== "undefined" && !!this.doc;
|
|
238
|
+
}
|
|
239
|
+
show() {
|
|
240
|
+
if (!this.live) return;
|
|
241
|
+
const el = this.dialog()?.nativeElement;
|
|
242
|
+
if (!el || this.phase() !== "closed") return;
|
|
243
|
+
try {
|
|
244
|
+
this.invoker.current = this.doc?.activeElement ?? null;
|
|
245
|
+
} catch {
|
|
246
|
+
this.invoker.current = null;
|
|
247
|
+
}
|
|
248
|
+
this.scrollLock?.acquire();
|
|
249
|
+
this.phase.set("open");
|
|
250
|
+
if (!el.open) try {
|
|
251
|
+
el.showModal();
|
|
252
|
+
} catch {}
|
|
253
|
+
focusFirst(el, this.showCloseButton());
|
|
254
|
+
}
|
|
255
|
+
hide() {
|
|
256
|
+
if (this.phase() === "closed") return;
|
|
257
|
+
this.teardown(false);
|
|
258
|
+
}
|
|
259
|
+
finish(kind, value, reason) {
|
|
260
|
+
this.teardown(true);
|
|
261
|
+
if (kind === "confirmed") this.confirmed.emit(value);
|
|
262
|
+
else if (kind === "dismissed") this.dismissed.emit(reason);
|
|
263
|
+
else this.cancelled.emit(reason);
|
|
264
|
+
if (this.open()) this.open.set(false);
|
|
265
|
+
}
|
|
266
|
+
teardown(animate) {
|
|
267
|
+
if (!animate) {
|
|
268
|
+
if (this.exitTimer) {
|
|
269
|
+
clearTimeout(this.exitTimer);
|
|
270
|
+
this.exitTimer = null;
|
|
271
|
+
}
|
|
272
|
+
this.finalize(this.dialog()?.nativeElement ?? null);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
this.playExit(() => {});
|
|
276
|
+
}
|
|
277
|
+
playExit(done) {
|
|
278
|
+
if (this.phase() !== "open") {
|
|
279
|
+
done();
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (this.exitTimer) {
|
|
283
|
+
clearTimeout(this.exitTimer);
|
|
284
|
+
this.exitTimer = null;
|
|
285
|
+
}
|
|
286
|
+
const el = this.dialog()?.nativeElement ?? null;
|
|
287
|
+
const animated = this.animation() !== "none" && this.prefersMotion() && !!el?.open;
|
|
288
|
+
this.phase.set(animated ? "closing" : "closed");
|
|
289
|
+
if (!animated) {
|
|
290
|
+
this.finalize(el);
|
|
291
|
+
done();
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
this.exitTimer = setTimeout(() => {
|
|
295
|
+
this.finalize(el);
|
|
296
|
+
done();
|
|
297
|
+
}, this.exitDurationMs(el));
|
|
298
|
+
}
|
|
299
|
+
exitDurationMs(el) {
|
|
300
|
+
try {
|
|
301
|
+
const seconds = (el ? getComputedStyle(el).animationDuration : "").split(",").map((part) => parseFloat(part)).filter((n) => Number.isFinite(n));
|
|
302
|
+
if (seconds.length > 0) return Math.max(0, Math.max(...seconds) * 1e3) + 50;
|
|
303
|
+
} catch {}
|
|
304
|
+
return EXIT_FALLBACK_MS;
|
|
305
|
+
}
|
|
306
|
+
finalize(el) {
|
|
307
|
+
this.exitTimer = null;
|
|
308
|
+
try {
|
|
309
|
+
el?.close();
|
|
310
|
+
} catch {}
|
|
311
|
+
this.phase.set("closed");
|
|
312
|
+
this.scrollLock?.release();
|
|
313
|
+
const invoker = this.invoker.current;
|
|
314
|
+
this.invoker.current = null;
|
|
315
|
+
try {
|
|
316
|
+
invoker?.focus?.();
|
|
317
|
+
} catch {}
|
|
318
|
+
}
|
|
319
|
+
prefersMotion() {
|
|
320
|
+
try {
|
|
321
|
+
return typeof window !== "undefined" && !window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
322
|
+
} catch {
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
327
|
+
minVersion: "12.0.0",
|
|
328
|
+
version: "22.2.2",
|
|
329
|
+
ngImport: i0,
|
|
330
|
+
type: RiviniaModalDialog,
|
|
331
|
+
deps: [],
|
|
332
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
333
|
+
});
|
|
334
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
335
|
+
minVersion: "17.0.0",
|
|
336
|
+
version: "22.2.2",
|
|
337
|
+
type: RiviniaModalDialog,
|
|
338
|
+
isStandalone: true,
|
|
339
|
+
selector: "rv-modal-dialog",
|
|
340
|
+
inputs: {
|
|
341
|
+
open: {
|
|
342
|
+
classPropertyName: "open",
|
|
343
|
+
publicName: "open",
|
|
344
|
+
isSignal: true,
|
|
345
|
+
isRequired: false,
|
|
346
|
+
transformFunction: null
|
|
347
|
+
},
|
|
348
|
+
title: {
|
|
349
|
+
classPropertyName: "title",
|
|
350
|
+
publicName: "title",
|
|
351
|
+
isSignal: true,
|
|
352
|
+
isRequired: false,
|
|
353
|
+
transformFunction: null
|
|
354
|
+
},
|
|
355
|
+
description: {
|
|
356
|
+
classPropertyName: "description",
|
|
357
|
+
publicName: "description",
|
|
358
|
+
isSignal: true,
|
|
359
|
+
isRequired: false,
|
|
360
|
+
transformFunction: null
|
|
361
|
+
},
|
|
362
|
+
ariaLabel: {
|
|
363
|
+
classPropertyName: "ariaLabel",
|
|
364
|
+
publicName: "ariaLabel",
|
|
365
|
+
isSignal: true,
|
|
366
|
+
isRequired: false,
|
|
367
|
+
transformFunction: null
|
|
368
|
+
},
|
|
369
|
+
size: {
|
|
370
|
+
classPropertyName: "size",
|
|
371
|
+
publicName: "size",
|
|
372
|
+
isSignal: true,
|
|
373
|
+
isRequired: false,
|
|
374
|
+
transformFunction: null
|
|
375
|
+
},
|
|
376
|
+
position: {
|
|
377
|
+
classPropertyName: "position",
|
|
378
|
+
publicName: "position",
|
|
379
|
+
isSignal: true,
|
|
380
|
+
isRequired: false,
|
|
381
|
+
transformFunction: null
|
|
382
|
+
},
|
|
383
|
+
animation: {
|
|
384
|
+
classPropertyName: "animation",
|
|
385
|
+
publicName: "animation",
|
|
386
|
+
isSignal: true,
|
|
387
|
+
isRequired: false,
|
|
388
|
+
transformFunction: null
|
|
389
|
+
},
|
|
390
|
+
closeOnEscape: {
|
|
391
|
+
classPropertyName: "closeOnEscape",
|
|
392
|
+
publicName: "closeOnEscape",
|
|
393
|
+
isSignal: true,
|
|
394
|
+
isRequired: false,
|
|
395
|
+
transformFunction: null
|
|
396
|
+
},
|
|
397
|
+
backdrop: {
|
|
398
|
+
classPropertyName: "backdrop",
|
|
399
|
+
publicName: "backdrop",
|
|
400
|
+
isSignal: true,
|
|
401
|
+
isRequired: false,
|
|
402
|
+
transformFunction: null
|
|
403
|
+
},
|
|
404
|
+
showCloseButton: {
|
|
405
|
+
classPropertyName: "showCloseButton",
|
|
406
|
+
publicName: "showCloseButton",
|
|
407
|
+
isSignal: true,
|
|
408
|
+
isRequired: false,
|
|
409
|
+
transformFunction: null
|
|
410
|
+
},
|
|
411
|
+
managed: {
|
|
412
|
+
classPropertyName: "managed",
|
|
413
|
+
publicName: "managed",
|
|
414
|
+
isSignal: true,
|
|
415
|
+
isRequired: false,
|
|
416
|
+
transformFunction: null
|
|
417
|
+
},
|
|
418
|
+
closing: {
|
|
419
|
+
classPropertyName: "closing",
|
|
420
|
+
publicName: "closing",
|
|
421
|
+
isSignal: true,
|
|
422
|
+
isRequired: false,
|
|
423
|
+
transformFunction: null
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
outputs: {
|
|
427
|
+
open: "openChange",
|
|
428
|
+
confirmed: "confirmed",
|
|
429
|
+
dismissed: "dismissed",
|
|
430
|
+
cancelled: "cancelled",
|
|
431
|
+
dismissRequested: "dismissRequested",
|
|
432
|
+
exitDone: "exitDone"
|
|
433
|
+
},
|
|
434
|
+
queries: [{
|
|
435
|
+
propertyName: "headerSlot",
|
|
436
|
+
first: true,
|
|
437
|
+
predicate: RvModalHeader,
|
|
438
|
+
descendants: true,
|
|
439
|
+
isSignal: true
|
|
440
|
+
}, {
|
|
441
|
+
propertyName: "footerSlot",
|
|
442
|
+
first: true,
|
|
443
|
+
predicate: RvModalFooter,
|
|
444
|
+
descendants: true,
|
|
445
|
+
isSignal: true
|
|
446
|
+
}],
|
|
447
|
+
viewQueries: [{
|
|
448
|
+
propertyName: "dialog",
|
|
449
|
+
first: true,
|
|
450
|
+
predicate: ["dialog"],
|
|
451
|
+
descendants: true,
|
|
452
|
+
isSignal: true
|
|
453
|
+
}],
|
|
454
|
+
ngImport: i0,
|
|
455
|
+
template: `
|
|
456
|
+
<dialog
|
|
457
|
+
#dialog
|
|
458
|
+
tabindex="-1"
|
|
459
|
+
class="rv-modal"
|
|
460
|
+
[attr.data-size]="size()"
|
|
461
|
+
[attr.data-position]="position()"
|
|
462
|
+
[attr.data-animation]="animation()"
|
|
463
|
+
[attr.data-state]="state()"
|
|
464
|
+
[attr.aria-label]="computedLabel()"
|
|
465
|
+
[attr.aria-labelledby]="title() && !ariaLabel() ? titleId : null"
|
|
466
|
+
[attr.aria-describedby]="description() ? descriptionId : null"
|
|
467
|
+
(cancel)="onCancel($event)"
|
|
468
|
+
(click)="onBackdropClick($event)"
|
|
469
|
+
(keydown)="onKeydown($event)"
|
|
470
|
+
>
|
|
471
|
+
@if (hasCustomHeader()) {
|
|
472
|
+
<div class="rv-modal-header rv-modal-header-custom">
|
|
473
|
+
<ng-content select="[rv-modal-header]"></ng-content>
|
|
474
|
+
</div>
|
|
475
|
+
} @else if (title() || showCloseButton()) {
|
|
476
|
+
<div class="rv-modal-header">
|
|
477
|
+
<div class="rv-modal-heading">
|
|
478
|
+
@if (title()) {
|
|
479
|
+
<h2 class="rv-modal-title" [id]="titleId">{{ title() }}</h2>
|
|
480
|
+
}
|
|
481
|
+
@if (description()) {
|
|
482
|
+
<p class="rv-modal-description" [id]="descriptionId">{{ description() }}</p>
|
|
483
|
+
}
|
|
484
|
+
</div>
|
|
485
|
+
@if (showCloseButton()) {
|
|
486
|
+
<button
|
|
487
|
+
type="button"
|
|
488
|
+
class="rv-modal-close"
|
|
489
|
+
(click)="onCloseButton()"
|
|
490
|
+
aria-label="Close dialog"
|
|
491
|
+
>
|
|
492
|
+
<span aria-hidden="true">×</span>
|
|
493
|
+
</button>
|
|
494
|
+
}
|
|
495
|
+
</div>
|
|
496
|
+
}
|
|
497
|
+
<div class="rv-modal-body">
|
|
498
|
+
<ng-content></ng-content>
|
|
499
|
+
</div>
|
|
500
|
+
@if (hasCustomFooter()) {
|
|
501
|
+
<div class="rv-modal-footer">
|
|
502
|
+
<ng-content select="[rv-modal-footer]"></ng-content>
|
|
503
|
+
</div>
|
|
504
|
+
}
|
|
505
|
+
</dialog>
|
|
506
|
+
`,
|
|
507
|
+
isInline: true,
|
|
508
|
+
styles: [".rv-modal{color-scheme:light dark;--rv-modal-bg: #ffffff;--rv-modal-fg: #111111;--rv-modal-muted: #555555;--rv-modal-border: #e0e0e0;--rv-modal-radius: 12px;--rv-modal-shadow: 0 24px 64px rgba(0, 0, 0, .28);--rv-modal-backdrop: rgba(0, 0, 0, .5);--rv-modal-pad: 20px;--rv-modal-gap: 12px;--rv-modal-width-sm: 24rem;--rv-modal-width-md: 32rem;--rv-modal-width-lg: 48rem;--rv-modal-width-xl: 64rem;--rv-modal-max-height: min(86dvh, 100%);--rv-modal-duration: .15s;--rv-modal-duration-in: var(--rv-modal-duration);--rv-modal-duration-out: .12s;--rv-modal-easing: ease-out;--rv-modal-easing-in: var(--rv-modal-easing);--rv-modal-easing-out: ease-in;--rv-modal-radius-sheet: 20px;--rv-modal-width-panel: 24rem;padding:0;border:1px solid var(--rv-modal-border);border-radius:var(--rv-modal-radius);background:var(--rv-modal-bg);color:var(--rv-modal-fg);box-shadow:var(--rv-modal-shadow);max-height:var(--rv-modal-max-height);width:var(--rv-modal-width-md);max-width:calc(100dvw - 2rem)}@media(prefers-color-scheme:dark){.rv-modal{--rv-modal-bg: #161616;--rv-modal-fg: #f2f2f2;--rv-modal-muted: #a8a8a8;--rv-modal-border: #333333;--rv-modal-shadow: 0 24px 64px rgba(0, 0, 0, .6)}}.rv-modal::backdrop{background:var(--rv-modal-backdrop)}.rv-modal[data-size=sm]{width:var(--rv-modal-width-sm)}.rv-modal[data-size=lg]{width:var(--rv-modal-width-lg)}.rv-modal[data-size=xl]{width:var(--rv-modal-width-xl)}.rv-modal[data-size=full]{width:calc(100dvw - 2rem)}.rv-modal[data-size=auto]{width:auto}.rv-modal[data-position=top]{margin-block-start:8dvh}.rv-modal[data-position=bottom]{margin-block-start:auto;margin-block-end:8dvh}.rv-modal[data-position=top-start],.rv-modal[data-position=center-start]{margin-inline-start:1rem;margin-inline-end:auto}.rv-modal[data-position=top-end],.rv-modal[data-position=center-end]{margin-inline-start:auto;margin-inline-end:1rem}.rv-modal[data-position=bottom-start]{margin-block-start:auto;margin-inline-start:1rem}.rv-modal[data-position=bottom-end]{margin-block-start:auto;margin-inline-end:1rem}.rv-modal[data-position=fullscreen]{inset:0;width:100dvw;height:100dvh;max-width:none;max-height:none;border-radius:0}.rv-modal[data-position=side-start],.rv-modal[data-position=side-end]{height:100dvh;max-height:none;width:var(--rv-modal-width-panel);margin-block:0}.rv-modal[data-position=side-start]{margin-inline-start:0;margin-inline-end:auto;border-start-start-radius:0;border-end-start-radius:0}.rv-modal[data-position=side-end]{margin-inline-start:auto;margin-inline-end:0;border-start-end-radius:0;border-end-end-radius:0}@media(max-width:640px){.rv-modal[data-position=center],.rv-modal[data-position=top],.rv-modal[data-position=bottom],.rv-modal[data-position=bottom-start],.rv-modal[data-position=bottom-end]{margin-block-start:auto;margin-block-end:0;margin-inline:0;width:100dvw;max-width:none;border-end-end-radius:0;border-end-start-radius:0;border-start-start-radius:var(--rv-modal-radius-sheet);border-start-end-radius:var(--rv-modal-radius-sheet)}.rv-modal[data-position=center][data-state=open],.rv-modal[data-position=top][data-state=open],.rv-modal[data-position=bottom][data-state=open],.rv-modal[data-position=bottom-start][data-state=open],.rv-modal[data-position=bottom-end][data-state=open]{animation-name:rv-modal-in-bottom}}.rv-modal[data-animation]:not([data-animation=none])[data-state=open]{animation:var(--rv-modal-animation-in, rv-modal-in) var(--rv-modal-duration-in) var(--rv-modal-easing-in)}.rv-modal[data-animation=scale][data-state=open]{--rv-modal-animation-in: rv-modal-in-scale}.rv-modal[data-animation=slide-top][data-state=open]{--rv-modal-animation-in: rv-modal-in-top}.rv-modal[data-animation=slide-bottom][data-state=open]{--rv-modal-animation-in: rv-modal-in-bottom}.rv-modal[data-animation=slide-start][data-state=open]{--rv-modal-animation-in: rv-modal-in-start}.rv-modal[data-animation=slide-end][data-state=open],[dir=rtl] .rv-modal[data-animation=slide-start][data-state=open]{--rv-modal-animation-in: rv-modal-in-end}[dir=rtl] .rv-modal[data-animation=slide-end][data-state=open]{--rv-modal-animation-in: rv-modal-in-start}.rv-modal[data-state=closing]{animation:rv-modal-out var(--rv-modal-duration-out) var(--rv-modal-easing-out) forwards}@keyframes rv-modal-in{0%{opacity:0}}@keyframes rv-modal-in-scale{0%{opacity:0;transform:translateY(8px) scale(.98)}}@keyframes rv-modal-in-top{0%{opacity:0;transform:translateY(-24px)}}@keyframes rv-modal-in-bottom{0%{opacity:0;transform:translateY(24px)}}@keyframes rv-modal-in-start{0%{opacity:0;transform:translate(-24px)}}@keyframes rv-modal-in-end{0%{opacity:0;transform:translate(24px)}}@keyframes rv-modal-out{to{opacity:0;transform:translateY(8px) scale(.98)}}@media(prefers-reduced-motion:reduce){.rv-modal[data-animation]{animation:none}}.rv-modal-header{display:flex;align-items:flex-start;gap:var(--rv-modal-gap);padding:var(--rv-modal-pad) var(--rv-modal-pad) 0}.rv-modal-header-custom>:first-child{flex:1;min-width:0}.rv-modal-heading:empty{display:none}.rv-modal-title{margin:0;font-size:1.125rem;flex:1}.rv-modal-heading{flex:1;display:flex;flex-direction:column;gap:4px}.rv-modal-description{margin:0;font-size:.875rem;color:var(--rv-modal-muted)}.rv-modal-close{margin-inline-start:auto;flex:none;border:1px solid var(--rv-modal-border);border-radius:8px;background:transparent;color:inherit;font-size:1.25rem;line-height:1;padding:4px 10px;cursor:pointer}.rv-modal-close:focus-visible{outline:2px solid currentColor;outline-offset:2px}.rv-modal-body{padding:var(--rv-modal-pad);overflow:auto;max-height:inherit}.rv-modal-footer{display:flex;gap:var(--rv-modal-gap);justify-content:flex-end;padding:0 var(--rv-modal-pad) var(--rv-modal-pad)}.rv-modal-footer:empty{display:none}\n"],
|
|
509
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
510
|
+
});
|
|
511
|
+
};
|
|
512
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
513
|
+
minVersion: "12.0.0",
|
|
514
|
+
version: "22.2.2",
|
|
515
|
+
ngImport: i0,
|
|
516
|
+
type: RiviniaModalDialog,
|
|
517
|
+
decorators: [{
|
|
518
|
+
type: Component,
|
|
519
|
+
args: [{
|
|
520
|
+
selector: "rv-modal-dialog",
|
|
521
|
+
standalone: true,
|
|
522
|
+
encapsulation: ViewEncapsulation.None,
|
|
523
|
+
template: `
|
|
524
|
+
<dialog
|
|
525
|
+
#dialog
|
|
526
|
+
tabindex="-1"
|
|
527
|
+
class="rv-modal"
|
|
528
|
+
[attr.data-size]="size()"
|
|
529
|
+
[attr.data-position]="position()"
|
|
530
|
+
[attr.data-animation]="animation()"
|
|
531
|
+
[attr.data-state]="state()"
|
|
532
|
+
[attr.aria-label]="computedLabel()"
|
|
533
|
+
[attr.aria-labelledby]="title() && !ariaLabel() ? titleId : null"
|
|
534
|
+
[attr.aria-describedby]="description() ? descriptionId : null"
|
|
535
|
+
(cancel)="onCancel($event)"
|
|
536
|
+
(click)="onBackdropClick($event)"
|
|
537
|
+
(keydown)="onKeydown($event)"
|
|
538
|
+
>
|
|
539
|
+
@if (hasCustomHeader()) {
|
|
540
|
+
<div class="rv-modal-header rv-modal-header-custom">
|
|
541
|
+
<ng-content select="[rv-modal-header]"></ng-content>
|
|
542
|
+
</div>
|
|
543
|
+
} @else if (title() || showCloseButton()) {
|
|
544
|
+
<div class="rv-modal-header">
|
|
545
|
+
<div class="rv-modal-heading">
|
|
546
|
+
@if (title()) {
|
|
547
|
+
<h2 class="rv-modal-title" [id]="titleId">{{ title() }}</h2>
|
|
548
|
+
}
|
|
549
|
+
@if (description()) {
|
|
550
|
+
<p class="rv-modal-description" [id]="descriptionId">{{ description() }}</p>
|
|
551
|
+
}
|
|
552
|
+
</div>
|
|
553
|
+
@if (showCloseButton()) {
|
|
554
|
+
<button
|
|
555
|
+
type="button"
|
|
556
|
+
class="rv-modal-close"
|
|
557
|
+
(click)="onCloseButton()"
|
|
558
|
+
aria-label="Close dialog"
|
|
559
|
+
>
|
|
560
|
+
<span aria-hidden="true">×</span>
|
|
561
|
+
</button>
|
|
562
|
+
}
|
|
563
|
+
</div>
|
|
564
|
+
}
|
|
565
|
+
<div class="rv-modal-body">
|
|
566
|
+
<ng-content></ng-content>
|
|
567
|
+
</div>
|
|
568
|
+
@if (hasCustomFooter()) {
|
|
569
|
+
<div class="rv-modal-footer">
|
|
570
|
+
<ng-content select="[rv-modal-footer]"></ng-content>
|
|
571
|
+
</div>
|
|
572
|
+
}
|
|
573
|
+
</dialog>
|
|
574
|
+
`,
|
|
575
|
+
styles: [".rv-modal{color-scheme:light dark;--rv-modal-bg: #ffffff;--rv-modal-fg: #111111;--rv-modal-muted: #555555;--rv-modal-border: #e0e0e0;--rv-modal-radius: 12px;--rv-modal-shadow: 0 24px 64px rgba(0, 0, 0, .28);--rv-modal-backdrop: rgba(0, 0, 0, .5);--rv-modal-pad: 20px;--rv-modal-gap: 12px;--rv-modal-width-sm: 24rem;--rv-modal-width-md: 32rem;--rv-modal-width-lg: 48rem;--rv-modal-width-xl: 64rem;--rv-modal-max-height: min(86dvh, 100%);--rv-modal-duration: .15s;--rv-modal-duration-in: var(--rv-modal-duration);--rv-modal-duration-out: .12s;--rv-modal-easing: ease-out;--rv-modal-easing-in: var(--rv-modal-easing);--rv-modal-easing-out: ease-in;--rv-modal-radius-sheet: 20px;--rv-modal-width-panel: 24rem;padding:0;border:1px solid var(--rv-modal-border);border-radius:var(--rv-modal-radius);background:var(--rv-modal-bg);color:var(--rv-modal-fg);box-shadow:var(--rv-modal-shadow);max-height:var(--rv-modal-max-height);width:var(--rv-modal-width-md);max-width:calc(100dvw - 2rem)}@media(prefers-color-scheme:dark){.rv-modal{--rv-modal-bg: #161616;--rv-modal-fg: #f2f2f2;--rv-modal-muted: #a8a8a8;--rv-modal-border: #333333;--rv-modal-shadow: 0 24px 64px rgba(0, 0, 0, .6)}}.rv-modal::backdrop{background:var(--rv-modal-backdrop)}.rv-modal[data-size=sm]{width:var(--rv-modal-width-sm)}.rv-modal[data-size=lg]{width:var(--rv-modal-width-lg)}.rv-modal[data-size=xl]{width:var(--rv-modal-width-xl)}.rv-modal[data-size=full]{width:calc(100dvw - 2rem)}.rv-modal[data-size=auto]{width:auto}.rv-modal[data-position=top]{margin-block-start:8dvh}.rv-modal[data-position=bottom]{margin-block-start:auto;margin-block-end:8dvh}.rv-modal[data-position=top-start],.rv-modal[data-position=center-start]{margin-inline-start:1rem;margin-inline-end:auto}.rv-modal[data-position=top-end],.rv-modal[data-position=center-end]{margin-inline-start:auto;margin-inline-end:1rem}.rv-modal[data-position=bottom-start]{margin-block-start:auto;margin-inline-start:1rem}.rv-modal[data-position=bottom-end]{margin-block-start:auto;margin-inline-end:1rem}.rv-modal[data-position=fullscreen]{inset:0;width:100dvw;height:100dvh;max-width:none;max-height:none;border-radius:0}.rv-modal[data-position=side-start],.rv-modal[data-position=side-end]{height:100dvh;max-height:none;width:var(--rv-modal-width-panel);margin-block:0}.rv-modal[data-position=side-start]{margin-inline-start:0;margin-inline-end:auto;border-start-start-radius:0;border-end-start-radius:0}.rv-modal[data-position=side-end]{margin-inline-start:auto;margin-inline-end:0;border-start-end-radius:0;border-end-end-radius:0}@media(max-width:640px){.rv-modal[data-position=center],.rv-modal[data-position=top],.rv-modal[data-position=bottom],.rv-modal[data-position=bottom-start],.rv-modal[data-position=bottom-end]{margin-block-start:auto;margin-block-end:0;margin-inline:0;width:100dvw;max-width:none;border-end-end-radius:0;border-end-start-radius:0;border-start-start-radius:var(--rv-modal-radius-sheet);border-start-end-radius:var(--rv-modal-radius-sheet)}.rv-modal[data-position=center][data-state=open],.rv-modal[data-position=top][data-state=open],.rv-modal[data-position=bottom][data-state=open],.rv-modal[data-position=bottom-start][data-state=open],.rv-modal[data-position=bottom-end][data-state=open]{animation-name:rv-modal-in-bottom}}.rv-modal[data-animation]:not([data-animation=none])[data-state=open]{animation:var(--rv-modal-animation-in, rv-modal-in) var(--rv-modal-duration-in) var(--rv-modal-easing-in)}.rv-modal[data-animation=scale][data-state=open]{--rv-modal-animation-in: rv-modal-in-scale}.rv-modal[data-animation=slide-top][data-state=open]{--rv-modal-animation-in: rv-modal-in-top}.rv-modal[data-animation=slide-bottom][data-state=open]{--rv-modal-animation-in: rv-modal-in-bottom}.rv-modal[data-animation=slide-start][data-state=open]{--rv-modal-animation-in: rv-modal-in-start}.rv-modal[data-animation=slide-end][data-state=open],[dir=rtl] .rv-modal[data-animation=slide-start][data-state=open]{--rv-modal-animation-in: rv-modal-in-end}[dir=rtl] .rv-modal[data-animation=slide-end][data-state=open]{--rv-modal-animation-in: rv-modal-in-start}.rv-modal[data-state=closing]{animation:rv-modal-out var(--rv-modal-duration-out) var(--rv-modal-easing-out) forwards}@keyframes rv-modal-in{0%{opacity:0}}@keyframes rv-modal-in-scale{0%{opacity:0;transform:translateY(8px) scale(.98)}}@keyframes rv-modal-in-top{0%{opacity:0;transform:translateY(-24px)}}@keyframes rv-modal-in-bottom{0%{opacity:0;transform:translateY(24px)}}@keyframes rv-modal-in-start{0%{opacity:0;transform:translate(-24px)}}@keyframes rv-modal-in-end{0%{opacity:0;transform:translate(24px)}}@keyframes rv-modal-out{to{opacity:0;transform:translateY(8px) scale(.98)}}@media(prefers-reduced-motion:reduce){.rv-modal[data-animation]{animation:none}}.rv-modal-header{display:flex;align-items:flex-start;gap:var(--rv-modal-gap);padding:var(--rv-modal-pad) var(--rv-modal-pad) 0}.rv-modal-header-custom>:first-child{flex:1;min-width:0}.rv-modal-heading:empty{display:none}.rv-modal-title{margin:0;font-size:1.125rem;flex:1}.rv-modal-heading{flex:1;display:flex;flex-direction:column;gap:4px}.rv-modal-description{margin:0;font-size:.875rem;color:var(--rv-modal-muted)}.rv-modal-close{margin-inline-start:auto;flex:none;border:1px solid var(--rv-modal-border);border-radius:8px;background:transparent;color:inherit;font-size:1.25rem;line-height:1;padding:4px 10px;cursor:pointer}.rv-modal-close:focus-visible{outline:2px solid currentColor;outline-offset:2px}.rv-modal-body{padding:var(--rv-modal-pad);overflow:auto;max-height:inherit}.rv-modal-footer{display:flex;gap:var(--rv-modal-gap);justify-content:flex-end;padding:0 var(--rv-modal-pad) var(--rv-modal-pad)}.rv-modal-footer:empty{display:none}\n"]
|
|
576
|
+
}]
|
|
577
|
+
}],
|
|
578
|
+
ctorParameters: () => [],
|
|
579
|
+
propDecorators: {
|
|
580
|
+
open: [{
|
|
581
|
+
type: i0.Input,
|
|
582
|
+
args: [{
|
|
583
|
+
isSignal: true,
|
|
584
|
+
alias: "open",
|
|
585
|
+
required: false
|
|
586
|
+
}]
|
|
587
|
+
}, {
|
|
588
|
+
type: i0.Output,
|
|
589
|
+
args: ["openChange"]
|
|
590
|
+
}],
|
|
591
|
+
title: [{
|
|
592
|
+
type: i0.Input,
|
|
593
|
+
args: [{
|
|
594
|
+
isSignal: true,
|
|
595
|
+
alias: "title",
|
|
596
|
+
required: false
|
|
597
|
+
}]
|
|
598
|
+
}],
|
|
599
|
+
description: [{
|
|
600
|
+
type: i0.Input,
|
|
601
|
+
args: [{
|
|
602
|
+
isSignal: true,
|
|
603
|
+
alias: "description",
|
|
604
|
+
required: false
|
|
605
|
+
}]
|
|
606
|
+
}],
|
|
607
|
+
ariaLabel: [{
|
|
608
|
+
type: i0.Input,
|
|
609
|
+
args: [{
|
|
610
|
+
isSignal: true,
|
|
611
|
+
alias: "ariaLabel",
|
|
612
|
+
required: false
|
|
613
|
+
}]
|
|
614
|
+
}],
|
|
615
|
+
size: [{
|
|
616
|
+
type: i0.Input,
|
|
617
|
+
args: [{
|
|
618
|
+
isSignal: true,
|
|
619
|
+
alias: "size",
|
|
620
|
+
required: false
|
|
621
|
+
}]
|
|
622
|
+
}],
|
|
623
|
+
position: [{
|
|
624
|
+
type: i0.Input,
|
|
625
|
+
args: [{
|
|
626
|
+
isSignal: true,
|
|
627
|
+
alias: "position",
|
|
628
|
+
required: false
|
|
629
|
+
}]
|
|
630
|
+
}],
|
|
631
|
+
animation: [{
|
|
632
|
+
type: i0.Input,
|
|
633
|
+
args: [{
|
|
634
|
+
isSignal: true,
|
|
635
|
+
alias: "animation",
|
|
636
|
+
required: false
|
|
637
|
+
}]
|
|
638
|
+
}],
|
|
639
|
+
closeOnEscape: [{
|
|
640
|
+
type: i0.Input,
|
|
641
|
+
args: [{
|
|
642
|
+
isSignal: true,
|
|
643
|
+
alias: "closeOnEscape",
|
|
644
|
+
required: false
|
|
645
|
+
}]
|
|
646
|
+
}],
|
|
647
|
+
backdrop: [{
|
|
648
|
+
type: i0.Input,
|
|
649
|
+
args: [{
|
|
650
|
+
isSignal: true,
|
|
651
|
+
alias: "backdrop",
|
|
652
|
+
required: false
|
|
653
|
+
}]
|
|
654
|
+
}],
|
|
655
|
+
showCloseButton: [{
|
|
656
|
+
type: i0.Input,
|
|
657
|
+
args: [{
|
|
658
|
+
isSignal: true,
|
|
659
|
+
alias: "showCloseButton",
|
|
660
|
+
required: false
|
|
661
|
+
}]
|
|
662
|
+
}],
|
|
663
|
+
managed: [{
|
|
664
|
+
type: i0.Input,
|
|
665
|
+
args: [{
|
|
666
|
+
isSignal: true,
|
|
667
|
+
alias: "managed",
|
|
668
|
+
required: false
|
|
669
|
+
}]
|
|
670
|
+
}],
|
|
671
|
+
closing: [{
|
|
672
|
+
type: i0.Input,
|
|
673
|
+
args: [{
|
|
674
|
+
isSignal: true,
|
|
675
|
+
alias: "closing",
|
|
676
|
+
required: false
|
|
677
|
+
}]
|
|
678
|
+
}],
|
|
679
|
+
confirmed: [{
|
|
680
|
+
type: i0.Output,
|
|
681
|
+
args: ["confirmed"]
|
|
682
|
+
}],
|
|
683
|
+
dismissed: [{
|
|
684
|
+
type: i0.Output,
|
|
685
|
+
args: ["dismissed"]
|
|
686
|
+
}],
|
|
687
|
+
cancelled: [{
|
|
688
|
+
type: i0.Output,
|
|
689
|
+
args: ["cancelled"]
|
|
690
|
+
}],
|
|
691
|
+
dismissRequested: [{
|
|
692
|
+
type: i0.Output,
|
|
693
|
+
args: ["dismissRequested"]
|
|
694
|
+
}],
|
|
695
|
+
exitDone: [{
|
|
696
|
+
type: i0.Output,
|
|
697
|
+
args: ["exitDone"]
|
|
698
|
+
}],
|
|
699
|
+
dialog: [{
|
|
700
|
+
type: i0.ViewChild,
|
|
701
|
+
args: ["dialog", { isSignal: true }]
|
|
702
|
+
}],
|
|
703
|
+
headerSlot: [{
|
|
704
|
+
type: i0.ContentChild,
|
|
705
|
+
args: [i0.forwardRef(() => RvModalHeader), { isSignal: true }]
|
|
706
|
+
}],
|
|
707
|
+
footerSlot: [{
|
|
708
|
+
type: i0.ContentChild,
|
|
709
|
+
args: [i0.forwardRef(() => RvModalFooter), { isSignal: true }]
|
|
710
|
+
}]
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
let dialogSeq = 0;
|
|
714
|
+
function focusables(root) {
|
|
715
|
+
return Array.from(root.querySelectorAll("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])"));
|
|
716
|
+
}
|
|
717
|
+
function focusFirst(dialog, closeVisible) {
|
|
718
|
+
try {
|
|
719
|
+
const auto = dialog.querySelector("[autofocus]");
|
|
720
|
+
if (auto) {
|
|
721
|
+
auto.focus({ preventScroll: true });
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
if (!closeVisible) {
|
|
725
|
+
const title = dialog.querySelector(".rv-modal-title");
|
|
726
|
+
if (title) {
|
|
727
|
+
title.setAttribute("tabindex", "-1");
|
|
728
|
+
title.focus({ preventScroll: true });
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
dialog.focus({ preventScroll: true });
|
|
733
|
+
} catch {}
|
|
734
|
+
}
|
|
735
|
+
var RiviniaModalHost = class RiviniaModalHost {
|
|
736
|
+
modal = input.required(...ngDevMode ? [{ debugName: "modal" }] : /* istanbul ignore next */ []);
|
|
737
|
+
size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
738
|
+
showCloseButton = input(true, ...ngDevMode ? [{ debugName: "showCloseButton" }] : /* istanbul ignore next */ []);
|
|
739
|
+
titleOf = input(...ngDevMode ? [void 0, { debugName: "titleOf" }] : /* istanbul ignore next */ []);
|
|
740
|
+
visible = computed(() => this.modal().visible(), ...ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []);
|
|
741
|
+
titleOfInstance(instance) {
|
|
742
|
+
try {
|
|
743
|
+
const custom = this.titleOf()?.(instance);
|
|
744
|
+
if (custom !== void 0) return custom;
|
|
745
|
+
} catch {}
|
|
746
|
+
const meta = instance.metadata?.["title"];
|
|
747
|
+
if (typeof meta === "string" && meta.length > 0) return meta;
|
|
748
|
+
return instance.ref ?? "";
|
|
749
|
+
}
|
|
750
|
+
templateContext(instance) {
|
|
751
|
+
return {
|
|
752
|
+
$implicit: instance.data,
|
|
753
|
+
modal: this.modalContext(instance)
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
contextInjector(instance) {
|
|
757
|
+
const modal = this.modal();
|
|
758
|
+
return Injector.create({ providers: [{
|
|
759
|
+
provide: RIVINIA_MODAL_CONTEXT,
|
|
760
|
+
useValue: {
|
|
761
|
+
id: instance.id,
|
|
762
|
+
data: instance.data,
|
|
763
|
+
parentId: instance.parentId,
|
|
764
|
+
close: (result) => modal.close(instance.id, result),
|
|
765
|
+
dismiss: (reason) => modal.dismiss(instance.id, reason)
|
|
766
|
+
}
|
|
767
|
+
}] });
|
|
768
|
+
}
|
|
769
|
+
async onIntent(id, origin) {
|
|
770
|
+
try {
|
|
771
|
+
await this.modal().requestDismiss(id, origin);
|
|
772
|
+
} catch {}
|
|
773
|
+
}
|
|
774
|
+
onExitDone(id) {
|
|
775
|
+
this.modal().confirmClosed(id);
|
|
776
|
+
}
|
|
777
|
+
modalContext(instance) {
|
|
778
|
+
const modal = this.modal();
|
|
779
|
+
const id = instance.id;
|
|
780
|
+
return {
|
|
781
|
+
id,
|
|
782
|
+
data: instance.data,
|
|
783
|
+
parentId: instance.parentId,
|
|
784
|
+
close: (result) => modal.close(id, result),
|
|
785
|
+
dismiss: (reason) => modal.dismiss(id, reason)
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
789
|
+
minVersion: "12.0.0",
|
|
790
|
+
version: "22.2.2",
|
|
791
|
+
ngImport: i0,
|
|
792
|
+
type: RiviniaModalHost,
|
|
793
|
+
deps: [],
|
|
794
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
795
|
+
});
|
|
796
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
797
|
+
minVersion: "17.0.0",
|
|
798
|
+
version: "22.2.2",
|
|
799
|
+
type: RiviniaModalHost,
|
|
800
|
+
isStandalone: true,
|
|
801
|
+
selector: "rv-modal-host",
|
|
802
|
+
inputs: {
|
|
803
|
+
modal: {
|
|
804
|
+
classPropertyName: "modal",
|
|
805
|
+
publicName: "modal",
|
|
806
|
+
isSignal: true,
|
|
807
|
+
isRequired: true,
|
|
808
|
+
transformFunction: null
|
|
809
|
+
},
|
|
810
|
+
size: {
|
|
811
|
+
classPropertyName: "size",
|
|
812
|
+
publicName: "size",
|
|
813
|
+
isSignal: true,
|
|
814
|
+
isRequired: false,
|
|
815
|
+
transformFunction: null
|
|
816
|
+
},
|
|
817
|
+
showCloseButton: {
|
|
818
|
+
classPropertyName: "showCloseButton",
|
|
819
|
+
publicName: "showCloseButton",
|
|
820
|
+
isSignal: true,
|
|
821
|
+
isRequired: false,
|
|
822
|
+
transformFunction: null
|
|
823
|
+
},
|
|
824
|
+
titleOf: {
|
|
825
|
+
classPropertyName: "titleOf",
|
|
826
|
+
publicName: "titleOf",
|
|
827
|
+
isSignal: true,
|
|
828
|
+
isRequired: false,
|
|
829
|
+
transformFunction: null
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
ngImport: i0,
|
|
833
|
+
template: `
|
|
834
|
+
@for (instance of visible(); track instance.id) {
|
|
835
|
+
<rv-modal-dialog
|
|
836
|
+
[open]="true"
|
|
837
|
+
[managed]="true"
|
|
838
|
+
[closing]="instance.status === 'closing'"
|
|
839
|
+
[title]="titleOfInstance(instance)"
|
|
840
|
+
[size]="size()"
|
|
841
|
+
[showCloseButton]="showCloseButton()"
|
|
842
|
+
[closeOnEscape]="instance.dismiss.closeOnEscape ?? true"
|
|
843
|
+
[backdrop]="instance.dismiss.backdrop ?? 'close'"
|
|
844
|
+
(dismissRequested)="onIntent(instance.id, $event)"
|
|
845
|
+
(exitDone)="onExitDone(instance.id)"
|
|
846
|
+
>
|
|
847
|
+
@if (instance.content.kind === 'template') {
|
|
848
|
+
<ng-container
|
|
849
|
+
*ngTemplateOutlet="instance.content.template; context: templateContext(instance)"
|
|
850
|
+
></ng-container>
|
|
851
|
+
} @else {
|
|
852
|
+
<ng-container
|
|
853
|
+
*ngComponentOutlet="
|
|
854
|
+
instance.content.component;
|
|
855
|
+
inputs: instance.content.inputs;
|
|
856
|
+
injector: contextInjector(instance)
|
|
857
|
+
"
|
|
858
|
+
></ng-container>
|
|
859
|
+
}
|
|
860
|
+
</rv-modal-dialog>
|
|
861
|
+
}
|
|
862
|
+
`,
|
|
863
|
+
isInline: true,
|
|
864
|
+
dependencies: [
|
|
865
|
+
{
|
|
866
|
+
kind: "component",
|
|
867
|
+
type: RiviniaModalDialog,
|
|
868
|
+
selector: "rv-modal-dialog",
|
|
869
|
+
inputs: [
|
|
870
|
+
"open",
|
|
871
|
+
"title",
|
|
872
|
+
"description",
|
|
873
|
+
"ariaLabel",
|
|
874
|
+
"size",
|
|
875
|
+
"position",
|
|
876
|
+
"animation",
|
|
877
|
+
"closeOnEscape",
|
|
878
|
+
"backdrop",
|
|
879
|
+
"showCloseButton",
|
|
880
|
+
"managed",
|
|
881
|
+
"closing"
|
|
882
|
+
],
|
|
883
|
+
outputs: [
|
|
884
|
+
"openChange",
|
|
885
|
+
"confirmed",
|
|
886
|
+
"dismissed",
|
|
887
|
+
"cancelled",
|
|
888
|
+
"dismissRequested",
|
|
889
|
+
"exitDone"
|
|
890
|
+
]
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
kind: "directive",
|
|
894
|
+
type: NgComponentOutlet,
|
|
895
|
+
selector: "[ngComponentOutlet]",
|
|
896
|
+
inputs: [
|
|
897
|
+
"ngComponentOutlet",
|
|
898
|
+
"ngComponentOutletInputs",
|
|
899
|
+
"ngComponentOutletInjector",
|
|
900
|
+
"ngComponentOutletEnvironmentInjector",
|
|
901
|
+
"ngComponentOutletContent",
|
|
902
|
+
"ngComponentOutletNgModule"
|
|
903
|
+
],
|
|
904
|
+
exportAs: ["ngComponentOutlet"]
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
kind: "directive",
|
|
908
|
+
type: NgTemplateOutlet,
|
|
909
|
+
selector: "[ngTemplateOutlet]",
|
|
910
|
+
inputs: [
|
|
911
|
+
"ngTemplateOutletContext",
|
|
912
|
+
"ngTemplateOutlet",
|
|
913
|
+
"ngTemplateOutletInjector"
|
|
914
|
+
]
|
|
915
|
+
}
|
|
916
|
+
]
|
|
917
|
+
});
|
|
918
|
+
};
|
|
919
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
920
|
+
minVersion: "12.0.0",
|
|
921
|
+
version: "22.2.2",
|
|
922
|
+
ngImport: i0,
|
|
923
|
+
type: RiviniaModalHost,
|
|
924
|
+
decorators: [{
|
|
925
|
+
type: Component,
|
|
926
|
+
args: [{
|
|
927
|
+
selector: "rv-modal-host",
|
|
928
|
+
standalone: true,
|
|
929
|
+
imports: [
|
|
930
|
+
RiviniaModalDialog,
|
|
931
|
+
NgComponentOutlet,
|
|
932
|
+
NgTemplateOutlet
|
|
933
|
+
],
|
|
934
|
+
template: `
|
|
935
|
+
@for (instance of visible(); track instance.id) {
|
|
936
|
+
<rv-modal-dialog
|
|
937
|
+
[open]="true"
|
|
938
|
+
[managed]="true"
|
|
939
|
+
[closing]="instance.status === 'closing'"
|
|
940
|
+
[title]="titleOfInstance(instance)"
|
|
941
|
+
[size]="size()"
|
|
942
|
+
[showCloseButton]="showCloseButton()"
|
|
943
|
+
[closeOnEscape]="instance.dismiss.closeOnEscape ?? true"
|
|
944
|
+
[backdrop]="instance.dismiss.backdrop ?? 'close'"
|
|
945
|
+
(dismissRequested)="onIntent(instance.id, $event)"
|
|
946
|
+
(exitDone)="onExitDone(instance.id)"
|
|
947
|
+
>
|
|
948
|
+
@if (instance.content.kind === 'template') {
|
|
949
|
+
<ng-container
|
|
950
|
+
*ngTemplateOutlet="instance.content.template; context: templateContext(instance)"
|
|
951
|
+
></ng-container>
|
|
952
|
+
} @else {
|
|
953
|
+
<ng-container
|
|
954
|
+
*ngComponentOutlet="
|
|
955
|
+
instance.content.component;
|
|
956
|
+
inputs: instance.content.inputs;
|
|
957
|
+
injector: contextInjector(instance)
|
|
958
|
+
"
|
|
959
|
+
></ng-container>
|
|
960
|
+
}
|
|
961
|
+
</rv-modal-dialog>
|
|
962
|
+
}
|
|
963
|
+
`
|
|
964
|
+
}]
|
|
965
|
+
}],
|
|
966
|
+
propDecorators: {
|
|
967
|
+
modal: [{
|
|
968
|
+
type: i0.Input,
|
|
969
|
+
args: [{
|
|
970
|
+
isSignal: true,
|
|
971
|
+
alias: "modal",
|
|
972
|
+
required: true
|
|
973
|
+
}]
|
|
974
|
+
}],
|
|
975
|
+
size: [{
|
|
976
|
+
type: i0.Input,
|
|
977
|
+
args: [{
|
|
978
|
+
isSignal: true,
|
|
979
|
+
alias: "size",
|
|
980
|
+
required: false
|
|
981
|
+
}]
|
|
982
|
+
}],
|
|
983
|
+
showCloseButton: [{
|
|
984
|
+
type: i0.Input,
|
|
985
|
+
args: [{
|
|
986
|
+
isSignal: true,
|
|
987
|
+
alias: "showCloseButton",
|
|
988
|
+
required: false
|
|
989
|
+
}]
|
|
990
|
+
}],
|
|
991
|
+
titleOf: [{
|
|
992
|
+
type: i0.Input,
|
|
993
|
+
args: [{
|
|
994
|
+
isSignal: true,
|
|
995
|
+
alias: "titleOf",
|
|
996
|
+
required: false
|
|
997
|
+
}]
|
|
998
|
+
}]
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
export { RiviniaModalDialog, RiviniaModalHost, RiviniaModalScrollLock, RvModalFooter, RvModalHeader };
|
|
1002
|
+
|
|
1003
|
+
//# sourceMappingURL=rivinia-modal-ui.mjs.map
|