@justeattakeaway/pie-modal 0.24.0 → 0.26.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 +41 -14
- package/dist/index.js +128 -128
- package/package.json +10 -7
- package/src/modal.scss +34 -37
- package/LICENSE +0 -17
package/README.md
CHANGED
|
@@ -11,18 +11,54 @@
|
|
|
11
11
|
# Table of Contents
|
|
12
12
|
|
|
13
13
|
1. [Introduction](#pie-modal)
|
|
14
|
-
2. [
|
|
14
|
+
2. [Installation](#installation)
|
|
15
15
|
3. [Importing the component](#importing-the-component)
|
|
16
|
-
4. [
|
|
17
|
-
5. [
|
|
18
|
-
|
|
16
|
+
4. [Peer Dependencies](#peer-dependencies)
|
|
17
|
+
5. [Local Development](#local-development)
|
|
18
|
+
6. [Props](#props)
|
|
19
|
+
7. [Testing](#testing)
|
|
20
|
+
8. [Legacy browser support](#legacy-browser-support)
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
|
|
23
|
+
## pie-modal
|
|
21
24
|
|
|
22
25
|
`pie-modal` is a Web Component built using the Lit library. It offers a simple and accessible modal component for web applications, which uses the native HTML `dialog` element under the hood.
|
|
23
26
|
|
|
24
27
|
This component can be easily integrated into various frontend frameworks and customized through a set of properties.
|
|
25
28
|
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
To install `pie-modal` in your application, run the following on your command line:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# npm
|
|
36
|
+
$ npm i @justeattakeaway/pie-modal
|
|
37
|
+
|
|
38
|
+
# yarn
|
|
39
|
+
$ yarn add @justeattakeaway/pie-modal
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
For full information on using PIE components as part of an application, check out the [Getting Started Guide](https://github.com/justeattakeaway/pie/wiki/Getting-started-with-PIE-Web-Components).
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Importing the component
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
// default
|
|
49
|
+
import { PieModal } from '@justeattakeaway/pie-modal';
|
|
50
|
+
|
|
51
|
+
// react
|
|
52
|
+
import { PieModal } from '@justeattakeaway/pie-modal/dist/react';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## Peer Dependencies
|
|
57
|
+
|
|
58
|
+
> [!IMPORTANT]
|
|
59
|
+
> When using `pie-modal`, you will also need to include a couple of dependencies to ensure the component renders as expected. See [the PIE Wiki](https://github.com/justeattakeaway/pie/wiki/Getting-started-with-PIE-Web-Components#expected-dependencies) for more information and how to include these in your application.
|
|
60
|
+
|
|
61
|
+
|
|
26
62
|
## Local development
|
|
27
63
|
|
|
28
64
|
Install the dependencies. Note that this, and the following commands below, should be run from the **root of the monorepo**:
|
|
@@ -46,15 +82,6 @@ yarn watch --filter=pie-modal
|
|
|
46
82
|
yarn dev --filter=pie-storybook
|
|
47
83
|
```
|
|
48
84
|
|
|
49
|
-
### Importing the component
|
|
50
|
-
|
|
51
|
-
```js
|
|
52
|
-
// default
|
|
53
|
-
import { PieModal } from '@justeattakeaway/pie-modal';
|
|
54
|
-
|
|
55
|
-
// react
|
|
56
|
-
import { PieModal } from '@justeattakeaway/pie-modal/dist/react';
|
|
57
|
-
```
|
|
58
85
|
|
|
59
86
|
## Props
|
|
60
87
|
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isServer as te, css as I, LitElement as O, html as M, unsafeCSS as
|
|
2
|
-
import { html as p, unsafeStatic as
|
|
3
|
-
import { property as
|
|
1
|
+
import { isServer as te, css as I, LitElement as O, html as M, unsafeCSS as ie, nothing as c } from "lit";
|
|
2
|
+
import { html as p, unsafeStatic as oe } from "lit/static-html.js";
|
|
3
|
+
import { property as l, query as $ } from "lit/decorators.js";
|
|
4
4
|
const ne = (n) => {
|
|
5
5
|
class e extends n {
|
|
6
6
|
/**
|
|
@@ -17,30 +17,30 @@ const ne = (n) => {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
return e;
|
|
20
|
-
}, E = (n, e, t) => function(
|
|
21
|
-
const
|
|
22
|
-
Object.defineProperty(
|
|
20
|
+
}, E = (n, e, t) => function(o, a) {
|
|
21
|
+
const r = `#${a}`;
|
|
22
|
+
Object.defineProperty(o, a, {
|
|
23
23
|
get() {
|
|
24
|
-
return this[
|
|
24
|
+
return this[r];
|
|
25
25
|
},
|
|
26
26
|
set(h) {
|
|
27
|
-
const
|
|
28
|
-
e.includes(h) ? this[
|
|
27
|
+
const m = this[r];
|
|
28
|
+
e.includes(h) ? this[r] = h : (console.error(
|
|
29
29
|
`<${n}> Invalid value "${h}" provided for property "${a}".`,
|
|
30
30
|
`Must be one of: ${e.join(" | ")}.`,
|
|
31
31
|
`Falling back to default value: "${t}"`
|
|
32
|
-
), this[
|
|
32
|
+
), this[r] = t), this.requestUpdate(a, m);
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
-
}, ae = (n) => function(t,
|
|
36
|
-
const
|
|
37
|
-
Object.defineProperty(t,
|
|
35
|
+
}, ae = (n) => function(t, i) {
|
|
36
|
+
const o = `#${i}`;
|
|
37
|
+
Object.defineProperty(t, i, {
|
|
38
38
|
get() {
|
|
39
|
-
return this[
|
|
39
|
+
return this[o];
|
|
40
40
|
},
|
|
41
41
|
set(a) {
|
|
42
|
-
const
|
|
43
|
-
(a == null || typeof a == "string" && a.trim() === "") && console.error(`<${n}> Missing required attribute "${
|
|
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
44
|
}
|
|
45
45
|
});
|
|
46
46
|
}, _ = {
|
|
@@ -51,15 +51,15 @@ const ne = (n) => {
|
|
|
51
51
|
xl: 32,
|
|
52
52
|
xxl: 40
|
|
53
53
|
}, W = Object.keys(_), Y = "xs", U = 8, z = 32;
|
|
54
|
-
function
|
|
55
|
-
const
|
|
56
|
-
return
|
|
54
|
+
function re(n, e, t) {
|
|
55
|
+
const i = parseInt(n, 10), o = i % t === 0;
|
|
56
|
+
return i >= e && o;
|
|
57
57
|
}
|
|
58
58
|
const H = {
|
|
59
|
-
large: (n) =>
|
|
59
|
+
large: (n) => re(n, z, U),
|
|
60
60
|
regular: (n) => W.includes(n)
|
|
61
61
|
};
|
|
62
|
-
function
|
|
62
|
+
function le(n) {
|
|
63
63
|
const e = H.large(n);
|
|
64
64
|
return { isValid: e, size: e ? n : z };
|
|
65
65
|
}
|
|
@@ -67,26 +67,26 @@ function se(n) {
|
|
|
67
67
|
const e = H.regular(n), t = e ? _[n] : _[Y];
|
|
68
68
|
return { isValid: e, size: t };
|
|
69
69
|
}
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
let a,
|
|
70
|
+
const u = (n, e, t, i) => {
|
|
71
|
+
const o = n.endsWith("Large") || n.endsWith("-large");
|
|
72
|
+
let a, r;
|
|
73
73
|
if (t) {
|
|
74
|
-
if ({ isValid: a, size:
|
|
75
|
-
const h =
|
|
74
|
+
if ({ isValid: a, size: r } = o ? le(t) : se(t), !a) {
|
|
75
|
+
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 ${U}.` : `Invalid prop "size" value supplied to "${i}". The prop value should be one of the following values: ${W.join(", ")}.`;
|
|
76
76
|
console.error(h);
|
|
77
77
|
}
|
|
78
78
|
} else
|
|
79
|
-
|
|
79
|
+
r = o ? z : _[Y];
|
|
80
80
|
return {
|
|
81
81
|
class: [n, e].filter(Boolean).join(" "),
|
|
82
|
-
width:
|
|
83
|
-
height:
|
|
82
|
+
width: r,
|
|
83
|
+
height: r
|
|
84
84
|
};
|
|
85
85
|
};
|
|
86
|
-
var de = Object.defineProperty, ce = Object.getOwnPropertyDescriptor, P = (n, e, t,
|
|
87
|
-
for (var
|
|
88
|
-
(
|
|
89
|
-
return
|
|
86
|
+
var de = Object.defineProperty, ce = Object.getOwnPropertyDescriptor, P = (n, e, t, i) => {
|
|
87
|
+
for (var o = i > 1 ? void 0 : i ? ce(e, t) : e, a = n.length - 1, r; a >= 0; a--)
|
|
88
|
+
(r = n[a]) && (o = (i ? r(e, t, o) : r(o)) || o);
|
|
89
|
+
return i && o && de(e, t, o), o;
|
|
90
90
|
};
|
|
91
91
|
const R = "icon-close";
|
|
92
92
|
let b = class extends O {
|
|
@@ -94,16 +94,16 @@ let b = class extends O {
|
|
|
94
94
|
super(...arguments), this.size = "xs", this.class = "c-pieIcon c-pieIcon--close";
|
|
95
95
|
}
|
|
96
96
|
connectedCallback() {
|
|
97
|
-
var e, t,
|
|
97
|
+
var e, t, i;
|
|
98
98
|
if (super.connectedCallback(), ((e = this._svg) == null ? void 0 : e.getAttribute("width")) === null) {
|
|
99
|
-
const
|
|
100
|
-
(t = this._svg) == null || t.setAttribute("width",
|
|
99
|
+
const o = u("c-pieIcon c-pieIcon--close", "", null, "IconClose");
|
|
100
|
+
(t = this._svg) == null || t.setAttribute("width", o.width), (i = this._svg) == null || i.setAttribute("height", o.height);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
updated(e) {
|
|
104
|
-
var t,
|
|
105
|
-
let
|
|
106
|
-
e.has("size") && (
|
|
104
|
+
var t, i;
|
|
105
|
+
let o;
|
|
106
|
+
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));
|
|
107
107
|
}
|
|
108
108
|
render() {
|
|
109
109
|
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>`;
|
|
@@ -118,19 +118,19 @@ b.styles = I`
|
|
|
118
118
|
}
|
|
119
119
|
`;
|
|
120
120
|
P([
|
|
121
|
-
|
|
121
|
+
l({ type: String, reflect: !0 })
|
|
122
122
|
], b.prototype, "size", 2);
|
|
123
123
|
P([
|
|
124
|
-
|
|
124
|
+
l({ type: String, reflect: !0 })
|
|
125
125
|
], b.prototype, "class", 2);
|
|
126
126
|
P([
|
|
127
127
|
$("svg")
|
|
128
128
|
], b.prototype, "_svg", 2);
|
|
129
129
|
customElements.get(R) === void 0 && customElements.define(R, b);
|
|
130
|
-
var he = Object.defineProperty, pe = Object.getOwnPropertyDescriptor, D = (n, e, t,
|
|
131
|
-
for (var
|
|
132
|
-
(
|
|
133
|
-
return
|
|
130
|
+
var he = Object.defineProperty, pe = Object.getOwnPropertyDescriptor, D = (n, e, t, i) => {
|
|
131
|
+
for (var o = i > 1 ? void 0 : i ? pe(e, t) : e, a = n.length - 1, r; a >= 0; a--)
|
|
132
|
+
(r = n[a]) && (o = (i ? r(e, t, o) : r(o)) || o);
|
|
133
|
+
return i && o && he(e, t, o), o;
|
|
134
134
|
};
|
|
135
135
|
const N = "icon-chevron-left";
|
|
136
136
|
class w extends O {
|
|
@@ -138,16 +138,16 @@ class w extends O {
|
|
|
138
138
|
super(...arguments), this.size = "xs", this.class = "c-pieIcon c-pieIcon--chevronLeft";
|
|
139
139
|
}
|
|
140
140
|
connectedCallback() {
|
|
141
|
-
var e, t,
|
|
141
|
+
var e, t, i;
|
|
142
142
|
if (super.connectedCallback(), ((e = this._svg) == null ? void 0 : e.getAttribute("width")) === null) {
|
|
143
|
-
const
|
|
144
|
-
(t = this._svg) == null || t.setAttribute("width",
|
|
143
|
+
const o = u("c-pieIcon c-pieIcon--chevronLeft", "", null, "IconChevronLeft");
|
|
144
|
+
(t = this._svg) == null || t.setAttribute("width", o.width), (i = this._svg) == null || i.setAttribute("height", o.height);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
updated(e) {
|
|
148
|
-
var t,
|
|
149
|
-
let
|
|
150
|
-
e.has("size") && (
|
|
148
|
+
var t, i;
|
|
149
|
+
let o;
|
|
150
|
+
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));
|
|
151
151
|
}
|
|
152
152
|
render() {
|
|
153
153
|
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>`;
|
|
@@ -162,19 +162,19 @@ w.styles = I`
|
|
|
162
162
|
}
|
|
163
163
|
`;
|
|
164
164
|
D([
|
|
165
|
-
|
|
165
|
+
l({ type: String, reflect: !0 })
|
|
166
166
|
], w.prototype, "size", 2);
|
|
167
167
|
D([
|
|
168
|
-
|
|
168
|
+
l({ type: String, reflect: !0 })
|
|
169
169
|
], w.prototype, "class", 2);
|
|
170
170
|
D([
|
|
171
171
|
$("svg")
|
|
172
172
|
], w.prototype, "_svg", 2);
|
|
173
173
|
customElements.get(N) === void 0 && customElements.define(N, w);
|
|
174
|
-
var ge = Object.defineProperty,
|
|
175
|
-
for (var
|
|
176
|
-
(
|
|
177
|
-
return
|
|
174
|
+
var ge = Object.defineProperty, me = Object.getOwnPropertyDescriptor, T = (n, e, t, i) => {
|
|
175
|
+
for (var o = i > 1 ? void 0 : i ? me(e, t) : e, a = n.length - 1, r; a >= 0; a--)
|
|
176
|
+
(r = n[a]) && (o = (i ? r(e, t, o) : r(o)) || o);
|
|
177
|
+
return i && o && ge(e, t, o), o;
|
|
178
178
|
};
|
|
179
179
|
const q = "icon-chevron-right";
|
|
180
180
|
class y extends O {
|
|
@@ -182,16 +182,16 @@ class y extends O {
|
|
|
182
182
|
super(...arguments), this.size = "xs", this.class = "c-pieIcon c-pieIcon--chevronRight";
|
|
183
183
|
}
|
|
184
184
|
connectedCallback() {
|
|
185
|
-
var e, t,
|
|
185
|
+
var e, t, i;
|
|
186
186
|
if (super.connectedCallback(), ((e = this._svg) == null ? void 0 : e.getAttribute("width")) === null) {
|
|
187
|
-
const
|
|
188
|
-
(t = this._svg) == null || t.setAttribute("width",
|
|
187
|
+
const o = u("c-pieIcon c-pieIcon--chevronRight", "", null, "IconChevronRight");
|
|
188
|
+
(t = this._svg) == null || t.setAttribute("width", o.width), (i = this._svg) == null || i.setAttribute("height", o.height);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
updated(e) {
|
|
192
|
-
var t,
|
|
193
|
-
let
|
|
194
|
-
e.has("size") && (
|
|
192
|
+
var t, i;
|
|
193
|
+
let o;
|
|
194
|
+
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));
|
|
195
195
|
}
|
|
196
196
|
render() {
|
|
197
197
|
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>`;
|
|
@@ -206,16 +206,16 @@ y.styles = I`
|
|
|
206
206
|
}
|
|
207
207
|
`;
|
|
208
208
|
T([
|
|
209
|
-
|
|
209
|
+
l({ type: String, reflect: !0 })
|
|
210
210
|
], y.prototype, "size", 2);
|
|
211
211
|
T([
|
|
212
|
-
|
|
212
|
+
l({ type: String, reflect: !0 })
|
|
213
213
|
], y.prototype, "class", 2);
|
|
214
214
|
T([
|
|
215
215
|
$("svg")
|
|
216
216
|
], y.prototype, "_svg", 2);
|
|
217
217
|
customElements.get(q) === void 0 && customElements.define(q, y);
|
|
218
|
-
function
|
|
218
|
+
function ue(n) {
|
|
219
219
|
if (Array.isArray(n)) {
|
|
220
220
|
for (var e = 0, t = Array(n.length); e < n.length; e++)
|
|
221
221
|
t[e] = n[e];
|
|
@@ -241,8 +241,8 @@ var Z = typeof window < "u" && window.navigator && window.navigator.platform &&
|
|
|
241
241
|
return X(t.target) || t.touches.length > 1 ? !0 : (t.preventDefault && t.preventDefault(), !1);
|
|
242
242
|
}, ve = function(e) {
|
|
243
243
|
if (f === void 0) {
|
|
244
|
-
var t = !!e && e.reserveScrollBarGap === !0,
|
|
245
|
-
t &&
|
|
244
|
+
var t = !!e && e.reserveScrollBarGap === !0, i = window.innerWidth - document.documentElement.clientWidth;
|
|
245
|
+
t && i > 0 && (f = document.body.style.paddingRight, document.body.style.paddingRight = i + "px");
|
|
246
246
|
}
|
|
247
247
|
v === void 0 && (v = document.body.style.overflow, document.body.style.overflow = "hidden");
|
|
248
248
|
}, fe = function() {
|
|
@@ -250,24 +250,24 @@ var Z = typeof window < "u" && window.navigator && window.navigator.platform &&
|
|
|
250
250
|
}, be = function(e) {
|
|
251
251
|
return e ? e.scrollHeight - e.scrollTop <= e.clientHeight : !1;
|
|
252
252
|
}, we = function(e, t) {
|
|
253
|
-
var
|
|
254
|
-
return X(e.target) ? !1 : t && t.scrollTop === 0 &&
|
|
253
|
+
var i = e.targetTouches[0].clientY - G;
|
|
254
|
+
return X(e.target) ? !1 : t && t.scrollTop === 0 && i > 0 || be(t) && i < 0 ? A(e) : (e.stopPropagation(), !0);
|
|
255
255
|
}, ye = function(e, t) {
|
|
256
256
|
if (!e) {
|
|
257
257
|
console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");
|
|
258
258
|
return;
|
|
259
259
|
}
|
|
260
|
-
if (!g.some(function(
|
|
261
|
-
return
|
|
260
|
+
if (!g.some(function(o) {
|
|
261
|
+
return o.targetElement === e;
|
|
262
262
|
})) {
|
|
263
|
-
var
|
|
263
|
+
var i = {
|
|
264
264
|
targetElement: e,
|
|
265
265
|
options: t || {}
|
|
266
266
|
};
|
|
267
|
-
g = [].concat(
|
|
268
|
-
|
|
269
|
-
}, e.ontouchmove = function(
|
|
270
|
-
|
|
267
|
+
g = [].concat(ue(g), [i]), Z ? (e.ontouchstart = function(o) {
|
|
268
|
+
o.targetTouches.length === 1 && (G = o.targetTouches[0].clientY);
|
|
269
|
+
}, e.ontouchmove = function(o) {
|
|
270
|
+
o.targetTouches.length === 1 && we(o, e);
|
|
271
271
|
}, C || (document.addEventListener("touchmove", A, j ? { passive: !1 } : void 0), C = !0)) : ve(t);
|
|
272
272
|
}
|
|
273
273
|
}, ke = function(e) {
|
|
@@ -279,12 +279,12 @@ var Z = typeof window < "u" && window.navigator && window.navigator.platform &&
|
|
|
279
279
|
return t.targetElement !== e;
|
|
280
280
|
}), Z ? (e.ontouchstart = null, e.ontouchmove = null, C && g.length === 0 && (document.removeEventListener("touchmove", A, j ? { passive: !1 } : void 0), C = !1)) : g.length || fe();
|
|
281
281
|
};
|
|
282
|
-
const xe = `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: 768px){.c-modal pie-icon-button{--btn-dimension: 40px}}.c-modal[open]{display:flex;flex-direction:column}@media (min-width: 768px){.c-modal{--modal-margin-block: var(--modal-margin-large)}}.c-modal[size=small]{--modal-max-inline-size: var(--modal-size-s)}@media (min-width: 768px){.c-modal[size=small]{--modal-margin-block: var(--modal-margin-large)}}@media (max-width: 767px){.c-modal[size=medium][isfullwidthbelowmid]{--modal-margin-block: var(--modal-margin-none);--modal-border-radius: var(--dt-radius-rounded-none);--modal-block-size: 100%;--modal-inline-size: 100%;--modal-max-inline-size: 100%}}.c-modal[size=large]{--modal-inline-size: 75%;--modal-max-inline-size: var(--modal-size-l);--modal-margin-block: var(--modal-margin-large)}@media (max-width: 767px){.c-modal[size=large]{--modal-margin-block: var(--modal-margin-none);--modal-border-radius: var(--dt-radius-rounded-none);--modal-block-size: 100%;--modal-inline-size: 100%}}.c-modal[position=top]{margin-block-start:var(--dt-spacing-j)}@media (max-width: 767px){.c-modal[position=top][isfullwidthbelowmid]{margin-block-start:var(--dt-spacing-none)}}.c-modal::backdrop{background:rgba(0,0,0,.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{
|
|
282
|
+
const xe = `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: 768px){.c-modal pie-icon-button{--btn-dimension: 40px}}.c-modal[open]{display:flex;flex-direction:column}@media (min-width: 768px){.c-modal{--modal-margin-block: var(--modal-margin-large)}}.c-modal[size=small]{--modal-max-inline-size: var(--modal-size-s)}@media (min-width: 768px){.c-modal[size=small]{--modal-margin-block: var(--modal-margin-large)}}@media (max-width: 767px){.c-modal[size=medium][isfullwidthbelowmid]{--modal-margin-block: var(--modal-margin-none);--modal-border-radius: var(--dt-radius-rounded-none);--modal-block-size: 100%;--modal-inline-size: 100%;--modal-max-inline-size: 100%}}.c-modal[size=large]{--modal-inline-size: 75%;--modal-max-inline-size: var(--modal-size-l);--modal-margin-block: var(--modal-margin-large)}@media (max-width: 767px){.c-modal[size=large]{--modal-margin-block: var(--modal-margin-none);--modal-border-radius: var(--dt-radius-rounded-none);--modal-block-size: 100%;--modal-inline-size: 100%}}.c-modal[position=top]{margin-block-start:var(--dt-spacing-j)}@media (max-width: 767px){.c-modal[position=top][isfullwidthbelowmid]{margin-block-start:var(--dt-spacing-none)}}.c-modal::backdrop{background:rgba(0,0,0,.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--wide) * 1px);--modal-header-font-line-height: calc(var(--dt-font-heading-m-line-height--wide) * 1px);--modal-header-font-weight: var(--dt-font-heading-m-weight);font-size:var(--modal-header-font-size);line-height:var(--modal-header-font-line-height);font-weight:var(--modal-header-font-weight);margin:0;grid-area:heading;margin-inline:var(--dt-spacing-d);margin-block:14px}@media (min-width: 768px){.c-modal .c-modal-heading{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[isfooterpinned] .c-modal-content,.c-modal .c-modal-scrollContainer{overflow-y:auto}.c-modal .c-modal-scrollContainer{--bg-scroll-start: linear-gradient(var(--dt-color-container-default) 30%, rgba(255, 255, 255, 0));--bg-scroll-end: linear-gradient(rgba(255, 255, 255, 0), var(--dt-color-container-default) 70%) 0 100%;--bg-scroll-top: radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, .3), rgba(0, 0, 0, 0));--bg-scroll-bottom: radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, .3), rgba(0, 0, 0, 0)) 0 100%;--bg-size-scroll-start: 100% 40px;--bg-size-scroll-end: 100% 40px;--bg-size-scroll-top: 100% 16px;--bg-size-scroll-bottom: 100% 16px;background:var(--bg-scroll-start),var(--bg-scroll-end),var(--bg-scroll-top),var(--bg-scroll-bottom);background-repeat:no-repeat;background-color:var(--dt-color-container-default);background-size:var(--bg-size-scroll-start),var(--bg-size-scroll-end),var(--bg-size-scroll-top),var(--bg-size-scroll-bottom);background-attachment:local,local,scroll,scroll}.c-modal .c-modal-content{--modal-content-font-size: calc(var(--dt-font-size-16) * 1px);--modal-content-font-weight: var(--dt-font-weight-regular);--modal-content-line-height: calc(var(--dt-font-size-16-line-height) * 1px);--modal-content-padding-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)}@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[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}
|
|
283
283
|
`, _e = ["h1", "h2", "h3", "h4", "h5", "h6"], ze = ["small", "medium", "large"], Ce = ["top", "center"], S = "pie-modal-close", x = "pie-modal-open", B = "pie-modal-back", Ae = "pie-modal-leading-action-click", Oe = "pie-modal-supporting-action-click";
|
|
284
|
-
var $e = Object.defineProperty, Le = Object.getOwnPropertyDescriptor, d = (n, e, t,
|
|
285
|
-
for (var
|
|
286
|
-
(
|
|
287
|
-
return
|
|
284
|
+
var $e = Object.defineProperty, Le = Object.getOwnPropertyDescriptor, d = (n, e, t, i) => {
|
|
285
|
+
for (var o = i > 1 ? void 0 : i ? Le(e, t) : e, a = n.length - 1, r; a >= 0; a--)
|
|
286
|
+
(r = n[a]) && (o = (i ? r(e, t, o) : r(o)) || o);
|
|
287
|
+
return i && o && $e(e, t, o), o;
|
|
288
288
|
};
|
|
289
289
|
const k = "pie-modal";
|
|
290
290
|
class s extends ne(O) {
|
|
@@ -292,18 +292,18 @@ class s extends ne(O) {
|
|
|
292
292
|
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) => {
|
|
293
293
|
this.isDismissible || e.preventDefault();
|
|
294
294
|
}, this._handleDialogLightDismiss = (e) => {
|
|
295
|
-
var
|
|
295
|
+
var m;
|
|
296
296
|
if (!this.isDismissible)
|
|
297
297
|
return;
|
|
298
|
-
const t = (
|
|
299
|
-
top:
|
|
300
|
-
bottom:
|
|
298
|
+
const t = (m = this._dialog) == null ? void 0 : m.getBoundingClientRect(), {
|
|
299
|
+
top: i = 0,
|
|
300
|
+
bottom: o = 0,
|
|
301
301
|
left: a = 0,
|
|
302
|
-
right:
|
|
302
|
+
right: r = 0
|
|
303
303
|
} = t || {};
|
|
304
|
-
if (
|
|
304
|
+
if (i === 0 && o === 0 && a === 0 && r === 0)
|
|
305
305
|
return;
|
|
306
|
-
(e.clientY <
|
|
306
|
+
(e.clientY < i || e.clientY > o || e.clientX < a || e.clientX > r) && (this.isOpen = !1);
|
|
307
307
|
}, this._dispatchModalCustomEvent = (e) => {
|
|
308
308
|
const t = new CustomEvent(e, {
|
|
309
309
|
bubbles: !0,
|
|
@@ -319,7 +319,7 @@ class s extends ne(O) {
|
|
|
319
319
|
document.removeEventListener(x, this._handleModalOpened.bind(this)), document.removeEventListener(S, this._handleModalClosed.bind(this)), document.removeEventListener(B, this._handleModalClosed.bind(this)), super.disconnectedCallback();
|
|
320
320
|
}
|
|
321
321
|
async firstUpdated(e) {
|
|
322
|
-
super.firstUpdated(e), this._dialog && ((await import("./dialog-polyfill.esm-29edb142.js").then((
|
|
322
|
+
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", () => {
|
|
323
323
|
this.isOpen = !1;
|
|
324
324
|
})), this._handleModalOpenStateOnFirstRender(e);
|
|
325
325
|
}
|
|
@@ -330,17 +330,17 @@ class s extends ne(O) {
|
|
|
330
330
|
* Opens the dialog element and disables page scrolling
|
|
331
331
|
*/
|
|
332
332
|
_handleModalOpened() {
|
|
333
|
-
var t,
|
|
333
|
+
var t, i, o, a;
|
|
334
334
|
const e = (t = this._dialog) == null ? void 0 : t.querySelector(".c-modal-scrollContainer");
|
|
335
|
-
e && ye(e), !((
|
|
335
|
+
e && ye(e), !((i = this._dialog) != null && i.hasAttribute("open") || !((o = this._dialog) != null && o.isConnected)) && ((a = this._dialog) == null || a.showModal());
|
|
336
336
|
}
|
|
337
337
|
/**
|
|
338
338
|
* Closes the dialog element and re-enables page scrolling
|
|
339
339
|
*/
|
|
340
340
|
_handleModalClosed() {
|
|
341
|
-
var t,
|
|
341
|
+
var t, i;
|
|
342
342
|
const e = (t = this._dialog) == null ? void 0 : t.querySelector(".c-modal-scrollContainer");
|
|
343
|
-
e && ke(e), (
|
|
343
|
+
e && ke(e), (i = this._dialog) == null || i.close(), this._returnFocus();
|
|
344
344
|
}
|
|
345
345
|
// Handles the value of the isOpen property on first render of the component
|
|
346
346
|
_handleModalOpenStateOnFirstRender(e) {
|
|
@@ -352,17 +352,17 @@ class s extends ne(O) {
|
|
|
352
352
|
t !== void 0 && (t ? this._backButtonClicked ? (this._backButtonClicked = !1, this._dispatchModalCustomEvent(B)) : this._dispatchModalCustomEvent(S) : this._dispatchModalCustomEvent(x));
|
|
353
353
|
}
|
|
354
354
|
_handleActionClick(e) {
|
|
355
|
-
var t,
|
|
356
|
-
e === "leading" ? ((t = this._dialog) == null || t.close("leading"), this._dispatchModalCustomEvent(Ae)) : e === "supporting" && ((
|
|
355
|
+
var t, i;
|
|
356
|
+
e === "leading" ? ((t = this._dialog) == null || t.close("leading"), this._dispatchModalCustomEvent(Ae)) : e === "supporting" && ((i = this._dialog) == null || i.close("supporting"), this._dispatchModalCustomEvent(Oe));
|
|
357
357
|
}
|
|
358
358
|
/**
|
|
359
359
|
* Return focus to the specified element, providing the selector is valid
|
|
360
360
|
* and the chosen element can be found.
|
|
361
361
|
*/
|
|
362
362
|
_returnFocus() {
|
|
363
|
-
var t,
|
|
363
|
+
var t, i;
|
|
364
364
|
const e = (t = this.returnFocusAfterCloseSelector) == null ? void 0 : t.trim();
|
|
365
|
-
e && ((
|
|
365
|
+
e && ((i = document.querySelector(e)) == null || i.focus());
|
|
366
366
|
}
|
|
367
367
|
/**
|
|
368
368
|
* Template for the close button element. Called within the
|
|
@@ -415,11 +415,11 @@ class s extends ne(O) {
|
|
|
415
415
|
* @private
|
|
416
416
|
*/
|
|
417
417
|
renderLeadingAction() {
|
|
418
|
-
const { text: e, variant: t = "primary", ariaLabel:
|
|
418
|
+
const { text: e, variant: t = "primary", ariaLabel: i } = this.leadingAction;
|
|
419
419
|
return e ? p`
|
|
420
420
|
<pie-button
|
|
421
421
|
variant="${t}"
|
|
422
|
-
aria-label="${
|
|
422
|
+
aria-label="${i || c}"
|
|
423
423
|
type="submit"
|
|
424
424
|
?isFullWidth="${this.hasStackedActions}"
|
|
425
425
|
@click="${() => this._handleActionClick("leading")}"
|
|
@@ -440,11 +440,11 @@ class s extends ne(O) {
|
|
|
440
440
|
* @private
|
|
441
441
|
*/
|
|
442
442
|
renderSupportingAction() {
|
|
443
|
-
const { text: e, variant: t = "ghost", ariaLabel:
|
|
443
|
+
const { text: e, variant: t = "ghost", ariaLabel: i } = this.supportingAction;
|
|
444
444
|
return e ? this.leadingAction ? p`
|
|
445
445
|
<pie-button
|
|
446
446
|
variant="${t}"
|
|
447
|
-
aria-label="${
|
|
447
|
+
aria-label="${i || c}"
|
|
448
448
|
type="reset"
|
|
449
449
|
?isFullWidth="${this.hasStackedActions}"
|
|
450
450
|
@click="${() => this._handleActionClick("supporting")}"
|
|
@@ -473,18 +473,18 @@ class s extends ne(O) {
|
|
|
473
473
|
const {
|
|
474
474
|
aria: e,
|
|
475
475
|
hasBackButton: t,
|
|
476
|
-
hasStackedActions:
|
|
477
|
-
heading:
|
|
476
|
+
hasStackedActions: i,
|
|
477
|
+
heading: o,
|
|
478
478
|
headingLevel: a = "h2",
|
|
479
|
-
isDismissible:
|
|
479
|
+
isDismissible: r,
|
|
480
480
|
isFooterPinned: h,
|
|
481
|
-
isFullWidthBelowMid:
|
|
481
|
+
isFullWidthBelowMid: m,
|
|
482
482
|
isLoading: L,
|
|
483
483
|
leadingAction: J,
|
|
484
484
|
position: Q,
|
|
485
485
|
size: K,
|
|
486
486
|
supportingAction: ee
|
|
487
|
-
} = this, F =
|
|
487
|
+
} = this, F = oe(a);
|
|
488
488
|
return p`
|
|
489
489
|
<dialog
|
|
490
490
|
id="dialog"
|
|
@@ -493,10 +493,10 @@ class s extends ne(O) {
|
|
|
493
493
|
position="${Q}"
|
|
494
494
|
?hasActions=${J || ee}
|
|
495
495
|
?hasBackButton=${t}
|
|
496
|
-
?hasStackedActions=${
|
|
497
|
-
?isDismissible=${
|
|
496
|
+
?hasStackedActions=${i}
|
|
497
|
+
?isDismissible=${r}
|
|
498
498
|
?isFooterPinned=${h}
|
|
499
|
-
?isFullWidthBelowMid=${
|
|
499
|
+
?isFullWidthBelowMid=${m}
|
|
500
500
|
?isLoading=${L}
|
|
501
501
|
aria-busy="${L ? "true" : "false"}"
|
|
502
502
|
aria-label="${L && (e == null ? void 0 : e.loading) || c}"
|
|
@@ -504,9 +504,9 @@ class s extends ne(O) {
|
|
|
504
504
|
<header class="c-modal-header">
|
|
505
505
|
${t ? this.renderBackButton() : c}
|
|
506
506
|
<${F} class="c-modal-heading">
|
|
507
|
-
${
|
|
507
|
+
${o}
|
|
508
508
|
</${F}>
|
|
509
|
-
${
|
|
509
|
+
${r ? this.renderCloseButton() : c}
|
|
510
510
|
</header>
|
|
511
511
|
${// We need to wrap the remaining content in a shared scrollable container if the footer is not pinned
|
|
512
512
|
h ? this.renderModalContentAndFooter() : p`
|
|
@@ -517,55 +517,55 @@ class s extends ne(O) {
|
|
|
517
517
|
</dialog>`;
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
|
-
s.styles =
|
|
520
|
+
s.styles = ie(xe);
|
|
521
521
|
d([
|
|
522
|
-
|
|
522
|
+
l({ type: Object })
|
|
523
523
|
], s.prototype, "aria", 2);
|
|
524
524
|
d([
|
|
525
|
-
|
|
525
|
+
l({ type: String }),
|
|
526
526
|
ae(k)
|
|
527
527
|
], s.prototype, "heading", 2);
|
|
528
528
|
d([
|
|
529
|
-
|
|
529
|
+
l(),
|
|
530
530
|
E(k, _e, "h2")
|
|
531
531
|
], s.prototype, "headingLevel", 2);
|
|
532
532
|
d([
|
|
533
|
-
|
|
533
|
+
l({ type: Boolean })
|
|
534
534
|
], s.prototype, "hasBackButton", 2);
|
|
535
535
|
d([
|
|
536
|
-
|
|
536
|
+
l({ type: Boolean })
|
|
537
537
|
], s.prototype, "hasStackedActions", 2);
|
|
538
538
|
d([
|
|
539
|
-
|
|
539
|
+
l({ type: Boolean, reflect: !0 })
|
|
540
540
|
], s.prototype, "isDismissible", 2);
|
|
541
541
|
d([
|
|
542
|
-
|
|
542
|
+
l({ type: Boolean })
|
|
543
543
|
], s.prototype, "isFooterPinned", 2);
|
|
544
544
|
d([
|
|
545
|
-
|
|
545
|
+
l({ type: Boolean })
|
|
546
546
|
], s.prototype, "isFullWidthBelowMid", 2);
|
|
547
547
|
d([
|
|
548
|
-
|
|
548
|
+
l({ type: Boolean, reflect: !0 })
|
|
549
549
|
], s.prototype, "isLoading", 2);
|
|
550
550
|
d([
|
|
551
|
-
|
|
551
|
+
l({ type: Boolean })
|
|
552
552
|
], s.prototype, "isOpen", 2);
|
|
553
553
|
d([
|
|
554
|
-
|
|
554
|
+
l({ type: Object })
|
|
555
555
|
], s.prototype, "leadingAction", 2);
|
|
556
556
|
d([
|
|
557
|
-
|
|
557
|
+
l(),
|
|
558
558
|
E(k, Ce, "center")
|
|
559
559
|
], s.prototype, "position", 2);
|
|
560
560
|
d([
|
|
561
|
-
|
|
561
|
+
l()
|
|
562
562
|
], s.prototype, "returnFocusAfterCloseSelector", 2);
|
|
563
563
|
d([
|
|
564
|
-
|
|
564
|
+
l(),
|
|
565
565
|
E(k, ze, "medium")
|
|
566
566
|
], s.prototype, "size", 2);
|
|
567
567
|
d([
|
|
568
|
-
|
|
568
|
+
l({ type: Object })
|
|
569
569
|
], s.prototype, "supportingAction", 2);
|
|
570
570
|
d([
|
|
571
571
|
$("dialog")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-modal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "PIE design system modal built using web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"test:visual": "run -T cross-env-shell PERCY_TOKEN=${PERCY_TOKEN_PIE_MODAL} percy exec --allowed-hostname cloudfront.net -- npx playwright test -c ./playwright-lit-visual.config.ts",
|
|
26
26
|
"test:visual:ci": "yarn test:visual"
|
|
27
27
|
},
|
|
28
|
-
"author": "
|
|
28
|
+
"author": "Just Eat Takeaway.com - Design System Team",
|
|
29
29
|
"license": "Apache-2.0",
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@justeat/pie-design-tokens": "5.8.2",
|
|
32
|
-
"@justeattakeaway/pie-button": "0.
|
|
32
|
+
"@justeattakeaway/pie-button": "0.31.0",
|
|
33
33
|
"@justeattakeaway/pie-components-config": "0.4.0",
|
|
34
|
-
"@justeattakeaway/pie-icon-button": "0.
|
|
35
|
-
"@justeattakeaway/pie-icons-webc": "0.
|
|
36
|
-
"@justeattakeaway/pie-webc-core": "0.
|
|
34
|
+
"@justeattakeaway/pie-icon-button": "0.17.0",
|
|
35
|
+
"@justeattakeaway/pie-icons-webc": "0.10.0",
|
|
36
|
+
"@justeattakeaway/pie-webc-core": "0.10.0",
|
|
37
37
|
"@types/body-scroll-lock": "3.1.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -44,5 +44,8 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"dialog-polyfill": "0.5.6"
|
|
47
|
-
}
|
|
47
|
+
},
|
|
48
|
+
"sideEffects": [
|
|
49
|
+
"dist/*.js"
|
|
50
|
+
]
|
|
48
51
|
}
|
package/src/modal.scss
CHANGED
|
@@ -162,39 +162,10 @@
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
& .c-modal-header {
|
|
165
|
-
padding-inline: var(--dt-spacing-d);
|
|
166
|
-
padding-block: 14px; // This is deliberately not a custom property
|
|
167
165
|
display: grid;
|
|
168
|
-
grid-template-areas:
|
|
169
|
-
'back heading close'
|
|
170
|
-
'. heading .';
|
|
166
|
+
grid-template-areas: 'back heading close';
|
|
171
167
|
grid-template-columns: minmax(0, max-content) minmax(0, 1fr) minmax(0, max-content);
|
|
172
|
-
align-items:
|
|
173
|
-
|
|
174
|
-
@media (min-width: $breakpoint-wide) {
|
|
175
|
-
padding-inline: var(--dt-spacing-e);
|
|
176
|
-
padding-block: 20px; // This is deliberately not a custom property
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
&[hasbackbutton] .c-modal-header {
|
|
181
|
-
padding-block: var(--dt-spacing-b);
|
|
182
|
-
padding-inline-start: var(--dt-spacing-b);
|
|
183
|
-
|
|
184
|
-
@media (min-width: $breakpoint-wide) {
|
|
185
|
-
padding-block: var(--dt-spacing-c);
|
|
186
|
-
padding-inline-start: var(--dt-spacing-c);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
&[isdismissible] .c-modal-header {
|
|
191
|
-
padding-block: var(--dt-spacing-b);
|
|
192
|
-
padding-inline-end: var(--dt-spacing-b);
|
|
193
|
-
|
|
194
|
-
@media (min-width: $breakpoint-wide) {
|
|
195
|
-
padding-block: var(--dt-spacing-c);
|
|
196
|
-
padding-inline-end: var(--dt-spacing-c);
|
|
197
|
-
}
|
|
168
|
+
align-items: start;
|
|
198
169
|
}
|
|
199
170
|
|
|
200
171
|
& .c-modal-heading {
|
|
@@ -207,32 +178,54 @@
|
|
|
207
178
|
font-weight: var(--modal-header-font-weight);
|
|
208
179
|
margin: 0;
|
|
209
180
|
grid-area: heading;
|
|
181
|
+
|
|
182
|
+
margin-inline: var(--dt-spacing-d);
|
|
183
|
+
margin-block: 14px; // This is deliberately not a custom property
|
|
184
|
+
|
|
185
|
+
@media (min-width: $breakpoint-wide) {
|
|
186
|
+
margin-inline: var(--dt-spacing-e);
|
|
187
|
+
margin-block: 20px; // This is deliberately not a custom property
|
|
188
|
+
}
|
|
210
189
|
}
|
|
211
190
|
|
|
212
191
|
// Ensure correct padding when there is a back button in front of the heading
|
|
213
192
|
&[hasbackbutton] .c-modal-heading {
|
|
214
|
-
|
|
193
|
+
margin-inline-start: var(--dt-spacing-b);
|
|
215
194
|
|
|
216
195
|
@media (min-width: $breakpoint-wide) {
|
|
217
|
-
|
|
196
|
+
margin-inline-start: var(--dt-spacing-c);
|
|
218
197
|
}
|
|
219
198
|
}
|
|
220
199
|
|
|
221
200
|
// Ensure correct padding when there is a close button behind the heading
|
|
222
201
|
&[isdismissible] .c-modal-heading {
|
|
223
|
-
|
|
202
|
+
margin-inline-end: var(--dt-spacing-d);
|
|
224
203
|
|
|
225
204
|
@media (min-width: $breakpoint-wide) {
|
|
226
|
-
|
|
205
|
+
margin-inline-end: var(--dt-spacing-e);
|
|
227
206
|
}
|
|
228
207
|
}
|
|
229
208
|
|
|
230
209
|
& .c-modal-backBtn {
|
|
231
210
|
grid-area: back;
|
|
211
|
+
margin-block: var(--dt-spacing-b);
|
|
212
|
+
margin-inline: var(--dt-spacing-b) var(--dt-spacing-none);
|
|
213
|
+
|
|
214
|
+
@media (min-width: $breakpoint-wide) {
|
|
215
|
+
margin-block: var(--dt-spacing-c);
|
|
216
|
+
margin-inline: var(--dt-spacing-c) var(--dt-spacing-none);
|
|
217
|
+
}
|
|
232
218
|
}
|
|
233
219
|
|
|
234
220
|
& .c-modal-closeBtn {
|
|
235
221
|
grid-area: close;
|
|
222
|
+
margin-block: var(--dt-spacing-b);
|
|
223
|
+
margin-inline: var(--dt-spacing-none) var(--dt-spacing-b);
|
|
224
|
+
|
|
225
|
+
@media (min-width: $breakpoint-wide) {
|
|
226
|
+
margin-block: var(--dt-spacing-c);
|
|
227
|
+
margin-inline: var(--dt-spacing-none) var(--dt-spacing-c);
|
|
228
|
+
}
|
|
236
229
|
}
|
|
237
230
|
|
|
238
231
|
&[isfooterpinned] .c-modal-content,
|
|
@@ -266,8 +259,12 @@
|
|
|
266
259
|
--modal-content-font-size: calc(var(--dt-font-size-16) * 1px);
|
|
267
260
|
--modal-content-font-weight: var(--dt-font-weight-regular);
|
|
268
261
|
--modal-content-line-height: calc(var(--dt-font-size-16-line-height) * 1px);
|
|
269
|
-
--modal-content-padding: var(--dt-spacing-e);
|
|
270
262
|
--modal-content-padding-block: var(--dt-spacing-a);
|
|
263
|
+
--modal-content-padding-inline: var(--dt-spacing-d);
|
|
264
|
+
|
|
265
|
+
@media (min-width: $breakpoint-wide) {
|
|
266
|
+
--modal-content-padding-inline: var(--dt-spacing-e);
|
|
267
|
+
}
|
|
271
268
|
|
|
272
269
|
// Spinner sizes defaults
|
|
273
270
|
--spinner-size: 48px;
|
|
@@ -293,7 +290,7 @@
|
|
|
293
290
|
line-height: var(--modal-content-line-height);
|
|
294
291
|
font-weight: var(--modal-content-font-weight);
|
|
295
292
|
|
|
296
|
-
padding-inline: var(--modal-content-padding);
|
|
293
|
+
padding-inline: var(--modal-content-padding-inline);
|
|
297
294
|
padding-block: var(--modal-content-padding-block);
|
|
298
295
|
|
|
299
296
|
&--scrollable {
|
package/LICENSE
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
Copyright (c) Just Eat Takeaway.com
|
|
6
|
-
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
you may not use this file except in compliance with the License.
|
|
9
|
-
You may obtain a copy of the License at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
See the License for the specific language governing permissions and
|
|
17
|
-
limitations under the License.
|