wj-elements 0.7.7 → 0.8.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/dist/animations.js +28 -51
- package/dist/animations.js.map +1 -1
- package/dist/base-path.js +19 -31
- package/dist/base-path.js.map +1 -1
- package/dist/custom-elements.json +11504 -11499
- package/dist/dark.css +1 -302
- package/dist/date.js +16 -36
- package/dist/date.js.map +1 -1
- package/dist/element-utils.js +20 -81
- package/dist/element-utils.js.map +1 -1
- package/dist/event.js +49 -165
- package/dist/event.js.map +1 -1
- package/dist/form-associated-element-BjeJn7j8.js +101 -0
- package/dist/{form-associated-element-DEQ4y-jn.js.map → form-associated-element-BjeJn7j8.js.map} +1 -1
- package/dist/icon-DmsqtDpL.js +102 -0
- package/dist/{icon-CReYMzAK.js.map → icon-DmsqtDpL.js.map} +1 -1
- package/dist/light.css +1 -731
- package/dist/localize.js +36 -111
- package/dist/localize.js.map +1 -1
- package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +3 -2
- package/dist/permissions.js +14 -41
- package/dist/permissions.js.map +1 -1
- package/dist/popup.element-CbkhthPP.js +806 -0
- package/dist/{popup.element-CwXvVFK7.js.map → popup.element-CbkhthPP.js.map} +1 -1
- package/dist/router-links-CNsJ-elb.js +105 -0
- package/dist/{router-links-wjqCnncc.js.map → router-links-CNsJ-elb.js.map} +1 -1
- package/dist/skeleton.css +1 -197
- package/dist/styles.css +1 -866
- package/dist/universal-service.js +48 -109
- package/dist/universal-service.js.map +1 -1
- package/dist/utils.js +11 -18
- package/dist/utils.js.map +1 -1
- package/dist/web-types.json +760 -760
- package/dist/wje-accordion-item.js +33 -106
- package/dist/wje-accordion-item.js.map +1 -1
- package/dist/wje-accordion.js +19 -84
- package/dist/wje-accordion.js.map +1 -1
- package/dist/wje-animation.js +37 -4258
- package/dist/wje-animation.js.map +1 -1
- package/dist/wje-aside.js +9 -34
- package/dist/wje-aside.js.map +1 -1
- package/dist/wje-avatar.js +36 -126
- package/dist/wje-avatar.js.map +1 -1
- package/dist/wje-badge.js +10 -52
- package/dist/wje-badge.js.map +1 -1
- package/dist/wje-breadcrumb.js +205 -672
- package/dist/wje-breadcrumb.js.map +1 -1
- package/dist/wje-breadcrumbs.js +177 -633
- package/dist/wje-breadcrumbs.js.map +1 -1
- package/dist/wje-button-group.js +48 -153
- package/dist/wje-button-group.js.map +1 -1
- package/dist/wje-button.js +92 -413
- package/dist/wje-button.js.map +1 -1
- package/dist/wje-card-content.js +7 -30
- package/dist/wje-card-content.js.map +1 -1
- package/dist/wje-card-controls.js +7 -30
- package/dist/wje-card-controls.js.map +1 -1
- package/dist/wje-card-header.js +7 -30
- package/dist/wje-card-header.js.map +1 -1
- package/dist/wje-card-subtitle.js +7 -34
- package/dist/wje-card-subtitle.js.map +1 -1
- package/dist/wje-card-title.js +7 -34
- package/dist/wje-card-title.js.map +1 -1
- package/dist/wje-card.js +15 -71
- package/dist/wje-card.js.map +1 -1
- package/dist/wje-carousel-item.js +12 -56
- package/dist/wje-carousel-item.js.map +1 -1
- package/dist/wje-carousel.js +154 -509
- package/dist/wje-carousel.js.map +1 -1
- package/dist/wje-checkbox.js +50 -227
- package/dist/wje-checkbox.js.map +1 -1
- package/dist/wje-chip.js +43 -160
- package/dist/wje-chip.js.map +1 -1
- package/dist/wje-col.js +7 -20
- package/dist/wje-col.js.map +1 -1
- package/dist/wje-color-picker.js +445 -1464
- package/dist/wje-color-picker.js.map +1 -1
- package/dist/wje-container.js +9 -35
- package/dist/wje-container.js.map +1 -1
- package/dist/wje-copy-button.js +64 -204
- package/dist/wje-copy-button.js.map +1 -1
- package/dist/wje-dialog.js +85 -553
- package/dist/wje-dialog.js.map +1 -1
- package/dist/wje-divider.js +7 -34
- package/dist/wje-divider.js.map +1 -1
- package/dist/wje-dropdown.js +78 -305
- package/dist/wje-dropdown.js.map +1 -1
- package/dist/wje-element.js +191 -700
- package/dist/wje-element.js.map +1 -1
- package/dist/wje-file-upload-item.js +51 -156
- package/dist/wje-file-upload-item.js.map +1 -1
- package/dist/wje-file-upload.js +181 -619
- package/dist/wje-file-upload.js.map +1 -1
- package/dist/wje-footer.js +7 -31
- package/dist/wje-footer.js.map +1 -1
- package/dist/wje-form.js +7 -32
- package/dist/wje-form.js.map +1 -1
- package/dist/wje-format-digital.js +26 -118
- package/dist/wje-format-digital.js.map +1 -1
- package/dist/wje-grid.js +7 -33
- package/dist/wje-grid.js.map +1 -1
- package/dist/wje-header.js +9 -35
- package/dist/wje-header.js.map +1 -1
- package/dist/wje-icon-library.js +12 -18
- package/dist/wje-icon-library.js.map +1 -1
- package/dist/wje-icon-picker.js +65 -320
- package/dist/wje-icon-picker.js.map +1 -1
- package/dist/wje-icon.js +1 -1
- package/dist/wje-img-comparer.js +37 -114
- package/dist/wje-img-comparer.js.map +1 -1
- package/dist/wje-img.js +50 -198
- package/dist/wje-img.js.map +1 -1
- package/dist/wje-infinite-scroll.js +94 -346
- package/dist/wje-infinite-scroll.js.map +1 -1
- package/dist/wje-input-file.js +23 -84
- package/dist/wje-input-file.js.map +1 -1
- package/dist/wje-input.js +78 -392
- package/dist/wje-input.js.map +1 -1
- package/dist/wje-item.js +11 -64
- package/dist/wje-item.js.map +1 -1
- package/dist/wje-kanban.js +124 -401
- package/dist/wje-kanban.js.map +1 -1
- package/dist/wje-label.js +9 -32
- package/dist/wje-label.js.map +1 -1
- package/dist/wje-level-indicator.js +38 -157
- package/dist/wje-level-indicator.js.map +1 -1
- package/dist/wje-list.js +10 -40
- package/dist/wje-list.js.map +1 -1
- package/dist/wje-main.js +7 -31
- package/dist/wje-main.js.map +1 -1
- package/dist/wje-masonry.js +66 -211
- package/dist/wje-masonry.js.map +1 -1
- package/dist/wje-master.js +45 -161
- package/dist/wje-master.js.map +1 -1
- package/dist/wje-menu-button.js +10 -38
- package/dist/wje-menu-button.js.map +1 -1
- package/dist/wje-menu-item.js +127 -577
- package/dist/wje-menu-item.js.map +1 -1
- package/dist/wje-menu-label.js +9 -35
- package/dist/wje-menu-label.js.map +1 -1
- package/dist/wje-menu.js +14 -49
- package/dist/wje-menu.js.map +1 -1
- package/dist/wje-option.js +48 -279
- package/dist/wje-option.js.map +1 -1
- package/dist/wje-options.js +130 -384
- package/dist/wje-options.js.map +1 -1
- package/dist/wje-orgchart-group.js +16 -52
- package/dist/wje-orgchart-group.js.map +1 -1
- package/dist/wje-orgchart-item.js +24 -93
- package/dist/wje-orgchart-item.js.map +1 -1
- package/dist/wje-orgchart.js +18 -68
- package/dist/wje-orgchart.js.map +1 -1
- package/dist/wje-pagination.js +113 -397
- package/dist/wje-pagination.js.map +1 -1
- package/dist/wje-popup.js +3 -3
- package/dist/wje-popup.js.map +1 -1
- package/dist/wje-progress-bar.js +53 -205
- package/dist/wje-progress-bar.js.map +1 -1
- package/dist/wje-qr-code.js +398 -2980
- package/dist/wje-qr-code.js.map +1 -1
- package/dist/wje-radio-group.js +52 -190
- package/dist/wje-radio-group.js.map +1 -1
- package/dist/wje-radio.js +24 -118
- package/dist/wje-radio.js.map +1 -1
- package/dist/wje-rate.js +62 -266
- package/dist/wje-rate.js.map +1 -1
- package/dist/wje-relative-time.js +24 -99
- package/dist/wje-relative-time.js.map +1 -1
- package/dist/wje-reorder-dropzone.js +9 -31
- package/dist/wje-reorder-dropzone.js.map +1 -1
- package/dist/wje-reorder-handle.js +67 -204
- package/dist/wje-reorder-handle.js.map +1 -1
- package/dist/wje-reorder-item.js +14 -44
- package/dist/wje-reorder-item.js.map +1 -1
- package/dist/wje-reorder.js +61 -246
- package/dist/wje-reorder.js.map +1 -1
- package/dist/wje-route.js +6 -24
- package/dist/wje-route.js.map +1 -1
- package/dist/wje-router-link.js +11 -39
- package/dist/wje-router-link.js.map +1 -1
- package/dist/wje-router-outlet.js +76 -172
- package/dist/wje-router-outlet.js.map +1 -1
- package/dist/wje-routerx.js +537 -1331
- package/dist/wje-routerx.js.map +1 -1
- package/dist/wje-row.js +9 -31
- package/dist/wje-row.js.map +1 -1
- package/dist/wje-select.js +326 -1152
- package/dist/wje-select.js.map +1 -1
- package/dist/wje-slider.js +44 -225
- package/dist/wje-slider.js.map +1 -1
- package/dist/wje-sliding-container.js +295 -1319
- package/dist/wje-sliding-container.js.map +1 -1
- package/dist/wje-split-view.js +35 -121
- package/dist/wje-split-view.js.map +1 -1
- package/dist/wje-status.js +14 -45
- package/dist/wje-status.js.map +1 -1
- package/dist/wje-step.js +9 -32
- package/dist/wje-step.js.map +1 -1
- package/dist/wje-stepper.js +109 -357
- package/dist/wje-stepper.js.map +1 -1
- package/dist/wje-store.js +67 -360
- package/dist/wje-store.js.map +1 -1
- package/dist/wje-tab-group.js +85 -314
- package/dist/wje-tab-group.js.map +1 -1
- package/dist/wje-tab-panel.js +7 -28
- package/dist/wje-tab-panel.js.map +1 -1
- package/dist/wje-tab.js +21 -198
- package/dist/wje-tab.js.map +1 -1
- package/dist/wje-textarea.js +64 -264
- package/dist/wje-textarea.js.map +1 -1
- package/dist/wje-thumbnail.js +10 -51
- package/dist/wje-thumbnail.js.map +1 -1
- package/dist/wje-toast.js +127 -632
- package/dist/wje-toast.js.map +1 -1
- package/dist/wje-toggle.js +52 -177
- package/dist/wje-toggle.js.map +1 -1
- package/dist/wje-toolbar-action.js +128 -456
- package/dist/wje-toolbar-action.js.map +1 -1
- package/dist/wje-toolbar.js +75 -270
- package/dist/wje-toolbar.js.map +1 -1
- package/dist/wje-tooltip.js +50 -161
- package/dist/wje-tooltip.js.map +1 -1
- package/dist/wje-tree-item.js +70 -301
- package/dist/wje-tree-item.js.map +1 -1
- package/dist/wje-tree.js +145 -489
- package/dist/wje-tree.js.map +1 -1
- package/dist/wje-visually-hidden.js +7 -34
- package/dist/wje-visually-hidden.js.map +1 -1
- package/package.json +3 -2
- package/dist/form-associated-element-DEQ4y-jn.js +0 -245
- package/dist/icon-CReYMzAK.js +0 -245
- package/dist/popup.element-CwXvVFK7.js +0 -2133
- package/dist/router-links-wjqCnncc.js +0 -156
|
@@ -1,1501 +1,477 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import
|
|
5
|
-
import { event } from "./event.js";
|
|
6
|
-
|
|
7
|
-
class SlidingContainer extends WJElement {
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of SlidingContainer.
|
|
10
|
-
* @class
|
|
11
|
-
*/
|
|
4
|
+
import t from "./wje-element.js";
|
|
5
|
+
import { event as e } from "./event.js";
|
|
6
|
+
class i extends t {
|
|
12
7
|
constructor() {
|
|
13
8
|
super();
|
|
14
9
|
__publicField(this, "className", "SlidingContainer");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
19
|
-
__publicField(this, "handleBackdropClick", (e) => {
|
|
20
|
-
if (this.isEventInsideSheet(e) || Date.now() < this._sheetIgnoreDismissUntil || Date.now() < this._sheetBackdropHandledUntil) {
|
|
21
|
-
e.preventDefault();
|
|
22
|
-
e.stopPropagation();
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (this.isBackdropElement(e.target)) {
|
|
26
|
-
this.close(e);
|
|
27
|
-
}
|
|
10
|
+
__publicField(this, "handleBackdropClick", (t2) => {
|
|
11
|
+
if (this.isEventInsideSheet(t2) || Date.now() < this._sheetIgnoreDismissUntil || Date.now() < this._sheetBackdropHandledUntil) return t2.preventDefault(), void t2.stopPropagation();
|
|
12
|
+
this.isBackdropElement(t2.target) && this.close(t2);
|
|
28
13
|
});
|
|
29
|
-
|
|
30
|
-
* Stops a handle interaction from dismissing the bottom sheet.
|
|
31
|
-
* @param {Event} e The interaction emitted by the resize handle.
|
|
32
|
-
*/
|
|
33
|
-
__publicField(this, "stopSheetHandleEvent", (e) => {
|
|
14
|
+
__publicField(this, "stopSheetHandleEvent", (t2) => {
|
|
34
15
|
var _a;
|
|
35
|
-
|
|
36
|
-
this._sheetIgnoreDismissUntil = Date.now() + 500;
|
|
37
|
-
e.preventDefault();
|
|
38
|
-
e.stopPropagation();
|
|
39
|
-
(_a = e.stopImmediatePropagation) == null ? void 0 : _a.call(e);
|
|
16
|
+
this.isBottomSheet() && (this._sheetIgnoreDismissUntil = Date.now() + 500, t2.preventDefault(), t2.stopPropagation(), (_a = t2.stopImmediatePropagation) == null ? void 0 : _a.call(t2));
|
|
40
17
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
* @param {Event} e The scroll event.
|
|
44
|
-
*/
|
|
45
|
-
__publicField(this, "preventBottomSheetScroll", (e) => {
|
|
46
|
-
if (!this.isBottomSheet() || !this.classList.contains("open")) return;
|
|
47
|
-
e.preventDefault();
|
|
48
|
-
e.stopPropagation();
|
|
18
|
+
__publicField(this, "preventBottomSheetScroll", (t2) => {
|
|
19
|
+
this.isBottomSheet() && this.classList.contains("open") && (t2.preventDefault(), t2.stopPropagation());
|
|
49
20
|
});
|
|
50
|
-
|
|
51
|
-
* Starts mobile bottom sheet resizing.
|
|
52
|
-
* @param {PointerEvent} e The pointer event.
|
|
53
|
-
*/
|
|
54
|
-
__publicField(this, "handleSheetDragStart", (e) => {
|
|
21
|
+
__publicField(this, "handleSheetDragStart", (t2) => {
|
|
55
22
|
var _a, _b;
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
(_b = this.sheetHandleArea) == null ? void 0 : _b.setPointerCapture(e.pointerId);
|
|
65
|
-
} catch {
|
|
23
|
+
if (this.sheetResizable && this.isBottomSheet() && (t2.preventDefault(), t2.stopPropagation(), (_a = t2.stopImmediatePropagation) == null ? void 0 : _a.call(t2), this._sheetIgnoreDismissUntil = Date.now() + 500, !this._sheetDrag)) {
|
|
24
|
+
this.startSheetDrag(t2.pointerId, t2.clientY);
|
|
25
|
+
try {
|
|
26
|
+
(_b = this.sheetHandleArea) == null ? void 0 : _b.setPointerCapture(t2.pointerId);
|
|
27
|
+
} catch {
|
|
28
|
+
}
|
|
29
|
+
window.addEventListener("pointermove", this.handleSheetDragMove), window.addEventListener("pointerup", this.handleSheetDragEnd), window.addEventListener("pointercancel", this.handleSheetDragEnd);
|
|
66
30
|
}
|
|
67
|
-
window.addEventListener("pointermove", this.handleSheetDragMove);
|
|
68
|
-
window.addEventListener("pointerup", this.handleSheetDragEnd);
|
|
69
|
-
window.addEventListener("pointercancel", this.handleSheetDragEnd);
|
|
70
31
|
});
|
|
71
|
-
|
|
72
|
-
* Starts mobile bottom sheet resizing from a touch event.
|
|
73
|
-
* @param {TouchEvent} e The touch event.
|
|
74
|
-
*/
|
|
75
|
-
__publicField(this, "handleSheetTouchStart", (e) => {
|
|
32
|
+
__publicField(this, "handleSheetTouchStart", (t2) => {
|
|
76
33
|
var _a, _b;
|
|
77
34
|
if (!this.sheetResizable || !this.isBottomSheet() || this._sheetDrag) return;
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
e.preventDefault();
|
|
81
|
-
e.stopPropagation();
|
|
82
|
-
(_b = e.stopImmediatePropagation) == null ? void 0 : _b.call(e);
|
|
83
|
-
this._sheetIgnoreDismissUntil = Date.now() + 500;
|
|
84
|
-
this.startSheetDrag("touch", touch.clientY);
|
|
85
|
-
window.addEventListener("touchmove", this.handleSheetTouchMove, { passive: false });
|
|
86
|
-
window.addEventListener("touchend", this.handleSheetTouchEnd, { passive: false });
|
|
87
|
-
window.addEventListener("touchcancel", this.handleSheetTouchEnd, { passive: false });
|
|
35
|
+
const e2 = (_a = t2.touches) == null ? void 0 : _a[0];
|
|
36
|
+
e2 && (t2.preventDefault(), t2.stopPropagation(), (_b = t2.stopImmediatePropagation) == null ? void 0 : _b.call(t2), this._sheetIgnoreDismissUntil = Date.now() + 500, this.startSheetDrag("touch", e2.clientY), window.addEventListener("touchmove", this.handleSheetTouchMove, { passive: false }), window.addEventListener("touchend", this.handleSheetTouchEnd, { passive: false }), window.addEventListener("touchcancel", this.handleSheetTouchEnd, { passive: false }));
|
|
88
37
|
});
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
* @param {PointerEvent} e The pointer event.
|
|
92
|
-
*/
|
|
93
|
-
__publicField(this, "handleBackdropPointerStart", (e) => {
|
|
94
|
-
if (!this.isBottomSheet() || !this.isBackdropElement(e.target) || this.isEventInsideSheet(e) || Date.now() < this._sheetIgnoreDismissUntil) {
|
|
95
|
-
this._sheetBackdropGesture = null;
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
this._sheetBackdropGesture = {
|
|
99
|
-
pointerId: e.pointerId,
|
|
100
|
-
startX: e.clientX,
|
|
101
|
-
startY: e.clientY,
|
|
102
|
-
hasMoved: false
|
|
103
|
-
};
|
|
38
|
+
__publicField(this, "handleBackdropPointerStart", (t2) => {
|
|
39
|
+
!this.isBottomSheet() || !this.isBackdropElement(t2.target) || this.isEventInsideSheet(t2) || Date.now() < this._sheetIgnoreDismissUntil ? this._sheetBackdropGesture = null : this._sheetBackdropGesture = { pointerId: t2.pointerId, startX: t2.clientX, startY: t2.clientY, hasMoved: false };
|
|
104
40
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
__publicField(this, "handleBackdropPointerMove", (e) => {
|
|
110
|
-
if (!this._sheetBackdropGesture || e.pointerId !== this._sheetBackdropGesture.pointerId) return;
|
|
111
|
-
const distanceX = Math.abs(e.clientX - this._sheetBackdropGesture.startX);
|
|
112
|
-
const distanceY = Math.abs(e.clientY - this._sheetBackdropGesture.startY);
|
|
113
|
-
if (distanceX > 8 || distanceY > 8) {
|
|
114
|
-
this._sheetBackdropGesture.hasMoved = true;
|
|
115
|
-
}
|
|
41
|
+
__publicField(this, "handleBackdropPointerMove", (t2) => {
|
|
42
|
+
if (!this._sheetBackdropGesture || t2.pointerId !== this._sheetBackdropGesture.pointerId) return;
|
|
43
|
+
const e2 = Math.abs(t2.clientX - this._sheetBackdropGesture.startX), i2 = Math.abs(t2.clientY - this._sheetBackdropGesture.startY);
|
|
44
|
+
(e2 > 8 || i2 > 8) && (this._sheetBackdropGesture.hasMoved = true);
|
|
116
45
|
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
__publicField(this, "handleBackdropPointerEnd", (e) => {
|
|
122
|
-
if (!this._sheetBackdropGesture || e.pointerId !== this._sheetBackdropGesture.pointerId) return;
|
|
123
|
-
const shouldClose = !this._sheetBackdropGesture.hasMoved && this.isBackdropElement(e.target) && !this.isEventInsideSheet(e) && Date.now() >= this._sheetIgnoreDismissUntil;
|
|
124
|
-
this._sheetBackdropGesture = null;
|
|
125
|
-
this._sheetBackdropHandledUntil = Date.now() + 350;
|
|
126
|
-
if (shouldClose) {
|
|
127
|
-
e.preventDefault();
|
|
128
|
-
e.stopPropagation();
|
|
129
|
-
this.close(e);
|
|
130
|
-
}
|
|
46
|
+
__publicField(this, "handleBackdropPointerEnd", (t2) => {
|
|
47
|
+
if (!this._sheetBackdropGesture || t2.pointerId !== this._sheetBackdropGesture.pointerId) return;
|
|
48
|
+
const e2 = !this._sheetBackdropGesture.hasMoved && this.isBackdropElement(t2.target) && !this.isEventInsideSheet(t2) && Date.now() >= this._sheetIgnoreDismissUntil;
|
|
49
|
+
this._sheetBackdropGesture = null, this._sheetBackdropHandledUntil = Date.now() + 350, e2 && (t2.preventDefault(), t2.stopPropagation(), this.close(t2));
|
|
131
50
|
});
|
|
132
|
-
/**
|
|
133
|
-
* Cancels a possible backdrop dismiss tap.
|
|
134
|
-
*/
|
|
135
51
|
__publicField(this, "handleBackdropPointerCancel", () => {
|
|
136
|
-
this._sheetBackdropGesture = null;
|
|
137
|
-
this._sheetBackdropHandledUntil = Date.now() + 350;
|
|
52
|
+
this._sheetBackdropGesture = null, this._sheetBackdropHandledUntil = Date.now() + 350;
|
|
138
53
|
});
|
|
139
|
-
|
|
140
|
-
* Resizes the mobile bottom sheet during dragging.
|
|
141
|
-
* @param {PointerEvent} e The pointer event.
|
|
142
|
-
*/
|
|
143
|
-
__publicField(this, "handleSheetDragMove", (e) => {
|
|
54
|
+
__publicField(this, "handleSheetDragMove", (t2) => {
|
|
144
55
|
var _a;
|
|
145
|
-
|
|
146
|
-
e.preventDefault();
|
|
147
|
-
e.stopPropagation();
|
|
148
|
-
(_a = e.stopImmediatePropagation) == null ? void 0 : _a.call(e);
|
|
149
|
-
this.updateSheetDrag(e.clientY);
|
|
56
|
+
this._sheetDrag && t2.pointerId === this._sheetDrag.pointerId && (t2.preventDefault(), t2.stopPropagation(), (_a = t2.stopImmediatePropagation) == null ? void 0 : _a.call(t2), this.updateSheetDrag(t2.clientY));
|
|
150
57
|
});
|
|
151
|
-
|
|
152
|
-
* Resizes the mobile bottom sheet during touch dragging.
|
|
153
|
-
* @param {TouchEvent} e The touch event.
|
|
154
|
-
*/
|
|
155
|
-
__publicField(this, "handleSheetTouchMove", (e) => {
|
|
58
|
+
__publicField(this, "handleSheetTouchMove", (t2) => {
|
|
156
59
|
var _a, _b;
|
|
157
|
-
if (!this._sheetDrag || this._sheetDrag.pointerId
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
e.preventDefault();
|
|
161
|
-
e.stopPropagation();
|
|
162
|
-
(_b = e.stopImmediatePropagation) == null ? void 0 : _b.call(e);
|
|
163
|
-
this.updateSheetDrag(touch.clientY);
|
|
60
|
+
if (!this._sheetDrag || "touch" !== this._sheetDrag.pointerId) return;
|
|
61
|
+
const e2 = (_a = t2.touches) == null ? void 0 : _a[0];
|
|
62
|
+
e2 && (t2.preventDefault(), t2.stopPropagation(), (_b = t2.stopImmediatePropagation) == null ? void 0 : _b.call(t2), this.updateSheetDrag(e2.clientY));
|
|
164
63
|
});
|
|
165
|
-
|
|
166
|
-
* Ends mobile bottom sheet resizing.
|
|
167
|
-
* @param {PointerEvent} e The pointer event.
|
|
168
|
-
*/
|
|
169
|
-
__publicField(this, "handleSheetDragEnd", (e) => {
|
|
64
|
+
__publicField(this, "handleSheetDragEnd", (t2) => {
|
|
170
65
|
var _a, _b, _c;
|
|
171
|
-
const
|
|
172
|
-
if (this._sheetDrag && (
|
|
173
|
-
|
|
174
|
-
e.stopPropagation();
|
|
175
|
-
(_b = e.stopImmediatePropagation) == null ? void 0 : _b.call(e);
|
|
66
|
+
const e2 = (_a = this._sheetDrag) == null ? void 0 : _a.hasMoved;
|
|
67
|
+
if (this._sheetDrag && (t2 == null ? void 0 : t2.pointerId) === this._sheetDrag.pointerId) {
|
|
68
|
+
t2.preventDefault(), t2.stopPropagation(), (_b = t2.stopImmediatePropagation) == null ? void 0 : _b.call(t2);
|
|
176
69
|
try {
|
|
177
|
-
(_c = this.sheetHandleArea) == null ? void 0 : _c.releasePointerCapture(
|
|
70
|
+
(_c = this.sheetHandleArea) == null ? void 0 : _c.releasePointerCapture(t2.pointerId);
|
|
178
71
|
} catch {
|
|
179
72
|
}
|
|
180
73
|
}
|
|
181
|
-
|
|
182
|
-
this._sheetIgnoreDismissUntil = Date.now() + 350;
|
|
183
|
-
} else {
|
|
184
|
-
this._sheetIgnoreDismissUntil = Date.now() + 500;
|
|
185
|
-
}
|
|
186
|
-
this.endSheetDrag();
|
|
74
|
+
this._sheetIgnoreDismissUntil = e2 ? Date.now() + 350 : Date.now() + 500, this.endSheetDrag();
|
|
187
75
|
});
|
|
188
|
-
|
|
189
|
-
* Ends mobile bottom sheet resizing from a touch event.
|
|
190
|
-
* @param {TouchEvent} e The touch event.
|
|
191
|
-
*/
|
|
192
|
-
__publicField(this, "handleSheetTouchEnd", (e) => {
|
|
76
|
+
__publicField(this, "handleSheetTouchEnd", (t2) => {
|
|
193
77
|
var _a;
|
|
194
|
-
if (!this._sheetDrag || this._sheetDrag.pointerId
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
e.preventDefault();
|
|
198
|
-
}
|
|
199
|
-
e.stopPropagation();
|
|
200
|
-
if (e.type !== "touchcancel") {
|
|
201
|
-
(_a = e.stopImmediatePropagation) == null ? void 0 : _a.call(e);
|
|
202
|
-
}
|
|
203
|
-
this._sheetIgnoreDismissUntil = Date.now() + (hasMoved ? 350 : 700);
|
|
204
|
-
this.endSheetDrag();
|
|
78
|
+
if (!this._sheetDrag || "touch" !== this._sheetDrag.pointerId) return;
|
|
79
|
+
const e2 = this._sheetDrag.hasMoved;
|
|
80
|
+
"touchcancel" !== t2.type && t2.preventDefault(), t2.stopPropagation(), "touchcancel" !== t2.type && ((_a = t2.stopImmediatePropagation) == null ? void 0 : _a.call(t2)), this._sheetIgnoreDismissUntil = Date.now() + (e2 ? 350 : 700), this.endSheetDrag();
|
|
205
81
|
});
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
* If the target element is different from the last caller, it refreshes the children by calling the `open` method.
|
|
209
|
-
* If the target element is the same as the last caller, it toggles the state by calling the `toggle` method.
|
|
210
|
-
* @param {Event} e The event object.
|
|
211
|
-
*/
|
|
212
|
-
__publicField(this, "triggerEvent", async (e) => {
|
|
213
|
-
if (this._lastCaller && this._lastCaller !== e.composedPath()[0]) {
|
|
214
|
-
await this.open(e);
|
|
215
|
-
} else {
|
|
216
|
-
await this.toggle(e);
|
|
217
|
-
}
|
|
218
|
-
this._lastCaller = e.composedPath()[0];
|
|
82
|
+
__publicField(this, "triggerEvent", async (t2) => {
|
|
83
|
+
this._lastCaller && this._lastCaller !== t2.composedPath()[0] ? await this.open(t2) : await this.toggle(t2), this._lastCaller = t2.composedPath()[0];
|
|
219
84
|
});
|
|
220
|
-
this._isOpen = false
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
this._sheetBackdropGesture = null;
|
|
225
|
-
this._sheetBackdropHandledUntil = 0;
|
|
226
|
-
this._bottomSheetScopeFrame = null;
|
|
227
|
-
this._resizeObserver = new ResizeObserver((entries) => {
|
|
228
|
-
for (let entry of entries) {
|
|
229
|
-
if (entry.contentBoxSize) {
|
|
230
|
-
if (this.drawingStatus < 3) return;
|
|
231
|
-
if (this.isBottomSheet()) {
|
|
232
|
-
this.checkForVariant(this.variant);
|
|
233
|
-
} else if (this.screenBreakPoint && window.innerWidth <= this.screenBreakPoint) {
|
|
234
|
-
if (this.variant !== "over") {
|
|
235
|
-
this.variant = "over";
|
|
236
|
-
} else {
|
|
237
|
-
this.checkForVariant(this.variant);
|
|
238
|
-
}
|
|
239
|
-
} else {
|
|
240
|
-
if (this.variant !== "in-place") {
|
|
241
|
-
this.variant = "in-place";
|
|
242
|
-
} else {
|
|
243
|
-
this.checkForVariant(this.variant);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
85
|
+
this._isOpen = false, this._lastCaller = null, this._sheetDrag = null, this._sheetIgnoreDismissUntil = 0, this._sheetBackdropGesture = null, this._sheetBackdropHandledUntil = 0, this._bottomSheetScopeFrame = null, this._resizeObserver = new ResizeObserver((t2) => {
|
|
86
|
+
for (let e2 of t2) if (e2.contentBoxSize) {
|
|
87
|
+
if (this.drawingStatus < 3) return;
|
|
88
|
+
this.isBottomSheet() ? this.checkForVariant(this.variant) : this.screenBreakPoint && window.innerWidth <= this.screenBreakPoint ? "over" !== this.variant ? this.variant = "over" : this.checkForVariant(this.variant) : "in-place" !== this.variant ? this.variant = "in-place" : this.checkForVariant(this.variant);
|
|
247
89
|
}
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
* @param {string} value The maximum width value to be set (e.g., '100px', '50%', etc.).
|
|
254
|
-
*/
|
|
255
|
-
set maxWidth(value) {
|
|
256
|
-
this.setAttribute("max-width", value);
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Gets the maximum width value of the element.
|
|
260
|
-
* Retrieves the value of the 'max-width' attribute. If the attribute is not set, it defaults to 'auto'.
|
|
261
|
-
* @returns {string} The maximum width value of the element or 'auto' if the attribute is not defined.
|
|
262
|
-
*/
|
|
90
|
+
}), this._resizeObserver.observe(document.documentElement);
|
|
91
|
+
}
|
|
92
|
+
set maxWidth(t2) {
|
|
93
|
+
this.setAttribute("max-width", t2);
|
|
94
|
+
}
|
|
263
95
|
get maxWidth() {
|
|
264
96
|
return this.getAttribute("max-width") ?? "auto";
|
|
265
97
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
*/
|
|
270
|
-
set maxHeight(value) {
|
|
271
|
-
this.setAttribute("max-height", value);
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Retrieves the maximum height value of the element, or returns 'auto' if not set.
|
|
275
|
-
* @returns {string} The maximum height value or 'auto' if the attribute is not specified.
|
|
276
|
-
*/
|
|
98
|
+
set maxHeight(t2) {
|
|
99
|
+
this.setAttribute("max-height", t2);
|
|
100
|
+
}
|
|
277
101
|
get maxHeight() {
|
|
278
102
|
return this.getAttribute("max-height") ?? "auto";
|
|
279
103
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
*/
|
|
284
|
-
set trigger(value) {
|
|
285
|
-
this.setAttribute("trigger", value);
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Retrieves the value of the 'trigger' attribute. If the attribute is not set, it defaults to 'sliding-container'.
|
|
289
|
-
* @returns {string} The value of the 'trigger' attribute or the default value 'sliding-container' if not defined.
|
|
290
|
-
*/
|
|
104
|
+
set trigger(t2) {
|
|
105
|
+
this.setAttribute("trigger", t2);
|
|
106
|
+
}
|
|
291
107
|
get trigger() {
|
|
292
108
|
return this.getAttribute("trigger") ?? "sliding-container";
|
|
293
109
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
*/
|
|
298
|
-
set direction(value) {
|
|
299
|
-
this.setAttribute("direction", value);
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Retrieves the direction attribute of the instance.
|
|
303
|
-
* If the direction attribute is not set, it defaults to 'right'.
|
|
304
|
-
* @returns {string} The value of the direction attribute or 'right' if not set.
|
|
305
|
-
*/
|
|
110
|
+
set direction(t2) {
|
|
111
|
+
this.setAttribute("direction", t2);
|
|
112
|
+
}
|
|
306
113
|
get direction() {
|
|
307
114
|
return this.getAttribute("direction") ?? "right";
|
|
308
115
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
* @param {boolean|string} value The value to set for the `remove-child-after-close` attribute. The value can be a boolean or a string representation of a boolean.
|
|
313
|
-
*/
|
|
314
|
-
set removeChildAfterClose(value) {
|
|
315
|
-
this.setAttribute("remove-child-after-close", value);
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Gets the value indicating whether the child element should be removed after closing.
|
|
319
|
-
*
|
|
320
|
-
* This property checks the presence of the 'remove-child-after-close' attribute on the element.
|
|
321
|
-
* Returns `false` if the attribute does not exist.
|
|
322
|
-
* @returns {boolean} True if the 'remove-child-after-close' attribute is present, otherwise false.
|
|
323
|
-
*/
|
|
116
|
+
set removeChildAfterClose(t2) {
|
|
117
|
+
this.setAttribute("remove-child-after-close", t2);
|
|
118
|
+
}
|
|
324
119
|
get removeChildAfterClose() {
|
|
325
120
|
return this.hasAttribute("remove-child-after-close") ?? false;
|
|
326
121
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
*/
|
|
331
|
-
set variant(value) {
|
|
332
|
-
this.setAttribute("variant", value);
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Retrieves the value of the "variant" attribute. If the attribute is not set,
|
|
336
|
-
* it returns the default value 'in-place'.
|
|
337
|
-
* @returns {string} The variant value or the default value 'in-place'.
|
|
338
|
-
*/
|
|
122
|
+
set variant(t2) {
|
|
123
|
+
this.setAttribute("variant", t2);
|
|
124
|
+
}
|
|
339
125
|
get variant() {
|
|
340
126
|
return this.getAttribute("variant") ?? "in-place";
|
|
341
127
|
}
|
|
342
|
-
/**
|
|
343
|
-
* Retrieves the value of the 'screen-break-point' attribute.
|
|
344
|
-
* @returns {string} The value of the 'screen-break-point' attribute.
|
|
345
|
-
*/
|
|
346
128
|
get screenBreakPoint() {
|
|
347
129
|
return this.getAttribute("screen-break-point");
|
|
348
130
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Sets mobile presentation mode.
|
|
358
|
-
* @param {string} value The mobile presentation mode.
|
|
359
|
-
*/
|
|
360
|
-
set mobilePresentation(value) {
|
|
361
|
-
this.setAttribute("mobile-presentation", value);
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Gets mobile presentation mode.
|
|
365
|
-
* @returns {string|null} The mobile presentation mode.
|
|
366
|
-
*/
|
|
131
|
+
set screenBreakPoint(t2) {
|
|
132
|
+
this.setAttribute("screen-break-point", t2);
|
|
133
|
+
}
|
|
134
|
+
set mobilePresentation(t2) {
|
|
135
|
+
this.setAttribute("mobile-presentation", t2);
|
|
136
|
+
}
|
|
367
137
|
get mobilePresentation() {
|
|
368
138
|
return this.getAttribute("mobile-presentation");
|
|
369
139
|
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
*/
|
|
374
|
-
set mobileBreakPoint(value) {
|
|
375
|
-
this.setAttribute("mobile-break-point", value);
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Gets the breakpoint for mobile presentation.
|
|
379
|
-
* @returns {string} The mobile breakpoint.
|
|
380
|
-
*/
|
|
140
|
+
set mobileBreakPoint(t2) {
|
|
141
|
+
this.setAttribute("mobile-break-point", t2);
|
|
142
|
+
}
|
|
381
143
|
get mobileBreakPoint() {
|
|
382
144
|
return this.getAttribute("mobile-break-point") || "768";
|
|
383
145
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
* such as seconds (e.g., "2s") or milliseconds (e.g., "200ms").
|
|
388
|
-
*/
|
|
389
|
-
set animationDuration(value) {
|
|
390
|
-
this.setAttribute("animation-duration", value);
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Gets the animation duration for an element.
|
|
394
|
-
* It retrieves the value of the 'animation-duration' attribute if present; otherwise, it defaults to '500'.
|
|
395
|
-
* @returns {string} The value of the animation duration, either from the attribute or the default '500'.
|
|
396
|
-
*/
|
|
146
|
+
set animationDuration(t2) {
|
|
147
|
+
this.setAttribute("animation-duration", t2);
|
|
148
|
+
}
|
|
397
149
|
get animationDuration() {
|
|
398
150
|
return this.getAttribute("animation-duration") ?? "500";
|
|
399
151
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
*/
|
|
404
|
-
set animationEasing(value) {
|
|
405
|
-
this.setAttribute("animation-easing", value);
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Retrieves the easing function for the animation.
|
|
409
|
-
* @returns {string} The value of the 'animation-easing' attribute if set, otherwise defaults to 'linear'.
|
|
410
|
-
*/
|
|
152
|
+
set animationEasing(t2) {
|
|
153
|
+
this.setAttribute("animation-easing", t2);
|
|
154
|
+
}
|
|
411
155
|
get animationEasing() {
|
|
412
156
|
return this.getAttribute("animation-easing") ?? "linear";
|
|
413
157
|
}
|
|
414
|
-
/**
|
|
415
|
-
* Determines if the element has an 'has-opacity' attribute.
|
|
416
|
-
* @returns {boolean} True if the element has the 'has-opacity' attribute, otherwise false.
|
|
417
|
-
*/
|
|
418
158
|
get hasOpacity() {
|
|
419
159
|
return this.hasAttribute("has-opacity") ?? false;
|
|
420
160
|
}
|
|
421
|
-
/**
|
|
422
|
-
* Determines if the bottom sheet should close when the backdrop is clicked.
|
|
423
|
-
* @returns {boolean} True if backdrop dismiss is enabled.
|
|
424
|
-
*/
|
|
425
161
|
get backdropDismiss() {
|
|
426
162
|
return this.hasAttribute("backdrop-dismiss") ?? false;
|
|
427
163
|
}
|
|
428
|
-
/**
|
|
429
|
-
* Enables resizing for the mobile bottom sheet.
|
|
430
|
-
* @returns {boolean} True if the sheet can be resized.
|
|
431
|
-
*/
|
|
432
164
|
get sheetResizable() {
|
|
433
165
|
return this.hasAttribute("sheet-resizable") ?? false;
|
|
434
166
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
*/
|
|
439
|
-
set sheetResizable(value) {
|
|
440
|
-
this.setAttribute("sheet-resizable", value);
|
|
441
|
-
}
|
|
442
|
-
/**
|
|
443
|
-
* Gets the mobile bottom sheet panel scope. The backdrop always covers the viewport.
|
|
444
|
-
* @returns {string} Either 'viewport', 'container', or 'parent'.
|
|
445
|
-
*/
|
|
167
|
+
set sheetResizable(t2) {
|
|
168
|
+
this.setAttribute("sheet-resizable", t2);
|
|
169
|
+
}
|
|
446
170
|
get sheetScope() {
|
|
447
171
|
return this.getAttribute("sheet-scope") || "viewport";
|
|
448
172
|
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
*/
|
|
453
|
-
set sheetScope(value) {
|
|
454
|
-
this.setAttribute("sheet-scope", value);
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Gets the selector used for container-scoped mobile bottom sheet panels.
|
|
458
|
-
* @returns {string|null} A CSS selector used to find the composed boundary ancestor.
|
|
459
|
-
*/
|
|
173
|
+
set sheetScope(t2) {
|
|
174
|
+
this.setAttribute("sheet-scope", t2);
|
|
175
|
+
}
|
|
460
176
|
get sheetBoundary() {
|
|
461
177
|
return this.getAttribute("sheet-boundary");
|
|
462
178
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
*/
|
|
467
|
-
set sheetBoundary(value) {
|
|
468
|
-
this.setAttribute("sheet-boundary", value);
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Gets the mobile bottom sheet opening height.
|
|
472
|
-
* @returns {string|null} The opening height.
|
|
473
|
-
*/
|
|
179
|
+
set sheetBoundary(t2) {
|
|
180
|
+
this.setAttribute("sheet-boundary", t2);
|
|
181
|
+
}
|
|
474
182
|
get sheetHeight() {
|
|
475
183
|
return this.getAttribute("sheet-height");
|
|
476
184
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
*/
|
|
481
|
-
set sheetHeight(value) {
|
|
482
|
-
this.setAttribute("sheet-height", value);
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* Gets the minimum mobile bottom sheet height while resizing.
|
|
486
|
-
* @returns {string|null} The minimum height.
|
|
487
|
-
*/
|
|
185
|
+
set sheetHeight(t2) {
|
|
186
|
+
this.setAttribute("sheet-height", t2);
|
|
187
|
+
}
|
|
488
188
|
get sheetMinHeight() {
|
|
489
189
|
return this.getAttribute("sheet-min-height");
|
|
490
190
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
*/
|
|
495
|
-
set sheetMinHeight(value) {
|
|
496
|
-
this.setAttribute("sheet-min-height", value);
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* Gets the maximum mobile bottom sheet height while resizing.
|
|
500
|
-
* @returns {string|null} The maximum height.
|
|
501
|
-
*/
|
|
191
|
+
set sheetMinHeight(t2) {
|
|
192
|
+
this.setAttribute("sheet-min-height", t2);
|
|
193
|
+
}
|
|
502
194
|
get sheetMaxHeight() {
|
|
503
195
|
return this.getAttribute("sheet-max-height");
|
|
504
196
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* Sets the value of the 'add-to-height' attribute.
|
|
514
|
-
* This attribute is used to modify or adjust the height dynamically.
|
|
515
|
-
* @param {string} value The value to be assigned to the 'add-to-height' attribute.
|
|
516
|
-
*/
|
|
517
|
-
set addToHeight(value) {
|
|
518
|
-
this.setAttribute("add-to-height", value);
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* Retrieves the value of the 'add-to-height' attribute from the element.
|
|
522
|
-
* If the attribute is not set, it defaults to '0'.
|
|
523
|
-
* @returns {string} The value of the 'add-to-height' attribute or '0' if the attribute is not present.
|
|
524
|
-
*/
|
|
197
|
+
set sheetMaxHeight(t2) {
|
|
198
|
+
this.setAttribute("sheet-max-height", t2);
|
|
199
|
+
}
|
|
200
|
+
set addToHeight(t2) {
|
|
201
|
+
this.setAttribute("add-to-height", t2);
|
|
202
|
+
}
|
|
525
203
|
get addToHeight() {
|
|
526
204
|
return this.getAttribute("add-to-height") ?? "0";
|
|
527
205
|
}
|
|
528
|
-
/**
|
|
529
|
-
* Determines whether the current state is open.
|
|
530
|
-
* @returns {boolean} True if the state is open, otherwise false.
|
|
531
|
-
*/
|
|
532
206
|
get isOpen() {
|
|
533
207
|
return this._isOpen;
|
|
534
208
|
}
|
|
535
|
-
/**
|
|
536
|
-
* Returns the observed attributes for the component.
|
|
537
|
-
* @returns {string[]}
|
|
538
|
-
*/
|
|
539
209
|
static get observedAttributes() {
|
|
540
210
|
return ["max-width", "max-height", "trigger", "direction", "variant", "screen-break-point", "remove-child-after-close", "animation-duration", "animation-easing", "has-opacity", "mobile-presentation", "mobile-break-point", "backdrop-dismiss", "sheet-resizable", "sheet-scope", "sheet-boundary", "sheet-height", "sheet-min-height", "sheet-max-height"];
|
|
541
211
|
}
|
|
542
|
-
/**
|
|
543
|
-
* Returns the CSS styles for the component.
|
|
544
|
-
* @static
|
|
545
|
-
* @returns {CSSStyleSheet}
|
|
546
|
-
*/
|
|
547
212
|
static get cssStyleSheet() {
|
|
548
|
-
return
|
|
213
|
+
return ":host{display:block;z-index:var(--wje-sliding-container-z-index, 1000);position:relative;height:100%;right:unset;left:unset}:host .close-button{position:absolute;top:0;right:0;z-index:2}:host([hide-button]) .close-button{display:none}.sliding-container-backdrop{display:none}.sliding-container-wrapper{height:100%;position:relative;overflow:hidden}.native-sliding-container{position:absolute;width:0;height:100%}.native-sliding-container-inner{height:100%;position:absolute}.sliding-container-sheet-handle-area{display:none}:host(.bottom-sheet){top:0;right:0;bottom:0;left:0;pointer-events:none;z-index:var(--wje-sliding-container-bottom-sheet-z-index, var(--wje-sliding-container-z-index, 1000))}:host(.bottom-sheet.open){overscroll-behavior:contain}:host(.bottom-sheet) .sliding-container-backdrop{display:none;position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--wje-sliding-container-bottom-sheet-backdrop-z-index, 0);opacity:0;pointer-events:none;touch-action:none;overscroll-behavior:none;background:var(--wje-sliding-container-backdrop-background, var(--wje-backdrop, rgba(0, 0, 0, .35)))}:host(.bottom-sheet.open) .sliding-container-backdrop{pointer-events:auto}:host(.bottom-sheet) .sliding-container-wrapper{position:fixed;top:0;right:0;bottom:0;left:0;overflow:visible;pointer-events:none;z-index:var(--wje-sliding-container-bottom-sheet-panel-z-index, 1)}:host(.bottom-sheet) .sliding-container-transparent{display:none}:host(.bottom-sheet) .native-sliding-container{position:fixed;top:auto;height:fit-content;overflow:hidden;pointer-events:auto;display:flex;flex-direction:column;overscroll-behavior:contain;background:var(--wje-sliding-container-background);box-shadow:var(--wje-sliding-container-box-shadow, var(--wje-sliding-container-shadow));border-radius:var(--wje-sliding-container-sheet-border-radius, var(--wje-sliding-container-border-radius) var(--wje-sliding-container-border-radius) 0 0)}:host(.bottom-sheet) .native-sliding-container-inner{position:relative;flex:1 1 auto;min-height:0;height:auto;max-height:inherit;overflow:auto;overscroll-behavior:contain}:host(.bottom-sheet) .sliding-container-sheet-handle-area{display:flex;align-items:center;justify-content:center;flex:0 0 var(--wje-sliding-container-sheet-handle-area-height, 24px);height:var(--wje-sliding-container-sheet-handle-area-height, 24px);cursor:grab;pointer-events:auto;touch-action:none;user-select:none;-webkit-user-select:none}:host(.bottom-sheet) .sliding-container-sheet-handle-area:active{cursor:grabbing}:host(.bottom-sheet) .sliding-container-sheet-handle{width:var(--wje-sliding-container-sheet-handle-width, 36px);height:var(--wje-sliding-container-sheet-handle-height, 2px);background:var(--wje-sliding-container-sheet-handle-background, var(--wje-border-color));border-radius:var(--wje-sliding-container-sheet-handle-radius, 999px)}";
|
|
549
214
|
}
|
|
550
|
-
/**
|
|
551
|
-
* Sets up the attributes for the component.
|
|
552
|
-
*/
|
|
553
215
|
setupAttributes() {
|
|
554
|
-
this.isShadowRoot = "open";
|
|
555
|
-
this.syncAria();
|
|
216
|
+
this.isShadowRoot = "open", this.syncAria();
|
|
556
217
|
}
|
|
557
|
-
/**
|
|
558
|
-
* Executes before drawing the element.
|
|
559
|
-
*/
|
|
560
218
|
beforeDraw() {
|
|
561
219
|
var _a, _b;
|
|
562
|
-
(_a = this.animation) == null ? void 0 : _a.cancel();
|
|
563
|
-
|
|
564
|
-
this.endSheetDrag();
|
|
565
|
-
this.removePortalBackdrop();
|
|
566
|
-
document.removeEventListener(this.trigger, this.triggerEvent);
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* Cleans up global listeners and portaled layers.
|
|
570
|
-
*/
|
|
220
|
+
(_a = this.animation) == null ? void 0 : _a.cancel(), (_b = this.nativeAnimation) == null ? void 0 : _b.cancel(), this.endSheetDrag(), this.removePortalBackdrop(), document.removeEventListener(this.trigger, this.triggerEvent);
|
|
221
|
+
}
|
|
571
222
|
afterDisconnect() {
|
|
572
223
|
var _a, _b, _c;
|
|
573
|
-
(_a = this.animation) == null ? void 0 : _a.cancel();
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
document.
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
let
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
backdrop.setAttribute("part", "backdrop");
|
|
592
|
-
backdrop.classList.add("sliding-container-backdrop");
|
|
593
|
-
if (this._isOpen && isBottomSheet) {
|
|
594
|
-
backdrop.style.opacity = "var(--wje-sliding-container-backdrop-opacity, 1)";
|
|
595
|
-
}
|
|
596
|
-
this.addBackdropListeners(backdrop);
|
|
597
|
-
let wrapperDiv = document.createElement("div");
|
|
598
|
-
wrapperDiv.classList.add("sliding-container-wrapper");
|
|
599
|
-
let transparentDiv = document.createElement("div");
|
|
600
|
-
transparentDiv.classList.add("sliding-container-transparent");
|
|
601
|
-
if (this._isOpen && !isBottomSheet) {
|
|
602
|
-
transparentDiv.style.width = this.maxWidth;
|
|
603
|
-
}
|
|
604
|
-
let native = document.createElement("div");
|
|
605
|
-
native.setAttribute("part", "sliding-container");
|
|
606
|
-
native.classList.add("native-sliding-container");
|
|
607
|
-
native.style.width = isBottomSheet ? "100%" : 0;
|
|
608
|
-
if (this.hasOpacity) {
|
|
609
|
-
native.style.opacity = 0;
|
|
610
|
-
}
|
|
611
|
-
if (this._isOpen) {
|
|
612
|
-
native.style.width = isBottomSheet ? "100%" : this.maxWidth;
|
|
613
|
-
if (isBottomSheet) {
|
|
614
|
-
native.style.transform = "translateY(0)";
|
|
615
|
-
}
|
|
616
|
-
if (this.hasOpacity) {
|
|
617
|
-
native.style.opacity = 1;
|
|
618
|
-
}
|
|
619
|
-
} else if (isBottomSheet) {
|
|
620
|
-
native.style.transform = "translateY(100%)";
|
|
621
|
-
}
|
|
622
|
-
if (isBottomSheet) {
|
|
623
|
-
native.style.left = 0;
|
|
624
|
-
native.style.right = 0;
|
|
625
|
-
native.style.bottom = 0;
|
|
626
|
-
native.style.maxHeight = this.maxHeight;
|
|
627
|
-
} else if (this.direction === "right") {
|
|
628
|
-
native.style.right = 0;
|
|
629
|
-
} else {
|
|
630
|
-
native.style.left = 0;
|
|
631
|
-
}
|
|
632
|
-
const nativeInner = document.createElement("div");
|
|
633
|
-
nativeInner.classList.add("native-sliding-container-inner");
|
|
634
|
-
nativeInner.style.width = isBottomSheet ? "100%" : this.maxWidth;
|
|
635
|
-
if (isBottomSheet) {
|
|
636
|
-
nativeInner.style.maxHeight = this.maxHeight;
|
|
637
|
-
}
|
|
638
|
-
let slot = document.createElement("slot");
|
|
639
|
-
this.sheetHandleArea = null;
|
|
640
|
-
nativeInner.append(slot);
|
|
641
|
-
nativeInner.append(this.htmlCloseButton());
|
|
642
|
-
if (this.sheetResizable) {
|
|
643
|
-
native.append(this.htmlSheetHandle());
|
|
644
|
-
}
|
|
645
|
-
native.append(nativeInner);
|
|
646
|
-
wrapperDiv.append(transparentDiv);
|
|
647
|
-
wrapperDiv.append(native);
|
|
648
|
-
fragment.append(backdrop);
|
|
649
|
-
fragment.append(wrapperDiv);
|
|
650
|
-
this.backdropElement = backdrop;
|
|
651
|
-
this.transparentDiv = transparentDiv;
|
|
652
|
-
this.wrapperDiv = wrapperDiv;
|
|
653
|
-
this.nativeElement = native;
|
|
654
|
-
this.nativeInner = nativeInner;
|
|
655
|
-
return fragment;
|
|
656
|
-
}
|
|
657
|
-
/**
|
|
658
|
-
* Performs actions after the element is drawn on the screen.
|
|
659
|
-
* Attaches an event listener to the document based on the specified trigger.
|
|
660
|
-
* Sets the variant to "over" if the document width is smaller than the screen break point.
|
|
661
|
-
* Calls the checkForVariant method with the current variant.
|
|
662
|
-
*/
|
|
224
|
+
(_a = this.animation) == null ? void 0 : _a.cancel(), (_b = this.nativeAnimation) == null ? void 0 : _b.cancel(), this.endSheetDrag(), this.removePortalBackdrop(), (_c = this._resizeObserver) == null ? void 0 : _c.disconnect(), document.removeEventListener(this.trigger, this.triggerEvent);
|
|
225
|
+
}
|
|
226
|
+
draw(t2, e2, i2) {
|
|
227
|
+
let n = document.createDocumentFragment();
|
|
228
|
+
const s = this.isBottomSheet();
|
|
229
|
+
let a = document.createElement("div");
|
|
230
|
+
a.setAttribute("part", "backdrop"), a.classList.add("sliding-container-backdrop"), this._isOpen && s && (a.style.opacity = "var(--wje-sliding-container-backdrop-opacity, 1)"), this.addBackdropListeners(a);
|
|
231
|
+
let o = document.createElement("div");
|
|
232
|
+
o.classList.add("sliding-container-wrapper");
|
|
233
|
+
let r = document.createElement("div");
|
|
234
|
+
r.classList.add("sliding-container-transparent"), this._isOpen && !s && (r.style.width = this.maxWidth);
|
|
235
|
+
let h = document.createElement("div");
|
|
236
|
+
h.setAttribute("part", "sliding-container"), h.classList.add("native-sliding-container"), h.style.width = s ? "100%" : 0, this.hasOpacity && (h.style.opacity = 0), this._isOpen ? (h.style.width = s ? "100%" : this.maxWidth, s && (h.style.transform = "translateY(0)"), this.hasOpacity && (h.style.opacity = 1)) : s && (h.style.transform = "translateY(100%)"), s ? (h.style.left = 0, h.style.right = 0, h.style.bottom = 0, h.style.maxHeight = this.maxHeight) : "right" === this.direction ? h.style.right = 0 : h.style.left = 0;
|
|
237
|
+
const l = document.createElement("div");
|
|
238
|
+
l.classList.add("native-sliding-container-inner"), l.style.width = s ? "100%" : this.maxWidth, s && (l.style.maxHeight = this.maxHeight);
|
|
239
|
+
let d = document.createElement("slot");
|
|
240
|
+
return this.sheetHandleArea = null, l.append(d), l.append(this.htmlCloseButton()), this.sheetResizable && h.append(this.htmlSheetHandle()), h.append(l), o.append(r), o.append(h), n.append(a), n.append(o), this.backdropElement = a, this.transparentDiv = r, this.wrapperDiv = o, this.nativeElement = h, this.nativeInner = l, n;
|
|
241
|
+
}
|
|
663
242
|
afterDraw() {
|
|
664
|
-
this.syncAria();
|
|
665
|
-
document.addEventListener(this.trigger, this.triggerEvent);
|
|
666
|
-
if (!this.isBottomSheet() && this.screenBreakPoint && window.innerWidth <= this.screenBreakPoint) {
|
|
667
|
-
this.variant = "over";
|
|
668
|
-
}
|
|
669
|
-
this.checkForVariant(this.variant);
|
|
243
|
+
this.syncAria(), document.addEventListener(this.trigger, this.triggerEvent), !this.isBottomSheet() && this.screenBreakPoint && window.innerWidth <= this.screenBreakPoint && (this.variant = "over"), this.checkForVariant(this.variant);
|
|
670
244
|
}
|
|
671
|
-
/**
|
|
672
|
-
* Returns whether the mobile bottom sheet presentation is active.
|
|
673
|
-
* @returns {boolean}
|
|
674
|
-
*/
|
|
675
245
|
isBottomSheet() {
|
|
676
|
-
return
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
backdrop.addEventListener("click", this.handleBackdropClick);
|
|
691
|
-
}
|
|
692
|
-
/**
|
|
693
|
-
* Removes interaction listeners from a backdrop element.
|
|
694
|
-
* @param {HTMLElement} backdrop The backdrop element.
|
|
695
|
-
*/
|
|
696
|
-
removeBackdropListeners(backdrop) {
|
|
697
|
-
backdrop.removeEventListener("wheel", this.preventBottomSheetScroll);
|
|
698
|
-
backdrop.removeEventListener("touchmove", this.preventBottomSheetScroll);
|
|
699
|
-
backdrop.removeEventListener("pointerdown", this.handleBackdropPointerStart);
|
|
700
|
-
backdrop.removeEventListener("pointermove", this.handleBackdropPointerMove);
|
|
701
|
-
backdrop.removeEventListener("pointerup", this.handleBackdropPointerEnd);
|
|
702
|
-
backdrop.removeEventListener("pointercancel", this.handleBackdropPointerCancel);
|
|
703
|
-
backdrop.removeEventListener("click", this.handleBackdropClick);
|
|
704
|
-
}
|
|
705
|
-
/**
|
|
706
|
-
* Checks whether an element is one of this component's backdrop layers.
|
|
707
|
-
* @param {EventTarget|null} element The event target.
|
|
708
|
-
* @returns {boolean}
|
|
709
|
-
*/
|
|
710
|
-
isBackdropElement(element) {
|
|
711
|
-
return element === this.backdropElement || element === this._portalBackdropElement;
|
|
712
|
-
}
|
|
713
|
-
/**
|
|
714
|
-
* Gets the backdrop element that is active for the current presentation.
|
|
715
|
-
* @param {object} options Options for resolving the backdrop.
|
|
716
|
-
* @param {boolean} options.createPortal Creates the body-level mobile backdrop when needed.
|
|
717
|
-
* @returns {HTMLElement|null}
|
|
718
|
-
*/
|
|
719
|
-
getBackdropElement({ createPortal = false } = {}) {
|
|
720
|
-
if (!this.isBottomSheet()) return this.backdropElement;
|
|
721
|
-
if (createPortal) return this.ensurePortalBackdrop();
|
|
722
|
-
return this._portalBackdropElement || this.backdropElement;
|
|
723
|
-
}
|
|
724
|
-
/**
|
|
725
|
-
* Creates the body-level backdrop used by mobile bottom sheets.
|
|
726
|
-
* @returns {HTMLElement} Element appended to document.body for page-level dimming.
|
|
727
|
-
*/
|
|
246
|
+
return "bottom-sheet" === this.mobilePresentation && window.innerWidth <= +this.mobileBreakPoint;
|
|
247
|
+
}
|
|
248
|
+
addBackdropListeners(t2) {
|
|
249
|
+
t2.addEventListener("wheel", this.preventBottomSheetScroll, { passive: false }), t2.addEventListener("touchmove", this.preventBottomSheetScroll, { passive: false }), this.backdropDismiss && (t2.addEventListener("pointerdown", this.handleBackdropPointerStart), t2.addEventListener("pointermove", this.handleBackdropPointerMove), t2.addEventListener("pointerup", this.handleBackdropPointerEnd), t2.addEventListener("pointercancel", this.handleBackdropPointerCancel), t2.addEventListener("click", this.handleBackdropClick));
|
|
250
|
+
}
|
|
251
|
+
removeBackdropListeners(t2) {
|
|
252
|
+
t2.removeEventListener("wheel", this.preventBottomSheetScroll), t2.removeEventListener("touchmove", this.preventBottomSheetScroll), t2.removeEventListener("pointerdown", this.handleBackdropPointerStart), t2.removeEventListener("pointermove", this.handleBackdropPointerMove), t2.removeEventListener("pointerup", this.handleBackdropPointerEnd), t2.removeEventListener("pointercancel", this.handleBackdropPointerCancel), t2.removeEventListener("click", this.handleBackdropClick);
|
|
253
|
+
}
|
|
254
|
+
isBackdropElement(t2) {
|
|
255
|
+
return t2 === this.backdropElement || t2 === this._portalBackdropElement;
|
|
256
|
+
}
|
|
257
|
+
getBackdropElement({ createPortal: t2 = false } = {}) {
|
|
258
|
+
return this.isBottomSheet() ? t2 ? this.ensurePortalBackdrop() : this._portalBackdropElement || this.backdropElement : this.backdropElement;
|
|
259
|
+
}
|
|
728
260
|
ensurePortalBackdrop() {
|
|
729
|
-
|
|
730
|
-
this._portalBackdropElement = document.createElement("div");
|
|
731
|
-
this._portalBackdropElement.setAttribute("data-wje-sliding-container-backdrop", "");
|
|
732
|
-
this._portalBackdropElement.classList.add("sliding-container-backdrop", "sliding-container-backdrop-portal");
|
|
733
|
-
this.addBackdropListeners(this._portalBackdropElement);
|
|
734
|
-
document.body.append(this._portalBackdropElement);
|
|
735
|
-
}
|
|
736
|
-
this.syncPortalBackdropStyles();
|
|
737
|
-
return this._portalBackdropElement;
|
|
261
|
+
return this._portalBackdropElement || (this._portalBackdropElement = document.createElement("div"), this._portalBackdropElement.setAttribute("data-wje-sliding-container-backdrop", ""), this._portalBackdropElement.classList.add("sliding-container-backdrop", "sliding-container-backdrop-portal"), this.addBackdropListeners(this._portalBackdropElement), document.body.append(this._portalBackdropElement)), this.syncPortalBackdropStyles(), this._portalBackdropElement;
|
|
738
262
|
}
|
|
739
|
-
/**
|
|
740
|
-
* Removes the body-level mobile backdrop.
|
|
741
|
-
*/
|
|
742
263
|
removePortalBackdrop() {
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
this._portalBackdropElement.remove();
|
|
746
|
-
this._portalBackdropElement = null;
|
|
747
|
-
}
|
|
748
|
-
/**
|
|
749
|
-
* Gets the full-page z-index for the body-level mobile backdrop.
|
|
750
|
-
* @returns {string}
|
|
751
|
-
*/
|
|
264
|
+
this._portalBackdropElement && (this.removeBackdropListeners(this._portalBackdropElement), this._portalBackdropElement.remove(), this._portalBackdropElement = null);
|
|
265
|
+
}
|
|
752
266
|
getPortalBackdropZIndex() {
|
|
753
|
-
const
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
return "999";
|
|
759
|
-
}
|
|
760
|
-
/**
|
|
761
|
-
* Gets the target opacity for the active mobile backdrop.
|
|
762
|
-
* @returns {string}
|
|
763
|
-
*/
|
|
267
|
+
const t2 = getComputedStyle(this), e2 = t2.getPropertyValue("--wje-sliding-container-portal-backdrop-z-index").trim();
|
|
268
|
+
if (e2) return e2;
|
|
269
|
+
const i2 = Number.parseInt(t2.zIndex, 10);
|
|
270
|
+
return Number.isFinite(i2) ? String(i2 - 1) : "999";
|
|
271
|
+
}
|
|
764
272
|
getBackdropOpenOpacity() {
|
|
765
273
|
return getComputedStyle(this).getPropertyValue("--wje-sliding-container-backdrop-opacity").trim() || "1";
|
|
766
274
|
}
|
|
767
|
-
/**
|
|
768
|
-
* Syncs visual styles from the component to the body-level backdrop.
|
|
769
|
-
*/
|
|
770
275
|
syncPortalBackdropStyles() {
|
|
771
276
|
if (!this._portalBackdropElement) return;
|
|
772
|
-
const
|
|
773
|
-
this._portalBackdropElement.style.position = "fixed";
|
|
774
|
-
|
|
775
|
-
this._portalBackdropElement.style.display = "block";
|
|
776
|
-
this._portalBackdropElement.style.opacity = this.classList.contains("open") ? this.getBackdropOpenOpacity() : "0";
|
|
777
|
-
this._portalBackdropElement.style.pointerEvents = this.classList.contains("open") ? "auto" : "none";
|
|
778
|
-
this._portalBackdropElement.style.touchAction = "none";
|
|
779
|
-
this._portalBackdropElement.style.overscrollBehavior = "none";
|
|
780
|
-
this._portalBackdropElement.style.background = (backdropStyle == null ? void 0 : backdropStyle.background) || "rgba(0, 0, 0, .35)";
|
|
781
|
-
this._portalBackdropElement.style.zIndex = this.getPortalBackdropZIndex();
|
|
782
|
-
}
|
|
783
|
-
/**
|
|
784
|
-
* Sync ARIA attributes on host.
|
|
785
|
-
*/
|
|
277
|
+
const t2 = this.backdropElement ? getComputedStyle(this.backdropElement) : null;
|
|
278
|
+
this._portalBackdropElement.style.position = "fixed", this._portalBackdropElement.style.inset = "0", this._portalBackdropElement.style.display = "block", this._portalBackdropElement.style.opacity = this.classList.contains("open") ? this.getBackdropOpenOpacity() : "0", this._portalBackdropElement.style.pointerEvents = this.classList.contains("open") ? "auto" : "none", this._portalBackdropElement.style.touchAction = "none", this._portalBackdropElement.style.overscrollBehavior = "none", this._portalBackdropElement.style.background = (t2 == null ? void 0 : t2.background) || "rgba(0, 0, 0, .35)", this._portalBackdropElement.style.zIndex = this.getPortalBackdropZIndex();
|
|
279
|
+
}
|
|
786
280
|
syncAria() {
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
}
|
|
790
|
-
this.setAriaState({ hidden: !this.isOpen });
|
|
791
|
-
const ariaLabel = this.getAttribute("aria-label");
|
|
792
|
-
const label = this.getAttribute("label");
|
|
793
|
-
if (!ariaLabel && label) {
|
|
794
|
-
this.setAriaState({ label });
|
|
795
|
-
}
|
|
281
|
+
this.hasAttribute("role") || this.setAriaState({ role: "region" }), this.setAriaState({ hidden: !this.isOpen });
|
|
282
|
+
const t2 = this.getAttribute("aria-label"), e2 = this.getAttribute("label");
|
|
283
|
+
!t2 && e2 && this.setAriaState({ label: e2 });
|
|
796
284
|
}
|
|
797
|
-
/**
|
|
798
|
-
* Creates and returns a styled close button element with an icon,
|
|
799
|
-
* including an event listener to trigger the close method.
|
|
800
|
-
* @returns {HTMLElement} The close button element configured with styles, an icon, and event listener.
|
|
801
|
-
*/
|
|
802
285
|
htmlCloseButton() {
|
|
803
|
-
let
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
icon.setAttribute("slot", "icon-only");
|
|
808
|
-
icon.setAttribute("name", "x");
|
|
809
|
-
closeButton.append(icon);
|
|
810
|
-
event.addListener(closeButton, "wje-button:click", null, (e) => {
|
|
286
|
+
let t2 = document.createElement("wje-button");
|
|
287
|
+
t2.setAttribute("part", "close-button"), t2.classList.add("close-button");
|
|
288
|
+
let i2 = document.createElement("wje-icon");
|
|
289
|
+
return i2.setAttribute("slot", "icon-only"), i2.setAttribute("name", "x"), t2.append(i2), e.addListener(t2, "wje-button:click", null, (t3) => {
|
|
811
290
|
this.close();
|
|
812
|
-
});
|
|
813
|
-
return closeButton;
|
|
291
|
+
}), t2;
|
|
814
292
|
}
|
|
815
|
-
/**
|
|
816
|
-
* Creates the mobile bottom sheet resize handle.
|
|
817
|
-
* @returns {HTMLElement} The resize handle element.
|
|
818
|
-
*/
|
|
819
293
|
htmlSheetHandle() {
|
|
820
|
-
const
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
const handle = document.createElement("div");
|
|
826
|
-
handle.setAttribute("part", "sheet-handle");
|
|
827
|
-
handle.classList.add("sliding-container-sheet-handle");
|
|
828
|
-
handleArea.append(handle);
|
|
829
|
-
handleArea.addEventListener("pointerdown", this.handleSheetDragStart, { capture: true });
|
|
830
|
-
handleArea.addEventListener("touchstart", this.handleSheetTouchStart, { capture: true, passive: false });
|
|
831
|
-
handleArea.addEventListener("click", this.stopSheetHandleEvent, { capture: true });
|
|
832
|
-
handleArea.addEventListener("mousedown", this.stopSheetHandleEvent, { capture: true });
|
|
833
|
-
handleArea.addEventListener("mouseup", this.stopSheetHandleEvent, { capture: true });
|
|
834
|
-
this.sheetHandleArea = handleArea;
|
|
835
|
-
return handleArea;
|
|
836
|
-
}
|
|
837
|
-
/**
|
|
838
|
-
* Retrieves the parent element of the current element.
|
|
839
|
-
* If the parent element is not found, it attempts to find the root host element.
|
|
840
|
-
* @returns {Element|null} The parent element or the root host element if no parent exists. Returns null if neither is found.
|
|
841
|
-
*/
|
|
294
|
+
const t2 = document.createElement("div");
|
|
295
|
+
t2.setAttribute("part", "sheet-handle-area"), t2.setAttribute("role", "separator"), t2.setAttribute("aria-orientation", "horizontal"), t2.classList.add("sliding-container-sheet-handle-area");
|
|
296
|
+
const e2 = document.createElement("div");
|
|
297
|
+
return e2.setAttribute("part", "sheet-handle"), e2.classList.add("sliding-container-sheet-handle"), t2.append(e2), t2.addEventListener("pointerdown", this.handleSheetDragStart, { capture: true }), t2.addEventListener("touchstart", this.handleSheetTouchStart, { capture: true, passive: false }), t2.addEventListener("click", this.stopSheetHandleEvent, { capture: true }), t2.addEventListener("mousedown", this.stopSheetHandleEvent, { capture: true }), t2.addEventListener("mouseup", this.stopSheetHandleEvent, { capture: true }), this.sheetHandleArea = t2, t2;
|
|
298
|
+
}
|
|
842
299
|
getParentElement() {
|
|
843
|
-
let
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
return parentElement;
|
|
848
|
-
}
|
|
849
|
-
/**
|
|
850
|
-
* Finds the closest element across shadow DOM boundaries.
|
|
851
|
-
* @param {string} selector The selector to match.
|
|
852
|
-
* @returns {Element|null} The matched composed ancestor.
|
|
853
|
-
*/
|
|
854
|
-
getClosestComposedElement(selector) {
|
|
300
|
+
let t2 = this.parentElement;
|
|
301
|
+
return t2 || (t2 = this.getRootNode().host), t2;
|
|
302
|
+
}
|
|
303
|
+
getClosestComposedElement(t2) {
|
|
855
304
|
var _a;
|
|
856
|
-
let
|
|
857
|
-
|
|
858
|
-
let
|
|
305
|
+
let e2 = this;
|
|
306
|
+
for (; e2; ) {
|
|
307
|
+
let i2 = false;
|
|
859
308
|
try {
|
|
860
|
-
|
|
309
|
+
i2 = e2 instanceof Element && e2.matches(t2);
|
|
861
310
|
} catch {
|
|
862
311
|
return null;
|
|
863
312
|
}
|
|
864
|
-
if (
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
if (currentElement.parentElement) {
|
|
868
|
-
currentElement = currentElement.parentElement;
|
|
313
|
+
if (i2) return e2;
|
|
314
|
+
if (e2.parentElement) {
|
|
315
|
+
e2 = e2.parentElement;
|
|
869
316
|
continue;
|
|
870
317
|
}
|
|
871
|
-
const
|
|
872
|
-
|
|
318
|
+
const n = (_a = e2.getRootNode) == null ? void 0 : _a.call(e2);
|
|
319
|
+
e2 = n instanceof ShadowRoot ? n.host : null;
|
|
873
320
|
}
|
|
874
321
|
return null;
|
|
875
322
|
}
|
|
876
|
-
/**
|
|
877
|
-
* Returns the viewport frame.
|
|
878
|
-
* @returns {{top: number, left: number, right: number, bottom: number, width: number, height: number}}
|
|
879
|
-
*/
|
|
880
323
|
getViewportFrame() {
|
|
881
|
-
return {
|
|
882
|
-
|
|
883
|
-
left: 0,
|
|
884
|
-
right: window.innerWidth,
|
|
885
|
-
bottom: window.innerHeight,
|
|
886
|
-
width: window.innerWidth,
|
|
887
|
-
height: window.innerHeight
|
|
888
|
-
};
|
|
889
|
-
}
|
|
890
|
-
/**
|
|
891
|
-
* Returns the element that bounds the mobile bottom sheet panel.
|
|
892
|
-
* @returns {Element|null} The scope element, or null for viewport scope.
|
|
893
|
-
*/
|
|
324
|
+
return { top: 0, left: 0, right: window.innerWidth, bottom: window.innerHeight, width: window.innerWidth, height: window.innerHeight };
|
|
325
|
+
}
|
|
894
326
|
getBottomSheetScopeElement() {
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
if (this.sheetBoundary) return this.getClosestComposedElement(this.sheetBoundary);
|
|
898
|
-
return this.getParentElement();
|
|
899
|
-
}
|
|
900
|
-
/**
|
|
901
|
-
* Returns the frame used by the mobile bottom sheet panel.
|
|
902
|
-
* @returns {{top: number, left: number, right: number, bottom: number, width: number, height: number}}
|
|
903
|
-
*/
|
|
327
|
+
return "viewport" === this.sheetScope ? null : "parent" === this.sheetScope ? this.getParentElement() : this.sheetBoundary ? this.getClosestComposedElement(this.sheetBoundary) : this.getParentElement();
|
|
328
|
+
}
|
|
904
329
|
getBottomSheetScopeFrame() {
|
|
905
|
-
const
|
|
906
|
-
if (!
|
|
907
|
-
const
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
left,
|
|
920
|
-
right,
|
|
921
|
-
bottom,
|
|
922
|
-
width,
|
|
923
|
-
height
|
|
924
|
-
};
|
|
925
|
-
}
|
|
926
|
-
/**
|
|
927
|
-
* Applies a fixed frame to a bottom sheet layer.
|
|
928
|
-
* @param {HTMLElement|SlidingContainer} element The element to update.
|
|
929
|
-
* @param {object} frame The frame to apply.
|
|
930
|
-
*/
|
|
931
|
-
setBottomSheetLayerFrame(element, frame) {
|
|
932
|
-
element.style.top = frame.top + "px";
|
|
933
|
-
element.style.left = frame.left + "px";
|
|
934
|
-
element.style.right = "auto";
|
|
935
|
-
element.style.bottom = "auto";
|
|
936
|
-
element.style.width = frame.width + "px";
|
|
937
|
-
element.style.height = frame.height + "px";
|
|
938
|
-
}
|
|
939
|
-
/**
|
|
940
|
-
* Removes fixed frame styles from a bottom sheet layer.
|
|
941
|
-
* @param {HTMLElement|SlidingContainer} element The element to reset.
|
|
942
|
-
*/
|
|
943
|
-
resetBottomSheetLayerFrame(element) {
|
|
944
|
-
element == null ? void 0 : element.style.removeProperty("top");
|
|
945
|
-
element == null ? void 0 : element.style.removeProperty("left");
|
|
946
|
-
element == null ? void 0 : element.style.removeProperty("right");
|
|
947
|
-
element == null ? void 0 : element.style.removeProperty("bottom");
|
|
948
|
-
element == null ? void 0 : element.style.removeProperty("width");
|
|
949
|
-
element == null ? void 0 : element.style.removeProperty("height");
|
|
950
|
-
}
|
|
951
|
-
/**
|
|
952
|
-
* Adjusts the position and dimensions of the current element based on the specified variant.
|
|
953
|
-
*
|
|
954
|
-
* The method handles modifications to the element's positioning style, aligns it relative to its parent,
|
|
955
|
-
* and manages alignment to its siblings based on the specified direction.
|
|
956
|
-
* @param {string} variant The variant to determine how the element should be updated. For example, when set to 'over', specific adjustments to the position and size are performed.
|
|
957
|
-
* @returns {void} No value is returned, the method modifies the element's style properties directly.
|
|
958
|
-
*/
|
|
959
|
-
checkForVariant(variant) {
|
|
960
|
-
if (this.isBottomSheet()) {
|
|
961
|
-
this.setBottomSheetVariant();
|
|
962
|
-
return;
|
|
963
|
-
}
|
|
964
|
-
this.resetBottomSheetVariant();
|
|
965
|
-
if (variant === "over") {
|
|
330
|
+
const t2 = this.getBottomSheetScopeElement();
|
|
331
|
+
if (!t2) return this.getViewportFrame();
|
|
332
|
+
const e2 = t2.getBoundingClientRect(), i2 = Math.max(e2.top, 0), n = Math.max(e2.left, 0), s = Math.min(e2.right, window.innerWidth), a = Math.min(e2.bottom, window.innerHeight), o = s - n, r = a - i2;
|
|
333
|
+
return o <= 0 || r <= 0 ? this.getViewportFrame() : { top: i2, left: n, right: s, bottom: a, width: o, height: r };
|
|
334
|
+
}
|
|
335
|
+
setBottomSheetLayerFrame(t2, e2) {
|
|
336
|
+
t2.style.top = e2.top + "px", t2.style.left = e2.left + "px", t2.style.right = "auto", t2.style.bottom = "auto", t2.style.width = e2.width + "px", t2.style.height = e2.height + "px";
|
|
337
|
+
}
|
|
338
|
+
resetBottomSheetLayerFrame(t2) {
|
|
339
|
+
t2 == null ? void 0 : t2.style.removeProperty("top"), t2 == null ? void 0 : t2.style.removeProperty("left"), t2 == null ? void 0 : t2.style.removeProperty("right"), t2 == null ? void 0 : t2.style.removeProperty("bottom"), t2 == null ? void 0 : t2.style.removeProperty("width"), t2 == null ? void 0 : t2.style.removeProperty("height");
|
|
340
|
+
}
|
|
341
|
+
checkForVariant(t2) {
|
|
342
|
+
if (this.isBottomSheet()) this.setBottomSheetVariant();
|
|
343
|
+
else if (this.resetBottomSheetVariant(), "over" === t2) {
|
|
966
344
|
this.style.position = "fixed";
|
|
967
|
-
let
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
this.style.height = heightOfParrentElement + +this.addToHeight + "px";
|
|
972
|
-
this.wrapperDiv.style.height = heightOfParrentElement + +this.addToHeight + "px";
|
|
973
|
-
this.style.top = topOfParrentElement + "px";
|
|
974
|
-
const leftSibling = this.previousElementSibling;
|
|
975
|
-
const rightSibling = this.nextElementSibling;
|
|
976
|
-
const leftSiblingBoundingbox = leftSibling == null ? void 0 : leftSibling.getBoundingClientRect();
|
|
977
|
-
const rightSiblingBoundingbox = rightSibling == null ? void 0 : rightSibling.getBoundingClientRect();
|
|
978
|
-
if (this.direction === "right") {
|
|
979
|
-
if (leftSiblingBoundingbox) {
|
|
980
|
-
this.style.left = leftSiblingBoundingbox.left + leftSiblingBoundingbox.width + "px";
|
|
981
|
-
} else {
|
|
982
|
-
this.style.left = parentElementBoundingbox.left + "px";
|
|
983
|
-
}
|
|
984
|
-
} else {
|
|
985
|
-
if (rightSiblingBoundingbox) {
|
|
986
|
-
this.style.right = window.innerWidth - rightSiblingBoundingbox.left + "px";
|
|
987
|
-
} else {
|
|
988
|
-
this.style.right = window.innerWidth - (parentElementBoundingbox.left + parentElementBoundingbox.width) + "px";
|
|
989
|
-
}
|
|
990
|
-
}
|
|
345
|
+
let t3 = window.getComputedStyle(this.getParentElement()), e2 = this.getParentElement().getBoundingClientRect(), i2 = parseFloat(t3.height), n = parseFloat(t3.top);
|
|
346
|
+
this.style.height = i2 + +this.addToHeight + "px", this.wrapperDiv.style.height = i2 + +this.addToHeight + "px", this.style.top = n + "px";
|
|
347
|
+
const s = this.previousElementSibling, a = this.nextElementSibling, o = s == null ? void 0 : s.getBoundingClientRect(), r = a == null ? void 0 : a.getBoundingClientRect();
|
|
348
|
+
"right" === this.direction ? this.style.left = o ? o.left + o.width + "px" : e2.left + "px" : this.style.right = r ? window.innerWidth - r.left + "px" : window.innerWidth - (e2.left + e2.width) + "px";
|
|
991
349
|
}
|
|
992
350
|
}
|
|
993
|
-
/**
|
|
994
|
-
* Applies the mobile bottom sheet layout.
|
|
995
|
-
*/
|
|
996
351
|
setBottomSheetVariant() {
|
|
997
|
-
const
|
|
998
|
-
|
|
999
|
-
const backdrop = this.getBackdropElement({
|
|
1000
|
-
createPortal: this.classList.contains("open") || this._isOpen
|
|
1001
|
-
});
|
|
1002
|
-
this._bottomSheetScopeFrame = scopeFrame;
|
|
1003
|
-
this.classList.add("bottom-sheet");
|
|
1004
|
-
this.style.position = "fixed";
|
|
1005
|
-
this.setBottomSheetLayerFrame(this, scopeFrame);
|
|
1006
|
-
this.setBottomSheetLayerFrame(backdrop, backdropFrame);
|
|
1007
|
-
this.setBottomSheetLayerFrame(this.wrapperDiv, scopeFrame);
|
|
1008
|
-
this.syncPortalBackdropStyles();
|
|
1009
|
-
this.wrapperDiv.style.height = "100%";
|
|
1010
|
-
this.transparentDiv.style.width = 0;
|
|
1011
|
-
this.nativeElement.style.left = scopeFrame.left + "px";
|
|
1012
|
-
this.nativeElement.style.right = "auto";
|
|
1013
|
-
this.nativeElement.style.bottom = window.innerHeight - scopeFrame.bottom + "px";
|
|
1014
|
-
this.nativeElement.style.top = "auto";
|
|
1015
|
-
this.nativeElement.style.width = scopeFrame.width + "px";
|
|
1016
|
-
if (this._sheetDrag) {
|
|
1017
|
-
this.nativeElement.style.maxHeight = this.getSheetMaxHeightInPixels() + "px";
|
|
1018
|
-
} else {
|
|
1019
|
-
this.setSheetHeight();
|
|
1020
|
-
}
|
|
1021
|
-
this.setBottomSheetVisualState(this.classList.contains("open"));
|
|
1022
|
-
this.nativeInner.style.width = "100%";
|
|
1023
|
-
this.nativeInner.style.maxHeight = this.nativeElement.style.maxHeight;
|
|
352
|
+
const t2 = this.getBottomSheetScopeFrame(), e2 = this.getViewportFrame(), i2 = this.getBackdropElement({ createPortal: this.classList.contains("open") || this._isOpen });
|
|
353
|
+
this._bottomSheetScopeFrame = t2, this.classList.add("bottom-sheet"), this.style.position = "fixed", this.setBottomSheetLayerFrame(this, t2), this.setBottomSheetLayerFrame(i2, e2), this.setBottomSheetLayerFrame(this.wrapperDiv, t2), this.syncPortalBackdropStyles(), this.wrapperDiv.style.height = "100%", this.transparentDiv.style.width = 0, this.nativeElement.style.left = t2.left + "px", this.nativeElement.style.right = "auto", this.nativeElement.style.bottom = window.innerHeight - t2.bottom + "px", this.nativeElement.style.top = "auto", this.nativeElement.style.width = t2.width + "px", this._sheetDrag ? this.nativeElement.style.maxHeight = this.getSheetMaxHeightInPixels() + "px" : this.setSheetHeight(), this.setBottomSheetVisualState(this.classList.contains("open")), this.nativeInner.style.width = "100%", this.nativeInner.style.maxHeight = this.nativeElement.style.maxHeight;
|
|
1024
354
|
}
|
|
1025
|
-
/**
|
|
1026
|
-
* Removes layout styles managed by the mobile bottom sheet mode.
|
|
1027
|
-
*/
|
|
1028
355
|
resetBottomSheetVariant() {
|
|
1029
|
-
var _a, _b, _c, _d, _e, _f, _g, _h,
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
this.
|
|
1034
|
-
this.
|
|
1035
|
-
this.removePortalBackdrop();
|
|
1036
|
-
this.resetBottomSheetLayerFrame(this.wrapperDiv);
|
|
1037
|
-
if (this.transparentDiv) {
|
|
1038
|
-
this.transparentDiv.style.width = this._isOpen ? this.maxWidth : 0;
|
|
1039
|
-
}
|
|
1040
|
-
(_a = this.nativeElement) == null ? void 0 : _a.style.removeProperty("left");
|
|
1041
|
-
(_b = this.nativeElement) == null ? void 0 : _b.style.removeProperty("right");
|
|
1042
|
-
(_c = this.nativeElement) == null ? void 0 : _c.style.removeProperty("bottom");
|
|
1043
|
-
(_d = this.nativeElement) == null ? void 0 : _d.style.removeProperty("top");
|
|
1044
|
-
(_e = this.nativeElement) == null ? void 0 : _e.style.removeProperty("height");
|
|
1045
|
-
(_f = this.nativeElement) == null ? void 0 : _f.style.removeProperty("max-height");
|
|
1046
|
-
(_g = this.nativeElement) == null ? void 0 : _g.style.removeProperty("transform");
|
|
1047
|
-
if (this.nativeElement) {
|
|
1048
|
-
if (this.direction === "right") {
|
|
1049
|
-
this.nativeElement.style.right = 0;
|
|
1050
|
-
} else {
|
|
1051
|
-
this.nativeElement.style.left = 0;
|
|
1052
|
-
}
|
|
1053
|
-
this.nativeElement.style.width = this._isOpen ? this.maxWidth : 0;
|
|
1054
|
-
}
|
|
1055
|
-
(_h = this.nativeInner) == null ? void 0 : _h.style.removeProperty("max-height");
|
|
1056
|
-
if (this.nativeInner) {
|
|
1057
|
-
this.nativeInner.style.width = this.maxWidth;
|
|
1058
|
-
}
|
|
1059
|
-
(_i = this.backdropElement) == null ? void 0 : _i.style.removeProperty("opacity");
|
|
1060
|
-
this._bottomSheetScopeFrame = null;
|
|
1061
|
-
this.endSheetDrag();
|
|
1062
|
-
}
|
|
1063
|
-
/**
|
|
1064
|
-
* Applies the current visual open or closed state to the mobile bottom sheet.
|
|
1065
|
-
* @param {boolean} isOpen True when the sheet should be visible.
|
|
1066
|
-
*/
|
|
1067
|
-
setBottomSheetVisualState(isOpen) {
|
|
1068
|
-
this.nativeElement.style.transform = isOpen ? "translateY(0)" : "translateY(100%)";
|
|
1069
|
-
const backdrop = this.getBackdropElement({ createPortal: isOpen || Boolean(this._portalBackdropElement) });
|
|
1070
|
-
if (this.hasOpacity) {
|
|
1071
|
-
this.nativeElement.style.opacity = isOpen ? 1 : 0;
|
|
1072
|
-
}
|
|
1073
|
-
if (backdrop) {
|
|
1074
|
-
backdrop.style.opacity = isOpen ? this.getBackdropOpenOpacity() : "0";
|
|
1075
|
-
backdrop.style.pointerEvents = isOpen ? "auto" : "none";
|
|
1076
|
-
}
|
|
1077
|
-
if (!isOpen) {
|
|
1078
|
-
this.removePortalBackdrop();
|
|
1079
|
-
}
|
|
356
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i2;
|
|
357
|
+
this.classList.contains("bottom-sheet") && (this.classList.remove("bottom-sheet"), this.style.removeProperty("position"), this.resetBottomSheetLayerFrame(this), this.resetBottomSheetLayerFrame(this.backdropElement), this.removePortalBackdrop(), this.resetBottomSheetLayerFrame(this.wrapperDiv), this.transparentDiv && (this.transparentDiv.style.width = this._isOpen ? this.maxWidth : 0), (_a = this.nativeElement) == null ? void 0 : _a.style.removeProperty("left"), (_b = this.nativeElement) == null ? void 0 : _b.style.removeProperty("right"), (_c = this.nativeElement) == null ? void 0 : _c.style.removeProperty("bottom"), (_d = this.nativeElement) == null ? void 0 : _d.style.removeProperty("top"), (_e = this.nativeElement) == null ? void 0 : _e.style.removeProperty("height"), (_f = this.nativeElement) == null ? void 0 : _f.style.removeProperty("max-height"), (_g = this.nativeElement) == null ? void 0 : _g.style.removeProperty("transform"), this.nativeElement && ("right" === this.direction ? this.nativeElement.style.right = 0 : this.nativeElement.style.left = 0, this.nativeElement.style.width = this._isOpen ? this.maxWidth : 0), (_h = this.nativeInner) == null ? void 0 : _h.style.removeProperty("max-height"), this.nativeInner && (this.nativeInner.style.width = this.maxWidth), (_i2 = this.backdropElement) == null ? void 0 : _i2.style.removeProperty("opacity"), this._bottomSheetScopeFrame = null, this.endSheetDrag());
|
|
358
|
+
}
|
|
359
|
+
setBottomSheetVisualState(t2) {
|
|
360
|
+
this.nativeElement.style.transform = t2 ? "translateY(0)" : "translateY(100%)";
|
|
361
|
+
const e2 = this.getBackdropElement({ createPortal: t2 || Boolean(this._portalBackdropElement) });
|
|
362
|
+
this.hasOpacity && (this.nativeElement.style.opacity = t2 ? 1 : 0), e2 && (e2.style.opacity = t2 ? this.getBackdropOpenOpacity() : "0", e2.style.pointerEvents = t2 ? "auto" : "none"), t2 || this.removePortalBackdrop();
|
|
1080
363
|
}
|
|
1081
|
-
/**
|
|
1082
|
-
* Gets the CSS height limit used for the mobile bottom sheet.
|
|
1083
|
-
* @returns {string} The CSS max height.
|
|
1084
|
-
*/
|
|
1085
364
|
getSheetMaxHeight() {
|
|
1086
365
|
return this.sheetMaxHeight || this.maxHeight;
|
|
1087
366
|
}
|
|
1088
|
-
/**
|
|
1089
|
-
* Applies the configured bottom sheet opening height.
|
|
1090
|
-
*/
|
|
1091
367
|
setSheetHeight() {
|
|
1092
|
-
const
|
|
1093
|
-
this.nativeElement.style.maxHeight =
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
}
|
|
1098
|
-
const minHeight = Math.min(this.getSheetMinHeightInPixels(), maxHeightInPixels);
|
|
1099
|
-
const height = this.resolveCssHeight(this.sheetHeight, maxHeightInPixels);
|
|
1100
|
-
const clampedHeight = this.clamp(height, minHeight, maxHeightInPixels);
|
|
1101
|
-
this.nativeElement.style.height = clampedHeight + "px";
|
|
1102
|
-
}
|
|
1103
|
-
/**
|
|
1104
|
-
* Resolves the sheet minimum height in pixels.
|
|
1105
|
-
* @returns {number} The minimum height.
|
|
1106
|
-
*/
|
|
368
|
+
const t2 = this.getSheetMaxHeightInPixels();
|
|
369
|
+
if (this.nativeElement.style.maxHeight = t2 + "px", !this.sheetHeight) return void this.nativeElement.style.removeProperty("height");
|
|
370
|
+
const e2 = Math.min(this.getSheetMinHeightInPixels(), t2), i2 = this.resolveCssHeight(this.sheetHeight, t2), n = this.clamp(i2, e2, t2);
|
|
371
|
+
this.nativeElement.style.height = n + "px";
|
|
372
|
+
}
|
|
1107
373
|
getSheetMinHeightInPixels() {
|
|
1108
|
-
const
|
|
1109
|
-
return Math.min(
|
|
1110
|
-
|
|
1111
|
-
availableHeight
|
|
1112
|
-
);
|
|
1113
|
-
}
|
|
1114
|
-
/**
|
|
1115
|
-
* Resolves the sheet maximum height in pixels.
|
|
1116
|
-
* @returns {number} The maximum height.
|
|
1117
|
-
*/
|
|
374
|
+
const t2 = this.getBottomSheetAvailableHeight();
|
|
375
|
+
return Math.min(this.resolveCssHeight(this.sheetMinHeight || "30vh", 0.3 * t2), t2);
|
|
376
|
+
}
|
|
1118
377
|
getSheetMaxHeightInPixels() {
|
|
1119
|
-
const
|
|
1120
|
-
return Math.min(
|
|
1121
|
-
|
|
1122
|
-
availableHeight
|
|
1123
|
-
);
|
|
1124
|
-
}
|
|
1125
|
-
/**
|
|
1126
|
-
* Returns available height for the bottom sheet scope.
|
|
1127
|
-
* @returns {number} Pixel height that can be used inside the current sheet frame.
|
|
1128
|
-
*/
|
|
378
|
+
const t2 = this.getBottomSheetAvailableHeight();
|
|
379
|
+
return Math.min(this.resolveCssHeight(this.getSheetMaxHeight(), 0.9 * t2), t2);
|
|
380
|
+
}
|
|
1129
381
|
getBottomSheetAvailableHeight() {
|
|
1130
382
|
var _a;
|
|
1131
383
|
return ((_a = this._bottomSheetScopeFrame) == null ? void 0 : _a.height) || this.getBottomSheetScopeFrame().height || window.innerHeight;
|
|
1132
384
|
}
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
if (
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
}
|
|
1151
|
-
/**
|
|
1152
|
-
* Clamps a number between min and max.
|
|
1153
|
-
* @param {number} value The measured height.
|
|
1154
|
-
* @param {number} min The minimum.
|
|
1155
|
-
* @param {number} max The maximum.
|
|
1156
|
-
* @returns {number} The clamped value.
|
|
1157
|
-
*/
|
|
1158
|
-
clamp(value, min, max) {
|
|
1159
|
-
return Math.min(Math.max(value, min), max);
|
|
1160
|
-
}
|
|
1161
|
-
/**
|
|
1162
|
-
* Checks whether an event came from the resize handle.
|
|
1163
|
-
* @param {Event} e The event to check.
|
|
1164
|
-
* @returns {boolean} True when the event belongs to the resize handle.
|
|
1165
|
-
*/
|
|
1166
|
-
isSheetHandleEvent(e) {
|
|
1167
|
-
if (!(e == null ? void 0 : e.composedPath)) return false;
|
|
1168
|
-
return e.composedPath().includes(this.sheetHandleArea);
|
|
1169
|
-
}
|
|
1170
|
-
/**
|
|
1171
|
-
* Checks whether an event happened inside the visible bottom sheet.
|
|
1172
|
-
* @param {Event} e The event to check.
|
|
1173
|
-
* @returns {boolean} True when the event coordinates are inside the sheet.
|
|
1174
|
-
*/
|
|
1175
|
-
isEventInsideSheet(e) {
|
|
1176
|
-
if (!this.nativeElement || typeof (e == null ? void 0 : e.clientX) !== "number" || typeof (e == null ? void 0 : e.clientY) !== "number") return false;
|
|
1177
|
-
const rect = this.nativeElement.getBoundingClientRect();
|
|
1178
|
-
return e.clientX >= rect.left && e.clientX <= rect.right && e.clientY >= rect.top && e.clientY <= rect.bottom;
|
|
1179
|
-
}
|
|
1180
|
-
/**
|
|
1181
|
-
* Stores the initial drag state for the mobile bottom sheet.
|
|
1182
|
-
* @param {number|string} pointerId The pointer identifier.
|
|
1183
|
-
* @param {number} startY The starting Y coordinate.
|
|
1184
|
-
*/
|
|
1185
|
-
startSheetDrag(pointerId, startY) {
|
|
385
|
+
resolveCssHeight(t2, e2) {
|
|
386
|
+
if (!t2 || "auto" === t2) return e2;
|
|
387
|
+
const i2 = `${t2}`.trim(), n = Number.parseFloat(i2);
|
|
388
|
+
return Number.isNaN(n) ? e2 : i2.endsWith("px") ? n : i2.endsWith("vh") ? window.innerHeight * n / 100 : i2.endsWith("vw") ? window.innerWidth * n / 100 : i2.endsWith("%") ? window.innerHeight * n / 100 : /^-?\d+(\.\d+)?$/.test(i2) ? n : e2;
|
|
389
|
+
}
|
|
390
|
+
clamp(t2, e2, i2) {
|
|
391
|
+
return Math.min(Math.max(t2, e2), i2);
|
|
392
|
+
}
|
|
393
|
+
isSheetHandleEvent(t2) {
|
|
394
|
+
return !!(t2 == null ? void 0 : t2.composedPath) && t2.composedPath().includes(this.sheetHandleArea);
|
|
395
|
+
}
|
|
396
|
+
isEventInsideSheet(t2) {
|
|
397
|
+
if (!this.nativeElement || "number" != typeof (t2 == null ? void 0 : t2.clientX) || "number" != typeof (t2 == null ? void 0 : t2.clientY)) return false;
|
|
398
|
+
const e2 = this.nativeElement.getBoundingClientRect();
|
|
399
|
+
return t2.clientX >= e2.left && t2.clientX <= e2.right && t2.clientY >= e2.top && t2.clientY <= e2.bottom;
|
|
400
|
+
}
|
|
401
|
+
startSheetDrag(t2, e2) {
|
|
1186
402
|
var _a, _b;
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
this.
|
|
1193
|
-
this.
|
|
1194
|
-
const
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
pointerId,
|
|
1198
|
-
startY,
|
|
1199
|
-
startHeight: currentHeight,
|
|
1200
|
-
minHeight: this.getSheetMinHeightInPixels(),
|
|
1201
|
-
maxHeight: this.getSheetMaxHeightInPixels(),
|
|
1202
|
-
hasMoved: false
|
|
1203
|
-
};
|
|
1204
|
-
}
|
|
1205
|
-
/**
|
|
1206
|
-
* Applies a new height while the bottom sheet is being dragged.
|
|
1207
|
-
* @param {number} clientY The current Y coordinate.
|
|
1208
|
-
*/
|
|
1209
|
-
updateSheetDrag(clientY) {
|
|
1210
|
-
const distance = this._sheetDrag.startY - clientY;
|
|
1211
|
-
if (Math.abs(distance) > 3) {
|
|
1212
|
-
this._sheetDrag.hasMoved = true;
|
|
1213
|
-
}
|
|
1214
|
-
const height = this.clamp(
|
|
1215
|
-
this._sheetDrag.startHeight + distance,
|
|
1216
|
-
this._sheetDrag.minHeight,
|
|
1217
|
-
this._sheetDrag.maxHeight
|
|
1218
|
-
);
|
|
1219
|
-
this.nativeElement.style.height = height + "px";
|
|
1220
|
-
}
|
|
1221
|
-
/**
|
|
1222
|
-
* Cleans up mobile bottom sheet resizing listeners.
|
|
1223
|
-
*/
|
|
403
|
+
this.classList.contains("open") && this.setBottomSheetVisualState(true), (_a = this.animation) == null ? void 0 : _a.cancel(), (_b = this.nativeAnimation) == null ? void 0 : _b.cancel(), this.animation = null, this.nativeAnimation = null;
|
|
404
|
+
const i2 = this.resolveCssHeight(this.sheetHeight, 0.5 * window.innerHeight), n = this.nativeElement.getBoundingClientRect().height || i2;
|
|
405
|
+
this._sheetDrag = { pointerId: t2, startY: e2, startHeight: n, minHeight: this.getSheetMinHeightInPixels(), maxHeight: this.getSheetMaxHeightInPixels(), hasMoved: false };
|
|
406
|
+
}
|
|
407
|
+
updateSheetDrag(t2) {
|
|
408
|
+
const e2 = this._sheetDrag.startY - t2;
|
|
409
|
+
Math.abs(e2) > 3 && (this._sheetDrag.hasMoved = true);
|
|
410
|
+
const i2 = this.clamp(this._sheetDrag.startHeight + e2, this._sheetDrag.minHeight, this._sheetDrag.maxHeight);
|
|
411
|
+
this.nativeElement.style.height = i2 + "px";
|
|
412
|
+
}
|
|
1224
413
|
endSheetDrag() {
|
|
1225
|
-
window.removeEventListener("pointermove", this.handleSheetDragMove);
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
*/
|
|
1236
|
-
beforeOpen(e) {
|
|
1237
|
-
}
|
|
1238
|
-
/**
|
|
1239
|
-
* Callback function called after the element is opened.
|
|
1240
|
-
*/
|
|
1241
|
-
afterOpen(e) {
|
|
1242
|
-
}
|
|
1243
|
-
/**
|
|
1244
|
-
* Executes before closing the element.
|
|
1245
|
-
*/
|
|
1246
|
-
beforeClose(e) {
|
|
1247
|
-
}
|
|
1248
|
-
/**
|
|
1249
|
-
* Callback function that is called after the container is closed.
|
|
1250
|
-
*/
|
|
1251
|
-
afterClose(e) {
|
|
1252
|
-
}
|
|
1253
|
-
/**
|
|
1254
|
-
* Animates the transition of elements with specified options, toggling the visibility and/or dimensions
|
|
1255
|
-
* of the associated elements based on their current state.
|
|
1256
|
-
*
|
|
1257
|
-
* This method handles both forward and reverse animations for two elements (`transparentDiv` and `nativeElement`)
|
|
1258
|
-
* with optional opacity changes. It ensures smooth transitioning by canceling any previous animations on the provided
|
|
1259
|
-
* elements before initiating a new animation sequence.
|
|
1260
|
-
* @returns {Promise<void>} A promise that resolves when the transition animation is completed.
|
|
1261
|
-
*/
|
|
414
|
+
window.removeEventListener("pointermove", this.handleSheetDragMove), window.removeEventListener("pointerup", this.handleSheetDragEnd), window.removeEventListener("pointercancel", this.handleSheetDragEnd), window.removeEventListener("touchmove", this.handleSheetTouchMove), window.removeEventListener("touchend", this.handleSheetTouchEnd), window.removeEventListener("touchcancel", this.handleSheetTouchEnd), this._sheetDrag = null;
|
|
415
|
+
}
|
|
416
|
+
beforeOpen(t2) {
|
|
417
|
+
}
|
|
418
|
+
afterOpen(t2) {
|
|
419
|
+
}
|
|
420
|
+
beforeClose(t2) {
|
|
421
|
+
}
|
|
422
|
+
afterClose(t2) {
|
|
423
|
+
}
|
|
1262
424
|
doAnimateTransition() {
|
|
1263
425
|
var _a, _b, _c, _d;
|
|
1264
|
-
const
|
|
1265
|
-
|
|
1266
|
-
endDelay: 0,
|
|
1267
|
-
fill: "forwards",
|
|
1268
|
-
duration: +this.animationDuration,
|
|
1269
|
-
iterationStart: 0,
|
|
1270
|
-
iterations: 1,
|
|
1271
|
-
direction: "normal",
|
|
1272
|
-
easing: this.animationEasing
|
|
1273
|
-
};
|
|
1274
|
-
if (this.isBottomSheet()) {
|
|
1275
|
-
return this.doAnimateBottomSheetTransition(options);
|
|
1276
|
-
}
|
|
1277
|
-
if (this.animation && ((_b = (_a = this.animation) == null ? void 0 : _a.effect) == null ? void 0 : _b.target) !== this.transparentDiv) {
|
|
1278
|
-
this.animation.cancel();
|
|
1279
|
-
this.animation = null;
|
|
1280
|
-
}
|
|
1281
|
-
if (this.nativeAnimation && ((_d = (_c = this.nativeAnimation) == null ? void 0 : _c.effect) == null ? void 0 : _d.target) !== this.nativeElement) {
|
|
1282
|
-
this.nativeAnimation.cancel();
|
|
1283
|
-
this.nativeAnimation = null;
|
|
1284
|
-
}
|
|
1285
|
-
if (!this._isOpen) {
|
|
1286
|
-
if (this.animation && this.nativeAnimation) {
|
|
1287
|
-
this.animation.reverse();
|
|
1288
|
-
this.nativeAnimation.reverse();
|
|
1289
|
-
} else {
|
|
1290
|
-
this.animation = this.transparentDiv.animate(
|
|
1291
|
-
[
|
|
1292
|
-
{
|
|
1293
|
-
width: 0
|
|
1294
|
-
},
|
|
1295
|
-
{
|
|
1296
|
-
width: this.maxWidth
|
|
1297
|
-
}
|
|
1298
|
-
],
|
|
1299
|
-
options
|
|
1300
|
-
);
|
|
1301
|
-
this.nativeAnimation = this.nativeElement.animate(
|
|
1302
|
-
[
|
|
1303
|
-
{
|
|
1304
|
-
...this.hasOpacity ? { opacity: 0 } : {},
|
|
1305
|
-
width: 0
|
|
1306
|
-
},
|
|
1307
|
-
{
|
|
1308
|
-
...this.hasOpacity ? { opacity: 1 } : {},
|
|
1309
|
-
width: this.maxWidth
|
|
1310
|
-
}
|
|
1311
|
-
],
|
|
1312
|
-
options
|
|
1313
|
-
);
|
|
1314
|
-
}
|
|
1315
|
-
} else {
|
|
1316
|
-
if (this.animation && this.nativeAnimation) {
|
|
1317
|
-
this.animation.reverse();
|
|
1318
|
-
this.nativeAnimation.reverse();
|
|
1319
|
-
} else {
|
|
1320
|
-
this.animation = this.transparentDiv.animate(
|
|
1321
|
-
[
|
|
1322
|
-
{
|
|
1323
|
-
width: this.maxWidth
|
|
1324
|
-
},
|
|
1325
|
-
{
|
|
1326
|
-
width: 0
|
|
1327
|
-
}
|
|
1328
|
-
],
|
|
1329
|
-
options
|
|
1330
|
-
);
|
|
1331
|
-
this.nativeAnimation = this.nativeElement.animate(
|
|
1332
|
-
[
|
|
1333
|
-
{
|
|
1334
|
-
...this.hasOpacity ? { opacity: 1 } : {},
|
|
1335
|
-
width: this.maxWidth
|
|
1336
|
-
},
|
|
1337
|
-
{
|
|
1338
|
-
...this.hasOpacity ? { opacity: 0 } : {},
|
|
1339
|
-
width: 0
|
|
1340
|
-
}
|
|
1341
|
-
],
|
|
1342
|
-
options
|
|
1343
|
-
);
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
return new Promise((resolve) => {
|
|
426
|
+
const t2 = { delay: 0, endDelay: 0, fill: "forwards", duration: +this.animationDuration, iterationStart: 0, iterations: 1, direction: "normal", easing: this.animationEasing };
|
|
427
|
+
return this.isBottomSheet() ? this.doAnimateBottomSheetTransition(t2) : (this.animation && ((_b = (_a = this.animation) == null ? void 0 : _a.effect) == null ? void 0 : _b.target) !== this.transparentDiv && (this.animation.cancel(), this.animation = null), this.nativeAnimation && ((_d = (_c = this.nativeAnimation) == null ? void 0 : _c.effect) == null ? void 0 : _d.target) !== this.nativeElement && (this.nativeAnimation.cancel(), this.nativeAnimation = null), this._isOpen ? this.animation && this.nativeAnimation ? (this.animation.reverse(), this.nativeAnimation.reverse()) : (this.animation = this.transparentDiv.animate([{ width: this.maxWidth }, { width: 0 }], t2), this.nativeAnimation = this.nativeElement.animate([{ ...this.hasOpacity ? { opacity: 1 } : {}, width: this.maxWidth }, { ...this.hasOpacity ? { opacity: 0 } : {}, width: 0 }], t2)) : this.animation && this.nativeAnimation ? (this.animation.reverse(), this.nativeAnimation.reverse()) : (this.animation = this.transparentDiv.animate([{ width: 0 }, { width: this.maxWidth }], t2), this.nativeAnimation = this.nativeElement.animate([{ ...this.hasOpacity ? { opacity: 0 } : {}, width: 0 }, { ...this.hasOpacity ? { opacity: 1 } : {}, width: this.maxWidth }], t2)), new Promise((t3) => {
|
|
1347
428
|
this.animation.onfinish = () => {
|
|
1348
|
-
this._isOpen = !this._isOpen;
|
|
1349
|
-
resolve();
|
|
429
|
+
this._isOpen = !this._isOpen, t3();
|
|
1350
430
|
};
|
|
1351
|
-
});
|
|
431
|
+
}));
|
|
1352
432
|
}
|
|
1353
|
-
|
|
1354
|
-
* Animates the mobile bottom sheet and its backdrop.
|
|
1355
|
-
* @param {object} options Web Animation options.
|
|
1356
|
-
* @returns {Promise<void>}
|
|
1357
|
-
*/
|
|
1358
|
-
doAnimateBottomSheetTransition(options) {
|
|
433
|
+
doAnimateBottomSheetTransition(t2) {
|
|
1359
434
|
var _a, _b, _c, _d;
|
|
1360
|
-
const
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
const openBackdrop = {
|
|
1366
|
-
opacity: this.getBackdropOpenOpacity()
|
|
1367
|
-
};
|
|
1368
|
-
const closedSheet = {
|
|
1369
|
-
...this.hasOpacity ? { opacity: 0 } : {},
|
|
1370
|
-
transform: "translateY(100%)"
|
|
1371
|
-
};
|
|
1372
|
-
const openSheet = {
|
|
1373
|
-
...this.hasOpacity ? { opacity: 1 } : {},
|
|
1374
|
-
transform: "translateY(0)"
|
|
1375
|
-
};
|
|
1376
|
-
if (this.animation && ((_b = (_a = this.animation) == null ? void 0 : _a.effect) == null ? void 0 : _b.target) !== backdropElement) {
|
|
1377
|
-
this.animation.cancel();
|
|
1378
|
-
this.animation = null;
|
|
1379
|
-
}
|
|
1380
|
-
if (this.nativeAnimation && ((_d = (_c = this.nativeAnimation) == null ? void 0 : _c.effect) == null ? void 0 : _d.target) !== this.nativeElement) {
|
|
1381
|
-
this.nativeAnimation.cancel();
|
|
1382
|
-
this.nativeAnimation = null;
|
|
1383
|
-
}
|
|
1384
|
-
if (shouldOpen) {
|
|
1385
|
-
if (this.animation && this.nativeAnimation) {
|
|
1386
|
-
this.animation.reverse();
|
|
1387
|
-
this.nativeAnimation.reverse();
|
|
1388
|
-
} else {
|
|
1389
|
-
this.animation = backdropElement.animate([closedBackdrop, openBackdrop], options);
|
|
1390
|
-
this.nativeAnimation = this.nativeElement.animate([closedSheet, openSheet], options);
|
|
1391
|
-
}
|
|
1392
|
-
} else {
|
|
1393
|
-
if (this.animation && this.nativeAnimation) {
|
|
1394
|
-
this.animation.reverse();
|
|
1395
|
-
this.nativeAnimation.reverse();
|
|
1396
|
-
} else {
|
|
1397
|
-
this.animation = backdropElement.animate([openBackdrop, closedBackdrop], options);
|
|
1398
|
-
this.nativeAnimation = this.nativeElement.animate([openSheet, closedSheet], options);
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
return new Promise((resolve) => {
|
|
1402
|
-
let isFinished = false;
|
|
1403
|
-
const finish = () => {
|
|
1404
|
-
if (isFinished) return;
|
|
1405
|
-
isFinished = true;
|
|
1406
|
-
this._isOpen = shouldOpen;
|
|
1407
|
-
this.classList.toggle("open", shouldOpen);
|
|
1408
|
-
this.setBottomSheetVisualState(shouldOpen);
|
|
1409
|
-
resolve();
|
|
435
|
+
const e2 = !this._isOpen, i2 = this.getBackdropElement({ createPortal: true }), n = { opacity: 0 }, s = { opacity: this.getBackdropOpenOpacity() }, a = { ...this.hasOpacity ? { opacity: 0 } : {}, transform: "translateY(100%)" }, o = { ...this.hasOpacity ? { opacity: 1 } : {}, transform: "translateY(0)" };
|
|
436
|
+
return this.animation && ((_b = (_a = this.animation) == null ? void 0 : _a.effect) == null ? void 0 : _b.target) !== i2 && (this.animation.cancel(), this.animation = null), this.nativeAnimation && ((_d = (_c = this.nativeAnimation) == null ? void 0 : _c.effect) == null ? void 0 : _d.target) !== this.nativeElement && (this.nativeAnimation.cancel(), this.nativeAnimation = null), e2 ? this.animation && this.nativeAnimation ? (this.animation.reverse(), this.nativeAnimation.reverse()) : (this.animation = i2.animate([n, s], t2), this.nativeAnimation = this.nativeElement.animate([a, o], t2)) : this.animation && this.nativeAnimation ? (this.animation.reverse(), this.nativeAnimation.reverse()) : (this.animation = i2.animate([s, n], t2), this.nativeAnimation = this.nativeElement.animate([o, a], t2)), new Promise((t3) => {
|
|
437
|
+
let i3 = false;
|
|
438
|
+
const n2 = () => {
|
|
439
|
+
i3 || (i3 = true, this._isOpen = e2, this.classList.toggle("open", e2), this.setBottomSheetVisualState(e2), t3());
|
|
1410
440
|
};
|
|
1411
|
-
this.nativeAnimation.onfinish =
|
|
1412
|
-
this.nativeAnimation.oncancel = finish;
|
|
441
|
+
this.nativeAnimation.onfinish = n2, this.nativeAnimation.oncancel = n2;
|
|
1413
442
|
});
|
|
1414
443
|
}
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
async open(e) {
|
|
1421
|
-
await Promise.resolve(this.beforeOpen(e)).then(async () => {
|
|
1422
|
-
if (!this._isOpen) {
|
|
1423
|
-
this.classList.add("open");
|
|
1424
|
-
event.dispatchCustomEvent(this, "wje-sliding-container:beforeOpen");
|
|
1425
|
-
this.checkForVariant(this.variant);
|
|
1426
|
-
await this.doAnimateTransition();
|
|
1427
|
-
this.syncAria();
|
|
1428
|
-
await Promise.resolve(this.afterOpen(e)).then(() => {
|
|
1429
|
-
event.dispatchCustomEvent(this, "wje-sliding-container:open");
|
|
1430
|
-
});
|
|
1431
|
-
}
|
|
444
|
+
async open(t2) {
|
|
445
|
+
await Promise.resolve(this.beforeOpen(t2)).then(async () => {
|
|
446
|
+
this._isOpen || (this.classList.add("open"), e.dispatchCustomEvent(this, "wje-sliding-container:beforeOpen"), this.checkForVariant(this.variant), await this.doAnimateTransition(), this.syncAria(), await Promise.resolve(this.afterOpen(t2)).then(() => {
|
|
447
|
+
e.dispatchCustomEvent(this, "wje-sliding-container:open");
|
|
448
|
+
}));
|
|
1432
449
|
});
|
|
1433
450
|
}
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
await Promise.resolve(this.beforeClose(e)).then(async () => {
|
|
1444
|
-
if (this._isOpen) {
|
|
1445
|
-
this.classList.remove("open");
|
|
1446
|
-
event.dispatchCustomEvent(this, "wje-sliding-container:beforeClose");
|
|
1447
|
-
await this.doAnimateTransition().catch(() => {
|
|
1448
|
-
if (this.isBottomSheet()) {
|
|
1449
|
-
this.setBottomSheetClosedState();
|
|
1450
|
-
}
|
|
1451
|
-
});
|
|
1452
|
-
this.syncAria();
|
|
1453
|
-
await Promise.resolve(this.afterClose(e)).then(() => {
|
|
1454
|
-
if (this.removeChildAfterClose) {
|
|
1455
|
-
this.childNodes.forEach((child) => {
|
|
1456
|
-
child.remove();
|
|
1457
|
-
});
|
|
1458
|
-
}
|
|
1459
|
-
event.dispatchCustomEvent(this, "wje-sliding-container:afterClose");
|
|
1460
|
-
});
|
|
1461
|
-
}
|
|
451
|
+
async close(t2) {
|
|
452
|
+
this.isBottomSheet() && t2 instanceof Event && (this.isSheetHandleEvent(t2) || this.isBackdropElement(t2.target) && Date.now() < this._sheetIgnoreDismissUntil) || await Promise.resolve(this.beforeClose(t2)).then(async () => {
|
|
453
|
+
this._isOpen && (this.classList.remove("open"), e.dispatchCustomEvent(this, "wje-sliding-container:beforeClose"), await this.doAnimateTransition().catch(() => {
|
|
454
|
+
this.isBottomSheet() && this.setBottomSheetClosedState();
|
|
455
|
+
}), this.syncAria(), await Promise.resolve(this.afterClose(t2)).then(() => {
|
|
456
|
+
this.removeChildAfterClose && this.childNodes.forEach((t3) => {
|
|
457
|
+
t3.remove();
|
|
458
|
+
}), e.dispatchCustomEvent(this, "wje-sliding-container:afterClose");
|
|
459
|
+
}));
|
|
1462
460
|
});
|
|
1463
461
|
}
|
|
1464
|
-
/**
|
|
1465
|
-
* Forces the closed visual state for the mobile bottom sheet.
|
|
1466
|
-
*/
|
|
1467
462
|
setBottomSheetClosedState() {
|
|
1468
|
-
this._isOpen = false;
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
/**
|
|
1473
|
-
* Toggles the state between open and closed.
|
|
1474
|
-
* @param {Event} e The event object triggering the toggle.
|
|
1475
|
-
* @returns {Promise<void>} A promise that resolves once the toggle operation (open or close) is complete.
|
|
1476
|
-
*/
|
|
1477
|
-
async toggle(e) {
|
|
1478
|
-
if (this._isOpen) {
|
|
1479
|
-
await this.close(e);
|
|
1480
|
-
} else {
|
|
1481
|
-
await this.open(e);
|
|
1482
|
-
}
|
|
463
|
+
this._isOpen = false, this.classList.remove("open"), this.setBottomSheetVisualState(false);
|
|
464
|
+
}
|
|
465
|
+
async toggle(t2) {
|
|
466
|
+
this._isOpen ? await this.close(t2) : await this.open(t2);
|
|
1483
467
|
}
|
|
1484
|
-
/**
|
|
1485
|
-
* Cleans up resources associated with the component by disconnecting
|
|
1486
|
-
* the resize observer and setting it to null.
|
|
1487
|
-
* @returns {void} Does not return a value.
|
|
1488
|
-
*/
|
|
1489
468
|
componentCleanup() {
|
|
1490
469
|
var _a;
|
|
1491
|
-
this.endSheetDrag();
|
|
1492
|
-
this.removePortalBackdrop();
|
|
1493
|
-
(_a = this._resizeObserver) == null ? void 0 : _a.disconnect();
|
|
1494
|
-
this._resizeObserver = null;
|
|
470
|
+
this.endSheetDrag(), this.removePortalBackdrop(), (_a = this._resizeObserver) == null ? void 0 : _a.disconnect(), this._resizeObserver = null;
|
|
1495
471
|
}
|
|
1496
472
|
}
|
|
1497
|
-
|
|
473
|
+
i.define("wje-sliding-container", i);
|
|
1498
474
|
export {
|
|
1499
|
-
|
|
475
|
+
i as default
|
|
1500
476
|
};
|
|
1501
477
|
//# sourceMappingURL=wje-sliding-container.js.map
|