@justeattakeaway/pie-modal 0.39.0 → 0.41.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 +33 -31
- package/package.json +5 -4
- package/src/index.ts +4 -2
- package/src/modal.scss +1 -1
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(
|
|
12
|
-
if (Array.isArray(
|
|
13
|
-
for (var e = 0, i = Array(
|
|
14
|
-
i[e] =
|
|
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];
|
|
15
15
|
return i;
|
|
16
16
|
} else
|
|
17
|
-
return Array.from(
|
|
17
|
+
return Array.from(n);
|
|
18
18
|
}
|
|
19
19
|
var O = !1;
|
|
20
20
|
if (typeof window < "u") {
|
|
@@ -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 = `*,*: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-
|
|
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-l-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 te = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, l = (
|
|
78
|
-
for (var o = t > 1 ? void 0 : t ? oe(e, i) : e, r =
|
|
79
|
-
(c =
|
|
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
80
|
return t && o && te(e, i, o), o;
|
|
81
81
|
};
|
|
82
82
|
const v = "pie-modal";
|
|
83
|
-
class
|
|
83
|
+
class a 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();
|
|
@@ -255,7 +255,8 @@ class n 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}
|
|
@@ -297,7 +298,8 @@ class n 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}
|
|
@@ -313,67 +315,67 @@ class n extends R(P) {
|
|
|
313
315
|
</dialog>`;
|
|
314
316
|
}
|
|
315
317
|
}
|
|
316
|
-
|
|
318
|
+
a.styles = F(X);
|
|
317
319
|
l([
|
|
318
320
|
d({ type: Object })
|
|
319
|
-
],
|
|
321
|
+
], a.prototype, "aria", 2);
|
|
320
322
|
l([
|
|
321
323
|
d({ type: String }),
|
|
322
324
|
j(v)
|
|
323
|
-
],
|
|
325
|
+
], a.prototype, "heading", 2);
|
|
324
326
|
l([
|
|
325
327
|
d(),
|
|
326
328
|
C(v, J, "h2")
|
|
327
|
-
],
|
|
329
|
+
], a.prototype, "headingLevel", 2);
|
|
328
330
|
l([
|
|
329
331
|
d({ type: Boolean })
|
|
330
|
-
],
|
|
332
|
+
], a.prototype, "hasBackButton", 2);
|
|
331
333
|
l([
|
|
332
334
|
d({ type: Boolean })
|
|
333
|
-
],
|
|
335
|
+
], a.prototype, "hasStackedActions", 2);
|
|
334
336
|
l([
|
|
335
337
|
d({ type: Boolean, reflect: !0 })
|
|
336
|
-
],
|
|
338
|
+
], a.prototype, "isDismissible", 2);
|
|
337
339
|
l([
|
|
338
340
|
d({ type: Boolean })
|
|
339
|
-
],
|
|
341
|
+
], a.prototype, "isFooterPinned", 2);
|
|
340
342
|
l([
|
|
341
343
|
d({ type: Boolean })
|
|
342
|
-
],
|
|
344
|
+
], a.prototype, "isFullWidthBelowMid", 2);
|
|
343
345
|
l([
|
|
344
346
|
d({ type: Boolean, reflect: !0 })
|
|
345
|
-
],
|
|
347
|
+
], a.prototype, "isLoading", 2);
|
|
346
348
|
l([
|
|
347
349
|
d({ type: Boolean })
|
|
348
|
-
],
|
|
350
|
+
], a.prototype, "isOpen", 2);
|
|
349
351
|
l([
|
|
350
352
|
d({ type: Object })
|
|
351
|
-
],
|
|
353
|
+
], a.prototype, "leadingAction", 2);
|
|
352
354
|
l([
|
|
353
355
|
d(),
|
|
354
356
|
C(v, Z, "center")
|
|
355
|
-
],
|
|
357
|
+
], a.prototype, "position", 2);
|
|
356
358
|
l([
|
|
357
359
|
d()
|
|
358
|
-
],
|
|
360
|
+
], a.prototype, "returnFocusAfterCloseSelector", 2);
|
|
359
361
|
l([
|
|
360
362
|
d(),
|
|
361
363
|
C(v, Q, "medium")
|
|
362
|
-
],
|
|
364
|
+
], a.prototype, "size", 2);
|
|
363
365
|
l([
|
|
364
366
|
d({ type: Object })
|
|
365
|
-
],
|
|
367
|
+
], a.prototype, "supportingAction", 2);
|
|
366
368
|
l([
|
|
367
369
|
I("dialog")
|
|
368
|
-
],
|
|
369
|
-
W(v,
|
|
370
|
+
], a.prototype, "_dialog", 2);
|
|
371
|
+
W(v, a);
|
|
370
372
|
export {
|
|
371
373
|
z as ON_MODAL_BACK_EVENT,
|
|
372
374
|
_ as ON_MODAL_CLOSE_EVENT,
|
|
373
375
|
ee as ON_MODAL_LEADING_ACTION_CLICK,
|
|
374
376
|
k as ON_MODAL_OPEN_EVENT,
|
|
375
377
|
ie as ON_MODAL_SUPPORTING_ACTION_CLICK,
|
|
376
|
-
|
|
378
|
+
a as PieModal,
|
|
377
379
|
J as headingLevels,
|
|
378
380
|
Z as positions,
|
|
379
381
|
Q as sizes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-modal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "PIE design system modal built using web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"watch": "run -T vite build --watch",
|
|
24
24
|
"test": "echo \"Error: no test specified\" && exit 0",
|
|
25
25
|
"test:ci": "yarn test",
|
|
26
|
+
"test:browsers-setup": "npx playwright-lit-setup",
|
|
26
27
|
"test:browsers": "npx playwright test -c ./playwright-lit.config.ts",
|
|
27
28
|
"test:browsers:ci": "yarn test:browsers",
|
|
28
29
|
"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",
|
|
@@ -32,8 +33,8 @@
|
|
|
32
33
|
"license": "Apache-2.0",
|
|
33
34
|
"devDependencies": {
|
|
34
35
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
35
|
-
"@justeat/pie-design-tokens": "
|
|
36
|
-
"@justeattakeaway/pie-components-config": "0.
|
|
36
|
+
"@justeat/pie-design-tokens": "6.0.0",
|
|
37
|
+
"@justeattakeaway/pie-components-config": "0.13.0",
|
|
37
38
|
"@justeattakeaway/pie-wrapper-react": "0.14.0",
|
|
38
39
|
"@types/body-scroll-lock": "3.1.2",
|
|
39
40
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
"extends": "../../../package.json"
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
45
|
-
"@justeattakeaway/pie-button": "0.
|
|
46
|
+
"@justeattakeaway/pie-button": "0.46.0",
|
|
46
47
|
"@justeattakeaway/pie-icon-button": "0.27.7",
|
|
47
48
|
"@justeattakeaway/pie-icons-webc": "0.19.1",
|
|
48
49
|
"@justeattakeaway/pie-spinner": "0.5.5",
|
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
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
// The base modal defaults
|
|
15
15
|
--modal-border-radius: var(--dt-radius-rounded-d);
|
|
16
|
-
--modal-font: var(--dt-font-interactive-
|
|
16
|
+
--modal-font: var(--dt-font-interactive-l-family);
|
|
17
17
|
--modal-bg-color: var(--dt-color-container-default);
|
|
18
18
|
--modal-elevation: var(--dt-elevation-04);
|
|
19
19
|
|