mn-angular-lib 2.0.34 → 2.0.35
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/fesm2022/mn-angular-lib-alert.mjs +515 -527
- package/fesm2022/mn-angular-lib-alert.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs +264 -357
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-button.mjs +819 -382
- package/fesm2022/mn-angular-lib-button.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-calendar-core.mjs +240 -365
- package/fesm2022/mn-angular-lib-calendar-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-calendar.mjs +1691 -1545
- package/fesm2022/mn-angular-lib-calendar.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-collection.mjs +2367 -2796
- package/fesm2022/mn-angular-lib-collection.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-core.mjs +693 -1241
- package/fesm2022/mn-angular-lib-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-display.mjs +679 -712
- package/fesm2022/mn-angular-lib-display.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-forms.mjs +3671 -4647
- package/fesm2022/mn-angular-lib-forms.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-keyboard.mjs +221 -190
- package/fesm2022/mn-angular-lib-keyboard.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-core.mjs +711 -896
- package/fesm2022/mn-angular-lib-modal-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-ui.mjs +2089 -2035
- package/fesm2022/mn-angular-lib-modal-ui.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal.mjs +76 -121
- package/fesm2022/mn-angular-lib-modal.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs +289 -277
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-segmented.mjs +189 -241
- package/fesm2022/mn-angular-lib-segmented.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-tab.mjs +409 -642
- package/fesm2022/mn-angular-lib-tab.mjs.map +1 -1
- package/fesm2022/mn-angular-lib.mjs +16 -29
- package/package.json +1 -1
- package/types/mn-angular-lib-alert.d.ts +239 -241
- package/types/mn-angular-lib-bottom-sheet.d.ts +190 -150
- package/types/mn-angular-lib-button.d.ts +319 -317
- package/types/mn-angular-lib-calendar-core.d.ts +199 -209
- package/types/mn-angular-lib-calendar.d.ts +656 -511
- package/types/mn-angular-lib-collection.d.ts +1649 -1585
- package/types/mn-angular-lib-core.d.ts +524 -535
- package/types/mn-angular-lib-display.d.ts +946 -886
- package/types/mn-angular-lib-forms.d.ts +3012 -3013
- package/types/mn-angular-lib-keyboard.d.ts +125 -85
- package/types/mn-angular-lib-modal-core.d.ts +978 -994
- package/types/mn-angular-lib-modal-ui.d.ts +541 -493
- package/types/mn-angular-lib-modal.d.ts +24 -27
- package/types/mn-angular-lib-rich-text-editor.d.ts +131 -98
- package/types/mn-angular-lib-segmented.d.ts +354 -341
- package/types/mn-angular-lib-tab.d.ts +345 -336
- package/types/mn-angular-lib.d.ts +16 -16
- package/fesm2022/mn-angular-lib.mjs.map +0 -1
|
@@ -1,358 +1,265 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { NgClass } from
|
|
4
|
-
import { MN_IN_BOTTOM_SHEET } from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
commitDismiss() {
|
|
264
|
-
void this.playExit().then(() => this.dismiss.emit());
|
|
265
|
-
}
|
|
266
|
-
/** Commits the exit animation exactly once and returns the shared in-flight promise.
|
|
267
|
-
* Short-circuits under reduced motion and falls back to a timeout if no event fires. */
|
|
268
|
-
playExit() {
|
|
269
|
-
if (this.exitPromise)
|
|
270
|
-
return this.exitPromise;
|
|
271
|
-
this.isDismissing = true;
|
|
272
|
-
this.sheetDragY = window.innerHeight;
|
|
273
|
-
this.cdr.detectChanges();
|
|
274
|
-
this.exitPromise = this.awaitExit();
|
|
275
|
-
return this.exitPromise;
|
|
276
|
-
}
|
|
277
|
-
/** Waits for the container's exit transition to end, with a reduced-motion short-circuit
|
|
278
|
-
* and a fallback timeout so it always resolves. */
|
|
279
|
-
awaitExit() {
|
|
280
|
-
return new Promise((resolve) => {
|
|
281
|
-
if (this.prefersReducedMotion()) {
|
|
282
|
-
resolve();
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
const container = this.containerRef()?.nativeElement ??
|
|
286
|
-
this.el.nativeElement.querySelector('.mn-sheet-container');
|
|
287
|
-
if (!container) {
|
|
288
|
-
resolve();
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
let settled = false;
|
|
292
|
-
const done = (event) => {
|
|
293
|
-
// Ignore end events bubbling up from descendant transitions.
|
|
294
|
-
if (event && event.target !== container)
|
|
295
|
-
return;
|
|
296
|
-
if (settled)
|
|
297
|
-
return;
|
|
298
|
-
settled = true;
|
|
299
|
-
container.removeEventListener('transitionend', done);
|
|
300
|
-
clearTimeout(fallback);
|
|
301
|
-
resolve();
|
|
302
|
-
};
|
|
303
|
-
container.addEventListener('transitionend', done);
|
|
304
|
-
const fallback = setTimeout(done, MnBottomSheet.CLOSE_FALLBACK_MS);
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
prefersReducedMotion() {
|
|
308
|
-
return (typeof window !== 'undefined' &&
|
|
309
|
-
typeof window.matchMedia === 'function' &&
|
|
310
|
-
window.matchMedia('(prefers-reduced-motion: reduce)').matches);
|
|
311
|
-
}
|
|
312
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnBottomSheet, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
313
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: MnBottomSheet, isStandalone: true, selector: "mn-bottom-sheet", inputs: { showBackdrop: "showBackdrop", showGrabber: "showGrabber", dismissible: "dismissible", minHeightPx: "minHeightPx", maxHeightVh: "maxHeightVh", containerClass: "containerClass", ariaLabel: "ariaLabel", ariaLabelledby: "ariaLabelledby", growWithKeyboard: "growWithKeyboard", dismissGuard: "dismissGuard" }, outputs: { dismiss: "dismiss" }, host: { properties: { "class": "this.hostClasses" } }, providers: [{ provide: MN_IN_BOTTOM_SHEET, useValue: true }], viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["container"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (showBackdrop) {\n <!-- Dims the page behind the sheet. Tapping it dismisses when the sheet is dismissible. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <div (click)=\"onBackdropClick()\" class=\"mn-sheet-backdrop fixed inset-0 z-9998 bg-black/40\"></div>\n}\n\n<div\n #container\n [attr.aria-label]=\"ariaLabelledby ? null : (ariaLabel || null)\"\n [attr.aria-labelledby]=\"ariaLabelledby || null\"\n [class.sheet-dragging]=\"isDraggingSheet\"\n [ngClass]=\"containerClass\"\n [style.--mn-sheet-max]=\"maxHeightVh + 'vh'\"\n [style.max-height.vh]=\"maxHeightVh\"\n [style.min-height.px]=\"minHeightPx\"\n [style.transform]=\"sheetDragY ? 'translateY(' + sheetDragY + 'px)' : null\"\n aria-modal=\"true\"\n class=\"mn-sheet-container fixed inset-x-0 bottom-0 z-9999 flex flex-col bg-base-100 border-t border-base-300 rounded-t-2xl shadow-lg\"\n role=\"dialog\"\n tabindex=\"-1\"\n>\n @if (showGrabber) {\n <!-- Drag handle for swipe-to-dismiss. The gesture is armed on the whole handle;\n drags starting on a control inside the projected content are ignored. -->\n <div\n (pointercancel)=\"onSheetPointerUp()\"\n (pointerdown)=\"onSheetPointerDown($event)\"\n (pointermove)=\"onSheetPointerMove($event)\"\n (pointerup)=\"onSheetPointerUp()\"\n class=\"flex justify-center pt-2 pb-1 touch-none cursor-grab shrink-0\"\n >\n <div class=\"h-1.5 w-10 rounded-full bg-base-300\"></div>\n </div>\n }\n\n <ng-content></ng-content>\n</div>\n", styles: [":host{--mn-sheet-ease: cubic-bezier(.32, .72, 0, 1);display:contents}.mn-sheet-container{padding-bottom:calc(.75rem + env(safe-area-inset-bottom));overscroll-behavior:contain;min-height:0;transition:transform .35s var(--mn-sheet-ease),min-height .25s var(--mn-sheet-ease);animation:mn-sheet-in .35s var(--mn-sheet-ease)}:host(.grow-with-keyboard):host-context(.mn-keyboard-open) .mn-sheet-container{min-height:var(--mn-sheet-max, 92vh)}.mn-sheet-container.sheet-dragging{transition:none}.mn-sheet-backdrop{animation:mn-sheet-backdrop-in .2s ease-out}:host(.is-dismissing) .mn-sheet-container{animation:none}@keyframes mn-sheet-in{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes mn-sheet-backdrop-in{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.mn-sheet-container,.mn-sheet-backdrop{animation-duration:.01ms!important;transition-duration:.01ms!important}}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
314
|
-
}
|
|
315
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnBottomSheet, decorators: [{
|
|
316
|
-
type: Component,
|
|
317
|
-
args: [{ selector: 'mn-bottom-sheet', standalone: true, imports: [NgClass], providers: [{ provide: MN_IN_BOTTOM_SHEET, useValue: true }], template: "@if (showBackdrop) {\n <!-- Dims the page behind the sheet. Tapping it dismisses when the sheet is dismissible. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <div (click)=\"onBackdropClick()\" class=\"mn-sheet-backdrop fixed inset-0 z-9998 bg-black/40\"></div>\n}\n\n<div\n #container\n [attr.aria-label]=\"ariaLabelledby ? null : (ariaLabel || null)\"\n [attr.aria-labelledby]=\"ariaLabelledby || null\"\n [class.sheet-dragging]=\"isDraggingSheet\"\n [ngClass]=\"containerClass\"\n [style.--mn-sheet-max]=\"maxHeightVh + 'vh'\"\n [style.max-height.vh]=\"maxHeightVh\"\n [style.min-height.px]=\"minHeightPx\"\n [style.transform]=\"sheetDragY ? 'translateY(' + sheetDragY + 'px)' : null\"\n aria-modal=\"true\"\n class=\"mn-sheet-container fixed inset-x-0 bottom-0 z-9999 flex flex-col bg-base-100 border-t border-base-300 rounded-t-2xl shadow-lg\"\n role=\"dialog\"\n tabindex=\"-1\"\n>\n @if (showGrabber) {\n <!-- Drag handle for swipe-to-dismiss. The gesture is armed on the whole handle;\n drags starting on a control inside the projected content are ignored. -->\n <div\n (pointercancel)=\"onSheetPointerUp()\"\n (pointerdown)=\"onSheetPointerDown($event)\"\n (pointermove)=\"onSheetPointerMove($event)\"\n (pointerup)=\"onSheetPointerUp()\"\n class=\"flex justify-center pt-2 pb-1 touch-none cursor-grab shrink-0\"\n >\n <div class=\"h-1.5 w-10 rounded-full bg-base-300\"></div>\n </div>\n }\n\n <ng-content></ng-content>\n</div>\n", styles: [":host{--mn-sheet-ease: cubic-bezier(.32, .72, 0, 1);display:contents}.mn-sheet-container{padding-bottom:calc(.75rem + env(safe-area-inset-bottom));overscroll-behavior:contain;min-height:0;transition:transform .35s var(--mn-sheet-ease),min-height .25s var(--mn-sheet-ease);animation:mn-sheet-in .35s var(--mn-sheet-ease)}:host(.grow-with-keyboard):host-context(.mn-keyboard-open) .mn-sheet-container{min-height:var(--mn-sheet-max, 92vh)}.mn-sheet-container.sheet-dragging{transition:none}.mn-sheet-backdrop{animation:mn-sheet-backdrop-in .2s ease-out}:host(.is-dismissing) .mn-sheet-container{animation:none}@keyframes mn-sheet-in{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes mn-sheet-backdrop-in{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.mn-sheet-container,.mn-sheet-backdrop{animation-duration:.01ms!important;transition-duration:.01ms!important}}\n"] }]
|
|
318
|
-
}], propDecorators: { showBackdrop: [{
|
|
319
|
-
type: Input
|
|
320
|
-
}], showGrabber: [{
|
|
321
|
-
type: Input
|
|
322
|
-
}], dismissible: [{
|
|
323
|
-
type: Input
|
|
324
|
-
}], minHeightPx: [{
|
|
325
|
-
type: Input
|
|
326
|
-
}], maxHeightVh: [{
|
|
327
|
-
type: Input
|
|
328
|
-
}], containerClass: [{
|
|
329
|
-
type: Input
|
|
330
|
-
}], ariaLabel: [{
|
|
331
|
-
type: Input
|
|
332
|
-
}], ariaLabelledby: [{
|
|
333
|
-
type: Input
|
|
334
|
-
}], growWithKeyboard: [{
|
|
335
|
-
type: Input
|
|
336
|
-
}], dismissGuard: [{
|
|
337
|
-
type: Input
|
|
338
|
-
}], dismiss: [{
|
|
339
|
-
type: Output
|
|
340
|
-
}], containerRef: [{ type: i0.ViewChild, args: ['container', { isSignal: true }] }], hostClasses: [{
|
|
341
|
-
type: HostBinding,
|
|
342
|
-
args: ['class']
|
|
343
|
-
}] } });
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Public API of the `mn-angular-lib/bottom-sheet` entry point: the bottom sheet.
|
|
347
|
-
*
|
|
348
|
-
* Each entry point is its own module in the published package, so a consumer's bundler
|
|
349
|
-
* splits it into the chunk that uses it instead of loading the whole library at startup.
|
|
350
|
-
* The root `mn-angular-lib` entry re-exports every entry point.
|
|
351
|
-
*/
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* Generated bundle index. Do not edit.
|
|
355
|
-
*/
|
|
356
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectorRef, Component, ElementRef, EventEmitter, HostBinding, Input, Output, inject, viewChild } from "@angular/core";
|
|
3
|
+
import { NgClass } from "@angular/common";
|
|
4
|
+
import { MN_IN_BOTTOM_SHEET } from "mn-angular-lib/core";
|
|
5
|
+
var MnBottomSheet = class MnBottomSheet {
|
|
6
|
+
static SHEET_MAX_WIDTH = 639.98;
|
|
7
|
+
static SWIPE_DISMISS_THRESHOLD = 150;
|
|
8
|
+
static FLICK_VELOCITY = .5;
|
|
9
|
+
static FLICK_MIN_DISTANCE = 32;
|
|
10
|
+
static CLOSE_FALLBACK_MS = 700;
|
|
11
|
+
showBackdrop = true;
|
|
12
|
+
showGrabber = true;
|
|
13
|
+
dismissible = true;
|
|
14
|
+
minHeightPx = null;
|
|
15
|
+
maxHeightVh = 80;
|
|
16
|
+
containerClass = "";
|
|
17
|
+
ariaLabel;
|
|
18
|
+
ariaLabelledby;
|
|
19
|
+
growWithKeyboard = false;
|
|
20
|
+
dismissGuard;
|
|
21
|
+
dismiss = new EventEmitter();
|
|
22
|
+
sheetDragY = 0;
|
|
23
|
+
isDraggingSheet = false;
|
|
24
|
+
isDismissing = false;
|
|
25
|
+
cdr = inject(ChangeDetectorRef);
|
|
26
|
+
el = inject(ElementRef);
|
|
27
|
+
containerRef = viewChild("container", ...ngDevMode ? [{ debugName: "containerRef" }] : /* istanbul ignore next */ []);
|
|
28
|
+
dragStartY = 0;
|
|
29
|
+
lastSample = null;
|
|
30
|
+
prevSample = null;
|
|
31
|
+
exitPromise = null;
|
|
32
|
+
portalledHost = null;
|
|
33
|
+
scrollGuard = null;
|
|
34
|
+
ngOnInit() {
|
|
35
|
+
if (typeof document === "undefined") return;
|
|
36
|
+
const host = this.el.nativeElement;
|
|
37
|
+
document.body.appendChild(host);
|
|
38
|
+
this.portalledHost = host;
|
|
39
|
+
this.lockScroll();
|
|
40
|
+
}
|
|
41
|
+
lockScroll() {
|
|
42
|
+
const guard = (event) => {
|
|
43
|
+
const target = event.target;
|
|
44
|
+
const container = this.containerRef()?.nativeElement;
|
|
45
|
+
if (container && target && container.contains(target)) return;
|
|
46
|
+
if (event.cancelable) event.preventDefault();
|
|
47
|
+
};
|
|
48
|
+
document.addEventListener("wheel", guard, {
|
|
49
|
+
capture: true,
|
|
50
|
+
passive: false
|
|
51
|
+
});
|
|
52
|
+
document.addEventListener("touchmove", guard, {
|
|
53
|
+
capture: true,
|
|
54
|
+
passive: false
|
|
55
|
+
});
|
|
56
|
+
this.scrollGuard = guard;
|
|
57
|
+
}
|
|
58
|
+
unlockScroll() {
|
|
59
|
+
if (!this.scrollGuard) return;
|
|
60
|
+
document.removeEventListener("wheel", this.scrollGuard, { capture: true });
|
|
61
|
+
document.removeEventListener("touchmove", this.scrollGuard, { capture: true });
|
|
62
|
+
this.scrollGuard = null;
|
|
63
|
+
}
|
|
64
|
+
ngOnDestroy() {
|
|
65
|
+
this.unlockScroll();
|
|
66
|
+
this.portalledHost?.remove();
|
|
67
|
+
this.portalledHost = null;
|
|
68
|
+
}
|
|
69
|
+
get hostClasses() {
|
|
70
|
+
return `mn-bottom-sheet${this.isDismissing ? " is-dismissing" : ""}${this.growWithKeyboard ? " grow-with-keyboard" : ""}`;
|
|
71
|
+
}
|
|
72
|
+
get isNarrow() {
|
|
73
|
+
return typeof window === "undefined" || window.innerWidth <= MnBottomSheet.SHEET_MAX_WIDTH;
|
|
74
|
+
}
|
|
75
|
+
onSheetPointerDown(event) {
|
|
76
|
+
if (!this.dismissible || !this.isNarrow) return;
|
|
77
|
+
if (event.target.closest("button, input, textarea, select, a")) return;
|
|
78
|
+
this.isDraggingSheet = true;
|
|
79
|
+
this.dragStartY = event.clientY;
|
|
80
|
+
this.lastSample = {
|
|
81
|
+
y: event.clientY,
|
|
82
|
+
t: event.timeStamp
|
|
83
|
+
};
|
|
84
|
+
this.prevSample = this.lastSample;
|
|
85
|
+
event.target.setPointerCapture(event.pointerId);
|
|
86
|
+
}
|
|
87
|
+
onSheetPointerMove(event) {
|
|
88
|
+
if (!this.isDraggingSheet) return;
|
|
89
|
+
this.sheetDragY = Math.max(0, event.clientY - this.dragStartY);
|
|
90
|
+
this.prevSample = this.lastSample;
|
|
91
|
+
this.lastSample = {
|
|
92
|
+
y: event.clientY,
|
|
93
|
+
t: event.timeStamp
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
onSheetPointerUp() {
|
|
97
|
+
if (!this.isDraggingSheet) return;
|
|
98
|
+
this.isDraggingSheet = false;
|
|
99
|
+
if (this.shouldDismiss()) this.attemptDismiss();
|
|
100
|
+
else this.snapBack();
|
|
101
|
+
this.lastSample = null;
|
|
102
|
+
this.prevSample = null;
|
|
103
|
+
}
|
|
104
|
+
onBackdropClick() {
|
|
105
|
+
this.attemptDismiss();
|
|
106
|
+
}
|
|
107
|
+
startClosing() {
|
|
108
|
+
return this.playExit();
|
|
109
|
+
}
|
|
110
|
+
async attemptDismiss() {
|
|
111
|
+
if (!this.dismissible) return;
|
|
112
|
+
if (this.dismissGuard) {
|
|
113
|
+
if (!await this.dismissGuard()) {
|
|
114
|
+
this.snapBack();
|
|
115
|
+
this.cdr.detectChanges();
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
this.commitDismiss();
|
|
120
|
+
}
|
|
121
|
+
shouldDismiss() {
|
|
122
|
+
if (this.sheetDragY > MnBottomSheet.SWIPE_DISMISS_THRESHOLD) return true;
|
|
123
|
+
return this.releaseVelocity() > MnBottomSheet.FLICK_VELOCITY && this.sheetDragY > MnBottomSheet.FLICK_MIN_DISTANCE;
|
|
124
|
+
}
|
|
125
|
+
releaseVelocity() {
|
|
126
|
+
if (!this.lastSample || !this.prevSample) return 0;
|
|
127
|
+
const dt = this.lastSample.t - this.prevSample.t;
|
|
128
|
+
if (dt <= 0) return 0;
|
|
129
|
+
return (this.lastSample.y - this.prevSample.y) / dt;
|
|
130
|
+
}
|
|
131
|
+
snapBack() {
|
|
132
|
+
this.sheetDragY = 0;
|
|
133
|
+
}
|
|
134
|
+
commitDismiss() {
|
|
135
|
+
this.playExit().then(() => this.dismiss.emit());
|
|
136
|
+
}
|
|
137
|
+
playExit() {
|
|
138
|
+
if (this.exitPromise) return this.exitPromise;
|
|
139
|
+
this.isDismissing = true;
|
|
140
|
+
this.sheetDragY = window.innerHeight;
|
|
141
|
+
this.cdr.detectChanges();
|
|
142
|
+
this.exitPromise = this.awaitExit();
|
|
143
|
+
return this.exitPromise;
|
|
144
|
+
}
|
|
145
|
+
awaitExit() {
|
|
146
|
+
return new Promise((resolve) => {
|
|
147
|
+
if (this.prefersReducedMotion()) {
|
|
148
|
+
resolve();
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const container = this.containerRef()?.nativeElement ?? this.el.nativeElement.querySelector(".mn-sheet-container");
|
|
152
|
+
if (!container) {
|
|
153
|
+
resolve();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
let settled = false;
|
|
157
|
+
const done = (event) => {
|
|
158
|
+
if (event && event.target !== container) return;
|
|
159
|
+
if (settled) return;
|
|
160
|
+
settled = true;
|
|
161
|
+
container.removeEventListener("transitionend", done);
|
|
162
|
+
clearTimeout(fallback);
|
|
163
|
+
resolve();
|
|
164
|
+
};
|
|
165
|
+
container.addEventListener("transitionend", done);
|
|
166
|
+
const fallback = setTimeout(done, MnBottomSheet.CLOSE_FALLBACK_MS);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
prefersReducedMotion() {
|
|
170
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
171
|
+
}
|
|
172
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
173
|
+
minVersion: "12.0.0",
|
|
174
|
+
version: "22.2.2",
|
|
175
|
+
ngImport: i0,
|
|
176
|
+
type: MnBottomSheet,
|
|
177
|
+
deps: [],
|
|
178
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
179
|
+
});
|
|
180
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
181
|
+
minVersion: "17.0.0",
|
|
182
|
+
version: "22.2.2",
|
|
183
|
+
type: MnBottomSheet,
|
|
184
|
+
isStandalone: true,
|
|
185
|
+
selector: "mn-bottom-sheet",
|
|
186
|
+
inputs: {
|
|
187
|
+
showBackdrop: "showBackdrop",
|
|
188
|
+
showGrabber: "showGrabber",
|
|
189
|
+
dismissible: "dismissible",
|
|
190
|
+
minHeightPx: "minHeightPx",
|
|
191
|
+
maxHeightVh: "maxHeightVh",
|
|
192
|
+
containerClass: "containerClass",
|
|
193
|
+
ariaLabel: "ariaLabel",
|
|
194
|
+
ariaLabelledby: "ariaLabelledby",
|
|
195
|
+
growWithKeyboard: "growWithKeyboard",
|
|
196
|
+
dismissGuard: "dismissGuard"
|
|
197
|
+
},
|
|
198
|
+
outputs: { dismiss: "dismiss" },
|
|
199
|
+
host: { properties: { "class": "this.hostClasses" } },
|
|
200
|
+
providers: [{
|
|
201
|
+
provide: MN_IN_BOTTOM_SHEET,
|
|
202
|
+
useValue: true
|
|
203
|
+
}],
|
|
204
|
+
viewQueries: [{
|
|
205
|
+
propertyName: "containerRef",
|
|
206
|
+
first: true,
|
|
207
|
+
predicate: ["container"],
|
|
208
|
+
descendants: true,
|
|
209
|
+
isSignal: true
|
|
210
|
+
}],
|
|
211
|
+
ngImport: i0,
|
|
212
|
+
template: "@if (showBackdrop) {\n <!-- Dims the page behind the sheet. Tapping it dismisses when the sheet is dismissible. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <div (click)=\"onBackdropClick()\" class=\"mn-sheet-backdrop fixed inset-0 z-9998 bg-black/40\"></div>\n}\n\n<div\n #container\n [attr.aria-label]=\"ariaLabelledby ? null : (ariaLabel || null)\"\n [attr.aria-labelledby]=\"ariaLabelledby || null\"\n [class.sheet-dragging]=\"isDraggingSheet\"\n [ngClass]=\"containerClass\"\n [style.--mn-sheet-max]=\"maxHeightVh + 'vh'\"\n [style.max-height.vh]=\"maxHeightVh\"\n [style.min-height.px]=\"minHeightPx\"\n [style.transform]=\"sheetDragY ? 'translateY(' + sheetDragY + 'px)' : null\"\n aria-modal=\"true\"\n class=\"mn-sheet-container fixed inset-x-0 bottom-0 z-9999 flex flex-col bg-base-100 border-t border-base-300 rounded-t-2xl shadow-lg\"\n role=\"dialog\"\n tabindex=\"-1\"\n>\n @if (showGrabber) {\n <!-- Drag handle for swipe-to-dismiss. The gesture is armed on the whole handle;\n drags starting on a control inside the projected content are ignored. -->\n <div\n (pointercancel)=\"onSheetPointerUp()\"\n (pointerdown)=\"onSheetPointerDown($event)\"\n (pointermove)=\"onSheetPointerMove($event)\"\n (pointerup)=\"onSheetPointerUp()\"\n class=\"flex justify-center pt-2 pb-1 touch-none cursor-grab shrink-0\"\n >\n <div class=\"h-1.5 w-10 rounded-full bg-base-300\"></div>\n </div>\n }\n\n <ng-content></ng-content>\n</div>\n",
|
|
213
|
+
styles: [":host{--mn-sheet-ease: cubic-bezier(.32, .72, 0, 1);display:contents}.mn-sheet-container{padding-bottom:calc(.75rem + env(safe-area-inset-bottom));overscroll-behavior:contain;min-height:0;transition:transform .35s var(--mn-sheet-ease),min-height .25s var(--mn-sheet-ease);animation:mn-sheet-in .35s var(--mn-sheet-ease)}:host(.grow-with-keyboard):host-context(.mn-keyboard-open) .mn-sheet-container{min-height:var(--mn-sheet-max, 92vh)}.mn-sheet-container.sheet-dragging{transition:none}.mn-sheet-backdrop{animation:mn-sheet-backdrop-in .2s ease-out}:host(.is-dismissing) .mn-sheet-container{animation:none}@keyframes mn-sheet-in{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes mn-sheet-backdrop-in{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.mn-sheet-container,.mn-sheet-backdrop{animation-duration:.01ms!important;transition-duration:.01ms!important}}\n"],
|
|
214
|
+
dependencies: [{
|
|
215
|
+
kind: "directive",
|
|
216
|
+
type: NgClass,
|
|
217
|
+
selector: "[ngClass]",
|
|
218
|
+
inputs: ["class", "ngClass"]
|
|
219
|
+
}]
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
223
|
+
minVersion: "12.0.0",
|
|
224
|
+
version: "22.2.2",
|
|
225
|
+
ngImport: i0,
|
|
226
|
+
type: MnBottomSheet,
|
|
227
|
+
decorators: [{
|
|
228
|
+
type: Component,
|
|
229
|
+
args: [{
|
|
230
|
+
selector: "mn-bottom-sheet",
|
|
231
|
+
standalone: true,
|
|
232
|
+
imports: [NgClass],
|
|
233
|
+
providers: [{
|
|
234
|
+
provide: MN_IN_BOTTOM_SHEET,
|
|
235
|
+
useValue: true
|
|
236
|
+
}],
|
|
237
|
+
template: "@if (showBackdrop) {\n <!-- Dims the page behind the sheet. Tapping it dismisses when the sheet is dismissible. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <div (click)=\"onBackdropClick()\" class=\"mn-sheet-backdrop fixed inset-0 z-9998 bg-black/40\"></div>\n}\n\n<div\n #container\n [attr.aria-label]=\"ariaLabelledby ? null : (ariaLabel || null)\"\n [attr.aria-labelledby]=\"ariaLabelledby || null\"\n [class.sheet-dragging]=\"isDraggingSheet\"\n [ngClass]=\"containerClass\"\n [style.--mn-sheet-max]=\"maxHeightVh + 'vh'\"\n [style.max-height.vh]=\"maxHeightVh\"\n [style.min-height.px]=\"minHeightPx\"\n [style.transform]=\"sheetDragY ? 'translateY(' + sheetDragY + 'px)' : null\"\n aria-modal=\"true\"\n class=\"mn-sheet-container fixed inset-x-0 bottom-0 z-9999 flex flex-col bg-base-100 border-t border-base-300 rounded-t-2xl shadow-lg\"\n role=\"dialog\"\n tabindex=\"-1\"\n>\n @if (showGrabber) {\n <!-- Drag handle for swipe-to-dismiss. The gesture is armed on the whole handle;\n drags starting on a control inside the projected content are ignored. -->\n <div\n (pointercancel)=\"onSheetPointerUp()\"\n (pointerdown)=\"onSheetPointerDown($event)\"\n (pointermove)=\"onSheetPointerMove($event)\"\n (pointerup)=\"onSheetPointerUp()\"\n class=\"flex justify-center pt-2 pb-1 touch-none cursor-grab shrink-0\"\n >\n <div class=\"h-1.5 w-10 rounded-full bg-base-300\"></div>\n </div>\n }\n\n <ng-content></ng-content>\n</div>\n",
|
|
238
|
+
styles: [":host{--mn-sheet-ease: cubic-bezier(.32, .72, 0, 1);display:contents}.mn-sheet-container{padding-bottom:calc(.75rem + env(safe-area-inset-bottom));overscroll-behavior:contain;min-height:0;transition:transform .35s var(--mn-sheet-ease),min-height .25s var(--mn-sheet-ease);animation:mn-sheet-in .35s var(--mn-sheet-ease)}:host(.grow-with-keyboard):host-context(.mn-keyboard-open) .mn-sheet-container{min-height:var(--mn-sheet-max, 92vh)}.mn-sheet-container.sheet-dragging{transition:none}.mn-sheet-backdrop{animation:mn-sheet-backdrop-in .2s ease-out}:host(.is-dismissing) .mn-sheet-container{animation:none}@keyframes mn-sheet-in{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes mn-sheet-backdrop-in{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.mn-sheet-container,.mn-sheet-backdrop{animation-duration:.01ms!important;transition-duration:.01ms!important}}\n"]
|
|
239
|
+
}]
|
|
240
|
+
}],
|
|
241
|
+
propDecorators: {
|
|
242
|
+
showBackdrop: [{ type: Input }],
|
|
243
|
+
showGrabber: [{ type: Input }],
|
|
244
|
+
dismissible: [{ type: Input }],
|
|
245
|
+
minHeightPx: [{ type: Input }],
|
|
246
|
+
maxHeightVh: [{ type: Input }],
|
|
247
|
+
containerClass: [{ type: Input }],
|
|
248
|
+
ariaLabel: [{ type: Input }],
|
|
249
|
+
ariaLabelledby: [{ type: Input }],
|
|
250
|
+
growWithKeyboard: [{ type: Input }],
|
|
251
|
+
dismissGuard: [{ type: Input }],
|
|
252
|
+
dismiss: [{ type: Output }],
|
|
253
|
+
containerRef: [{
|
|
254
|
+
type: i0.ViewChild,
|
|
255
|
+
args: ["container", { isSignal: true }]
|
|
256
|
+
}],
|
|
257
|
+
hostClasses: [{
|
|
258
|
+
type: HostBinding,
|
|
259
|
+
args: ["class"]
|
|
260
|
+
}]
|
|
261
|
+
}
|
|
262
|
+
});
|
|
357
263
|
export { MnBottomSheet };
|
|
358
|
-
|
|
264
|
+
|
|
265
|
+
//# sourceMappingURL=mn-angular-lib-bottom-sheet.mjs.map
|