@justeattakeaway/pie-modal 0.19.1 → 0.21.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 +525 -1164
- package/package.json +2 -2
- package/src/index.ts +16 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-modal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "PIE design system modal built using web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@types/body-scroll-lock": "3.1.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"body-scroll-lock": "
|
|
40
|
+
"body-scroll-lock": "3.1.5"
|
|
41
41
|
},
|
|
42
42
|
"volta": {
|
|
43
43
|
"extends": "../../../package.json"
|
package/src/index.ts
CHANGED
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
} from '@justeattakeaway/pie-webc-core';
|
|
9
9
|
import type { DependentMap } from '@justeattakeaway/pie-webc-core';
|
|
10
10
|
import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
|
|
11
|
-
import '@justeattakeaway/pie-icons-webc/
|
|
12
|
-
import '@justeattakeaway/pie-icons-webc/
|
|
13
|
-
import '@justeattakeaway/pie-icons-webc/
|
|
11
|
+
import '@justeattakeaway/pie-icons-webc/IconClose';
|
|
12
|
+
import '@justeattakeaway/pie-icons-webc/IconChevronLeft';
|
|
13
|
+
import '@justeattakeaway/pie-icons-webc/IconChevronRight';
|
|
14
14
|
|
|
15
15
|
import dialogPolyfill from 'dialog-polyfill';
|
|
16
16
|
|
|
@@ -139,7 +139,12 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps {
|
|
|
139
139
|
* Opens the dialog element and disables page scrolling
|
|
140
140
|
*/
|
|
141
141
|
private _handleModalOpened () : void {
|
|
142
|
-
|
|
142
|
+
const modalScrollContainer = this._dialog?.querySelector('.c-modal-scrollContainer');
|
|
143
|
+
|
|
144
|
+
if (modalScrollContainer) {
|
|
145
|
+
disableBodyScroll(modalScrollContainer);
|
|
146
|
+
}
|
|
147
|
+
|
|
143
148
|
if (this._dialog?.hasAttribute('open') || !this._dialog?.isConnected) {
|
|
144
149
|
return;
|
|
145
150
|
}
|
|
@@ -151,7 +156,12 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps {
|
|
|
151
156
|
* Closes the dialog element and re-enables page scrolling
|
|
152
157
|
*/
|
|
153
158
|
private _handleModalClosed () : void {
|
|
154
|
-
|
|
159
|
+
const modalScrollContainer = this._dialog?.querySelector('.c-modal-scrollContainer');
|
|
160
|
+
|
|
161
|
+
if (modalScrollContainer) {
|
|
162
|
+
enableBodyScroll(modalScrollContainer);
|
|
163
|
+
}
|
|
164
|
+
|
|
155
165
|
this._dialog?.close();
|
|
156
166
|
this._returnFocus();
|
|
157
167
|
}
|
|
@@ -327,7 +337,7 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps {
|
|
|
327
337
|
*/
|
|
328
338
|
private renderModalContentAndFooter (): TemplateResult {
|
|
329
339
|
return html`
|
|
330
|
-
<article class="c-modal-content c-modal-content--scrollable">
|
|
340
|
+
<article class="c-modal-scrollContainer c-modal-content c-modal-content--scrollable">
|
|
331
341
|
<div class="c-modal-contentInner">
|
|
332
342
|
<slot></slot>
|
|
333
343
|
</div>
|