@justeattakeaway/pie-modal 0.38.8 → 0.40.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 +43 -41
- package/package.json +7 -7
- package/src/index.ts +4 -2
- package/src/modal.scss +4 -10
package/dist/index.js
CHANGED
|
@@ -34,8 +34,8 @@ var S = typeof window < "u" && window.navigator && window.navigator.platform &&
|
|
|
34
34
|
return M(i.target) || i.touches.length > 1 ? !0 : (i.preventDefault && i.preventDefault(), !1);
|
|
35
35
|
}, V = function(e) {
|
|
36
36
|
if (f === void 0) {
|
|
37
|
-
var i = !!e && e.reserveScrollBarGap === !0,
|
|
38
|
-
i &&
|
|
37
|
+
var i = !!e && e.reserveScrollBarGap === !0, t = window.innerWidth - document.documentElement.clientWidth;
|
|
38
|
+
i && t > 0 && (f = document.body.style.paddingRight, document.body.style.paddingRight = t + "px");
|
|
39
39
|
}
|
|
40
40
|
u === void 0 && (u = document.body.style.overflow, document.body.style.overflow = "hidden");
|
|
41
41
|
}, q = function() {
|
|
@@ -43,24 +43,24 @@ var S = typeof window < "u" && window.navigator && window.navigator.platform &&
|
|
|
43
43
|
}, H = function(e) {
|
|
44
44
|
return e ? e.scrollHeight - e.scrollTop <= e.clientHeight : !1;
|
|
45
45
|
}, U = function(e, i) {
|
|
46
|
-
var
|
|
47
|
-
return M(e.target) ? !1 : i && i.scrollTop === 0 &&
|
|
46
|
+
var t = e.targetTouches[0].clientY - L;
|
|
47
|
+
return M(e.target) ? !1 : i && i.scrollTop === 0 && t > 0 || H(i) && t < 0 ? y(e) : (e.stopPropagation(), !0);
|
|
48
48
|
}, K = function(e, i) {
|
|
49
49
|
if (!e) {
|
|
50
50
|
console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
if (!g.some(function(
|
|
54
|
-
return
|
|
53
|
+
if (!g.some(function(o) {
|
|
54
|
+
return o.targetElement === e;
|
|
55
55
|
})) {
|
|
56
|
-
var
|
|
56
|
+
var t = {
|
|
57
57
|
targetElement: e,
|
|
58
58
|
options: i || {}
|
|
59
59
|
};
|
|
60
|
-
g = [].concat(Y(g), [
|
|
61
|
-
|
|
62
|
-
}, e.ontouchmove = function(
|
|
63
|
-
|
|
60
|
+
g = [].concat(Y(g), [t]), S ? (e.ontouchstart = function(o) {
|
|
61
|
+
o.targetTouches.length === 1 && (L = o.targetTouches[0].clientY);
|
|
62
|
+
}, e.ontouchmove = function(o) {
|
|
63
|
+
o.targetTouches.length === 1 && U(o, e);
|
|
64
64
|
}, w || (document.addEventListener("touchmove", y, O ? { passive: !1 } : void 0), w = !0)) : V(i);
|
|
65
65
|
}
|
|
66
66
|
}, G = function(e) {
|
|
@@ -72,12 +72,12 @@ var S = typeof window < "u" && window.navigator && window.navigator.platform &&
|
|
|
72
72
|
return i.targetElement !== e;
|
|
73
73
|
}), S ? (e.ontouchstart = null, e.ontouchmove = null, w && g.length === 0 && (document.removeEventListener("touchmove", y, O ? { passive: !1 } : void 0), w = !1)) : g.length || q();
|
|
74
74
|
};
|
|
75
|
-
const X =
|
|
75
|
+
const X = `*,*:after,*:before{box-sizing:inherit}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%)}.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 (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)}}.c-modal[size=large]{--modal-inline-size: 75%;--modal-max-inline-size: var(--modal-size-l);--modal-margin-block: var(--modal-margin-large)}@media (width < 768px){.c-modal[size=large],.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]>.c-modal-scrollContainer,.c-modal[size=medium][isfullwidthbelowmid]>.c-modal-scrollContainer{block-size:100%}}.c-modal[position=top]{margin-block-start:var(--dt-spacing-j);max-block-size:calc(100% - var(--dt-spacing-j) * 2)}@media (width < 768px){.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 (width < 768px){.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-start:var(--dt-spacing-d);margin-inline-end: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-start:var(--dt-spacing-e);margin-inline-end: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-start:var(--dt-spacing-b);margin-block-end:var(--dt-spacing-b);margin-inline-start:var(--dt-spacing-b);margin-inline-end:var(--dt-spacing-none)}@media (min-width: 768px){.c-modal .c-modal-backBtn{margin-block-start:var(--dt-spacing-c);margin-block-end:var(--dt-spacing-c);margin-inline-start:var(--dt-spacing-c);margin-inline-end:var(--dt-spacing-none)}}.c-modal .c-modal-closeBtn{grid-area:close;margin-block-start:var(--dt-spacing-b);margin-block-end:var(--dt-spacing-b);margin-inline-start:var(--dt-spacing-none);margin-inline-end:var(--dt-spacing-b)}@media (min-width: 768px){.c-modal .c-modal-closeBtn{margin-block-start:var(--dt-spacing-c);margin-block-end:var(--dt-spacing-c);margin-inline-start:var(--dt-spacing-none);margin-inline-end: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);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-start:var(--modal-content-padding-inline);padding-inline-end:var(--modal-content-padding-inline);padding-block-start:var(--modal-content-padding-block);padding-block-end: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-scrollContainer{display:flex;flex-direction:column;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 pie-spinner{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}.c-modal[isLoading] .c-modal-content .c-modal-contentInner{display:none}@supports not (aspect-ratio: 1/1){.c-modal .c-modal-scrollContainer{background:none}}
|
|
76
76
|
`, J = ["h1", "h2", "h3", "h4", "h5", "h6"], Q = ["small", "medium", "large"], Z = ["top", "center"], _ = "pie-modal-close", k = "pie-modal-open", z = "pie-modal-back", ee = "pie-modal-leading-action-click", ie = "pie-modal-supporting-action-click";
|
|
77
|
-
var
|
|
78
|
-
for (var
|
|
79
|
-
(c = n[r]) && (
|
|
80
|
-
return
|
|
77
|
+
var te = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, l = (n, e, i, t) => {
|
|
78
|
+
for (var o = t > 1 ? void 0 : t ? oe(e, i) : e, r = n.length - 1, c; r >= 0; r--)
|
|
79
|
+
(c = n[r]) && (o = (t ? c(e, i, o) : c(o)) || o);
|
|
80
|
+
return t && o && te(e, i, o), o;
|
|
81
81
|
};
|
|
82
82
|
const v = "pie-modal";
|
|
83
83
|
class a extends R(P) {
|
|
@@ -89,14 +89,14 @@ class a extends R(P) {
|
|
|
89
89
|
if (!this.isDismissible)
|
|
90
90
|
return;
|
|
91
91
|
const i = (b = this._dialog) == null ? void 0 : b.getBoundingClientRect(), {
|
|
92
|
-
top:
|
|
93
|
-
bottom:
|
|
92
|
+
top: t = 0,
|
|
93
|
+
bottom: o = 0,
|
|
94
94
|
left: r = 0,
|
|
95
95
|
right: c = 0
|
|
96
96
|
} = i || {};
|
|
97
|
-
if (
|
|
97
|
+
if (t === 0 && o === 0 && r === 0 && c === 0)
|
|
98
98
|
return;
|
|
99
|
-
(e.clientY <
|
|
99
|
+
(e.clientY < t || e.clientY > o || e.clientX < r || e.clientX > c) && (this.isOpen = !1);
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
connectedCallback() {
|
|
@@ -106,7 +106,7 @@ class a extends R(P) {
|
|
|
106
106
|
document.removeEventListener(k, (e) => this._handleModalOpened(e)), document.removeEventListener(_, (e) => this._handleModalClosed(e)), document.removeEventListener(z, (e) => this._handleModalClosed(e)), super.disconnectedCallback();
|
|
107
107
|
}
|
|
108
108
|
async firstUpdated(e) {
|
|
109
|
-
super.firstUpdated(e), this._dialog && ((await import("./dialog-polyfill.esm-209f54f8.js").then((
|
|
109
|
+
super.firstUpdated(e), this._dialog && ((await import("./dialog-polyfill.esm-209f54f8.js").then((t) => t.default)).registerDialog(this._dialog), this._dialog.addEventListener("cancel", (t) => this._handleDialogCancelEvent(t)), this._dialog.addEventListener("close", () => {
|
|
110
110
|
this.isOpen = !1;
|
|
111
111
|
})), this._handleModalOpenStateOnFirstRender(e);
|
|
112
112
|
}
|
|
@@ -117,11 +117,11 @@ class a extends R(P) {
|
|
|
117
117
|
* Opens the dialog element and disables page scrolling
|
|
118
118
|
*/
|
|
119
119
|
_handleModalOpened(e) {
|
|
120
|
-
var
|
|
120
|
+
var t, o, r, c;
|
|
121
121
|
const { targetModal: i } = e.detail;
|
|
122
122
|
if (i === this) {
|
|
123
|
-
const p = (
|
|
124
|
-
if (p && ("scrollTo" in window && window.scrollTo(0, 0), K(p)), (
|
|
123
|
+
const p = (t = this._dialog) == null ? void 0 : t.querySelector(".c-modal-scrollContainer");
|
|
124
|
+
if (p && ("scrollTo" in window && window.scrollTo(0, 0), K(p)), (o = this._dialog) != null && o.hasAttribute("open") || !((r = this._dialog) != null && r.isConnected))
|
|
125
125
|
return;
|
|
126
126
|
(c = this._dialog) == null || c.showModal();
|
|
127
127
|
}
|
|
@@ -130,11 +130,11 @@ class a extends R(P) {
|
|
|
130
130
|
* Closes the dialog element and re-enables page scrolling
|
|
131
131
|
*/
|
|
132
132
|
_handleModalClosed(e) {
|
|
133
|
-
var
|
|
133
|
+
var t, o;
|
|
134
134
|
const { targetModal: i } = e.detail;
|
|
135
135
|
if (i === this) {
|
|
136
|
-
const r = (
|
|
137
|
-
r && G(r), (
|
|
136
|
+
const r = (t = this._dialog) == null ? void 0 : t.querySelector(".c-modal-scrollContainer");
|
|
137
|
+
r && G(r), (o = this._dialog) == null || o.close(), this._returnFocus();
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
// Handles the value of the isOpen property on first render of the component
|
|
@@ -147,17 +147,17 @@ class a extends R(P) {
|
|
|
147
147
|
i !== void 0 && (i ? this._backButtonClicked ? (this._backButtonClicked = !1, h(this, z, { targetModal: this })) : h(this, _, { targetModal: this }) : h(this, k, { targetModal: this }));
|
|
148
148
|
}
|
|
149
149
|
_handleActionClick(e) {
|
|
150
|
-
var i,
|
|
151
|
-
e === "leading" ? ((i = this._dialog) == null || i.close("leading"), h(this, ee, { targetModal: this })) : e === "supporting" && ((
|
|
150
|
+
var i, t;
|
|
151
|
+
e === "leading" ? ((i = this._dialog) == null || i.close("leading"), h(this, ee, { targetModal: this })) : e === "supporting" && ((t = this._dialog) == null || t.close("supporting"), h(this, ie, { targetModal: this }));
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
154
|
* Return focus to the specified element, providing the selector is valid
|
|
155
155
|
* and the chosen element can be found.
|
|
156
156
|
*/
|
|
157
157
|
_returnFocus() {
|
|
158
|
-
var i,
|
|
158
|
+
var i, t;
|
|
159
159
|
const e = (i = this.returnFocusAfterCloseSelector) == null ? void 0 : i.trim();
|
|
160
|
-
e && ((
|
|
160
|
+
e && ((t = document.querySelector(e)) == null || t.focus());
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
163
|
* Template for the close button element. Called within the
|
|
@@ -210,11 +210,11 @@ class a extends R(P) {
|
|
|
210
210
|
* @private
|
|
211
211
|
*/
|
|
212
212
|
renderLeadingAction() {
|
|
213
|
-
const { text: e, variant: i = "primary", ariaLabel:
|
|
213
|
+
const { text: e, variant: i = "primary", ariaLabel: t } = this.leadingAction;
|
|
214
214
|
return e ? m`
|
|
215
215
|
<pie-button
|
|
216
216
|
variant="${i}"
|
|
217
|
-
aria-label="${
|
|
217
|
+
aria-label="${t || s}"
|
|
218
218
|
type="submit"
|
|
219
219
|
?isFullWidth="${this.hasStackedActions}"
|
|
220
220
|
@click="${() => this._handleActionClick("leading")}"
|
|
@@ -235,11 +235,11 @@ class a extends R(P) {
|
|
|
235
235
|
* @private
|
|
236
236
|
*/
|
|
237
237
|
renderSupportingAction() {
|
|
238
|
-
const { text: e, variant: i = "ghost", ariaLabel:
|
|
238
|
+
const { text: e, variant: i = "ghost", ariaLabel: t } = this.supportingAction;
|
|
239
239
|
return e ? this.leadingAction ? m`
|
|
240
240
|
<pie-button
|
|
241
241
|
variant="${i}"
|
|
242
|
-
aria-label="${
|
|
242
|
+
aria-label="${t || s}"
|
|
243
243
|
type="reset"
|
|
244
244
|
?isFullWidth="${this.hasStackedActions}"
|
|
245
245
|
@click="${() => this._handleActionClick("supporting")}"
|
|
@@ -255,7 +255,8 @@ class a extends R(P) {
|
|
|
255
255
|
renderModalContentAndFooter() {
|
|
256
256
|
return m`
|
|
257
257
|
<article class="c-modal-scrollContainer c-modal-content c-modal-content--scrollable">
|
|
258
|
-
<div class="c-modal-contentInner"
|
|
258
|
+
<div class="c-modal-contentInner"
|
|
259
|
+
data-test-id="modal-content-inner">
|
|
259
260
|
<slot></slot>
|
|
260
261
|
</div>
|
|
261
262
|
${this.isLoading ? m`<pie-spinner size="xlarge" variant="secondary"></pie-spinner>` : s}
|
|
@@ -269,8 +270,8 @@ class a extends R(P) {
|
|
|
269
270
|
const {
|
|
270
271
|
aria: e,
|
|
271
272
|
hasBackButton: i,
|
|
272
|
-
hasStackedActions:
|
|
273
|
-
heading:
|
|
273
|
+
hasStackedActions: t,
|
|
274
|
+
heading: o,
|
|
274
275
|
headingLevel: r = "h2",
|
|
275
276
|
isDismissible: c,
|
|
276
277
|
isFooterPinned: p,
|
|
@@ -289,7 +290,7 @@ class a extends R(P) {
|
|
|
289
290
|
position="${D || "center"}"
|
|
290
291
|
?hasActions=${$ || T}
|
|
291
292
|
?hasBackButton=${i}
|
|
292
|
-
?hasStackedActions=${
|
|
293
|
+
?hasStackedActions=${t}
|
|
293
294
|
?isDismissible=${c}
|
|
294
295
|
?isFooterPinned=${p}
|
|
295
296
|
?isFullWidthBelowMid=${b}
|
|
@@ -297,10 +298,11 @@ class a extends R(P) {
|
|
|
297
298
|
aria-busy="${x ? "true" : "false"}"
|
|
298
299
|
aria-label="${x && (e == null ? void 0 : e.loading) || s}"
|
|
299
300
|
data-test-id="pie-modal">
|
|
300
|
-
<header class="c-modal-header"
|
|
301
|
+
<header class="c-modal-header"
|
|
302
|
+
data-test-id="modal-header">
|
|
301
303
|
${i ? this.renderBackButton() : s}
|
|
302
304
|
<${A} class="c-modal-heading">
|
|
303
|
-
${
|
|
305
|
+
${o}
|
|
304
306
|
</${A}>
|
|
305
307
|
${c ? this.renderCloseButton() : s}
|
|
306
308
|
</header>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-modal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"description": "PIE design system modal built using web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
35
35
|
"@justeat/pie-design-tokens": "5.9.0",
|
|
36
|
-
"@justeattakeaway/pie-components-config": "0.
|
|
36
|
+
"@justeattakeaway/pie-components-config": "0.12.0",
|
|
37
37
|
"@justeattakeaway/pie-wrapper-react": "0.14.0",
|
|
38
38
|
"@types/body-scroll-lock": "3.1.2",
|
|
39
39
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"extends": "../../../package.json"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@justeattakeaway/pie-button": "0.45.
|
|
46
|
-
"@justeattakeaway/pie-icon-button": "0.27.
|
|
47
|
-
"@justeattakeaway/pie-icons-webc": "0.19.
|
|
48
|
-
"@justeattakeaway/pie-spinner": "0.5.
|
|
49
|
-
"@justeattakeaway/pie-webc-core": "0.19.
|
|
45
|
+
"@justeattakeaway/pie-button": "0.45.6",
|
|
46
|
+
"@justeattakeaway/pie-icon-button": "0.27.7",
|
|
47
|
+
"@justeattakeaway/pie-icons-webc": "0.19.1",
|
|
48
|
+
"@justeattakeaway/pie-spinner": "0.5.5",
|
|
49
|
+
"@justeattakeaway/pie-webc-core": "0.19.1",
|
|
50
50
|
"body-scroll-lock": "3.1.5",
|
|
51
51
|
"dialog-polyfill": "0.5.6"
|
|
52
52
|
},
|
package/src/index.ts
CHANGED
|
@@ -361,7 +361,8 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps {
|
|
|
361
361
|
private renderModalContentAndFooter (): TemplateResult {
|
|
362
362
|
return html`
|
|
363
363
|
<article class="c-modal-scrollContainer c-modal-content c-modal-content--scrollable">
|
|
364
|
-
<div class="c-modal-contentInner"
|
|
364
|
+
<div class="c-modal-contentInner"
|
|
365
|
+
data-test-id="modal-content-inner">
|
|
365
366
|
<slot></slot>
|
|
366
367
|
</div>
|
|
367
368
|
${this.isLoading ? html`<pie-spinner size="xlarge" variant="secondary"></pie-spinner>` : nothing}
|
|
@@ -407,7 +408,8 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps {
|
|
|
407
408
|
aria-busy="${isLoading ? 'true' : 'false'}"
|
|
408
409
|
aria-label="${(isLoading && aria?.loading) || nothing}"
|
|
409
410
|
data-test-id="pie-modal">
|
|
410
|
-
<header class="c-modal-header"
|
|
411
|
+
<header class="c-modal-header"
|
|
412
|
+
data-test-id="modal-header">
|
|
411
413
|
${hasBackButton ? this.renderBackButton() : nothing}
|
|
412
414
|
<${headingTag} class="c-modal-heading">
|
|
413
415
|
${heading}
|
package/src/modal.scss
CHANGED
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
@use '@justeat/pie-design-tokens/dist/jet.scss' as dt;
|
|
3
3
|
@use 'dialog-polyfill/dist/dialog-polyfill.css';
|
|
4
4
|
|
|
5
|
-
*,
|
|
6
|
-
*:before,
|
|
7
|
-
*:after {
|
|
8
|
-
box-sizing: border-box;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
5
|
.c-modal {
|
|
12
6
|
// Custom Property Declarations
|
|
13
7
|
// These are defined here instead of :host to encapsulate them inside Shadow DOM
|
|
@@ -29,7 +23,7 @@
|
|
|
29
23
|
|
|
30
24
|
// We need to override the icon sizes at different screen sizes regardless of size prop passed in
|
|
31
25
|
pie-icon-button {
|
|
32
|
-
@media (
|
|
26
|
+
@media (width < $breakpoint-wide) {
|
|
33
27
|
--btn-dimension: 40px;
|
|
34
28
|
}
|
|
35
29
|
}
|
|
@@ -93,7 +87,7 @@
|
|
|
93
87
|
// Fullscreen styles
|
|
94
88
|
&[size='large'],
|
|
95
89
|
&[size='medium'][isfullwidthbelowmid] {
|
|
96
|
-
@media (
|
|
90
|
+
@media (width < $breakpoint-wide) {
|
|
97
91
|
--modal-margin-block: var(--modal-margin-none);
|
|
98
92
|
--modal-border-radius: var(--dt-radius-rounded-none);
|
|
99
93
|
--modal-block-size: 100%;
|
|
@@ -116,7 +110,7 @@
|
|
|
116
110
|
|
|
117
111
|
&[size='large'],
|
|
118
112
|
&[isfullwidthbelowmid][size='medium'] {
|
|
119
|
-
@media (
|
|
113
|
+
@media (width < $breakpoint-wide) {
|
|
120
114
|
margin-block-start: var(--dt-spacing-none);
|
|
121
115
|
max-block-size: 100%;
|
|
122
116
|
}
|
|
@@ -149,7 +143,7 @@
|
|
|
149
143
|
&[hasstackedactions] {
|
|
150
144
|
& .c-modal-footer {
|
|
151
145
|
// TODO: Move breakpoint sizes into shared CSS component utilities
|
|
152
|
-
@media (
|
|
146
|
+
@media (width < $breakpoint-wide) {
|
|
153
147
|
flex-direction: column;
|
|
154
148
|
}
|
|
155
149
|
}
|