@justeattakeaway/pie-modal 0.38.7 → 0.39.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 CHANGED
@@ -8,13 +8,13 @@ import "@justeattakeaway/pie-icons-webc/IconClose";
8
8
  import "@justeattakeaway/pie-icons-webc/IconChevronLeft";
9
9
  import "@justeattakeaway/pie-icons-webc/IconChevronRight";
10
10
  import "@justeattakeaway/pie-spinner";
11
- function Y(n) {
12
- if (Array.isArray(n)) {
13
- for (var e = 0, i = Array(n.length); e < n.length; e++)
14
- i[e] = n[e];
11
+ function Y(a) {
12
+ if (Array.isArray(a)) {
13
+ for (var e = 0, i = Array(a.length); e < a.length; e++)
14
+ i[e] = a[e];
15
15
  return i;
16
16
  } else
17
- return Array.from(n);
17
+ return Array.from(a);
18
18
  }
19
19
  var O = !1;
20
20
  if (typeof window < "u") {
@@ -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, o = window.innerWidth - document.documentElement.clientWidth;
38
- i && o > 0 && (f = document.body.style.paddingRight, document.body.style.paddingRight = o + "px");
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 o = e.targetTouches[0].clientY - L;
47
- return M(e.target) ? !1 : i && i.scrollTop === 0 && o > 0 || H(i) && o < 0 ? y(e) : (e.stopPropagation(), !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(t) {
54
- return t.targetElement === e;
53
+ if (!g.some(function(o) {
54
+ return o.targetElement === e;
55
55
  })) {
56
- var o = {
56
+ var t = {
57
57
  targetElement: e,
58
58
  options: i || {}
59
59
  };
60
- g = [].concat(Y(g), [o]), S ? (e.ontouchstart = function(t) {
61
- t.targetTouches.length === 1 && (L = t.targetTouches[0].clientY);
62
- }, e.ontouchmove = function(t) {
63
- t.targetTouches.length === 1 && U(t, e);
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,15 +72,15 @@ 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 = `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}.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)}}.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],.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 (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-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}}
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 oe = Object.defineProperty, te = Object.getOwnPropertyDescriptor, l = (n, e, i, o) => {
78
- for (var t = o > 1 ? void 0 : o ? te(e, i) : e, r = n.length - 1, c; r >= 0; r--)
79
- (c = n[r]) && (t = (o ? c(e, i, t) : c(t)) || t);
80
- return o && t && oe(e, i, t), t;
77
+ var te = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, l = (a, e, i, t) => {
78
+ for (var o = t > 1 ? void 0 : t ? oe(e, i) : e, r = a.length - 1, c; r >= 0; r--)
79
+ (c = a[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
- class a extends R(P) {
83
+ class n extends R(P) {
84
84
  constructor() {
85
85
  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) => {
86
86
  this.isDismissible || e.preventDefault();
@@ -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: o = 0,
93
- bottom: t = 0,
92
+ top: t = 0,
93
+ bottom: o = 0,
94
94
  left: r = 0,
95
95
  right: c = 0
96
96
  } = i || {};
97
- if (o === 0 && t === 0 && r === 0 && c === 0)
97
+ if (t === 0 && o === 0 && r === 0 && c === 0)
98
98
  return;
99
- (e.clientY < o || e.clientY > t || e.clientX < r || e.clientX > c) && (this.isOpen = !1);
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((o) => o.default)).registerDialog(this._dialog), this._dialog.addEventListener("cancel", (o) => this._handleDialogCancelEvent(o)), this._dialog.addEventListener("close", () => {
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 o, t, r, c;
120
+ var t, o, r, c;
121
121
  const { targetModal: i } = e.detail;
122
122
  if (i === this) {
123
- const p = (o = this._dialog) == null ? void 0 : o.querySelector(".c-modal-scrollContainer");
124
- if (p && ("scrollTo" in window && window.scrollTo(0, 0), K(p)), (t = this._dialog) != null && t.hasAttribute("open") || !((r = this._dialog) != null && r.isConnected))
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 o, t;
133
+ var t, o;
134
134
  const { targetModal: i } = e.detail;
135
135
  if (i === this) {
136
- const r = (o = this._dialog) == null ? void 0 : o.querySelector(".c-modal-scrollContainer");
137
- r && G(r), (t = this._dialog) == null || t.close(), this._returnFocus();
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, o;
151
- e === "leading" ? ((i = this._dialog) == null || i.close("leading"), h(this, ee, { targetModal: this })) : e === "supporting" && ((o = this._dialog) == null || o.close("supporting"), h(this, ie, { targetModal: this }));
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, o;
158
+ var i, t;
159
159
  const e = (i = this.returnFocusAfterCloseSelector) == null ? void 0 : i.trim();
160
- e && ((o = document.querySelector(e)) == null || o.focus());
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: o } = this.leadingAction;
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="${o || s}"
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: o } = this.supportingAction;
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="${o || s}"
242
+ aria-label="${t || s}"
243
243
  type="reset"
244
244
  ?isFullWidth="${this.hasStackedActions}"
245
245
  @click="${() => this._handleActionClick("supporting")}"
@@ -269,8 +269,8 @@ class a extends R(P) {
269
269
  const {
270
270
  aria: e,
271
271
  hasBackButton: i,
272
- hasStackedActions: o,
273
- heading: t,
272
+ hasStackedActions: t,
273
+ heading: o,
274
274
  headingLevel: r = "h2",
275
275
  isDismissible: c,
276
276
  isFooterPinned: p,
@@ -289,7 +289,7 @@ class a extends R(P) {
289
289
  position="${D || "center"}"
290
290
  ?hasActions=${$ || T}
291
291
  ?hasBackButton=${i}
292
- ?hasStackedActions=${o}
292
+ ?hasStackedActions=${t}
293
293
  ?isDismissible=${c}
294
294
  ?isFooterPinned=${p}
295
295
  ?isFullWidthBelowMid=${b}
@@ -300,7 +300,7 @@ class a extends R(P) {
300
300
  <header class="c-modal-header">
301
301
  ${i ? this.renderBackButton() : s}
302
302
  <${A} class="c-modal-heading">
303
- ${t}
303
+ ${o}
304
304
  </${A}>
305
305
  ${c ? this.renderCloseButton() : s}
306
306
  </header>
@@ -313,67 +313,67 @@ class a extends R(P) {
313
313
  </dialog>`;
314
314
  }
315
315
  }
316
- a.styles = F(X);
316
+ n.styles = F(X);
317
317
  l([
318
318
  d({ type: Object })
319
- ], a.prototype, "aria", 2);
319
+ ], n.prototype, "aria", 2);
320
320
  l([
321
321
  d({ type: String }),
322
322
  j(v)
323
- ], a.prototype, "heading", 2);
323
+ ], n.prototype, "heading", 2);
324
324
  l([
325
325
  d(),
326
326
  C(v, J, "h2")
327
- ], a.prototype, "headingLevel", 2);
327
+ ], n.prototype, "headingLevel", 2);
328
328
  l([
329
329
  d({ type: Boolean })
330
- ], a.prototype, "hasBackButton", 2);
330
+ ], n.prototype, "hasBackButton", 2);
331
331
  l([
332
332
  d({ type: Boolean })
333
- ], a.prototype, "hasStackedActions", 2);
333
+ ], n.prototype, "hasStackedActions", 2);
334
334
  l([
335
335
  d({ type: Boolean, reflect: !0 })
336
- ], a.prototype, "isDismissible", 2);
336
+ ], n.prototype, "isDismissible", 2);
337
337
  l([
338
338
  d({ type: Boolean })
339
- ], a.prototype, "isFooterPinned", 2);
339
+ ], n.prototype, "isFooterPinned", 2);
340
340
  l([
341
341
  d({ type: Boolean })
342
- ], a.prototype, "isFullWidthBelowMid", 2);
342
+ ], n.prototype, "isFullWidthBelowMid", 2);
343
343
  l([
344
344
  d({ type: Boolean, reflect: !0 })
345
- ], a.prototype, "isLoading", 2);
345
+ ], n.prototype, "isLoading", 2);
346
346
  l([
347
347
  d({ type: Boolean })
348
- ], a.prototype, "isOpen", 2);
348
+ ], n.prototype, "isOpen", 2);
349
349
  l([
350
350
  d({ type: Object })
351
- ], a.prototype, "leadingAction", 2);
351
+ ], n.prototype, "leadingAction", 2);
352
352
  l([
353
353
  d(),
354
354
  C(v, Z, "center")
355
- ], a.prototype, "position", 2);
355
+ ], n.prototype, "position", 2);
356
356
  l([
357
357
  d()
358
- ], a.prototype, "returnFocusAfterCloseSelector", 2);
358
+ ], n.prototype, "returnFocusAfterCloseSelector", 2);
359
359
  l([
360
360
  d(),
361
361
  C(v, Q, "medium")
362
- ], a.prototype, "size", 2);
362
+ ], n.prototype, "size", 2);
363
363
  l([
364
364
  d({ type: Object })
365
- ], a.prototype, "supportingAction", 2);
365
+ ], n.prototype, "supportingAction", 2);
366
366
  l([
367
367
  I("dialog")
368
- ], a.prototype, "_dialog", 2);
369
- W(v, a);
368
+ ], n.prototype, "_dialog", 2);
369
+ W(v, n);
370
370
  export {
371
371
  z as ON_MODAL_BACK_EVENT,
372
372
  _ as ON_MODAL_CLOSE_EVENT,
373
373
  ee as ON_MODAL_LEADING_ACTION_CLICK,
374
374
  k as ON_MODAL_OPEN_EVENT,
375
375
  ie as ON_MODAL_SUPPORTING_ACTION_CLICK,
376
- a as PieModal,
376
+ n as PieModal,
377
377
  J as headingLevels,
378
378
  Z as positions,
379
379
  Q as sizes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-modal",
3
- "version": "0.38.7",
3
+ "version": "0.39.0",
4
4
  "description": "PIE design system modal built using web components",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -42,11 +42,11 @@
42
42
  "extends": "../../../package.json"
43
43
  },
44
44
  "dependencies": {
45
- "@justeattakeaway/pie-button": "0.45.5",
46
- "@justeattakeaway/pie-icon-button": "0.27.5",
47
- "@justeattakeaway/pie-icons-webc": "0.18.0",
48
- "@justeattakeaway/pie-spinner": "0.5.4",
49
- "@justeattakeaway/pie-webc-core": "0.19.0",
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/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 (max-width: calc($breakpoint-wide - 1px)) {
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 (max-width: calc($breakpoint-wide - 1px)) {
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 (max-width: calc($breakpoint-wide - 1px)) {
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 (max-width: calc($breakpoint-wide - 1px)) {
146
+ @media (width < $breakpoint-wide) {
153
147
  flex-direction: column;
154
148
  }
155
149
  }