@massimo-cassandro/minimo 1.5.7 → 1.5.8
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/package.json
CHANGED
|
@@ -11,11 +11,11 @@ import * as styles from './modal-popup.module.css';
|
|
|
11
11
|
|
|
12
12
|
let dialogEl, dialogContentEl;
|
|
13
13
|
|
|
14
|
-
function closeDialog() {
|
|
15
|
-
|
|
14
|
+
function closeDialog(el) {
|
|
15
|
+
el.classList.remove(styles.on);
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
el.addEventListener('transitionend', () => {
|
|
18
|
+
el.close();
|
|
19
19
|
}, { once: true });
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -165,39 +165,41 @@ export function modalPopup({
|
|
|
165
165
|
}
|
|
166
166
|
], document.body);
|
|
167
167
|
|
|
168
|
+
// snapshot: dialogEl potrebbe essere sovrascritto da una seconda chiamata a modalPopup
|
|
169
|
+
const thisDialog = dialogEl;
|
|
168
170
|
|
|
169
171
|
// listener sul pulsante di chiusura
|
|
170
|
-
|
|
171
|
-
closeDialog();
|
|
172
|
+
thisDialog.querySelector(`.${styles.closeButton}`).addEventListener('click', () => {
|
|
173
|
+
closeDialog(thisDialog);
|
|
172
174
|
}, false);
|
|
173
175
|
|
|
174
176
|
// // Esc e clic sul backdrop
|
|
175
|
-
//
|
|
177
|
+
// thisDialog.addEventListener('cancel', (e) => {
|
|
176
178
|
// e.preventDefault();
|
|
177
|
-
// closeDialog();
|
|
179
|
+
// closeDialog(thisDialog);
|
|
178
180
|
// }, false);
|
|
179
181
|
|
|
180
182
|
|
|
181
183
|
|
|
182
|
-
|
|
184
|
+
thisDialog.addEventListener('close', () => {
|
|
183
185
|
|
|
184
186
|
document.body.classList.remove('overflow-hidden');
|
|
185
187
|
|
|
186
188
|
if(closeCallback) {
|
|
187
|
-
closeCallback(
|
|
189
|
+
closeCallback(thisDialog);
|
|
188
190
|
}
|
|
189
|
-
|
|
191
|
+
thisDialog.remove();
|
|
190
192
|
|
|
191
193
|
}, false);
|
|
192
194
|
|
|
193
195
|
|
|
194
196
|
document.body.classList.add('overflow-hidden');
|
|
195
|
-
|
|
196
|
-
|
|
197
|
+
thisDialog.showModal();
|
|
198
|
+
thisDialog.focus();
|
|
197
199
|
|
|
198
|
-
|
|
200
|
+
thisDialog.classList.add(styles.on);
|
|
199
201
|
|
|
200
202
|
|
|
201
|
-
return
|
|
203
|
+
return thisDialog;
|
|
202
204
|
|
|
203
205
|
}
|