@justeattakeaway/pie-modal 0.30.0 → 0.31.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/README.md +16 -2
- package/dist/index.js +193 -408
- package/dist/react.js +52 -45
- package/package.json +4 -4
- package/src/index.ts +4 -1
package/README.md
CHANGED
|
@@ -43,14 +43,28 @@ For full information on using PIE components as part of an application, check ou
|
|
|
43
43
|
|
|
44
44
|
### Importing the component
|
|
45
45
|
|
|
46
|
+
#### JavaScript
|
|
46
47
|
```js
|
|
47
|
-
//
|
|
48
|
+
// Default – for Native JS Applications, Vue, Angular, Svelte, etc.
|
|
48
49
|
import { PieModal } from '@justeattakeaway/pie-modal';
|
|
49
50
|
|
|
50
|
-
//
|
|
51
|
+
// If you don't need to reference the imported object, you can simply
|
|
52
|
+
// import the module which registers the component as a custom element.
|
|
53
|
+
import '@justeattakeaway/pie-modal';
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### React
|
|
57
|
+
```js
|
|
58
|
+
// React
|
|
59
|
+
// For React, you will need to import our React-specific component build
|
|
60
|
+
// which wraps the web component using @lit-labs/react
|
|
51
61
|
import { PieModal } from '@justeattakeaway/pie-modal/dist/react';
|
|
52
62
|
```
|
|
53
63
|
|
|
64
|
+
> [!NOTE]
|
|
65
|
+
> When using the React version of the component, please make sure to also
|
|
66
|
+
> include React as a [peer dependency](#peer-dependencies) in your project.
|
|
67
|
+
|
|
54
68
|
|
|
55
69
|
## Peer Dependencies
|
|
56
70
|
|
package/dist/index.js
CHANGED
|
@@ -1,329 +1,114 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { html as
|
|
3
|
-
import { property as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
get isRTL() {
|
|
16
|
-
return this.dir ? this.dir === "rtl" : !K && !this.dir ? document.documentElement.getAttribute("dir") === "rtl" : !1;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return e;
|
|
20
|
-
}, E = (n, e, t) => function(o, a) {
|
|
21
|
-
const r = `#${a}`;
|
|
22
|
-
Object.defineProperty(o, a, {
|
|
23
|
-
get() {
|
|
24
|
-
return this[r];
|
|
25
|
-
},
|
|
26
|
-
set(h) {
|
|
27
|
-
const g = this[r];
|
|
28
|
-
e.includes(h) ? this[r] = h : (console.error(
|
|
29
|
-
`<${n}> Invalid value "${h}" provided for property "${a}".`,
|
|
30
|
-
`Must be one of: ${e.join(" | ")}.`,
|
|
31
|
-
`Falling back to default value: "${t}"`
|
|
32
|
-
), this[r] = t), this.requestUpdate(a, g);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}, oe = (n) => function(t, i) {
|
|
36
|
-
const o = `#${i}`;
|
|
37
|
-
Object.defineProperty(t, i, {
|
|
38
|
-
get() {
|
|
39
|
-
return this[o];
|
|
40
|
-
},
|
|
41
|
-
set(a) {
|
|
42
|
-
const r = this[o];
|
|
43
|
-
(a == null || typeof a == "string" && a.trim() === "") && console.error(`<${n}> Missing required attribute "${i}"`), this[o] = a, this.requestUpdate(i, r);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
function ne(n, e) {
|
|
48
|
-
customElements.get(n) ? console.warn(`PIE Web Component: "${n}" has already been defined. Please ensure the component is only being defined once in your application.`) : customElements.define(n, e);
|
|
49
|
-
}
|
|
50
|
-
function P(n, e) {
|
|
51
|
-
customElements.get(n) ? console.warn(`PIE Web Component: "${n}" has already been defined. Please ensure the component is only being defined once in your application.`) : customElements.define(n, e);
|
|
52
|
-
}
|
|
53
|
-
const _ = {
|
|
54
|
-
xs: 16,
|
|
55
|
-
s: 20,
|
|
56
|
-
m: 24,
|
|
57
|
-
l: 28,
|
|
58
|
-
xl: 32,
|
|
59
|
-
xxl: 40
|
|
60
|
-
}, W = Object.keys(_), q = "xs", V = 8, z = 32;
|
|
61
|
-
function ae(n, e, t) {
|
|
62
|
-
const i = parseInt(n, 10), o = i % t === 0;
|
|
63
|
-
return i >= e && o;
|
|
64
|
-
}
|
|
65
|
-
const Y = {
|
|
66
|
-
large: (n) => ae(n, z, V),
|
|
67
|
-
regular: (n) => W.includes(n)
|
|
68
|
-
};
|
|
69
|
-
function re(n) {
|
|
70
|
-
const e = Y.large(n);
|
|
71
|
-
return { isValid: e, size: e ? n : z };
|
|
72
|
-
}
|
|
73
|
-
function le(n) {
|
|
74
|
-
const e = Y.regular(n), t = e ? _[n] : _[q];
|
|
75
|
-
return { isValid: e, size: t };
|
|
76
|
-
}
|
|
77
|
-
const u = (n, e, t, i) => {
|
|
78
|
-
const o = n.endsWith("Large") || n.endsWith("-large");
|
|
79
|
-
let a, r;
|
|
80
|
-
if (t) {
|
|
81
|
-
if ({ isValid: a, size: r } = o ? re(t) : le(t), !a) {
|
|
82
|
-
const h = o ? `Invalid prop "size" value supplied to "${i}". The prop value should be a number equal or greater than ${z} and multiple of ${V}.` : `Invalid prop "size" value supplied to "${i}". The prop value should be one of the following values: ${W.join(", ")}.`;
|
|
83
|
-
console.error(h);
|
|
84
|
-
}
|
|
1
|
+
import { LitElement as P, nothing as d, unsafeCSS as T } from "lit";
|
|
2
|
+
import { html as m, unsafeStatic as F } from "lit/static-html.js";
|
|
3
|
+
import { property as r, query as N } from "lit/decorators.js";
|
|
4
|
+
import "@justeattakeaway/pie-button";
|
|
5
|
+
import "@justeattakeaway/pie-icon-button";
|
|
6
|
+
import { RtlMixin as I, requiredProperty as R, validPropertyValues as z, defineCustomElement as j } from "@justeattakeaway/pie-webc-core";
|
|
7
|
+
import "@justeattakeaway/pie-icons-webc/IconClose";
|
|
8
|
+
import "@justeattakeaway/pie-icons-webc/IconChevronLeft";
|
|
9
|
+
import "@justeattakeaway/pie-icons-webc/IconChevronRight";
|
|
10
|
+
function W(a) {
|
|
11
|
+
if (Array.isArray(a)) {
|
|
12
|
+
for (var e = 0, o = Array(a.length); e < a.length; e++)
|
|
13
|
+
o[e] = a[e];
|
|
14
|
+
return o;
|
|
85
15
|
} else
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
class: [n, e].filter(Boolean).join(" "),
|
|
89
|
-
width: r,
|
|
90
|
-
height: r
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
var se = Object.defineProperty, de = Object.getOwnPropertyDescriptor, D = (n, e, t, i) => {
|
|
94
|
-
for (var o = i > 1 ? void 0 : i ? de(e, t) : e, a = n.length - 1, r; a >= 0; a--)
|
|
95
|
-
(r = n[a]) && (o = (i ? r(e, t, o) : r(o)) || o);
|
|
96
|
-
return i && o && se(e, t, o), o;
|
|
97
|
-
};
|
|
98
|
-
const ce = "icon-close";
|
|
99
|
-
class b extends $ {
|
|
100
|
-
constructor() {
|
|
101
|
-
super(...arguments), this.size = "xs", this.class = "c-pieIcon c-pieIcon--close";
|
|
102
|
-
}
|
|
103
|
-
connectedCallback() {
|
|
104
|
-
var e, t, i;
|
|
105
|
-
if (super.connectedCallback(), ((e = this._svg) == null ? void 0 : e.getAttribute("width")) === null) {
|
|
106
|
-
const o = u("c-pieIcon c-pieIcon--close", "", null, "IconClose");
|
|
107
|
-
(t = this._svg) == null || t.setAttribute("width", o.width), (i = this._svg) == null || i.setAttribute("height", o.height);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
updated(e) {
|
|
111
|
-
var t, i;
|
|
112
|
-
let o;
|
|
113
|
-
e.has("size") && (o = u("c-pieIcon c-pieIcon--close", "", this.size, "IconClose"), (t = this._svg) == null || t.setAttribute("width", o.width), (i = this._svg) == null || i.setAttribute("height", o.height));
|
|
114
|
-
}
|
|
115
|
-
render() {
|
|
116
|
-
return M`<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>`;
|
|
117
|
-
}
|
|
16
|
+
return Array.from(a);
|
|
118
17
|
}
|
|
119
|
-
|
|
120
|
-
:host-context(pie-icon-button) svg,
|
|
121
|
-
:host-context(pie-button) svg {
|
|
122
|
-
display: block;
|
|
123
|
-
width: var(--btn-icon-size);
|
|
124
|
-
height: var(--btn-icon-size);
|
|
125
|
-
}
|
|
126
|
-
`;
|
|
127
|
-
D([
|
|
128
|
-
l({ type: String, reflect: !0 })
|
|
129
|
-
], b.prototype, "size", 2);
|
|
130
|
-
D([
|
|
131
|
-
l({ type: String, reflect: !0 })
|
|
132
|
-
], b.prototype, "class", 2);
|
|
133
|
-
D([
|
|
134
|
-
O("svg")
|
|
135
|
-
], b.prototype, "_svg", 2);
|
|
136
|
-
P(ce, b);
|
|
137
|
-
var he = Object.defineProperty, pe = Object.getOwnPropertyDescriptor, T = (n, e, t, i) => {
|
|
138
|
-
for (var o = i > 1 ? void 0 : i ? pe(e, t) : e, a = n.length - 1, r; a >= 0; a--)
|
|
139
|
-
(r = n[a]) && (o = (i ? r(e, t, o) : r(o)) || o);
|
|
140
|
-
return i && o && he(e, t, o), o;
|
|
141
|
-
};
|
|
142
|
-
const me = "icon-chevron-left";
|
|
143
|
-
class w extends $ {
|
|
144
|
-
constructor() {
|
|
145
|
-
super(...arguments), this.size = "xs", this.class = "c-pieIcon c-pieIcon--chevronLeft";
|
|
146
|
-
}
|
|
147
|
-
connectedCallback() {
|
|
148
|
-
var e, t, i;
|
|
149
|
-
if (super.connectedCallback(), ((e = this._svg) == null ? void 0 : e.getAttribute("width")) === null) {
|
|
150
|
-
const o = u("c-pieIcon c-pieIcon--chevronLeft", "", null, "IconChevronLeft");
|
|
151
|
-
(t = this._svg) == null || t.setAttribute("width", o.width), (i = this._svg) == null || i.setAttribute("height", o.height);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
updated(e) {
|
|
155
|
-
var t, i;
|
|
156
|
-
let o;
|
|
157
|
-
e.has("size") && (o = u("c-pieIcon c-pieIcon--chevronLeft", "", this.size, "IconChevronLeft"), (t = this._svg) == null || t.setAttribute("width", o.width), (i = this._svg) == null || i.setAttribute("height", o.height));
|
|
158
|
-
}
|
|
159
|
-
render() {
|
|
160
|
-
return M`<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>`;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
w.styles = I`
|
|
164
|
-
:host-context(pie-icon-button) svg,
|
|
165
|
-
:host-context(pie-button) svg {
|
|
166
|
-
display: block;
|
|
167
|
-
width: var(--btn-icon-size);
|
|
168
|
-
height: var(--btn-icon-size);
|
|
169
|
-
}
|
|
170
|
-
`;
|
|
171
|
-
T([
|
|
172
|
-
l({ type: String, reflect: !0 })
|
|
173
|
-
], w.prototype, "size", 2);
|
|
174
|
-
T([
|
|
175
|
-
l({ type: String, reflect: !0 })
|
|
176
|
-
], w.prototype, "class", 2);
|
|
177
|
-
T([
|
|
178
|
-
O("svg")
|
|
179
|
-
], w.prototype, "_svg", 2);
|
|
180
|
-
P(me, w);
|
|
181
|
-
var ge = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, j = (n, e, t, i) => {
|
|
182
|
-
for (var o = i > 1 ? void 0 : i ? ue(e, t) : e, a = n.length - 1, r; a >= 0; a--)
|
|
183
|
-
(r = n[a]) && (o = (i ? r(e, t, o) : r(o)) || o);
|
|
184
|
-
return i && o && ge(e, t, o), o;
|
|
185
|
-
};
|
|
186
|
-
const ve = "icon-chevron-right";
|
|
187
|
-
class y extends $ {
|
|
188
|
-
constructor() {
|
|
189
|
-
super(...arguments), this.size = "xs", this.class = "c-pieIcon c-pieIcon--chevronRight";
|
|
190
|
-
}
|
|
191
|
-
connectedCallback() {
|
|
192
|
-
var e, t, i;
|
|
193
|
-
if (super.connectedCallback(), ((e = this._svg) == null ? void 0 : e.getAttribute("width")) === null) {
|
|
194
|
-
const o = u("c-pieIcon c-pieIcon--chevronRight", "", null, "IconChevronRight");
|
|
195
|
-
(t = this._svg) == null || t.setAttribute("width", o.width), (i = this._svg) == null || i.setAttribute("height", o.height);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
updated(e) {
|
|
199
|
-
var t, i;
|
|
200
|
-
let o;
|
|
201
|
-
e.has("size") && (o = u("c-pieIcon c-pieIcon--chevronRight", "", this.size, "IconChevronRight"), (t = this._svg) == null || t.setAttribute("width", o.width), (i = this._svg) == null || i.setAttribute("height", o.height));
|
|
202
|
-
}
|
|
203
|
-
render() {
|
|
204
|
-
return M`<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>`;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
y.styles = I`
|
|
208
|
-
:host-context(pie-icon-button) svg,
|
|
209
|
-
:host-context(pie-button) svg {
|
|
210
|
-
display: block;
|
|
211
|
-
width: var(--btn-icon-size);
|
|
212
|
-
height: var(--btn-icon-size);
|
|
213
|
-
}
|
|
214
|
-
`;
|
|
215
|
-
j([
|
|
216
|
-
l({ type: String, reflect: !0 })
|
|
217
|
-
], y.prototype, "size", 2);
|
|
218
|
-
j([
|
|
219
|
-
l({ type: String, reflect: !0 })
|
|
220
|
-
], y.prototype, "class", 2);
|
|
221
|
-
j([
|
|
222
|
-
O("svg")
|
|
223
|
-
], y.prototype, "_svg", 2);
|
|
224
|
-
P(ve, y);
|
|
225
|
-
function fe(n) {
|
|
226
|
-
if (Array.isArray(n)) {
|
|
227
|
-
for (var e = 0, t = Array(n.length); e < n.length; e++)
|
|
228
|
-
t[e] = n[e];
|
|
229
|
-
return t;
|
|
230
|
-
} else
|
|
231
|
-
return Array.from(n);
|
|
232
|
-
}
|
|
233
|
-
var F = !1;
|
|
18
|
+
var C = !1;
|
|
234
19
|
if (typeof window < "u") {
|
|
235
|
-
var
|
|
20
|
+
var A = {
|
|
236
21
|
get passive() {
|
|
237
|
-
|
|
22
|
+
C = !0;
|
|
238
23
|
}
|
|
239
24
|
};
|
|
240
|
-
window.addEventListener("testPassive", null,
|
|
25
|
+
window.addEventListener("testPassive", null, A), window.removeEventListener("testPassive", null, A);
|
|
241
26
|
}
|
|
242
|
-
var
|
|
243
|
-
return
|
|
244
|
-
return !!(
|
|
27
|
+
var B = typeof window < "u" && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === "MacIntel" && window.navigator.maxTouchPoints > 1), p = [], b = !1, S = -1, h = void 0, g = void 0, L = function(e) {
|
|
28
|
+
return p.some(function(o) {
|
|
29
|
+
return !!(o.options.allowTouchMove && o.options.allowTouchMove(e));
|
|
245
30
|
});
|
|
246
|
-
},
|
|
247
|
-
var
|
|
248
|
-
return
|
|
249
|
-
},
|
|
250
|
-
if (
|
|
251
|
-
var
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
},
|
|
256
|
-
|
|
257
|
-
},
|
|
31
|
+
}, y = function(e) {
|
|
32
|
+
var o = e || window.event;
|
|
33
|
+
return L(o.target) || o.touches.length > 1 ? !0 : (o.preventDefault && o.preventDefault(), !1);
|
|
34
|
+
}, Y = function(e) {
|
|
35
|
+
if (g === void 0) {
|
|
36
|
+
var o = !!e && e.reserveScrollBarGap === !0, i = window.innerWidth - document.documentElement.clientWidth;
|
|
37
|
+
o && i > 0 && (g = document.body.style.paddingRight, document.body.style.paddingRight = i + "px");
|
|
38
|
+
}
|
|
39
|
+
h === void 0 && (h = document.body.style.overflow, document.body.style.overflow = "hidden");
|
|
40
|
+
}, V = function() {
|
|
41
|
+
g !== void 0 && (document.body.style.paddingRight = g, g = void 0), h !== void 0 && (document.body.style.overflow = h, h = void 0);
|
|
42
|
+
}, q = function(e) {
|
|
258
43
|
return e ? e.scrollHeight - e.scrollTop <= e.clientHeight : !1;
|
|
259
|
-
},
|
|
260
|
-
var i = e.targetTouches[0].clientY -
|
|
261
|
-
return
|
|
262
|
-
},
|
|
44
|
+
}, H = function(e, o) {
|
|
45
|
+
var i = e.targetTouches[0].clientY - S;
|
|
46
|
+
return L(e.target) ? !1 : o && o.scrollTop === 0 && i > 0 || q(o) && i < 0 ? y(e) : (e.stopPropagation(), !0);
|
|
47
|
+
}, U = function(e, o) {
|
|
263
48
|
if (!e) {
|
|
264
49
|
console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");
|
|
265
50
|
return;
|
|
266
51
|
}
|
|
267
|
-
if (!
|
|
268
|
-
return
|
|
52
|
+
if (!p.some(function(t) {
|
|
53
|
+
return t.targetElement === e;
|
|
269
54
|
})) {
|
|
270
55
|
var i = {
|
|
271
56
|
targetElement: e,
|
|
272
|
-
options:
|
|
57
|
+
options: o || {}
|
|
273
58
|
};
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}, e.ontouchmove = function(
|
|
277
|
-
|
|
278
|
-
},
|
|
59
|
+
p = [].concat(W(p), [i]), B ? (e.ontouchstart = function(t) {
|
|
60
|
+
t.targetTouches.length === 1 && (S = t.targetTouches[0].clientY);
|
|
61
|
+
}, e.ontouchmove = function(t) {
|
|
62
|
+
t.targetTouches.length === 1 && H(t, e);
|
|
63
|
+
}, b || (document.addEventListener("touchmove", y, C ? { passive: !1 } : void 0), b = !0)) : Y(o);
|
|
279
64
|
}
|
|
280
|
-
},
|
|
65
|
+
}, K = function(e) {
|
|
281
66
|
if (!e) {
|
|
282
67
|
console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");
|
|
283
68
|
return;
|
|
284
69
|
}
|
|
285
|
-
|
|
286
|
-
return
|
|
287
|
-
}),
|
|
70
|
+
p = p.filter(function(o) {
|
|
71
|
+
return o.targetElement !== e;
|
|
72
|
+
}), B ? (e.ontouchstart = null, e.ontouchmove = null, b && p.length === 0 && (document.removeEventListener("touchmove", y, C ? { passive: !1 } : void 0), b = !1)) : p.length || V();
|
|
288
73
|
};
|
|
289
|
-
const
|
|
290
|
-
`,
|
|
291
|
-
var
|
|
292
|
-
for (var
|
|
293
|
-
(
|
|
294
|
-
return i &&
|
|
74
|
+
const G = `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);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: 767px){.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);max-block-size:calc(100% - var(--dt-spacing-j) * 2)}@media (max-width: 767px){.c-modal[position=top][size=large],.c-modal[position=top][isfullwidthbelowmid][size=medium]{margin-block-start:var(--dt-spacing-none);max-block-size:100%}}.c-modal::backdrop{background:rgba(0,0,0,.55)}.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{display:grid;grid-template-areas:"back heading close";grid-template-columns:minmax(0,max-content) minmax(0,1fr) minmax(0,max-content);align-items:start}.c-modal .c-modal-heading{--modal-header-font-size: calc(var(--dt-font-heading-m-size--narrow) * 1px);--modal-header-font-line-height: calc(var(--dt-font-heading-m-line-height--narrow) * 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;margin-inline:var(--dt-spacing-d);margin-block:14px}@media (min-width: 768px){.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);margin-inline:var(--dt-spacing-e);margin-block:20px}}.c-modal[hasbackbutton] .c-modal-heading{margin-inline-start:var(--dt-spacing-b)}@media (min-width: 768px){.c-modal[hasbackbutton] .c-modal-heading{margin-inline-start:var(--dt-spacing-c)}}.c-modal[isdismissible] .c-modal-heading{margin-inline-end:var(--dt-spacing-d)}@media (min-width: 768px){.c-modal[isdismissible] .c-modal-heading{margin-inline-end:var(--dt-spacing-e)}}.c-modal .c-modal-backBtn{grid-area:back;margin-block:var(--dt-spacing-b);margin-inline:var(--dt-spacing-b) var(--dt-spacing-none)}@media (min-width: 768px){.c-modal .c-modal-backBtn{margin-block:var(--dt-spacing-c);margin-inline:var(--dt-spacing-c) var(--dt-spacing-none)}}.c-modal .c-modal-closeBtn{grid-area:close;margin-block:var(--dt-spacing-b);margin-inline:var(--dt-spacing-none) var(--dt-spacing-b)}@media (min-width: 768px){.c-modal .c-modal-closeBtn{margin-block:var(--dt-spacing-c);margin-inline:var(--dt-spacing-none) var(--dt-spacing-c)}}.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-block: var(--dt-spacing-a);--modal-content-padding-inline: var(--dt-spacing-d);--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-inline);padding-block:var(--modal-content-padding-block);flex-grow:1}@media (min-width: 768px){.c-modal .c-modal-content{--modal-content-padding-inline: var(--dt-spacing-e)}}.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>.c-modal-scrollContainer{display:flex;flex-direction:column;height:100%;overflow-y:auto;--bg-scroll-end: linear-gradient(rgba(255, 255, 255, 0), var(--dt-color-container-default) 70%) 0 100%;--bg-scroll-bottom: radial-gradient(farthest-corner at 50% 100%, rgba(0, 0, 0, .3), rgba(0, 0, 0, 0)) 0 100%;--bg-size-scroll-end: 100% 40px;--bg-size-scroll-bottom: 100% 8px;background:var(--bg-scroll-end),var(--bg-scroll-bottom);background-repeat:no-repeat;background-size:var(--bg-size-scroll-end),var(--bg-size-scroll-bottom);background-attachment:local,scroll}.c-modal>.c-modal-scrollContainer .c-modal-content{flex-shrink:0}.c-modal[isfooterpinned] .c-modal-content{overflow-y:auto}.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}@supports not (aspect-ratio: 1/1){.c-modal .c-modal-scrollContainer{background:none}}
|
|
75
|
+
`, X = ["h1", "h2", "h3", "h4", "h5", "h6"], J = ["small", "medium", "large"], Q = ["top", "center"], x = "pie-modal-close", v = "pie-modal-open", _ = "pie-modal-back", Z = "pie-modal-leading-action-click", ee = "pie-modal-supporting-action-click";
|
|
76
|
+
var oe = Object.defineProperty, ie = Object.getOwnPropertyDescriptor, l = (a, e, o, i) => {
|
|
77
|
+
for (var t = i > 1 ? void 0 : i ? ie(e, o) : e, s = a.length - 1, c; s >= 0; s--)
|
|
78
|
+
(c = a[s]) && (t = (i ? c(e, o, t) : c(t)) || t);
|
|
79
|
+
return i && t && oe(e, o, t), t;
|
|
295
80
|
};
|
|
296
|
-
const
|
|
297
|
-
class
|
|
81
|
+
const u = "pie-modal";
|
|
82
|
+
class n extends I(P) {
|
|
298
83
|
constructor() {
|
|
299
84
|
super(...arguments), 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 = (e) => {
|
|
300
85
|
this.isDismissible || e.preventDefault();
|
|
301
86
|
}, this._handleDialogLightDismiss = (e) => {
|
|
302
|
-
var
|
|
87
|
+
var f;
|
|
303
88
|
if (!this.isDismissible)
|
|
304
89
|
return;
|
|
305
|
-
const
|
|
90
|
+
const o = (f = this._dialog) == null ? void 0 : f.getBoundingClientRect(), {
|
|
306
91
|
top: i = 0,
|
|
307
|
-
bottom:
|
|
308
|
-
left:
|
|
309
|
-
right:
|
|
310
|
-
} =
|
|
311
|
-
if (i === 0 &&
|
|
92
|
+
bottom: t = 0,
|
|
93
|
+
left: s = 0,
|
|
94
|
+
right: c = 0
|
|
95
|
+
} = o || {};
|
|
96
|
+
if (i === 0 && t === 0 && s === 0 && c === 0)
|
|
312
97
|
return;
|
|
313
|
-
(e.clientY < i || e.clientY >
|
|
98
|
+
(e.clientY < i || e.clientY > t || e.clientX < s || e.clientX > c) && (this.isOpen = !1);
|
|
314
99
|
}, this._dispatchModalCustomEvent = (e) => {
|
|
315
|
-
const
|
|
100
|
+
const o = new CustomEvent(e, {
|
|
316
101
|
bubbles: !0,
|
|
317
102
|
composed: !0
|
|
318
103
|
});
|
|
319
|
-
this.dispatchEvent(
|
|
104
|
+
this.dispatchEvent(o);
|
|
320
105
|
};
|
|
321
106
|
}
|
|
322
107
|
connectedCallback() {
|
|
323
|
-
super.connectedCallback(), this.addEventListener("click", (e) => this._handleDialogLightDismiss(e)), document.addEventListener(
|
|
108
|
+
super.connectedCallback(), this.addEventListener("click", (e) => this._handleDialogLightDismiss(e)), document.addEventListener(v, this._handleModalOpened.bind(this)), document.addEventListener(x, this._handleModalClosed.bind(this)), document.addEventListener(_, this._handleModalClosed.bind(this));
|
|
324
109
|
}
|
|
325
110
|
disconnectedCallback() {
|
|
326
|
-
document.removeEventListener(
|
|
111
|
+
document.removeEventListener(v, this._handleModalOpened.bind(this)), document.removeEventListener(x, this._handleModalClosed.bind(this)), document.removeEventListener(_, this._handleModalClosed.bind(this)), super.disconnectedCallback();
|
|
327
112
|
}
|
|
328
113
|
async firstUpdated(e) {
|
|
329
114
|
super.firstUpdated(e), this._dialog && ((await import("./dialog-polyfill.esm-29edb142.js").then((i) => i.default)).registerDialog(this._dialog), this._dialog.addEventListener("cancel", (i) => this._handleDialogCancelEvent(i)), this._dialog.addEventListener("close", () => {
|
|
@@ -337,38 +122,38 @@ class s extends ie($) {
|
|
|
337
122
|
* Opens the dialog element and disables page scrolling
|
|
338
123
|
*/
|
|
339
124
|
_handleModalOpened() {
|
|
340
|
-
var
|
|
341
|
-
const e = (
|
|
342
|
-
e &&
|
|
125
|
+
var o, i, t, s;
|
|
126
|
+
const e = (o = this._dialog) == null ? void 0 : o.querySelector(".c-modal-scrollContainer");
|
|
127
|
+
e && U(e), !((i = this._dialog) != null && i.hasAttribute("open") || !((t = this._dialog) != null && t.isConnected)) && ((s = this._dialog) == null || s.showModal());
|
|
343
128
|
}
|
|
344
129
|
/**
|
|
345
130
|
* Closes the dialog element and re-enables page scrolling
|
|
346
131
|
*/
|
|
347
132
|
_handleModalClosed() {
|
|
348
|
-
var
|
|
349
|
-
const e = (
|
|
350
|
-
e &&
|
|
133
|
+
var o, i;
|
|
134
|
+
const e = (o = this._dialog) == null ? void 0 : o.querySelector(".c-modal-scrollContainer");
|
|
135
|
+
e && K(e), (i = this._dialog) == null || i.close(), this._returnFocus();
|
|
351
136
|
}
|
|
352
137
|
// Handles the value of the isOpen property on first render of the component
|
|
353
138
|
_handleModalOpenStateOnFirstRender(e) {
|
|
354
|
-
e.get("isOpen") === void 0 && this.isOpen && this._dispatchModalCustomEvent(
|
|
139
|
+
e.get("isOpen") === void 0 && this.isOpen && this._dispatchModalCustomEvent(v);
|
|
355
140
|
}
|
|
356
141
|
// Handles changes to the modal isOpen property by dispatching any appropriate events
|
|
357
142
|
_handleModalOpenStateChanged(e) {
|
|
358
|
-
const
|
|
359
|
-
|
|
143
|
+
const o = e.get("isOpen");
|
|
144
|
+
o !== void 0 && (o ? this._backButtonClicked ? (this._backButtonClicked = !1, this._dispatchModalCustomEvent(_)) : this._dispatchModalCustomEvent(x) : this._dispatchModalCustomEvent(v));
|
|
360
145
|
}
|
|
361
146
|
_handleActionClick(e) {
|
|
362
|
-
var
|
|
363
|
-
e === "leading" ? ((
|
|
147
|
+
var o, i;
|
|
148
|
+
e === "leading" ? ((o = this._dialog) == null || o.close("leading"), this._dispatchModalCustomEvent(Z)) : e === "supporting" && ((i = this._dialog) == null || i.close("supporting"), this._dispatchModalCustomEvent(ee));
|
|
364
149
|
}
|
|
365
150
|
/**
|
|
366
151
|
* Return focus to the specified element, providing the selector is valid
|
|
367
152
|
* and the chosen element can be found.
|
|
368
153
|
*/
|
|
369
154
|
_returnFocus() {
|
|
370
|
-
var
|
|
371
|
-
const e = (
|
|
155
|
+
var o, i;
|
|
156
|
+
const e = (o = this.returnFocusAfterCloseSelector) == null ? void 0 : o.trim();
|
|
372
157
|
e && ((i = document.querySelector(e)) == null || i.focus());
|
|
373
158
|
}
|
|
374
159
|
/**
|
|
@@ -379,14 +164,14 @@ class s extends ie($) {
|
|
|
379
164
|
*/
|
|
380
165
|
renderCloseButton() {
|
|
381
166
|
var e;
|
|
382
|
-
return
|
|
167
|
+
return m`
|
|
383
168
|
<pie-icon-button
|
|
384
169
|
@click="${() => {
|
|
385
170
|
this.isOpen = !1;
|
|
386
171
|
}}"
|
|
387
172
|
variant="ghost-secondary"
|
|
388
173
|
class="c-modal-closeBtn"
|
|
389
|
-
aria-label="${((e = this.aria) == null ? void 0 : e.close) ||
|
|
174
|
+
aria-label="${((e = this.aria) == null ? void 0 : e.close) || d}"
|
|
390
175
|
data-test-id="modal-close-button">
|
|
391
176
|
<icon-close></icon-close>
|
|
392
177
|
</pie-icon-button>`;
|
|
@@ -399,16 +184,16 @@ class s extends ie($) {
|
|
|
399
184
|
*/
|
|
400
185
|
renderBackButton() {
|
|
401
186
|
var e;
|
|
402
|
-
return
|
|
187
|
+
return m`
|
|
403
188
|
<pie-icon-button
|
|
404
189
|
@click="${() => {
|
|
405
190
|
this._backButtonClicked = !0, this.isOpen = !1;
|
|
406
191
|
}}"
|
|
407
192
|
variant="ghost-secondary"
|
|
408
193
|
class="c-modal-backBtn"
|
|
409
|
-
aria-label="${((e = this.aria) == null ? void 0 : e.back) ||
|
|
194
|
+
aria-label="${((e = this.aria) == null ? void 0 : e.back) || d}"
|
|
410
195
|
data-test-id="modal-back-button">
|
|
411
|
-
${this.isRTL ?
|
|
196
|
+
${this.isRTL ? m`<icon-chevron-right></icon-chevron-right>` : m`<icon-chevron-left></icon-chevron-left>`}
|
|
412
197
|
</pie-icon-button>
|
|
413
198
|
`;
|
|
414
199
|
}
|
|
@@ -422,18 +207,18 @@ class s extends ie($) {
|
|
|
422
207
|
* @private
|
|
423
208
|
*/
|
|
424
209
|
renderLeadingAction() {
|
|
425
|
-
const { text: e, variant:
|
|
426
|
-
return e ?
|
|
210
|
+
const { text: e, variant: o = "primary", ariaLabel: i } = this.leadingAction;
|
|
211
|
+
return e ? m`
|
|
427
212
|
<pie-button
|
|
428
|
-
variant="${
|
|
429
|
-
aria-label="${i ||
|
|
213
|
+
variant="${o}"
|
|
214
|
+
aria-label="${i || d}"
|
|
430
215
|
type="submit"
|
|
431
216
|
?isFullWidth="${this.hasStackedActions}"
|
|
432
217
|
@click="${() => this._handleActionClick("leading")}"
|
|
433
218
|
data-test-id="modal-leading-action">
|
|
434
219
|
${e}
|
|
435
220
|
</pie-button>
|
|
436
|
-
` :
|
|
221
|
+
` : d;
|
|
437
222
|
}
|
|
438
223
|
/**
|
|
439
224
|
* Render supportingAction button depending on prop availability.
|
|
@@ -447,76 +232,76 @@ class s extends ie($) {
|
|
|
447
232
|
* @private
|
|
448
233
|
*/
|
|
449
234
|
renderSupportingAction() {
|
|
450
|
-
const { text: e, variant:
|
|
451
|
-
return e ? this.leadingAction ?
|
|
235
|
+
const { text: e, variant: o = "ghost", ariaLabel: i } = this.supportingAction;
|
|
236
|
+
return e ? this.leadingAction ? m`
|
|
452
237
|
<pie-button
|
|
453
|
-
variant="${
|
|
454
|
-
aria-label="${i ||
|
|
238
|
+
variant="${o}"
|
|
239
|
+
aria-label="${i || d}"
|
|
455
240
|
type="reset"
|
|
456
241
|
?isFullWidth="${this.hasStackedActions}"
|
|
457
242
|
@click="${() => this._handleActionClick("supporting")}"
|
|
458
243
|
data-test-id="modal-supporting-action">
|
|
459
244
|
${e}
|
|
460
245
|
</pie-button>
|
|
461
|
-
` : (console.warn("Use `leadingAction` instead of `supportingAction`. `supportingAction` is being ignored."),
|
|
246
|
+
` : (console.warn("Use `leadingAction` instead of `supportingAction`. `supportingAction` is being ignored."), d) : d;
|
|
462
247
|
}
|
|
463
248
|
/**
|
|
464
249
|
* Renders the modal inner content and footer of the modal.
|
|
465
250
|
* @private
|
|
466
251
|
*/
|
|
467
252
|
renderModalContentAndFooter() {
|
|
468
|
-
return
|
|
253
|
+
return m`
|
|
469
254
|
<article class="c-modal-scrollContainer c-modal-content c-modal-content--scrollable">
|
|
470
255
|
<div class="c-modal-contentInner">
|
|
471
256
|
<slot></slot>
|
|
472
257
|
</div>
|
|
473
258
|
</article>
|
|
474
259
|
<footer class="c-modal-footer">
|
|
475
|
-
${this.leadingAction ? this.renderLeadingAction() :
|
|
476
|
-
${this.supportingAction ? this.renderSupportingAction() :
|
|
260
|
+
${this.leadingAction ? this.renderLeadingAction() : d}
|
|
261
|
+
${this.supportingAction ? this.renderSupportingAction() : d}
|
|
477
262
|
</footer>`;
|
|
478
263
|
}
|
|
479
264
|
render() {
|
|
480
265
|
const {
|
|
481
266
|
aria: e,
|
|
482
|
-
hasBackButton:
|
|
267
|
+
hasBackButton: o,
|
|
483
268
|
hasStackedActions: i,
|
|
484
|
-
heading:
|
|
485
|
-
headingLevel:
|
|
486
|
-
isDismissible:
|
|
487
|
-
isFooterPinned:
|
|
488
|
-
isFullWidthBelowMid:
|
|
489
|
-
isLoading:
|
|
490
|
-
leadingAction:
|
|
491
|
-
position:
|
|
492
|
-
size:
|
|
493
|
-
supportingAction:
|
|
494
|
-
} = this,
|
|
495
|
-
return
|
|
269
|
+
heading: t,
|
|
270
|
+
headingLevel: s = "h2",
|
|
271
|
+
isDismissible: c,
|
|
272
|
+
isFooterPinned: w,
|
|
273
|
+
isFullWidthBelowMid: f,
|
|
274
|
+
isLoading: k,
|
|
275
|
+
leadingAction: M,
|
|
276
|
+
position: $,
|
|
277
|
+
size: E,
|
|
278
|
+
supportingAction: D
|
|
279
|
+
} = this, O = F(s);
|
|
280
|
+
return m`
|
|
496
281
|
<dialog
|
|
497
282
|
id="dialog"
|
|
498
283
|
class="c-modal"
|
|
499
|
-
size="${
|
|
500
|
-
position="${
|
|
501
|
-
?hasActions=${
|
|
502
|
-
?hasBackButton=${
|
|
284
|
+
size="${E}"
|
|
285
|
+
position="${$}"
|
|
286
|
+
?hasActions=${M || D}
|
|
287
|
+
?hasBackButton=${o}
|
|
503
288
|
?hasStackedActions=${i}
|
|
504
|
-
?isDismissible=${
|
|
505
|
-
?isFooterPinned=${
|
|
506
|
-
?isFullWidthBelowMid=${
|
|
507
|
-
?isLoading=${
|
|
508
|
-
aria-busy="${
|
|
509
|
-
aria-label="${
|
|
289
|
+
?isDismissible=${c}
|
|
290
|
+
?isFooterPinned=${w}
|
|
291
|
+
?isFullWidthBelowMid=${f}
|
|
292
|
+
?isLoading=${k}
|
|
293
|
+
aria-busy="${k ? "true" : "false"}"
|
|
294
|
+
aria-label="${k && (e == null ? void 0 : e.loading) || d}"
|
|
510
295
|
data-test-id="pie-modal">
|
|
511
296
|
<header class="c-modal-header">
|
|
512
|
-
${
|
|
513
|
-
<${
|
|
514
|
-
${
|
|
515
|
-
</${
|
|
516
|
-
${
|
|
297
|
+
${o ? this.renderBackButton() : d}
|
|
298
|
+
<${O} class="c-modal-heading">
|
|
299
|
+
${t}
|
|
300
|
+
</${O}>
|
|
301
|
+
${c ? this.renderCloseButton() : d}
|
|
517
302
|
</header>
|
|
518
303
|
${// We need to wrap the remaining content in a shared scrollable container if the footer is not pinned
|
|
519
|
-
|
|
304
|
+
w ? this.renderModalContentAndFooter() : m`
|
|
520
305
|
<div class="c-modal-scrollContainer">
|
|
521
306
|
${this.renderModalContentAndFooter()}
|
|
522
307
|
</div>
|
|
@@ -524,68 +309,68 @@ class s extends ie($) {
|
|
|
524
309
|
</dialog>`;
|
|
525
310
|
}
|
|
526
311
|
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
],
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
],
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
],
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
],
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
],
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
],
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
],
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
],
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
],
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
],
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
],
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
],
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
],
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
],
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
],
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
],
|
|
580
|
-
|
|
312
|
+
n.styles = T(G);
|
|
313
|
+
l([
|
|
314
|
+
r({ type: Object })
|
|
315
|
+
], n.prototype, "aria", 2);
|
|
316
|
+
l([
|
|
317
|
+
r({ type: String }),
|
|
318
|
+
R(u)
|
|
319
|
+
], n.prototype, "heading", 2);
|
|
320
|
+
l([
|
|
321
|
+
r(),
|
|
322
|
+
z(u, X, "h2")
|
|
323
|
+
], n.prototype, "headingLevel", 2);
|
|
324
|
+
l([
|
|
325
|
+
r({ type: Boolean })
|
|
326
|
+
], n.prototype, "hasBackButton", 2);
|
|
327
|
+
l([
|
|
328
|
+
r({ type: Boolean })
|
|
329
|
+
], n.prototype, "hasStackedActions", 2);
|
|
330
|
+
l([
|
|
331
|
+
r({ type: Boolean, reflect: !0 })
|
|
332
|
+
], n.prototype, "isDismissible", 2);
|
|
333
|
+
l([
|
|
334
|
+
r({ type: Boolean })
|
|
335
|
+
], n.prototype, "isFooterPinned", 2);
|
|
336
|
+
l([
|
|
337
|
+
r({ type: Boolean })
|
|
338
|
+
], n.prototype, "isFullWidthBelowMid", 2);
|
|
339
|
+
l([
|
|
340
|
+
r({ type: Boolean, reflect: !0 })
|
|
341
|
+
], n.prototype, "isLoading", 2);
|
|
342
|
+
l([
|
|
343
|
+
r({ type: Boolean })
|
|
344
|
+
], n.prototype, "isOpen", 2);
|
|
345
|
+
l([
|
|
346
|
+
r({ type: Object })
|
|
347
|
+
], n.prototype, "leadingAction", 2);
|
|
348
|
+
l([
|
|
349
|
+
r(),
|
|
350
|
+
z(u, Q, "center")
|
|
351
|
+
], n.prototype, "position", 2);
|
|
352
|
+
l([
|
|
353
|
+
r()
|
|
354
|
+
], n.prototype, "returnFocusAfterCloseSelector", 2);
|
|
355
|
+
l([
|
|
356
|
+
r(),
|
|
357
|
+
z(u, J, "medium")
|
|
358
|
+
], n.prototype, "size", 2);
|
|
359
|
+
l([
|
|
360
|
+
r({ type: Object })
|
|
361
|
+
], n.prototype, "supportingAction", 2);
|
|
362
|
+
l([
|
|
363
|
+
N("dialog")
|
|
364
|
+
], n.prototype, "_dialog", 2);
|
|
365
|
+
j(u, n);
|
|
581
366
|
export {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
367
|
+
_ as ON_MODAL_BACK_EVENT,
|
|
368
|
+
x as ON_MODAL_CLOSE_EVENT,
|
|
369
|
+
Z as ON_MODAL_LEADING_ACTION_CLICK,
|
|
370
|
+
v as ON_MODAL_OPEN_EVENT,
|
|
371
|
+
ee as ON_MODAL_SUPPORTING_ACTION_CLICK,
|
|
372
|
+
n as PieModal,
|
|
373
|
+
X as headingLevels,
|
|
374
|
+
Q as positions,
|
|
375
|
+
J as sizes
|
|
591
376
|
};
|
package/dist/react.js
CHANGED
|
@@ -1,67 +1,74 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { PieModal as
|
|
3
|
-
import { ON_MODAL_BACK_EVENT as
|
|
1
|
+
import * as f from "react";
|
|
2
|
+
import { PieModal as E } from "./index.js";
|
|
3
|
+
import { ON_MODAL_BACK_EVENT as V, ON_MODAL_CLOSE_EVENT as $, ON_MODAL_LEADING_ACTION_CLICK as j, ON_MODAL_OPEN_EVENT as B, ON_MODAL_SUPPORTING_ACTION_CLICK as H, headingLevels as U, positions as W, sizes as z } from "./index.js";
|
|
4
4
|
import "lit";
|
|
5
5
|
import "lit/static-html.js";
|
|
6
6
|
import "lit/decorators.js";
|
|
7
|
+
import "@justeattakeaway/pie-button";
|
|
8
|
+
import "@justeattakeaway/pie-icon-button";
|
|
9
|
+
import "@justeattakeaway/pie-webc-core";
|
|
10
|
+
import "@justeattakeaway/pie-icons-webc/IconClose";
|
|
11
|
+
import "@justeattakeaway/pie-icons-webc/IconChevronLeft";
|
|
12
|
+
import "@justeattakeaway/pie-icons-webc/IconChevronRight";
|
|
7
13
|
/**
|
|
8
14
|
* @license
|
|
9
15
|
* Copyright 2018 Google LLC
|
|
10
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
17
|
*/
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
let l =
|
|
16
|
-
l === void 0 &&
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
})(
|
|
18
|
+
const C = /* @__PURE__ */ new Set(["children", "localName", "ref", "style", "className"]), O = /* @__PURE__ */ new WeakMap(), L = (o, t, d, c, m) => {
|
|
19
|
+
const s = m == null ? void 0 : m[t];
|
|
20
|
+
s === void 0 || d === c ? d == null && t in HTMLElement.prototype ? o.removeAttribute(t) : o[t] = d : ((a, i, h) => {
|
|
21
|
+
let l = O.get(a);
|
|
22
|
+
l === void 0 && O.set(a, l = /* @__PURE__ */ new Map());
|
|
23
|
+
let r = l.get(i);
|
|
24
|
+
h !== void 0 ? r === void 0 ? (l.set(i, r = { handleEvent: h }), a.addEventListener(i, r)) : r.handleEvent = h : r !== void 0 && (l.delete(i), a.removeEventListener(i, r));
|
|
25
|
+
})(o, s, d);
|
|
26
|
+
}, A = (o, t) => {
|
|
27
|
+
typeof o == "function" ? o(t) : o.current = t;
|
|
20
28
|
};
|
|
21
|
-
function
|
|
22
|
-
let
|
|
23
|
-
if (
|
|
24
|
-
const
|
|
25
|
-
({ tagName:
|
|
29
|
+
function y(o = window.React, t, d, c, m) {
|
|
30
|
+
let s, a, i;
|
|
31
|
+
if (t === void 0) {
|
|
32
|
+
const p = o;
|
|
33
|
+
({ tagName: a, elementClass: i, events: c, displayName: m } = p), s = p.react;
|
|
26
34
|
} else
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
class v extends
|
|
35
|
+
s = o, i = d, a = t;
|
|
36
|
+
const h = s.Component, l = s.createElement, r = new Set(Object.keys(c ?? {}));
|
|
37
|
+
class v extends h {
|
|
30
38
|
constructor() {
|
|
31
39
|
super(...arguments), this.o = null;
|
|
32
40
|
}
|
|
33
41
|
t(e) {
|
|
34
42
|
if (this.o !== null)
|
|
35
|
-
for (const
|
|
36
|
-
|
|
43
|
+
for (const u in this.i)
|
|
44
|
+
L(this.o, u, this.props[u], e ? e[u] : void 0, c);
|
|
37
45
|
}
|
|
38
46
|
componentDidMount() {
|
|
39
|
-
|
|
47
|
+
var e;
|
|
48
|
+
this.t(), (e = this.o) === null || e === void 0 || e.removeAttribute("defer-hydration");
|
|
40
49
|
}
|
|
41
50
|
componentDidUpdate(e) {
|
|
42
51
|
this.t(e);
|
|
43
52
|
}
|
|
44
53
|
render() {
|
|
45
|
-
const { _$Gl: e, ...
|
|
46
|
-
this.h !== e && (this.u = (
|
|
47
|
-
e !== null && (
|
|
48
|
-
typeof r == "function" ? r(O) : r.current = O;
|
|
49
|
-
})(e, o), this.o = o, this.h = e;
|
|
54
|
+
const { _$Gl: e, ...u } = this.props;
|
|
55
|
+
this.h !== e && (this.u = (n) => {
|
|
56
|
+
e !== null && A(e, n), this.o = n, this.h = e;
|
|
50
57
|
}), this.i = {};
|
|
51
|
-
const
|
|
52
|
-
for (const [
|
|
53
|
-
|
|
54
|
-
return l(
|
|
58
|
+
const N = { ref: this.u };
|
|
59
|
+
for (const [n, _] of Object.entries(u))
|
|
60
|
+
C.has(n) ? N[n === "className" ? "class" : n] = _ : r.has(n) || n in i.prototype ? this.i[n] = _ : N[n] = _;
|
|
61
|
+
return N.suppressHydrationWarning = !0, l(a, N);
|
|
55
62
|
}
|
|
56
63
|
}
|
|
57
|
-
v.displayName =
|
|
58
|
-
const M =
|
|
64
|
+
v.displayName = m ?? i.name;
|
|
65
|
+
const M = s.forwardRef((p, e) => l(v, { ...p, _$Gl: e }, p == null ? void 0 : p.children));
|
|
59
66
|
return M.displayName = v.displayName, M;
|
|
60
67
|
}
|
|
61
|
-
const
|
|
68
|
+
const R = y({
|
|
62
69
|
displayName: "PieModal",
|
|
63
|
-
elementClass:
|
|
64
|
-
react:
|
|
70
|
+
elementClass: E,
|
|
71
|
+
react: f,
|
|
65
72
|
tagName: "pie-modal",
|
|
66
73
|
events: {
|
|
67
74
|
onPieModalOpen: "pie-modal-open",
|
|
@@ -77,13 +84,13 @@ const w = P({
|
|
|
77
84
|
}
|
|
78
85
|
});
|
|
79
86
|
export {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
V as ON_MODAL_BACK_EVENT,
|
|
88
|
+
$ as ON_MODAL_CLOSE_EVENT,
|
|
89
|
+
j as ON_MODAL_LEADING_ACTION_CLICK,
|
|
90
|
+
B as ON_MODAL_OPEN_EVENT,
|
|
91
|
+
H as ON_MODAL_SUPPORTING_ACTION_CLICK,
|
|
92
|
+
R as PieModal,
|
|
93
|
+
U as headingLevels,
|
|
94
|
+
W as positions,
|
|
95
|
+
z as sizes
|
|
89
96
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-modal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "PIE design system modal built using web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,10 +29,7 @@
|
|
|
29
29
|
"license": "Apache-2.0",
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@justeat/pie-design-tokens": "5.8.2",
|
|
32
|
-
"@justeattakeaway/pie-button": "0.35.0",
|
|
33
32
|
"@justeattakeaway/pie-components-config": "0.4.0",
|
|
34
|
-
"@justeattakeaway/pie-icon-button": "0.19.0",
|
|
35
|
-
"@justeattakeaway/pie-icons-webc": "0.11.1",
|
|
36
33
|
"@justeattakeaway/pie-webc-core": "0.11.0",
|
|
37
34
|
"@types/body-scroll-lock": "3.1.1"
|
|
38
35
|
},
|
|
@@ -43,6 +40,9 @@
|
|
|
43
40
|
"extends": "../../../package.json"
|
|
44
41
|
},
|
|
45
42
|
"dependencies": {
|
|
43
|
+
"@justeattakeaway/pie-button": "0.36.1",
|
|
44
|
+
"@justeattakeaway/pie-icon-button": "0.21.1",
|
|
45
|
+
"@justeattakeaway/pie-icons-webc": "0.11.1",
|
|
46
46
|
"dialog-polyfill": "0.5.6"
|
|
47
47
|
},
|
|
48
48
|
"sideEffects": [
|
package/src/index.ts
CHANGED
|
@@ -3,13 +3,16 @@ import {
|
|
|
3
3
|
} from 'lit';
|
|
4
4
|
import { html, unsafeStatic } from 'lit/static-html.js';
|
|
5
5
|
import { property, query } from 'lit/decorators.js';
|
|
6
|
+
import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
|
|
7
|
+
|
|
8
|
+
import '@justeattakeaway/pie-button';
|
|
9
|
+
import '@justeattakeaway/pie-icon-button';
|
|
6
10
|
import {
|
|
7
11
|
requiredProperty, RtlMixin, validPropertyValues, defineCustomElement,
|
|
8
12
|
} from '@justeattakeaway/pie-webc-core';
|
|
9
13
|
import '@justeattakeaway/pie-icons-webc/IconClose';
|
|
10
14
|
import '@justeattakeaway/pie-icons-webc/IconChevronLeft';
|
|
11
15
|
import '@justeattakeaway/pie-icons-webc/IconChevronRight';
|
|
12
|
-
import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
|
|
13
16
|
|
|
14
17
|
import styles from './modal.scss?inline';
|
|
15
18
|
import {
|