@justeattakeaway/pie-modal 0.20.0 → 0.21.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/index.js +269 -292
- package/package.json +2 -2
- package/src/index.ts +13 -3
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { html as g, unsafeStatic as
|
|
3
|
-
import { property as
|
|
4
|
-
import { property as
|
|
5
|
-
var
|
|
6
|
-
for (var n = i > 1 ? void 0 : i ?
|
|
1
|
+
import { css as B, LitElement as L, html as F, nothing as u, unsafeCSS as pe } from "lit";
|
|
2
|
+
import { html as g, unsafeStatic as ge } from "lit/static-html.js";
|
|
3
|
+
import { property as s, query as I } from "lit/decorators.js";
|
|
4
|
+
import { property as me } from "lit/decorators/property.js";
|
|
5
|
+
var fe = Object.defineProperty, ve = Object.getOwnPropertyDescriptor, be = (e, t, o, i) => {
|
|
6
|
+
for (var n = i > 1 ? void 0 : i ? ve(t, o) : t, a = e.length - 1, r; a >= 0; a--)
|
|
7
7
|
(r = e[a]) && (n = (i ? r(t, o, n) : r(n)) || n);
|
|
8
|
-
return i && n &&
|
|
8
|
+
return i && n && fe(t, o, n), n;
|
|
9
9
|
};
|
|
10
|
-
const
|
|
10
|
+
const ye = (e) => {
|
|
11
11
|
class t extends e {
|
|
12
12
|
constructor() {
|
|
13
13
|
var i;
|
|
@@ -26,25 +26,25 @@ const we = (e) => {
|
|
|
26
26
|
return this.dir === "rtl";
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
return
|
|
30
|
-
|
|
29
|
+
return be([
|
|
30
|
+
me({ type: String, reflect: !0 })
|
|
31
31
|
], t.prototype, "dir", 2), t;
|
|
32
|
-
},
|
|
32
|
+
}, N = (e, t, o) => function(n, a) {
|
|
33
33
|
const r = `#${a}`;
|
|
34
34
|
Object.defineProperty(n, a, {
|
|
35
35
|
get() {
|
|
36
36
|
return this[r];
|
|
37
37
|
},
|
|
38
|
-
set(
|
|
38
|
+
set(h) {
|
|
39
39
|
const p = this[r];
|
|
40
|
-
t.includes(
|
|
41
|
-
`<${e}> Invalid value "${
|
|
40
|
+
t.includes(h) ? this[r] = h : (console.error(
|
|
41
|
+
`<${e}> Invalid value "${h}" provided for property "${a}".`,
|
|
42
42
|
`Must be one of: ${t.join(" | ")}.`,
|
|
43
43
|
`Falling back to default value: "${o}"`
|
|
44
44
|
), this[r] = o), this.requestUpdate(a, p);
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
-
},
|
|
47
|
+
}, we = (e) => function(o, i) {
|
|
48
48
|
const n = `#${i}`;
|
|
49
49
|
Object.defineProperty(o, i, {
|
|
50
50
|
get() {
|
|
@@ -56,7 +56,7 @@ const we = (e) => {
|
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
|
-
function
|
|
59
|
+
function _e(e) {
|
|
60
60
|
if (Array.isArray(e)) {
|
|
61
61
|
for (var t = 0, o = Array(e.length); t < e.length; t++)
|
|
62
62
|
o[t] = e[t];
|
|
@@ -64,154 +64,129 @@ function ke(e) {
|
|
|
64
64
|
} else
|
|
65
65
|
return Array.from(e);
|
|
66
66
|
}
|
|
67
|
-
var
|
|
67
|
+
var R = !1;
|
|
68
68
|
if (typeof window < "u") {
|
|
69
|
-
var
|
|
69
|
+
var W = {
|
|
70
70
|
get passive() {
|
|
71
|
-
|
|
71
|
+
R = !0;
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
window.addEventListener("testPassive", null,
|
|
74
|
+
window.addEventListener("testPassive", null, W), window.removeEventListener("testPassive", null, W);
|
|
75
75
|
}
|
|
76
|
-
var
|
|
77
|
-
return
|
|
76
|
+
var G = typeof window < "u" && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === "MacIntel" && window.navigator.maxTouchPoints > 1), m = [], S = !1, J = -1, w = void 0, _ = void 0, Q = function(t) {
|
|
77
|
+
return m.some(function(o) {
|
|
78
78
|
return !!(o.options.allowTouchMove && o.options.allowTouchMove(t));
|
|
79
79
|
});
|
|
80
|
-
},
|
|
80
|
+
}, O = function(t) {
|
|
81
81
|
var o = t || window.event;
|
|
82
|
-
return
|
|
83
|
-
},
|
|
84
|
-
if (
|
|
82
|
+
return Q(o.target) || o.touches.length > 1 ? !0 : (o.preventDefault && o.preventDefault(), !1);
|
|
83
|
+
}, ke = function(t) {
|
|
84
|
+
if (_ === void 0) {
|
|
85
85
|
var o = !!t && t.reserveScrollBarGap === !0, i = window.innerWidth - document.documentElement.clientWidth;
|
|
86
|
-
|
|
87
|
-
var n = parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"), 10);
|
|
88
|
-
k = document.body.style.paddingRight, document.body.style.paddingRight = n + i + "px";
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
_ === void 0 && (_ = document.body.style.overflow, document.body.style.overflow = "hidden");
|
|
92
|
-
}, Ee = function() {
|
|
93
|
-
k !== void 0 && (document.body.style.paddingRight = k, k = void 0), _ !== void 0 && (document.body.style.overflow = _, _ = void 0);
|
|
94
|
-
}, Me = function() {
|
|
95
|
-
return window.requestAnimationFrame(function() {
|
|
96
|
-
if (m === void 0) {
|
|
97
|
-
m = {
|
|
98
|
-
position: document.body.style.position,
|
|
99
|
-
top: document.body.style.top,
|
|
100
|
-
left: document.body.style.left
|
|
101
|
-
};
|
|
102
|
-
var t = window, o = t.scrollY, i = t.scrollX, n = t.innerHeight;
|
|
103
|
-
document.body.style.position = "fixed", document.body.style.top = -o, document.body.style.left = -i, setTimeout(function() {
|
|
104
|
-
return window.requestAnimationFrame(function() {
|
|
105
|
-
var a = n - window.innerHeight;
|
|
106
|
-
a && o >= n && (document.body.style.top = -(o + a));
|
|
107
|
-
});
|
|
108
|
-
}, 300);
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}, ze = function() {
|
|
112
|
-
if (m !== void 0) {
|
|
113
|
-
var t = -parseInt(document.body.style.top, 10), o = -parseInt(document.body.style.left, 10);
|
|
114
|
-
document.body.style.position = m.position, document.body.style.top = m.top, document.body.style.left = m.left, window.scrollTo(o, t), m = void 0;
|
|
86
|
+
o && i > 0 && (_ = document.body.style.paddingRight, document.body.style.paddingRight = i + "px");
|
|
115
87
|
}
|
|
116
|
-
|
|
88
|
+
w === void 0 && (w = document.body.style.overflow, document.body.style.overflow = "hidden");
|
|
89
|
+
}, xe = function() {
|
|
90
|
+
_ !== void 0 && (document.body.style.paddingRight = _, _ = void 0), w !== void 0 && (document.body.style.overflow = w, w = void 0);
|
|
91
|
+
}, Ee = function(t) {
|
|
117
92
|
return t ? t.scrollHeight - t.scrollTop <= t.clientHeight : !1;
|
|
118
|
-
},
|
|
119
|
-
var i = t.targetTouches[0].clientY -
|
|
120
|
-
return
|
|
121
|
-
},
|
|
93
|
+
}, Me = function(t, o) {
|
|
94
|
+
var i = t.targetTouches[0].clientY - J;
|
|
95
|
+
return Q(t.target) ? !1 : o && o.scrollTop === 0 && i > 0 || Ee(o) && i < 0 ? O(t) : (t.stopPropagation(), !0);
|
|
96
|
+
}, Ce = function(t, o) {
|
|
122
97
|
if (!t) {
|
|
123
98
|
console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");
|
|
124
99
|
return;
|
|
125
100
|
}
|
|
126
|
-
if (!
|
|
101
|
+
if (!m.some(function(n) {
|
|
127
102
|
return n.targetElement === t;
|
|
128
103
|
})) {
|
|
129
104
|
var i = {
|
|
130
105
|
targetElement: t,
|
|
131
106
|
options: o || {}
|
|
132
107
|
};
|
|
133
|
-
|
|
134
|
-
n.targetTouches.length === 1 && (
|
|
108
|
+
m = [].concat(_e(m), [i]), G ? (t.ontouchstart = function(n) {
|
|
109
|
+
n.targetTouches.length === 1 && (J = n.targetTouches[0].clientY);
|
|
135
110
|
}, t.ontouchmove = function(n) {
|
|
136
|
-
n.targetTouches.length === 1 &&
|
|
137
|
-
},
|
|
111
|
+
n.targetTouches.length === 1 && Me(n, t);
|
|
112
|
+
}, S || (document.addEventListener("touchmove", O, R ? { passive: !1 } : void 0), S = !0)) : ke(o);
|
|
138
113
|
}
|
|
139
|
-
},
|
|
114
|
+
}, ze = function(t) {
|
|
140
115
|
if (!t) {
|
|
141
116
|
console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");
|
|
142
117
|
return;
|
|
143
118
|
}
|
|
144
|
-
|
|
119
|
+
m = m.filter(function(o) {
|
|
145
120
|
return o.targetElement !== t;
|
|
146
|
-
}),
|
|
121
|
+
}), G ? (t.ontouchstart = null, t.ontouchmove = null, S && m.length === 0 && (document.removeEventListener("touchmove", O, R ? { passive: !1 } : void 0), S = !1)) : m.length || xe();
|
|
147
122
|
};
|
|
148
|
-
const
|
|
123
|
+
const A = {
|
|
149
124
|
xs: 16,
|
|
150
125
|
s: 20,
|
|
151
126
|
m: 24,
|
|
152
127
|
l: 28,
|
|
153
128
|
xl: 32,
|
|
154
129
|
xxl: 40
|
|
155
|
-
},
|
|
156
|
-
function
|
|
130
|
+
}, ee = Object.keys(A), te = "xs", oe = 8, D = 32;
|
|
131
|
+
function Se(e, t, o) {
|
|
157
132
|
const i = parseInt(e, 10), n = i % o === 0;
|
|
158
133
|
return i >= t && n;
|
|
159
134
|
}
|
|
160
|
-
const
|
|
161
|
-
large: (e) =>
|
|
162
|
-
regular: (e) =>
|
|
135
|
+
const ie = {
|
|
136
|
+
large: (e) => Se(e, D, oe),
|
|
137
|
+
regular: (e) => ee.includes(e)
|
|
163
138
|
};
|
|
164
|
-
function
|
|
165
|
-
const t =
|
|
166
|
-
return { isValid: t, size: t ? e :
|
|
139
|
+
function Oe(e) {
|
|
140
|
+
const t = ie.large(e);
|
|
141
|
+
return { isValid: t, size: t ? e : D };
|
|
167
142
|
}
|
|
168
|
-
function
|
|
169
|
-
const t =
|
|
143
|
+
function Ae(e) {
|
|
144
|
+
const t = ie.regular(e), o = t ? A[e] : A[te];
|
|
170
145
|
return { isValid: t, size: o };
|
|
171
146
|
}
|
|
172
|
-
const
|
|
147
|
+
const b = (e, t, o, i) => {
|
|
173
148
|
const n = e.endsWith("Large") || e.endsWith("-large");
|
|
174
149
|
let a, r;
|
|
175
150
|
if (o) {
|
|
176
|
-
if ({ isValid: a, size: r } = n ?
|
|
177
|
-
const
|
|
178
|
-
console.error(
|
|
151
|
+
if ({ isValid: a, size: r } = n ? Oe(o) : Ae(o), !a) {
|
|
152
|
+
const h = n ? `Invalid prop "size" value supplied to "${i}". The prop value should be a number equal or greater than ${D} and multiple of ${oe}.` : `Invalid prop "size" value supplied to "${i}". The prop value should be one of the following values: ${ee.join(", ")}.`;
|
|
153
|
+
console.error(h);
|
|
179
154
|
}
|
|
180
155
|
} else
|
|
181
|
-
r = n ?
|
|
156
|
+
r = n ? D : A[te];
|
|
182
157
|
return {
|
|
183
158
|
class: [e, t].filter(Boolean).join(" "),
|
|
184
159
|
width: r,
|
|
185
160
|
height: r
|
|
186
161
|
};
|
|
187
162
|
};
|
|
188
|
-
var
|
|
189
|
-
for (var n = i > 1 ? void 0 : i ?
|
|
163
|
+
var De = Object.defineProperty, Le = Object.getOwnPropertyDescriptor, j = (e, t, o, i) => {
|
|
164
|
+
for (var n = i > 1 ? void 0 : i ? Le(t, o) : t, a = e.length - 1, r; a >= 0; a--)
|
|
190
165
|
(r = e[a]) && (n = (i ? r(t, o, n) : r(n)) || n);
|
|
191
|
-
return i && n &&
|
|
166
|
+
return i && n && De(t, o, n), n;
|
|
192
167
|
};
|
|
193
|
-
const
|
|
194
|
-
let
|
|
168
|
+
const U = "icon-close";
|
|
169
|
+
let x = class extends L {
|
|
195
170
|
constructor() {
|
|
196
171
|
super(...arguments), this.size = "xs", this.class = "c-pieIcon c-pieIcon--close";
|
|
197
172
|
}
|
|
198
173
|
connectedCallback() {
|
|
199
174
|
var t, o, i;
|
|
200
175
|
if (super.connectedCallback(), ((t = this._svg) == null ? void 0 : t.getAttribute("width")) === null) {
|
|
201
|
-
const n =
|
|
176
|
+
const n = b("c-pieIcon c-pieIcon--close", "", null, "IconClose");
|
|
202
177
|
(o = this._svg) == null || o.setAttribute("width", n.width), (i = this._svg) == null || i.setAttribute("height", n.height);
|
|
203
178
|
}
|
|
204
179
|
}
|
|
205
180
|
updated(t) {
|
|
206
181
|
var o, i;
|
|
207
182
|
let n;
|
|
208
|
-
t.has("size") && (n =
|
|
183
|
+
t.has("size") && (n = b("c-pieIcon c-pieIcon--close", "", this.size, "IconClose"), (o = this._svg) == null || o.setAttribute("width", n.width), (i = this._svg) == null || i.setAttribute("height", n.height));
|
|
209
184
|
}
|
|
210
185
|
render() {
|
|
211
|
-
return
|
|
186
|
+
return F`<svg xmlns="http://www.w3.org/2000/svg" role="presentation" focusable="false" fill="currentColor" viewBox="0 0 16 16" class="c-pieIcon c-pieIcon--close"><path d="M11.868 3.205 8 7.072 4.133 3.205l-.928.927L7.073 8l-3.868 3.867.928.928L8 8.927l3.868 3.868.927-.928L8.928 8l3.867-3.868-.927-.927Z"></path></svg>`;
|
|
212
187
|
}
|
|
213
188
|
};
|
|
214
|
-
|
|
189
|
+
x.styles = B`
|
|
215
190
|
:host-context(pie-icon-button) svg,
|
|
216
191
|
:host-context(pie-button) svg {
|
|
217
192
|
display: block;
|
|
@@ -219,43 +194,43 @@ E.styles = N`
|
|
|
219
194
|
height: var(--btn-icon-size);
|
|
220
195
|
}
|
|
221
196
|
`;
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
],
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
],
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
],
|
|
231
|
-
customElements.get(
|
|
232
|
-
var
|
|
233
|
-
for (var n = i > 1 ? void 0 : i ?
|
|
197
|
+
j([
|
|
198
|
+
s({ type: String, reflect: !0 })
|
|
199
|
+
], x.prototype, "size", 2);
|
|
200
|
+
j([
|
|
201
|
+
s({ type: String, reflect: !0 })
|
|
202
|
+
], x.prototype, "class", 2);
|
|
203
|
+
j([
|
|
204
|
+
I("svg")
|
|
205
|
+
], x.prototype, "_svg", 2);
|
|
206
|
+
customElements.get(U) === void 0 && customElements.define(U, x);
|
|
207
|
+
var Ie = Object.defineProperty, $e = Object.getOwnPropertyDescriptor, H = (e, t, o, i) => {
|
|
208
|
+
for (var n = i > 1 ? void 0 : i ? $e(t, o) : t, a = e.length - 1, r; a >= 0; a--)
|
|
234
209
|
(r = e[a]) && (n = (i ? r(t, o, n) : r(n)) || n);
|
|
235
|
-
return i && n &&
|
|
210
|
+
return i && n && Ie(t, o, n), n;
|
|
236
211
|
};
|
|
237
|
-
const
|
|
238
|
-
class
|
|
212
|
+
const Y = "icon-chevron-left";
|
|
213
|
+
class E extends L {
|
|
239
214
|
constructor() {
|
|
240
215
|
super(...arguments), this.size = "xs", this.class = "c-pieIcon c-pieIcon--chevronLeft";
|
|
241
216
|
}
|
|
242
217
|
connectedCallback() {
|
|
243
218
|
var t, o, i;
|
|
244
219
|
if (super.connectedCallback(), ((t = this._svg) == null ? void 0 : t.getAttribute("width")) === null) {
|
|
245
|
-
const n =
|
|
220
|
+
const n = b("c-pieIcon c-pieIcon--chevronLeft", "", null, "IconChevronLeft");
|
|
246
221
|
(o = this._svg) == null || o.setAttribute("width", n.width), (i = this._svg) == null || i.setAttribute("height", n.height);
|
|
247
222
|
}
|
|
248
223
|
}
|
|
249
224
|
updated(t) {
|
|
250
225
|
var o, i;
|
|
251
226
|
let n;
|
|
252
|
-
t.has("size") && (n =
|
|
227
|
+
t.has("size") && (n = b("c-pieIcon c-pieIcon--chevronLeft", "", this.size, "IconChevronLeft"), (o = this._svg) == null || o.setAttribute("width", n.width), (i = this._svg) == null || i.setAttribute("height", n.height));
|
|
253
228
|
}
|
|
254
229
|
render() {
|
|
255
|
-
return
|
|
230
|
+
return F`<svg xmlns="http://www.w3.org/2000/svg" role="presentation" focusable="false" fill="currentColor" viewBox="0 0 16 16" class="c-pieIcon c-pieIcon--chevronLeft"><path d="M10.96 2.82 5.605 8l5.399 5.197-.875.963-5.565-5.364a1.164 1.164 0 0 1 0-1.671l5.495-5.25.901.945Z"></path></svg>`;
|
|
256
231
|
}
|
|
257
232
|
}
|
|
258
|
-
|
|
233
|
+
E.styles = B`
|
|
259
234
|
:host-context(pie-icon-button) svg,
|
|
260
235
|
:host-context(pie-button) svg {
|
|
261
236
|
display: block;
|
|
@@ -263,43 +238,43 @@ M.styles = N`
|
|
|
263
238
|
height: var(--btn-icon-size);
|
|
264
239
|
}
|
|
265
240
|
`;
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
],
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
],
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
],
|
|
275
|
-
customElements.get(
|
|
276
|
-
var
|
|
277
|
-
for (var n = i > 1 ? void 0 : i ?
|
|
241
|
+
H([
|
|
242
|
+
s({ type: String, reflect: !0 })
|
|
243
|
+
], E.prototype, "size", 2);
|
|
244
|
+
H([
|
|
245
|
+
s({ type: String, reflect: !0 })
|
|
246
|
+
], E.prototype, "class", 2);
|
|
247
|
+
H([
|
|
248
|
+
I("svg")
|
|
249
|
+
], E.prototype, "_svg", 2);
|
|
250
|
+
customElements.get(Y) === void 0 && customElements.define(Y, E);
|
|
251
|
+
var Pe = Object.defineProperty, Te = Object.getOwnPropertyDescriptor, V = (e, t, o, i) => {
|
|
252
|
+
for (var n = i > 1 ? void 0 : i ? Te(t, o) : t, a = e.length - 1, r; a >= 0; a--)
|
|
278
253
|
(r = e[a]) && (n = (i ? r(t, o, n) : r(n)) || n);
|
|
279
|
-
return i && n &&
|
|
254
|
+
return i && n && Pe(t, o, n), n;
|
|
280
255
|
};
|
|
281
|
-
const
|
|
282
|
-
class
|
|
256
|
+
const K = "icon-chevron-right";
|
|
257
|
+
class M extends L {
|
|
283
258
|
constructor() {
|
|
284
259
|
super(...arguments), this.size = "xs", this.class = "c-pieIcon c-pieIcon--chevronRight";
|
|
285
260
|
}
|
|
286
261
|
connectedCallback() {
|
|
287
262
|
var t, o, i;
|
|
288
263
|
if (super.connectedCallback(), ((t = this._svg) == null ? void 0 : t.getAttribute("width")) === null) {
|
|
289
|
-
const n =
|
|
264
|
+
const n = b("c-pieIcon c-pieIcon--chevronRight", "", null, "IconChevronRight");
|
|
290
265
|
(o = this._svg) == null || o.setAttribute("width", n.width), (i = this._svg) == null || i.setAttribute("height", n.height);
|
|
291
266
|
}
|
|
292
267
|
}
|
|
293
268
|
updated(t) {
|
|
294
269
|
var o, i;
|
|
295
270
|
let n;
|
|
296
|
-
t.has("size") && (n =
|
|
271
|
+
t.has("size") && (n = b("c-pieIcon c-pieIcon--chevronRight", "", this.size, "IconChevronRight"), (o = this._svg) == null || o.setAttribute("width", n.width), (i = this._svg) == null || i.setAttribute("height", n.height));
|
|
297
272
|
}
|
|
298
273
|
render() {
|
|
299
|
-
return
|
|
274
|
+
return F`<svg xmlns="http://www.w3.org/2000/svg" role="presentation" focusable="false" fill="currentColor" viewBox="0 0 16 16" class="c-pieIcon c-pieIcon--chevronRight"><path d="M5.044 13.18 10.399 8 5 2.82l.875-.962 5.539 5.346a1.164 1.164 0 0 1 0 1.636l-5.469 5.285-.901-.945Z"></path></svg>`;
|
|
300
275
|
}
|
|
301
276
|
}
|
|
302
|
-
|
|
277
|
+
M.styles = B`
|
|
303
278
|
:host-context(pie-icon-button) svg,
|
|
304
279
|
:host-context(pie-button) svg {
|
|
305
280
|
display: block;
|
|
@@ -307,27 +282,27 @@ z.styles = N`
|
|
|
307
282
|
height: var(--btn-icon-size);
|
|
308
283
|
}
|
|
309
284
|
`;
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
],
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
],
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
],
|
|
319
|
-
customElements.get(
|
|
320
|
-
var
|
|
321
|
-
(!
|
|
285
|
+
V([
|
|
286
|
+
s({ type: String, reflect: !0 })
|
|
287
|
+
], M.prototype, "size", 2);
|
|
288
|
+
V([
|
|
289
|
+
s({ type: String, reflect: !0 })
|
|
290
|
+
], M.prototype, "class", 2);
|
|
291
|
+
V([
|
|
292
|
+
I("svg")
|
|
293
|
+
], M.prototype, "_svg", 2);
|
|
294
|
+
customElements.get(K) === void 0 && customElements.define(K, M);
|
|
295
|
+
var v = window.CustomEvent;
|
|
296
|
+
(!v || typeof v == "object") && (v = function(t, o) {
|
|
322
297
|
o = o || {};
|
|
323
298
|
var i = document.createEvent("CustomEvent");
|
|
324
299
|
return i.initCustomEvent(t, !!o.bubbles, !!o.cancelable, o.detail || null), i;
|
|
325
|
-
},
|
|
326
|
-
function
|
|
300
|
+
}, v.prototype = window.Event.prototype);
|
|
301
|
+
function ne(e, t) {
|
|
327
302
|
var o = "on" + t.type.toLowerCase();
|
|
328
303
|
return typeof e[o] == "function" && e[o](t), e.dispatchEvent(t);
|
|
329
304
|
}
|
|
330
|
-
function
|
|
305
|
+
function Be(e) {
|
|
331
306
|
for (; e && e !== document.body; ) {
|
|
332
307
|
var t = window.getComputedStyle(e), o = function(i, n) {
|
|
333
308
|
return !(t[i] === void 0 || t[i] === n);
|
|
@@ -338,7 +313,7 @@ function Re(e) {
|
|
|
338
313
|
}
|
|
339
314
|
return !1;
|
|
340
315
|
}
|
|
341
|
-
function
|
|
316
|
+
function k(e) {
|
|
342
317
|
for (; e; ) {
|
|
343
318
|
if (e.localName === "dialog")
|
|
344
319
|
return (
|
|
@@ -349,32 +324,32 @@ function x(e) {
|
|
|
349
324
|
}
|
|
350
325
|
return null;
|
|
351
326
|
}
|
|
352
|
-
function
|
|
327
|
+
function ae(e) {
|
|
353
328
|
for (; e && e.shadowRoot && e.shadowRoot.activeElement; )
|
|
354
329
|
e = e.shadowRoot.activeElement;
|
|
355
330
|
e && e.blur && e !== document.body && e.blur();
|
|
356
331
|
}
|
|
357
|
-
function
|
|
332
|
+
function Fe(e, t) {
|
|
358
333
|
for (var o = 0; o < e.length; ++o)
|
|
359
334
|
if (e[o] === t)
|
|
360
335
|
return !0;
|
|
361
336
|
return !1;
|
|
362
337
|
}
|
|
363
|
-
function
|
|
338
|
+
function $(e) {
|
|
364
339
|
return !e || !e.hasAttribute("method") ? !1 : e.getAttribute("method").toLowerCase() === "dialog";
|
|
365
340
|
}
|
|
366
|
-
function
|
|
341
|
+
function re(e) {
|
|
367
342
|
var t = ["button", "input", "keygen", "select", "textarea"], o = t.map(function(r) {
|
|
368
343
|
return r + ":not([disabled])";
|
|
369
344
|
});
|
|
370
345
|
o.push('[tabindex]:not([disabled]):not([tabindex=""])');
|
|
371
346
|
var i = e.querySelector(o.join(", "));
|
|
372
347
|
if (!i && "attachShadow" in Element.prototype)
|
|
373
|
-
for (var n = e.querySelectorAll("*"), a = 0; a < n.length && !(n[a].tagName && n[a].shadowRoot && (i =
|
|
348
|
+
for (var n = e.querySelectorAll("*"), a = 0; a < n.length && !(n[a].tagName && n[a].shadowRoot && (i = re(n[a].shadowRoot), i)); a++)
|
|
374
349
|
;
|
|
375
350
|
return i;
|
|
376
351
|
}
|
|
377
|
-
function
|
|
352
|
+
function X(e) {
|
|
378
353
|
return e.isConnected || document.body.contains(e);
|
|
379
354
|
}
|
|
380
355
|
function le(e) {
|
|
@@ -383,29 +358,29 @@ function le(e) {
|
|
|
383
358
|
var t = e.target;
|
|
384
359
|
if (!(t instanceof HTMLFormElement))
|
|
385
360
|
return null;
|
|
386
|
-
var o =
|
|
361
|
+
var o = l.formSubmitter;
|
|
387
362
|
if (!o) {
|
|
388
363
|
var i = e.target, n = "getRootNode" in i && i.getRootNode() || document;
|
|
389
364
|
o = n.activeElement;
|
|
390
365
|
}
|
|
391
366
|
return !o || o.form !== t ? null : o;
|
|
392
367
|
}
|
|
393
|
-
function
|
|
368
|
+
function Ne(e) {
|
|
394
369
|
if (!e.defaultPrevented) {
|
|
395
370
|
var t = (
|
|
396
371
|
/** @type {!HTMLFormElement} */
|
|
397
372
|
e.target
|
|
398
|
-
), o =
|
|
373
|
+
), o = l.imagemapUseValue, i = le(e);
|
|
399
374
|
o === null && i && (o = i.value);
|
|
400
|
-
var n =
|
|
375
|
+
var n = k(t);
|
|
401
376
|
if (n) {
|
|
402
377
|
var a = i && i.getAttribute("formmethod") || t.getAttribute("method");
|
|
403
378
|
a === "dialog" && (e.preventDefault(), o != null ? n.close(o) : n.close());
|
|
404
379
|
}
|
|
405
380
|
}
|
|
406
381
|
}
|
|
407
|
-
function
|
|
408
|
-
if (this.dialog_ = e, this.replacedStyleTop_ = !1, this.openAsModal_ = !1, e.hasAttribute("role") || e.setAttribute("role", "dialog"), e.show = this.show.bind(this), e.showModal = this.showModal.bind(this), e.close = this.close.bind(this), e.addEventListener("submit",
|
|
382
|
+
function se(e) {
|
|
383
|
+
if (this.dialog_ = e, this.replacedStyleTop_ = !1, this.openAsModal_ = !1, e.hasAttribute("role") || e.setAttribute("role", "dialog"), e.show = this.show.bind(this), e.showModal = this.showModal.bind(this), e.close = this.close.bind(this), e.addEventListener("submit", Ne, !1), "returnValue" in e || (e.returnValue = ""), "MutationObserver" in window) {
|
|
409
384
|
var t = new MutationObserver(this.maybeHideModal.bind(this));
|
|
410
385
|
t.observe(e, { attributes: !0, attributeFilter: ["open"] });
|
|
411
386
|
} else {
|
|
@@ -413,8 +388,8 @@ function de(e) {
|
|
|
413
388
|
o ? this.downgradeModal() : this.maybeHideModal(), o = !1;
|
|
414
389
|
}.bind(this), n, a = function(r) {
|
|
415
390
|
if (r.target === e) {
|
|
416
|
-
var
|
|
417
|
-
o |= r.type.substr(0,
|
|
391
|
+
var h = "DOMNodeRemoved";
|
|
392
|
+
o |= r.type.substr(0, h.length) === h, window.clearTimeout(n), n = window.setTimeout(i, 0);
|
|
418
393
|
}
|
|
419
394
|
};
|
|
420
395
|
["DOMAttrModified", "DOMNodeRemoved", "DOMNodeRemovedFromDocument"].forEach(function(r) {
|
|
@@ -426,7 +401,7 @@ function de(e) {
|
|
|
426
401
|
get: e.hasAttribute.bind(e, "open")
|
|
427
402
|
}), this.backdrop_ = document.createElement("div"), this.backdrop_.className = "backdrop", this.backdrop_.addEventListener("mouseup", this.backdropMouseEvent_.bind(this)), this.backdrop_.addEventListener("mousedown", this.backdropMouseEvent_.bind(this)), this.backdrop_.addEventListener("click", this.backdropMouseEvent_.bind(this));
|
|
428
403
|
}
|
|
429
|
-
|
|
404
|
+
se.prototype = /** @type {HTMLDialogElement.prototype} */
|
|
430
405
|
{
|
|
431
406
|
get dialog() {
|
|
432
407
|
return this.dialog_;
|
|
@@ -437,13 +412,13 @@ de.prototype = /** @type {HTMLDialogElement.prototype} */
|
|
|
437
412
|
* longer open or is no longer part of the DOM.
|
|
438
413
|
*/
|
|
439
414
|
maybeHideModal: function() {
|
|
440
|
-
this.dialog_.hasAttribute("open") &&
|
|
415
|
+
this.dialog_.hasAttribute("open") && X(this.dialog_) || this.downgradeModal();
|
|
441
416
|
},
|
|
442
417
|
/**
|
|
443
418
|
* Remove this dialog from the modal top layer, leaving it as a non-modal.
|
|
444
419
|
*/
|
|
445
420
|
downgradeModal: function() {
|
|
446
|
-
this.openAsModal_ && (this.openAsModal_ = !1, this.dialog_.style.zIndex = "", this.replacedStyleTop_ && (this.dialog_.style.top = "", this.replacedStyleTop_ = !1), this.backdrop_.parentNode && this.backdrop_.parentNode.removeChild(this.backdrop_),
|
|
421
|
+
this.openAsModal_ && (this.openAsModal_ = !1, this.dialog_.style.zIndex = "", this.replacedStyleTop_ && (this.dialog_.style.top = "", this.replacedStyleTop_ = !1), this.backdrop_.parentNode && this.backdrop_.parentNode.removeChild(this.backdrop_), l.dm.removeDialog(this));
|
|
447
422
|
},
|
|
448
423
|
/**
|
|
449
424
|
* @param {boolean} value whether to open or close this dialog
|
|
@@ -489,7 +464,7 @@ de.prototype = /** @type {HTMLDialogElement.prototype} */
|
|
|
489
464
|
*/
|
|
490
465
|
focus_: function() {
|
|
491
466
|
var e = this.dialog_.querySelector("[autofocus]:not([disabled])");
|
|
492
|
-
!e && this.dialog_.tabIndex >= 0 && (e = this.dialog_), e || (e =
|
|
467
|
+
!e && this.dialog_.tabIndex >= 0 && (e = this.dialog_), e || (e = re(this.dialog_)), ae(document.activeElement), e && e.focus();
|
|
493
468
|
},
|
|
494
469
|
/**
|
|
495
470
|
* Sets the zIndex for the backdrop and dialog.
|
|
@@ -514,11 +489,11 @@ de.prototype = /** @type {HTMLDialogElement.prototype} */
|
|
|
514
489
|
showModal: function() {
|
|
515
490
|
if (this.dialog_.hasAttribute("open"))
|
|
516
491
|
throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");
|
|
517
|
-
if (!
|
|
492
|
+
if (!X(this.dialog_))
|
|
518
493
|
throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");
|
|
519
|
-
if (!
|
|
494
|
+
if (!l.dm.pushDialog(this))
|
|
520
495
|
throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");
|
|
521
|
-
|
|
496
|
+
Be(this.dialog_.parentElement) && console.warn("A dialog is being shown inside a stacking context. This may cause it to be unusable. For more information, see this link: https://github.com/GoogleChrome/dialog-polyfill/#stacking-context"), this.setOpen(!0), this.openAsModal_ = !0, l.needsCentering(this.dialog_) ? (l.reposition(this.dialog_), this.replacedStyleTop_ = !0) : this.replacedStyleTop_ = !1, this.dialog_.parentNode.insertBefore(this.backdrop_, this.dialog_.nextSibling), this.focus_();
|
|
522
497
|
},
|
|
523
498
|
/**
|
|
524
499
|
* Closes this HTMLDialogElement. This is optional vs clearing the open
|
|
@@ -530,19 +505,19 @@ de.prototype = /** @type {HTMLDialogElement.prototype} */
|
|
|
530
505
|
if (!this.dialog_.hasAttribute("open"))
|
|
531
506
|
throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");
|
|
532
507
|
this.setOpen(!1), e !== void 0 && (this.dialog_.returnValue = e);
|
|
533
|
-
var t = new
|
|
508
|
+
var t = new v("close", {
|
|
534
509
|
bubbles: !1,
|
|
535
510
|
cancelable: !1
|
|
536
511
|
});
|
|
537
|
-
|
|
512
|
+
ne(this.dialog_, t);
|
|
538
513
|
}
|
|
539
514
|
};
|
|
540
|
-
var
|
|
541
|
-
|
|
515
|
+
var l = {};
|
|
516
|
+
l.reposition = function(e) {
|
|
542
517
|
var t = document.body.scrollTop || document.documentElement.scrollTop, o = t + (window.innerHeight - e.offsetHeight) / 2;
|
|
543
518
|
e.style.top = Math.max(t, o) + "px";
|
|
544
519
|
};
|
|
545
|
-
|
|
520
|
+
l.isInlinePositionSetByStylesheet = function(e) {
|
|
546
521
|
for (var t = 0; t < document.styleSheets.length; ++t) {
|
|
547
522
|
var o = document.styleSheets[t], i = null;
|
|
548
523
|
try {
|
|
@@ -556,31 +531,31 @@ s.isInlinePositionSetByStylesheet = function(e) {
|
|
|
556
531
|
r = document.querySelectorAll(a.selectorText);
|
|
557
532
|
} catch {
|
|
558
533
|
}
|
|
559
|
-
if (!(!r || !
|
|
560
|
-
var
|
|
561
|
-
if (
|
|
534
|
+
if (!(!r || !Fe(r, e))) {
|
|
535
|
+
var h = a.style.getPropertyValue("top"), p = a.style.getPropertyValue("bottom");
|
|
536
|
+
if (h && h !== "auto" || p && p !== "auto")
|
|
562
537
|
return !0;
|
|
563
538
|
}
|
|
564
539
|
}
|
|
565
540
|
}
|
|
566
541
|
return !1;
|
|
567
542
|
};
|
|
568
|
-
|
|
543
|
+
l.needsCentering = function(e) {
|
|
569
544
|
var t = window.getComputedStyle(e);
|
|
570
|
-
return t.position !== "absolute" || e.style.top !== "auto" && e.style.top !== "" || e.style.bottom !== "auto" && e.style.bottom !== "" ? !1 : !
|
|
545
|
+
return t.position !== "absolute" || e.style.top !== "auto" && e.style.top !== "" || e.style.bottom !== "auto" && e.style.bottom !== "" ? !1 : !l.isInlinePositionSetByStylesheet(e);
|
|
571
546
|
};
|
|
572
|
-
|
|
547
|
+
l.forceRegisterDialog = function(e) {
|
|
573
548
|
if ((window.HTMLDialogElement || e.showModal) && console.warn("This browser already supports <dialog>, the polyfill may not work correctly", e), e.localName !== "dialog")
|
|
574
549
|
throw new Error("Failed to register dialog: The element is not a dialog.");
|
|
575
|
-
new
|
|
550
|
+
new se(
|
|
576
551
|
/** @type {!HTMLDialogElement} */
|
|
577
552
|
e
|
|
578
553
|
);
|
|
579
554
|
};
|
|
580
|
-
|
|
581
|
-
e.showModal ||
|
|
555
|
+
l.registerDialog = function(e) {
|
|
556
|
+
e.showModal || l.forceRegisterDialog(e);
|
|
582
557
|
};
|
|
583
|
-
|
|
558
|
+
l.DialogManager = function() {
|
|
584
559
|
this.pendingDialogStack = [];
|
|
585
560
|
var e = this.checkDOM_.bind(this);
|
|
586
561
|
this.overlay = document.createElement("div"), this.overlay.className = "_dialog_overlay", this.overlay.addEventListener("click", function(t) {
|
|
@@ -598,13 +573,13 @@ s.DialogManager = function() {
|
|
|
598
573
|
}), o.length && e(o);
|
|
599
574
|
}));
|
|
600
575
|
};
|
|
601
|
-
|
|
576
|
+
l.DialogManager.prototype.blockDocument = function() {
|
|
602
577
|
document.documentElement.addEventListener("focus", this.handleFocus_, !0), document.addEventListener("keydown", this.handleKey_), this.mo_ && this.mo_.observe(document, { childList: !0, subtree: !0 });
|
|
603
578
|
};
|
|
604
|
-
|
|
579
|
+
l.DialogManager.prototype.unblockDocument = function() {
|
|
605
580
|
document.documentElement.removeEventListener("focus", this.handleFocus_, !0), document.removeEventListener("keydown", this.handleKey_), this.mo_ && this.mo_.disconnect();
|
|
606
581
|
};
|
|
607
|
-
|
|
582
|
+
l.DialogManager.prototype.updateStacking = function() {
|
|
608
583
|
for (var e = this.zIndexHigh_, t = 0, o; o = this.pendingDialogStack[t]; ++t)
|
|
609
584
|
o.updateZIndex(--e, --e), t === 0 && (this.overlay.style.zIndex = --e);
|
|
610
585
|
var i = this.pendingDialogStack[0];
|
|
@@ -614,8 +589,8 @@ s.DialogManager.prototype.updateStacking = function() {
|
|
|
614
589
|
} else
|
|
615
590
|
this.overlay.parentNode && this.overlay.parentNode.removeChild(this.overlay);
|
|
616
591
|
};
|
|
617
|
-
|
|
618
|
-
for (; e =
|
|
592
|
+
l.DialogManager.prototype.containedByTopDialog_ = function(e) {
|
|
593
|
+
for (; e = k(e); ) {
|
|
619
594
|
for (var t = 0, o; o = this.pendingDialogStack[t]; ++t)
|
|
620
595
|
if (o.dialog === e)
|
|
621
596
|
return t === 0;
|
|
@@ -623,9 +598,9 @@ s.DialogManager.prototype.containedByTopDialog_ = function(e) {
|
|
|
623
598
|
}
|
|
624
599
|
return !1;
|
|
625
600
|
};
|
|
626
|
-
|
|
601
|
+
l.DialogManager.prototype.handleFocus_ = function(e) {
|
|
627
602
|
var t = e.composedPath ? e.composedPath()[0] : e.target;
|
|
628
|
-
if (!this.containedByTopDialog_(t) && document.activeElement !== document.documentElement && (e.preventDefault(), e.stopPropagation(),
|
|
603
|
+
if (!this.containedByTopDialog_(t) && document.activeElement !== document.documentElement && (e.preventDefault(), e.stopPropagation(), ae(
|
|
629
604
|
/** @type {Element} */
|
|
630
605
|
t
|
|
631
606
|
), this.forwardTab_ !== void 0)) {
|
|
@@ -633,51 +608,51 @@ s.DialogManager.prototype.handleFocus_ = function(e) {
|
|
|
633
608
|
return n & Node.DOCUMENT_POSITION_PRECEDING && (this.forwardTab_ ? o.focus_() : t !== document.documentElement && document.documentElement.focus()), !1;
|
|
634
609
|
}
|
|
635
610
|
};
|
|
636
|
-
|
|
611
|
+
l.DialogManager.prototype.handleKey_ = function(e) {
|
|
637
612
|
if (this.forwardTab_ = void 0, e.keyCode === 27) {
|
|
638
613
|
e.preventDefault(), e.stopPropagation();
|
|
639
|
-
var t = new
|
|
614
|
+
var t = new v("cancel", {
|
|
640
615
|
bubbles: !1,
|
|
641
616
|
cancelable: !0
|
|
642
617
|
}), o = this.pendingDialogStack[0];
|
|
643
|
-
o &&
|
|
618
|
+
o && ne(o.dialog, t) && o.dialog.close();
|
|
644
619
|
} else
|
|
645
620
|
e.keyCode === 9 && (this.forwardTab_ = !e.shiftKey);
|
|
646
621
|
};
|
|
647
|
-
|
|
622
|
+
l.DialogManager.prototype.checkDOM_ = function(e) {
|
|
648
623
|
var t = this.pendingDialogStack.slice();
|
|
649
624
|
t.forEach(function(o) {
|
|
650
625
|
e.indexOf(o.dialog) !== -1 ? o.downgradeModal() : o.maybeHideModal();
|
|
651
626
|
});
|
|
652
627
|
};
|
|
653
|
-
|
|
628
|
+
l.DialogManager.prototype.pushDialog = function(e) {
|
|
654
629
|
var t = (this.zIndexHigh_ - this.zIndexLow_) / 2 - 1;
|
|
655
630
|
return this.pendingDialogStack.length >= t ? !1 : (this.pendingDialogStack.unshift(e) === 1 && this.blockDocument(), this.updateStacking(), !0);
|
|
656
631
|
};
|
|
657
|
-
|
|
632
|
+
l.DialogManager.prototype.removeDialog = function(e) {
|
|
658
633
|
var t = this.pendingDialogStack.indexOf(e);
|
|
659
634
|
t !== -1 && (this.pendingDialogStack.splice(t, 1), this.pendingDialogStack.length === 0 && this.unblockDocument(), this.updateStacking());
|
|
660
635
|
};
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
636
|
+
l.dm = new l.DialogManager();
|
|
637
|
+
l.formSubmitter = null;
|
|
638
|
+
l.imagemapUseValue = null;
|
|
664
639
|
if (window.HTMLDialogElement === void 0) {
|
|
665
|
-
var
|
|
666
|
-
if (
|
|
667
|
-
var
|
|
668
|
-
if (
|
|
669
|
-
var
|
|
670
|
-
|
|
671
|
-
return
|
|
640
|
+
var Z = document.createElement("form");
|
|
641
|
+
if (Z.setAttribute("method", "dialog"), Z.method !== "dialog") {
|
|
642
|
+
var f = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "method");
|
|
643
|
+
if (f) {
|
|
644
|
+
var Re = f.get;
|
|
645
|
+
f.get = function() {
|
|
646
|
+
return $(this) ? "dialog" : Re.call(this);
|
|
672
647
|
};
|
|
673
|
-
var
|
|
674
|
-
|
|
675
|
-
return typeof e == "string" && e.toLowerCase() === "dialog" ? this.setAttribute("method", e) :
|
|
676
|
-
}, Object.defineProperty(HTMLFormElement.prototype, "method",
|
|
648
|
+
var je = f.set;
|
|
649
|
+
f.set = function(e) {
|
|
650
|
+
return typeof e == "string" && e.toLowerCase() === "dialog" ? this.setAttribute("method", e) : je.call(this, e);
|
|
651
|
+
}, Object.defineProperty(HTMLFormElement.prototype, "method", f);
|
|
677
652
|
}
|
|
678
653
|
}
|
|
679
654
|
document.addEventListener("click", function(e) {
|
|
680
|
-
if (
|
|
655
|
+
if (l.formSubmitter = null, l.imagemapUseValue = null, !e.defaultPrevented) {
|
|
681
656
|
var t = (
|
|
682
657
|
/** @type {Element} */
|
|
683
658
|
e.target
|
|
@@ -686,41 +661,41 @@ if (window.HTMLDialogElement === void 0) {
|
|
|
686
661
|
var o = e.composedPath();
|
|
687
662
|
t = o.shift() || t;
|
|
688
663
|
}
|
|
689
|
-
if (!(!t ||
|
|
664
|
+
if (!(!t || !$(t.form))) {
|
|
690
665
|
var i = t.type === "submit" && ["button", "input"].indexOf(t.localName) > -1;
|
|
691
666
|
if (!i) {
|
|
692
667
|
if (!(t.localName === "input" && t.type === "image"))
|
|
693
668
|
return;
|
|
694
|
-
|
|
669
|
+
l.imagemapUseValue = e.offsetX + "," + e.offsetY;
|
|
695
670
|
}
|
|
696
|
-
var n =
|
|
697
|
-
n && (
|
|
671
|
+
var n = k(t);
|
|
672
|
+
n && (l.formSubmitter = t);
|
|
698
673
|
}
|
|
699
674
|
}
|
|
700
675
|
}, !1), document.addEventListener("submit", function(e) {
|
|
701
|
-
var t = e.target, o =
|
|
676
|
+
var t = e.target, o = k(t);
|
|
702
677
|
if (!o) {
|
|
703
678
|
var i = le(e), n = i && i.getAttribute("formmethod") || t.getAttribute("method");
|
|
704
679
|
n === "dialog" && e.preventDefault();
|
|
705
680
|
}
|
|
706
681
|
});
|
|
707
|
-
var
|
|
708
|
-
if (
|
|
709
|
-
return
|
|
710
|
-
var e =
|
|
682
|
+
var He = HTMLFormElement.prototype.submit, Ve = function() {
|
|
683
|
+
if (!$(this))
|
|
684
|
+
return He.call(this);
|
|
685
|
+
var e = k(this);
|
|
711
686
|
e && e.close();
|
|
712
687
|
};
|
|
713
|
-
HTMLFormElement.prototype.submit =
|
|
688
|
+
HTMLFormElement.prototype.submit = Ve;
|
|
714
689
|
}
|
|
715
|
-
const
|
|
716
|
-
`,
|
|
717
|
-
var
|
|
718
|
-
for (var n = i > 1 ? void 0 : i ?
|
|
690
|
+
const qe = `dialog{position:absolute;left:0;right:0;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;height:-moz-fit-content;height:-webkit-fit-content;height:fit-content;margin:auto;border:solid;padding:1em;background:white;color:#000;display:block}dialog:not([open]){display:none}dialog+.backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:rgba(0,0,0,.1)}._dialog_overlay{position:fixed;top:0;right:0;bottom:0;left:0}dialog.fixed{position:fixed;top:50%;transform:translateY(-50%)}*,*:before,*:after{box-sizing:border-box}@keyframes rotate360{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.c-modal{--modal-size-s: 450px;--modal-size-m: 600px;--modal-size-l: 1080px;--modal-border-radius: var(--dt-radius-rounded-d);--modal-font: var(--dt-font-interactive-m-family);--modal-bg-color: var(--dt-color-container-default);--modal-elevation: var(--dt-elevation-04);text-rendering:optimizelegibility;-webkit-font-smoothing:antialiased;-moz-font-smoothing:antialiased;border-radius:var(--modal-border-radius);border:none;box-shadow:var(--modal-elevation);font-family:var(--modal-font);background-color:var(--modal-bg-color);padding:0;--modal-margin-none: var(--dt-spacing-none);--modal-margin-small: var(--dt-spacing-g);--modal-margin-large: var(--dt-spacing-j);--modal-margin-block: var(--modal-margin-small);--modal-block-size: fit-content;--modal-inline-size: 75%;--modal-max-block-size: calc(100vh - calc(var(--modal-margin-block) * 2));--modal-max-inline-size: var(--modal-size-m);block-size:var(--modal-block-size);inline-size:var(--modal-inline-size);max-block-size:var(--modal-max-block-size);max-inline-size:var(--modal-max-inline-size)}.c-modal:focus-visible{outline:none}@media (max-width: 768px){.c-modal pie-icon-button{--btn-dimension: 40px}}.c-modal[open]{display:flex;flex-direction:column}@media (min-width: 768px){.c-modal{--modal-margin-block: var(--modal-margin-large)}}.c-modal[size=small]{--modal-max-inline-size: var(--modal-size-s)}@media (min-width: 768px){.c-modal[size=small]{--modal-margin-block: var(--modal-margin-large)}}@media (max-width: 767px){.c-modal[size=medium][isfullwidthbelowmid]{--modal-margin-block: var(--modal-margin-none);--modal-border-radius: var(--dt-radius-rounded-none);--modal-block-size: 100%;--modal-inline-size: 100%;--modal-max-inline-size: 100%}}.c-modal[size=large]{--modal-inline-size: 75%;--modal-max-inline-size: var(--modal-size-l);--modal-margin-block: var(--modal-margin-large)}@media (max-width: 767px){.c-modal[size=large]{--modal-margin-block: var(--modal-margin-none);--modal-border-radius: var(--dt-radius-rounded-none);--modal-block-size: 100%;--modal-inline-size: 100%}}.c-modal[position=top]{margin-block-start:var(--dt-spacing-j)}@media (max-width: 767px){.c-modal[position=top][isfullwidthbelowmid]{margin-block-start:var(--dt-spacing-none)}}.c-modal::backdrop{background:rgba(0,0,0,.5)}.c-modal .c-modal-footer{--modal-button-spacing: var(--dt-spacing-d);--modal-footer-padding: var(--dt-spacing-d);display:flex;flex-flow:row-reverse;flex-wrap:wrap;gap:var(--modal-button-spacing);padding:var(--modal-footer-padding)}@media (min-width: 768px){.c-modal .c-modal-footer{--modal-footer-padding: var(--dt-spacing-e)}}@media (max-width: 767px){.c-modal[hasstackedactions] .c-modal-footer{flex-direction:column}}.c-modal .c-modal-header{padding-inline:var(--dt-spacing-d);padding-block:14px;display:grid;grid-template-areas:"back heading close" ". heading .";grid-template-columns:minmax(0,max-content) minmax(0,1fr) minmax(0,max-content);align-items:center}@media (min-width: 768px){.c-modal .c-modal-header{padding-inline:var(--dt-spacing-e);padding-block:20px}}.c-modal[hasbackbutton] .c-modal-header{padding-block:var(--dt-spacing-b);padding-inline-start:var(--dt-spacing-b)}@media (min-width: 768px){.c-modal[hasbackbutton] .c-modal-header{padding-block:var(--dt-spacing-c);padding-inline-start:var(--dt-spacing-c)}}.c-modal[isdismissible] .c-modal-header{padding-block:var(--dt-spacing-b);padding-inline-end:var(--dt-spacing-b)}@media (min-width: 768px){.c-modal[isdismissible] .c-modal-header{padding-block:var(--dt-spacing-c);padding-inline-end:var(--dt-spacing-c)}}.c-modal .c-modal-heading{--modal-header-font-size: calc(var(--dt-font-heading-m-size--wide) * 1px);--modal-header-font-line-height: calc(var(--dt-font-heading-m-line-height--wide) * 1px);--modal-header-font-weight: var(--dt-font-heading-m-weight);font-size:var(--modal-header-font-size);line-height:var(--modal-header-font-line-height);font-weight:var(--modal-header-font-weight);margin:0;grid-area:heading}.c-modal[hasbackbutton] .c-modal-heading{padding-inline-start:var(--dt-spacing-b)}@media (min-width: 768px){.c-modal[hasbackbutton] .c-modal-heading{padding-inline-start:var(--dt-spacing-c)}}.c-modal[isdismissible] .c-modal-heading{padding-inline-end:var(--dt-spacing-d)}@media (min-width: 768px){.c-modal[isdismissible] .c-modal-heading{padding-inline-end:var(--dt-spacing-e)}}.c-modal .c-modal-backBtn{grid-area:back}.c-modal .c-modal-closeBtn{grid-area:close}.c-modal[isfooterpinned] .c-modal-content,.c-modal .c-modal-scrollContainer{overflow-y:auto}.c-modal .c-modal-scrollContainer{--bg-scroll-start: linear-gradient(var(--dt-color-container-default) 30%, rgba(255, 255, 255, 0));--bg-scroll-end: linear-gradient(rgba(255, 255, 255, 0), var(--dt-color-container-default) 70%) 0 100%;--bg-scroll-top: radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, .3), rgba(0, 0, 0, 0));--bg-scroll-bottom: radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, .3), rgba(0, 0, 0, 0)) 0 100%;--bg-size-scroll-start: 100% 40px;--bg-size-scroll-end: 100% 40px;--bg-size-scroll-top: 100% 16px;--bg-size-scroll-bottom: 100% 16px;background:var(--bg-scroll-start),var(--bg-scroll-end),var(--bg-scroll-top),var(--bg-scroll-bottom);background-repeat:no-repeat;background-color:var(--dt-color-container-default);background-size:var(--bg-size-scroll-start),var(--bg-size-scroll-end),var(--bg-size-scroll-top),var(--bg-size-scroll-bottom);background-attachment:local,local,scroll,scroll}.c-modal .c-modal-content{--modal-content-font-size: calc(var(--dt-font-size-16) * 1px);--modal-content-font-weight: var(--dt-font-weight-regular);--modal-content-line-height: calc(var(--dt-font-size-16-line-height) * 1px);--modal-content-padding: var(--dt-spacing-e);--modal-content-padding-block: var(--dt-spacing-a);--spinner-size: 48px;--spinner-border-width: 6px;--spinner-base-color-h: var(--dt-color-content-interactive-secondary-h);--spinner-base-color-s: var(--dt-color-content-interactive-secondary-s);--spinner-base-color-l: var(--dt-color-content-interactive-secondary-l);--spinner-left-color-opacity: .35;--spinner-left-color: hsl(var(--spinner-base-color-h), var(--spinner-base-color-s), var(--spinner-base-color-l), var(--spinner-left-color-opacity));--spinner-right-color: hsl(var(--spinner-base-color-h), var(--spinner-base-color-s), var(--spinner-base-color-l), 1);--spinner-animation-duration: 1.15s;--spinner-animation-timing-function: linear;--spinner-animation-iteration-count: infinite;position:relative;min-block-size:var(--dt-spacing-j);font-size:var(--modal-content-font-size);line-height:var(--modal-content-line-height);font-weight:var(--modal-content-font-weight);padding-inline:var(--modal-content-padding);padding-block:var(--modal-content-padding-block)}.c-modal .c-modal-content--scrollable{background:linear-gradient(to bottom,transparent,var(--dt-color-container-default) 75%) center bottom,linear-gradient(transparent,var(--dt-color-border-strong)) center bottom;background-repeat:no-repeat;background-size:100% 48px,100% 12px;background-attachment:local,scroll}.c-modal .c-modal-content:before{content:"";position:absolute;left:50%;top:50%;translate:-50% -50%;height:var(--spinner-size);width:var(--spinner-size);display:block;background-color:transparent;border-radius:50%;border-color:var(--spinner-left-color) var(--spinner-right-color) var(--spinner-right-color) var(--spinner-left-color);border-width:var(--spinner-border-width);border-style:solid;will-change:transform;opacity:0}.c-modal[isLoading] .c-modal-content:before{animation:rotate360 var(--spinner-animation-duration) var(--spinner-animation-timing-function) var(--spinner-animation-iteration-count);opacity:1}.c-modal[isLoading] .c-modal-content .c-modal-contentInner{opacity:0}
|
|
691
|
+
`, We = ["h1", "h2", "h3", "h4", "h5", "h6"], Ue = ["small", "medium", "large"], Ye = ["top", "center"], P = "pie-modal-close", z = "pie-modal-open", T = "pie-modal-back", Ke = "pie-modal-leading-action-click", Xe = "pie-modal-supporting-action-click";
|
|
692
|
+
var Ze = Object.defineProperty, Ge = Object.getOwnPropertyDescriptor, c = (e, t, o, i) => {
|
|
693
|
+
for (var n = i > 1 ? void 0 : i ? Ge(t, o) : t, a = e.length - 1, r; a >= 0; a--)
|
|
719
694
|
(r = e[a]) && (n = (i ? r(t, o, n) : r(n)) || n);
|
|
720
|
-
return i && n &&
|
|
695
|
+
return i && n && Ze(t, o, n), n;
|
|
721
696
|
};
|
|
722
697
|
const C = "pie-modal";
|
|
723
|
-
class d extends
|
|
698
|
+
class d extends ye(L) {
|
|
724
699
|
constructor() {
|
|
725
700
|
super(), this.headingLevel = "h2", this.hasBackButton = !1, this.hasStackedActions = !1, this.isDismissible = !1, this.isFooterPinned = !0, this.isFullWidthBelowMid = !1, this.isLoading = !1, this.isOpen = !1, this.position = "center", this.size = "medium", this._backButtonClicked = !1, this._handleDialogCancelEvent = (t) => {
|
|
726
701
|
this.isDismissible || t.preventDefault();
|
|
@@ -746,13 +721,13 @@ class d extends we(P) {
|
|
|
746
721
|
}, this.addEventListener("click", (t) => this._handleDialogLightDismiss(t));
|
|
747
722
|
}
|
|
748
723
|
connectedCallback() {
|
|
749
|
-
super.connectedCallback(), document.addEventListener(
|
|
724
|
+
super.connectedCallback(), document.addEventListener(z, this._handleModalOpened.bind(this)), document.addEventListener(P, this._handleModalClosed.bind(this)), document.addEventListener(T, this._handleModalClosed.bind(this));
|
|
750
725
|
}
|
|
751
726
|
disconnectedCallback() {
|
|
752
|
-
document.removeEventListener(
|
|
727
|
+
document.removeEventListener(z, this._handleModalOpened.bind(this)), document.removeEventListener(P, this._handleModalClosed.bind(this)), document.removeEventListener(T, this._handleModalClosed.bind(this)), super.disconnectedCallback();
|
|
753
728
|
}
|
|
754
729
|
firstUpdated(t) {
|
|
755
|
-
this._dialog && (
|
|
730
|
+
this._dialog && (l.registerDialog(this._dialog), this._dialog.addEventListener("cancel", (o) => this._handleDialogCancelEvent(o)), this._dialog.addEventListener("close", () => {
|
|
756
731
|
this.isOpen = !1;
|
|
757
732
|
})), this._handleModalOpenStateOnFirstRender(t);
|
|
758
733
|
}
|
|
@@ -763,28 +738,30 @@ class d extends we(P) {
|
|
|
763
738
|
* Opens the dialog element and disables page scrolling
|
|
764
739
|
*/
|
|
765
740
|
_handleModalOpened() {
|
|
766
|
-
var
|
|
767
|
-
|
|
741
|
+
var o, i, n, a;
|
|
742
|
+
const t = (o = this._dialog) == null ? void 0 : o.querySelector(".c-modal-scrollContainer");
|
|
743
|
+
t && Ce(t), !((i = this._dialog) != null && i.hasAttribute("open") || !((n = this._dialog) != null && n.isConnected)) && ((a = this._dialog) == null || a.showModal());
|
|
768
744
|
}
|
|
769
745
|
/**
|
|
770
746
|
* Closes the dialog element and re-enables page scrolling
|
|
771
747
|
*/
|
|
772
748
|
_handleModalClosed() {
|
|
773
|
-
var
|
|
774
|
-
|
|
749
|
+
var o, i;
|
|
750
|
+
const t = (o = this._dialog) == null ? void 0 : o.querySelector(".c-modal-scrollContainer");
|
|
751
|
+
t && ze(t), (i = this._dialog) == null || i.close(), this._returnFocus();
|
|
775
752
|
}
|
|
776
753
|
// Handles the value of the isOpen property on first render of the component
|
|
777
754
|
_handleModalOpenStateOnFirstRender(t) {
|
|
778
|
-
t.get("isOpen") === void 0 && this.isOpen && this._dispatchModalCustomEvent(
|
|
755
|
+
t.get("isOpen") === void 0 && this.isOpen && this._dispatchModalCustomEvent(z);
|
|
779
756
|
}
|
|
780
757
|
// Handles changes to the modal isOpen property by dispatching any appropriate events
|
|
781
758
|
_handleModalOpenStateChanged(t) {
|
|
782
759
|
const o = t.get("isOpen");
|
|
783
|
-
o !== void 0 && (o ? this._backButtonClicked ? (this._backButtonClicked = !1, this._dispatchModalCustomEvent(
|
|
760
|
+
o !== void 0 && (o ? this._backButtonClicked ? (this._backButtonClicked = !1, this._dispatchModalCustomEvent(T)) : this._dispatchModalCustomEvent(P) : this._dispatchModalCustomEvent(z));
|
|
784
761
|
}
|
|
785
762
|
_handleActionClick(t) {
|
|
786
763
|
var o, i;
|
|
787
|
-
t === "leading" ? ((o = this._dialog) == null || o.close("leading"), this._dispatchModalCustomEvent(
|
|
764
|
+
t === "leading" ? ((o = this._dialog) == null || o.close("leading"), this._dispatchModalCustomEvent(Ke)) : t === "supporting" && ((i = this._dialog) == null || i.close("supporting"), this._dispatchModalCustomEvent(Xe));
|
|
788
765
|
}
|
|
789
766
|
/**
|
|
790
767
|
* Return focus to the specified element, providing the selector is valid
|
|
@@ -810,7 +787,7 @@ class d extends we(P) {
|
|
|
810
787
|
}}"
|
|
811
788
|
variant="ghost-secondary"
|
|
812
789
|
class="c-modal-closeBtn"
|
|
813
|
-
aria-label="${((t = this.aria) == null ? void 0 : t.close) ||
|
|
790
|
+
aria-label="${((t = this.aria) == null ? void 0 : t.close) || u}"
|
|
814
791
|
data-test-id="modal-close-button">
|
|
815
792
|
<icon-close></icon-close>
|
|
816
793
|
</pie-icon-button>`;
|
|
@@ -830,7 +807,7 @@ class d extends we(P) {
|
|
|
830
807
|
}}"
|
|
831
808
|
variant="ghost-secondary"
|
|
832
809
|
class="c-modal-backBtn"
|
|
833
|
-
aria-label="${((t = this.aria) == null ? void 0 : t.back) ||
|
|
810
|
+
aria-label="${((t = this.aria) == null ? void 0 : t.back) || u}"
|
|
834
811
|
data-test-id="modal-back-button">
|
|
835
812
|
${this.isRTL ? g`<icon-chevron-right></icon-chevron-right>` : g`<icon-chevron-left></icon-chevron-left>`}
|
|
836
813
|
</pie-icon-button>
|
|
@@ -850,14 +827,14 @@ class d extends we(P) {
|
|
|
850
827
|
return t ? g`
|
|
851
828
|
<pie-button
|
|
852
829
|
variant="${o}"
|
|
853
|
-
aria-label="${i ||
|
|
830
|
+
aria-label="${i || u}"
|
|
854
831
|
type="submit"
|
|
855
832
|
?isFullWidth="${this.hasStackedActions}"
|
|
856
833
|
@click="${() => this._handleActionClick("leading")}"
|
|
857
834
|
data-test-id="modal-leading-action">
|
|
858
835
|
${t}
|
|
859
836
|
</pie-button>
|
|
860
|
-
` :
|
|
837
|
+
` : u;
|
|
861
838
|
}
|
|
862
839
|
/**
|
|
863
840
|
* Render supportingAction button depending on prop availability.
|
|
@@ -875,14 +852,14 @@ class d extends we(P) {
|
|
|
875
852
|
return t ? this.leadingAction ? g`
|
|
876
853
|
<pie-button
|
|
877
854
|
variant="${o}"
|
|
878
|
-
aria-label="${i ||
|
|
855
|
+
aria-label="${i || u}"
|
|
879
856
|
type="reset"
|
|
880
857
|
?isFullWidth="${this.hasStackedActions}"
|
|
881
858
|
@click="${() => this._handleActionClick("supporting")}"
|
|
882
859
|
data-test-id="modal-supporting-action">
|
|
883
860
|
${t}
|
|
884
861
|
</pie-button>
|
|
885
|
-
` : (console.warn("Use `leadingAction` instead of `supportingAction`. `supportingAction` is being ignored."),
|
|
862
|
+
` : (console.warn("Use `leadingAction` instead of `supportingAction`. `supportingAction` is being ignored."), u) : u;
|
|
886
863
|
}
|
|
887
864
|
/**
|
|
888
865
|
* Renders the modal inner content and footer of the modal.
|
|
@@ -890,14 +867,14 @@ class d extends we(P) {
|
|
|
890
867
|
*/
|
|
891
868
|
renderModalContentAndFooter() {
|
|
892
869
|
return g`
|
|
893
|
-
<article class="c-modal-content c-modal-content--scrollable">
|
|
870
|
+
<article class="c-modal-scrollContainer c-modal-content c-modal-content--scrollable">
|
|
894
871
|
<div class="c-modal-contentInner">
|
|
895
872
|
<slot></slot>
|
|
896
873
|
</div>
|
|
897
874
|
</article>
|
|
898
875
|
<footer class="c-modal-footer">
|
|
899
|
-
${this.leadingAction ? this.renderLeadingAction() :
|
|
900
|
-
${this.supportingAction ? this.renderSupportingAction() :
|
|
876
|
+
${this.leadingAction ? this.renderLeadingAction() : u}
|
|
877
|
+
${this.supportingAction ? this.renderSupportingAction() : u}
|
|
901
878
|
</footer>`;
|
|
902
879
|
}
|
|
903
880
|
render() {
|
|
@@ -908,39 +885,39 @@ class d extends we(P) {
|
|
|
908
885
|
heading: n,
|
|
909
886
|
headingLevel: a = "h2",
|
|
910
887
|
isDismissible: r,
|
|
911
|
-
isFooterPinned:
|
|
888
|
+
isFooterPinned: h,
|
|
912
889
|
isFullWidthBelowMid: p,
|
|
913
|
-
isLoading:
|
|
914
|
-
leadingAction:
|
|
915
|
-
position:
|
|
890
|
+
isLoading: y,
|
|
891
|
+
leadingAction: de,
|
|
892
|
+
position: ce,
|
|
916
893
|
size: he,
|
|
917
|
-
supportingAction:
|
|
918
|
-
} = this,
|
|
894
|
+
supportingAction: ue
|
|
895
|
+
} = this, q = ge(a);
|
|
919
896
|
return g`
|
|
920
897
|
<dialog
|
|
921
898
|
id="dialog"
|
|
922
899
|
class="c-modal"
|
|
923
900
|
size="${he}"
|
|
924
|
-
position="${
|
|
925
|
-
?hasActions=${
|
|
901
|
+
position="${ce}"
|
|
902
|
+
?hasActions=${de || ue}
|
|
926
903
|
?hasBackButton=${o}
|
|
927
904
|
?hasStackedActions=${i}
|
|
928
905
|
?isDismissible=${r}
|
|
929
|
-
?isFooterPinned=${
|
|
906
|
+
?isFooterPinned=${h}
|
|
930
907
|
?isFullWidthBelowMid=${p}
|
|
931
|
-
?isLoading=${
|
|
932
|
-
aria-busy="${
|
|
933
|
-
aria-label="${
|
|
908
|
+
?isLoading=${y}
|
|
909
|
+
aria-busy="${y ? "true" : "false"}"
|
|
910
|
+
aria-label="${y && (t == null ? void 0 : t.loading) || u}"
|
|
934
911
|
data-test-id="pie-modal">
|
|
935
912
|
<header class="c-modal-header">
|
|
936
|
-
${o ? this.renderBackButton() :
|
|
937
|
-
<${
|
|
913
|
+
${o ? this.renderBackButton() : u}
|
|
914
|
+
<${q} class="c-modal-heading">
|
|
938
915
|
${n}
|
|
939
|
-
</${
|
|
940
|
-
${r ? this.renderCloseButton() :
|
|
916
|
+
</${q}>
|
|
917
|
+
${r ? this.renderCloseButton() : u}
|
|
941
918
|
</header>
|
|
942
919
|
${// We need to wrap the remaining content in a shared scrollable container if the footer is not pinned
|
|
943
|
-
|
|
920
|
+
h ? this.renderModalContentAndFooter() : g`
|
|
944
921
|
<div class="c-modal-scrollContainer">
|
|
945
922
|
${this.renderModalContentAndFooter()}
|
|
946
923
|
</div>
|
|
@@ -948,68 +925,68 @@ class d extends we(P) {
|
|
|
948
925
|
</dialog>`;
|
|
949
926
|
}
|
|
950
927
|
}
|
|
951
|
-
d.styles =
|
|
928
|
+
d.styles = pe(qe);
|
|
952
929
|
c([
|
|
953
|
-
|
|
930
|
+
s({ type: Object })
|
|
954
931
|
], d.prototype, "aria", 2);
|
|
955
932
|
c([
|
|
956
|
-
|
|
957
|
-
|
|
933
|
+
s({ type: String }),
|
|
934
|
+
we(C)
|
|
958
935
|
], d.prototype, "heading", 2);
|
|
959
936
|
c([
|
|
960
|
-
|
|
961
|
-
|
|
937
|
+
s(),
|
|
938
|
+
N(C, We, "h2")
|
|
962
939
|
], d.prototype, "headingLevel", 2);
|
|
963
940
|
c([
|
|
964
|
-
|
|
941
|
+
s({ type: Boolean })
|
|
965
942
|
], d.prototype, "hasBackButton", 2);
|
|
966
943
|
c([
|
|
967
|
-
|
|
944
|
+
s({ type: Boolean })
|
|
968
945
|
], d.prototype, "hasStackedActions", 2);
|
|
969
946
|
c([
|
|
970
|
-
|
|
947
|
+
s({ type: Boolean, reflect: !0 })
|
|
971
948
|
], d.prototype, "isDismissible", 2);
|
|
972
949
|
c([
|
|
973
|
-
|
|
950
|
+
s({ type: Boolean })
|
|
974
951
|
], d.prototype, "isFooterPinned", 2);
|
|
975
952
|
c([
|
|
976
|
-
|
|
953
|
+
s({ type: Boolean })
|
|
977
954
|
], d.prototype, "isFullWidthBelowMid", 2);
|
|
978
955
|
c([
|
|
979
|
-
|
|
956
|
+
s({ type: Boolean, reflect: !0 })
|
|
980
957
|
], d.prototype, "isLoading", 2);
|
|
981
958
|
c([
|
|
982
|
-
|
|
959
|
+
s({ type: Boolean })
|
|
983
960
|
], d.prototype, "isOpen", 2);
|
|
984
961
|
c([
|
|
985
|
-
|
|
962
|
+
s({ type: Object })
|
|
986
963
|
], d.prototype, "leadingAction", 2);
|
|
987
964
|
c([
|
|
988
|
-
|
|
989
|
-
|
|
965
|
+
s(),
|
|
966
|
+
N(C, Ye, "center")
|
|
990
967
|
], d.prototype, "position", 2);
|
|
991
968
|
c([
|
|
992
|
-
|
|
969
|
+
s()
|
|
993
970
|
], d.prototype, "returnFocusAfterCloseSelector", 2);
|
|
994
971
|
c([
|
|
995
|
-
|
|
996
|
-
|
|
972
|
+
s(),
|
|
973
|
+
N(C, Ue, "medium")
|
|
997
974
|
], d.prototype, "size", 2);
|
|
998
975
|
c([
|
|
999
|
-
|
|
976
|
+
s({ type: Object })
|
|
1000
977
|
], d.prototype, "supportingAction", 2);
|
|
1001
978
|
c([
|
|
1002
|
-
|
|
979
|
+
I("dialog")
|
|
1003
980
|
], d.prototype, "_dialog", 2);
|
|
1004
981
|
customElements.define(C, d);
|
|
1005
982
|
export {
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
983
|
+
T as ON_MODAL_BACK_EVENT,
|
|
984
|
+
P as ON_MODAL_CLOSE_EVENT,
|
|
985
|
+
Ke as ON_MODAL_LEADING_ACTION_CLICK,
|
|
986
|
+
z as ON_MODAL_OPEN_EVENT,
|
|
987
|
+
Xe as ON_MODAL_SUPPORTING_ACTION_CLICK,
|
|
1011
988
|
d as PieModal,
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
989
|
+
We as headingLevels,
|
|
990
|
+
Ye as positions,
|
|
991
|
+
Ue as sizes
|
|
1015
992
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-modal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "PIE design system modal built using web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@types/body-scroll-lock": "3.1.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"body-scroll-lock": "
|
|
40
|
+
"body-scroll-lock": "3.1.5"
|
|
41
41
|
},
|
|
42
42
|
"volta": {
|
|
43
43
|
"extends": "../../../package.json"
|
package/src/index.ts
CHANGED
|
@@ -139,7 +139,12 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps {
|
|
|
139
139
|
* Opens the dialog element and disables page scrolling
|
|
140
140
|
*/
|
|
141
141
|
private _handleModalOpened () : void {
|
|
142
|
-
|
|
142
|
+
const modalScrollContainer = this._dialog?.querySelector('.c-modal-scrollContainer');
|
|
143
|
+
|
|
144
|
+
if (modalScrollContainer) {
|
|
145
|
+
disableBodyScroll(modalScrollContainer);
|
|
146
|
+
}
|
|
147
|
+
|
|
143
148
|
if (this._dialog?.hasAttribute('open') || !this._dialog?.isConnected) {
|
|
144
149
|
return;
|
|
145
150
|
}
|
|
@@ -151,7 +156,12 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps {
|
|
|
151
156
|
* Closes the dialog element and re-enables page scrolling
|
|
152
157
|
*/
|
|
153
158
|
private _handleModalClosed () : void {
|
|
154
|
-
|
|
159
|
+
const modalScrollContainer = this._dialog?.querySelector('.c-modal-scrollContainer');
|
|
160
|
+
|
|
161
|
+
if (modalScrollContainer) {
|
|
162
|
+
enableBodyScroll(modalScrollContainer);
|
|
163
|
+
}
|
|
164
|
+
|
|
155
165
|
this._dialog?.close();
|
|
156
166
|
this._returnFocus();
|
|
157
167
|
}
|
|
@@ -327,7 +337,7 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps {
|
|
|
327
337
|
*/
|
|
328
338
|
private renderModalContentAndFooter (): TemplateResult {
|
|
329
339
|
return html`
|
|
330
|
-
<article class="c-modal-content c-modal-content--scrollable">
|
|
340
|
+
<article class="c-modal-scrollContainer c-modal-content c-modal-content--scrollable">
|
|
331
341
|
<div class="c-modal-contentInner">
|
|
332
342
|
<slot></slot>
|
|
333
343
|
</div>
|