@lemonadejs/modal 3.3.0 → 5.0.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 +16 -10
- package/dist/style.css +10 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* pin the modal to the left panel
|
|
3
3
|
*/
|
|
4
|
-
if (!
|
|
4
|
+
if (!lemonade && typeof (require) === 'function') {
|
|
5
5
|
var lemonade = require('lemonadejs');
|
|
6
6
|
}
|
|
7
7
|
|
|
@@ -180,8 +180,10 @@ if (! lemonade && typeof (require) === 'function') {
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
document
|
|
184
|
-
|
|
183
|
+
if (typeof(document) !== "undefined") {
|
|
184
|
+
document.addEventListener('mouseup', mouseUp);
|
|
185
|
+
document.addEventListener('mousemove', mouseMove);
|
|
186
|
+
}
|
|
185
187
|
|
|
186
188
|
const isTrue = function(e) {
|
|
187
189
|
return e === true || e === 1 || e === 'true';
|
|
@@ -494,11 +496,6 @@ if (! lemonade && typeof (require) === 'function') {
|
|
|
494
496
|
}
|
|
495
497
|
}
|
|
496
498
|
|
|
497
|
-
// Bring to front on focus
|
|
498
|
-
if (self.layers !== false) {
|
|
499
|
-
self.el.classList.add('lm-modal-layers');
|
|
500
|
-
}
|
|
501
|
-
|
|
502
499
|
// Import content from DOM
|
|
503
500
|
if (self.content) {
|
|
504
501
|
if (typeof(self.content) === 'string') {
|
|
@@ -510,13 +507,20 @@ if (! lemonade && typeof (require) === 'function') {
|
|
|
510
507
|
|
|
511
508
|
// Focus out of the component
|
|
512
509
|
self.el.addEventListener('focusout', function(e) {
|
|
513
|
-
if (
|
|
514
|
-
if (
|
|
510
|
+
if (! self.el.contains(e.relatedTarget)) {
|
|
511
|
+
if (isTrue(self['auto-close'])) {
|
|
515
512
|
self.closed = true;
|
|
516
513
|
}
|
|
514
|
+
// Remove focus
|
|
515
|
+
self.el.classList.remove('lm-modal-focus');
|
|
517
516
|
}
|
|
518
517
|
});
|
|
519
518
|
|
|
519
|
+
// Focus out of the component
|
|
520
|
+
self.el.addEventListener('focusin', function(e) {
|
|
521
|
+
self.el.classList.add('lm-modal-focus');
|
|
522
|
+
});
|
|
523
|
+
|
|
520
524
|
// Close and stop propagation
|
|
521
525
|
self.el.addEventListener('keydown', (e) => {
|
|
522
526
|
if (e.key === 'Escape') {
|
|
@@ -741,6 +745,8 @@ if (! lemonade && typeof (require) === 'function') {
|
|
|
741
745
|
if (self.closed === true) {
|
|
742
746
|
self.closed = false;
|
|
743
747
|
}
|
|
748
|
+
// Focus on the new modal
|
|
749
|
+
self.el.focus();
|
|
744
750
|
}
|
|
745
751
|
|
|
746
752
|
self.close = function() {
|
package/dist/style.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.lm-modal {
|
|
2
2
|
position: fixed;
|
|
3
|
-
min-width:
|
|
4
|
-
min-height:
|
|
3
|
+
min-width: 200px;
|
|
4
|
+
min-height: 200px;
|
|
5
5
|
border-radius: 5px;
|
|
6
6
|
z-index: 15;
|
|
7
7
|
background-color: var(--lm-background-color, #fff);
|
|
@@ -28,15 +28,19 @@
|
|
|
28
28
|
.lm-modal-title {
|
|
29
29
|
width: 100%;
|
|
30
30
|
border-bottom: 1px solid var(--lm-border-color, #ccc);
|
|
31
|
-
padding:
|
|
31
|
+
padding: 12px;
|
|
32
32
|
box-sizing: border-box;
|
|
33
|
-
font-size: 1.
|
|
33
|
+
font-size: 1.3em;
|
|
34
34
|
line-height: 24px;
|
|
35
35
|
user-select: none;
|
|
36
36
|
display: flex;
|
|
37
37
|
border-radius: 5px 5px 0 0;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
.lm-modal-focus {
|
|
41
|
+
z-index: 999;
|
|
42
|
+
}
|
|
43
|
+
|
|
40
44
|
.lm-modal > .lm-modal-title {
|
|
41
45
|
display: none;
|
|
42
46
|
}
|
|
@@ -57,9 +61,9 @@
|
|
|
57
61
|
height: 24px;
|
|
58
62
|
font-size: 24px;
|
|
59
63
|
cursor: pointer;
|
|
60
|
-
font-family: "Material Icons";
|
|
64
|
+
font-family: "Material Symbols Outlined", "Material Icons";
|
|
61
65
|
text-align: center;
|
|
62
|
-
margin-right:
|
|
66
|
+
margin-right: 8px;
|
|
63
67
|
display: none;
|
|
64
68
|
}
|
|
65
69
|
|
|
@@ -92,10 +96,6 @@
|
|
|
92
96
|
opacity: 0;
|
|
93
97
|
}
|
|
94
98
|
|
|
95
|
-
.lm-modal-layers:focus {
|
|
96
|
-
z-index: 999;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
99
|
.lm-modal[animation="false"] {
|
|
100
100
|
transition: initial;
|
|
101
101
|
}
|