@lemonadejs/modal 2.2.0 → 2.2.1
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.d.ts +15 -0
- package/dist/index.js +9 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,21 +10,36 @@ interface Modal {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
interface options {
|
|
13
|
+
/** Close the modal when it loses the focus */
|
|
14
|
+
autoclose?: boolean;
|
|
15
|
+
/** Modal is closed */
|
|
13
16
|
closed?: boolean;
|
|
17
|
+
/** Modal can be closed */
|
|
14
18
|
closable?: boolean;
|
|
19
|
+
/** Modal is minimized */
|
|
15
20
|
minimized?: boolean;
|
|
21
|
+
/** Modal can be minimized */
|
|
16
22
|
minimizable?: boolean;
|
|
23
|
+
/** Modal can be resized */
|
|
17
24
|
resizable?: boolean;
|
|
25
|
+
/** Modal can be moved from its original position */
|
|
18
26
|
draggable?: boolean;
|
|
27
|
+
/** Modal is automatic align center */
|
|
19
28
|
center?: boolean;
|
|
29
|
+
/** Title of the modal */
|
|
20
30
|
title?: string;
|
|
31
|
+
/** Width of the modal */
|
|
21
32
|
width?: number;
|
|
33
|
+
/** Height of the modal */
|
|
22
34
|
height?: number;
|
|
35
|
+
/** Position top */
|
|
23
36
|
top?: number;
|
|
37
|
+
/** Position Left */
|
|
24
38
|
left?: number;
|
|
25
39
|
}
|
|
26
40
|
|
|
27
41
|
interface instance {
|
|
42
|
+
autoclose: boolean;
|
|
28
43
|
closed: boolean;
|
|
29
44
|
closable: boolean;
|
|
30
45
|
minimized: boolean;
|
package/dist/index.js
CHANGED
|
@@ -161,6 +161,15 @@ if (! lemonade && typeof(require) === 'function') {
|
|
|
161
161
|
self.el.classList.add('fullscreen');
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
// Focus out of the component
|
|
165
|
+
self.el.addEventListener('focusout', function(e) {
|
|
166
|
+
if (self.autoclose === true) {
|
|
167
|
+
if (!self.el.contains(e.relatedTarget)) {
|
|
168
|
+
self.closed = true;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
164
173
|
// Close and stop propagation
|
|
165
174
|
document.addEventListener('keydown', (e) => {
|
|
166
175
|
if (e.key === 'Escape' && self.closed === false) {
|
package/package.json
CHANGED