@lemonadejs/modal 2.8.1 → 3.2.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/README.md +44 -29
- package/dist/index.d.ts +6 -0
- package/dist/index.js +165 -77
- package/dist/react.d.ts +5 -2
- package/dist/style.css +39 -30
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -121,7 +121,7 @@ Quick example with Vue
|
|
|
121
121
|
</script>
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
Programmatically - Quick example with Javascript
|
|
125
125
|
|
|
126
126
|
```html
|
|
127
127
|
<html>
|
|
@@ -159,43 +159,58 @@ You can configure things such as position, size, and functionalities.
|
|
|
159
159
|
|
|
160
160
|
### Settings
|
|
161
161
|
|
|
162
|
-
| Attribute
|
|
163
|
-
|
|
164
|
-
| title?
|
|
165
|
-
| height?
|
|
166
|
-
| width?
|
|
167
|
-
| top?
|
|
168
|
-
| left?
|
|
169
|
-
| draggable?
|
|
170
|
-
| resizable?
|
|
171
|
-
| closed?
|
|
172
|
-
| closable?
|
|
173
|
-
| center?
|
|
174
|
-
| url?
|
|
175
|
-
| auto-close?
|
|
176
|
-
| auto-adjust? | Boolean | Ensures modal will be visible on screen. `Default: false`.
|
|
177
|
-
| backdrop?
|
|
178
|
-
| minimizable? | Boolean | Modal can be minimized. `Default: false`.
|
|
179
|
-
| minimized?
|
|
180
|
-
| position?
|
|
181
|
-
| title?
|
|
182
|
-
| responsive?
|
|
183
|
-
| layers?
|
|
184
|
-
| focus?
|
|
185
|
-
| overflow?
|
|
162
|
+
| Attribute | Type | Description |
|
|
163
|
+
|--------------|---------|----------------------------------------------------------------------------|
|
|
164
|
+
| title? | String | The header title of the modal. If empty, the header will be not displayed. |
|
|
165
|
+
| height? | Number | The height of the modal in pixels. |
|
|
166
|
+
| width? | Number | The width of the modal in pixels. |
|
|
167
|
+
| top? | Number | The vertical position of the modal within its window in pixels. |
|
|
168
|
+
| left? | Number | The horizontal position of the modal within its window in pixels. |
|
|
169
|
+
| draggable? | Boolean | Determines if the modal can be dragged. `Default: false`. |
|
|
170
|
+
| resizable? | Boolean | Determines if the modal can be resized. `Default: false`. |
|
|
171
|
+
| closed? | Boolean | Controls the open and close state of the modal. `Default: false`. |
|
|
172
|
+
| closable? | Boolean | Disables the ability to close the modal. `Default: false`. |
|
|
173
|
+
| center? | Boolean | Enables rendering the modal in the center of its window. `Default: false`. |
|
|
174
|
+
| url? | String | The URL from which to fetch and render content. |
|
|
175
|
+
| auto-close? | Boolean | Close the modal when it loses the focus. `Default: false`. |
|
|
176
|
+
| auto-adjust? | Boolean | Ensures modal will be visible on screen. `Default: false`. |
|
|
177
|
+
| backdrop? | Boolean | Enables the backdrop when the modal is opened. |
|
|
178
|
+
| minimizable? | Boolean | Modal can be minimized. `Default: false`. |
|
|
179
|
+
| minimized? | Boolean | Current minimized state of the modal. |
|
|
180
|
+
| position? | String | Modal is automatic align during initialization. |
|
|
181
|
+
| title? | String | Title of the modal. |
|
|
182
|
+
| responsive? | Boolean | Enables responsive mode. `Default: true`. |
|
|
183
|
+
| layers? | Boolean | Bring to front on focus. |
|
|
184
|
+
| focus? | Boolean | Focus on the modal when open it. `Default: true`. |
|
|
185
|
+
| overflow? | Boolean | Create scroll when the content is larger than the modal. `Default: false`. |
|
|
186
186
|
|
|
187
187
|
|
|
188
188
|
### Events
|
|
189
189
|
|
|
190
|
-
| Event
|
|
191
|
-
|
|
192
|
-
|
|
|
193
|
-
|
|
|
190
|
+
| Event | Description |
|
|
191
|
+
|-----------|------------------------------------------|
|
|
192
|
+
| onload? | When the modal is ready. |
|
|
193
|
+
| onclose? | Called when modal closes. |
|
|
194
|
+
| onopen? | Called when modal opens. |
|
|
195
|
+
| onresize? | When the user resize the modal. |
|
|
196
|
+
| onmove? | When the user change the modal position. |
|
|
197
|
+
|
|
194
198
|
|
|
195
199
|
## License
|
|
196
200
|
|
|
197
201
|
The LemonadeJS Modal is released under the MIT.
|
|
198
202
|
|
|
203
|
+
|
|
204
|
+
## Changelog
|
|
205
|
+
|
|
206
|
+
### 3.1.1
|
|
207
|
+
|
|
208
|
+
- Added new events: `onmove` and `onresize`.
|
|
209
|
+
|
|
210
|
+
### 3.1.0
|
|
211
|
+
|
|
212
|
+
- Close modal using the keyboard by pressing `Shift + Tab` on the icon.
|
|
213
|
+
|
|
199
214
|
## Other Tools
|
|
200
215
|
|
|
201
216
|
- [jSuites](https://jsuites.net/docs)
|
package/dist/index.d.ts
CHANGED
|
@@ -54,6 +54,12 @@ declare namespace Modal {
|
|
|
54
54
|
onclose?: (self: object) => void;
|
|
55
55
|
/** onload event */
|
|
56
56
|
onload?: (self: object) => void;
|
|
57
|
+
/** Move event */
|
|
58
|
+
onmove?: (self: object, x: number, y: number) => void;
|
|
59
|
+
/** Resize event */
|
|
60
|
+
onresize?: (self: object, w: number, h: number) => void;
|
|
61
|
+
/** Import content from DOM reference */
|
|
62
|
+
content?: HTMLElement;
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
interface Instance {
|
package/dist/index.js
CHANGED
|
@@ -123,33 +123,59 @@ if (!lemonade && typeof (require) === 'function') {
|
|
|
123
123
|
|
|
124
124
|
state.x = x;
|
|
125
125
|
state.y = y;
|
|
126
|
-
state.top = top
|
|
127
|
-
state.left = left
|
|
126
|
+
state.top = top;
|
|
127
|
+
state.left = left;
|
|
128
128
|
} else if (controls.type === 'resize') {
|
|
129
|
+
let top = null;
|
|
130
|
+
let left = null;
|
|
129
131
|
let width = null;
|
|
130
132
|
let height = null;
|
|
131
|
-
let newHeight = null;
|
|
132
133
|
|
|
133
134
|
if (controls.d === 'e-resize' || controls.d === 'ne-resize' || controls.d === 'se-resize') {
|
|
134
|
-
// Update width
|
|
135
135
|
width = controls.w + (x - controls.x);
|
|
136
|
-
controls.e.style.width = width + 'px';
|
|
137
136
|
|
|
138
|
-
// Update Height
|
|
139
137
|
if (e.shiftKey) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
138
|
+
height = controls.h + (x - controls.x) * (controls.h / controls.w);
|
|
139
|
+
}
|
|
140
|
+
} else if (controls.d === 'w-resize' || controls.d === 'nw-resize'|| controls.d === 'sw-resize') {
|
|
141
|
+
left = controls.l + (x - controls.x);
|
|
142
|
+
// Do not move further
|
|
143
|
+
if (left >= controls.l) {
|
|
144
|
+
left = controls.l;
|
|
145
|
+
}
|
|
146
|
+
// Update width
|
|
147
|
+
width = controls.l + controls.w - left;
|
|
148
|
+
// Consider shift to update height
|
|
149
|
+
if (e.shiftKey) {
|
|
150
|
+
height = controls.h - (x - controls.x) * (controls.h / controls.w);
|
|
145
151
|
}
|
|
146
152
|
}
|
|
147
153
|
|
|
148
|
-
if (
|
|
149
|
-
if (
|
|
154
|
+
if (controls.d === 's-resize' || controls.d === 'se-resize' || controls.d === 'sw-resize') {
|
|
155
|
+
if (! height) {
|
|
150
156
|
height = controls.h + (y - controls.y);
|
|
151
|
-
controls.e.style.height = height + 'px';
|
|
152
157
|
}
|
|
158
|
+
} else if (controls.d === 'n-resize' || controls.d === 'ne-resize' || controls.d === 'nw-resize') {
|
|
159
|
+
top = controls.t + (y - controls.y);
|
|
160
|
+
// Do not move further
|
|
161
|
+
if (top >= controls.t) {
|
|
162
|
+
top = controls.t;
|
|
163
|
+
}
|
|
164
|
+
// Update height
|
|
165
|
+
height = controls.t + controls.h - top;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (top) {
|
|
169
|
+
controls.e.style.top = top + 'px';
|
|
170
|
+
}
|
|
171
|
+
if (left) {
|
|
172
|
+
controls.e.style.left = left + 'px';
|
|
173
|
+
}
|
|
174
|
+
if (width) {
|
|
175
|
+
controls.e.style.width = width + 'px';
|
|
176
|
+
}
|
|
177
|
+
if (height) {
|
|
178
|
+
controls.e.style.height = height + 'px';
|
|
153
179
|
}
|
|
154
180
|
}
|
|
155
181
|
}
|
|
@@ -162,9 +188,11 @@ if (!lemonade && typeof (require) === 'function') {
|
|
|
162
188
|
}
|
|
163
189
|
|
|
164
190
|
// Dispatcher
|
|
165
|
-
const Dispatch = function(type
|
|
191
|
+
const Dispatch = function(type){
|
|
166
192
|
if (typeof this[type] === 'function') {
|
|
167
|
-
|
|
193
|
+
let args = Array.from(arguments);
|
|
194
|
+
args.shift();
|
|
195
|
+
this[type](...args)
|
|
168
196
|
}
|
|
169
197
|
}
|
|
170
198
|
|
|
@@ -355,9 +383,40 @@ if (!lemonade && typeof (require) === 'function') {
|
|
|
355
383
|
}
|
|
356
384
|
}
|
|
357
385
|
|
|
386
|
+
const removeElements = function(root) {
|
|
387
|
+
// Keep the DOM elements
|
|
388
|
+
let elements = [];
|
|
389
|
+
if (root) {
|
|
390
|
+
while (root.firstChild) {
|
|
391
|
+
elements.push(root.firstChild);
|
|
392
|
+
root.firstChild.remove();
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return elements;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const appendElements = function(root, elements) {
|
|
399
|
+
if (elements && elements.length) {
|
|
400
|
+
while (elements[0]) {
|
|
401
|
+
root.appendChild(elements.shift());
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
358
406
|
const Modal = function (template) {
|
|
359
407
|
let self = this;
|
|
360
408
|
let backdrop = null;
|
|
409
|
+
let elements = null;
|
|
410
|
+
|
|
411
|
+
if (this.tagName) {
|
|
412
|
+
// Remove elements from the DOM
|
|
413
|
+
elements = removeElements(this);
|
|
414
|
+
|
|
415
|
+
this.addEventListener('dragstart', (e) => {
|
|
416
|
+
e.preventDefault();
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
|
|
361
420
|
// Make sure keep the state as boolean
|
|
362
421
|
self.closed = !!self.closed;
|
|
363
422
|
|
|
@@ -440,7 +499,11 @@ if (!lemonade && typeof (require) === 'function') {
|
|
|
440
499
|
backdrop.classList.add('lm-modal-backdrop');
|
|
441
500
|
backdrop.addEventListener('click', function() {
|
|
442
501
|
self.closed = true;
|
|
443
|
-
})
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
if (self.closed === false) {
|
|
505
|
+
self.el.parentNode.insertBefore(backdrop, self.el);
|
|
506
|
+
}
|
|
444
507
|
}
|
|
445
508
|
|
|
446
509
|
// Bring to front on focus
|
|
@@ -448,6 +511,11 @@ if (!lemonade && typeof (require) === 'function') {
|
|
|
448
511
|
self.el.classList.add('lm-modal-layers');
|
|
449
512
|
}
|
|
450
513
|
|
|
514
|
+
// Import content from DOM
|
|
515
|
+
if (self.content) {
|
|
516
|
+
self.el.children[1].appendChild(self.content);
|
|
517
|
+
}
|
|
518
|
+
|
|
451
519
|
// Focus out of the component
|
|
452
520
|
self.el.addEventListener('focusout', function(e) {
|
|
453
521
|
if (isTrue(self['auto-close'])) {
|
|
@@ -459,13 +527,20 @@ if (!lemonade && typeof (require) === 'function') {
|
|
|
459
527
|
|
|
460
528
|
// Close and stop propagation
|
|
461
529
|
self.el.addEventListener('keydown', (e) => {
|
|
462
|
-
if (e.key === 'Escape'
|
|
463
|
-
self.closed
|
|
464
|
-
|
|
465
|
-
|
|
530
|
+
if (e.key === 'Escape') {
|
|
531
|
+
if (self.closed === false) {
|
|
532
|
+
self.closed = true;
|
|
533
|
+
e.preventDefault();
|
|
534
|
+
e.stopImmediatePropagation();
|
|
535
|
+
}
|
|
536
|
+
} else if (e.key === 'Enter') {
|
|
537
|
+
self.click(e);
|
|
466
538
|
}
|
|
467
539
|
});
|
|
468
540
|
|
|
541
|
+
// Append elements to the container
|
|
542
|
+
appendElements(self.el.children[1], elements);
|
|
543
|
+
|
|
469
544
|
if (typeof(onload) === 'function') {
|
|
470
545
|
Dispatch.call(self, 'onload', self);
|
|
471
546
|
}
|
|
@@ -539,6 +614,8 @@ if (!lemonade && typeof (require) === 'function') {
|
|
|
539
614
|
return;
|
|
540
615
|
}
|
|
541
616
|
|
|
617
|
+
// Get mouse coordinates
|
|
618
|
+
let [x,y] = getCoords(e);
|
|
542
619
|
// Root element of the component
|
|
543
620
|
let item = self.el;
|
|
544
621
|
// Get the position and dimensions
|
|
@@ -549,17 +626,31 @@ if (!lemonade && typeof (require) === 'function') {
|
|
|
549
626
|
controls.e = item;
|
|
550
627
|
controls.w = rect.width;
|
|
551
628
|
controls.h = rect.height;
|
|
629
|
+
controls.t = rect.top;
|
|
630
|
+
controls.l = rect.left;
|
|
552
631
|
|
|
553
632
|
// When resizable
|
|
554
633
|
if (self.resizable === true) {
|
|
555
|
-
if (
|
|
634
|
+
if (e.clientY - rect.top < cornerSize) {
|
|
635
|
+
if (rect.width - (e.clientX - rect.left) < cornerSize) {
|
|
636
|
+
item.style.cursor = 'ne-resize';
|
|
637
|
+
} else if (e.clientX - rect.left < cornerSize) {
|
|
638
|
+
item.style.cursor = 'nw-resize';
|
|
639
|
+
} else {
|
|
640
|
+
item.style.cursor = 'n-resize';
|
|
641
|
+
}
|
|
642
|
+
} else if (rect.height - (e.clientY - rect.top) < cornerSize) {
|
|
556
643
|
if (rect.width - (e.clientX - rect.left) < cornerSize) {
|
|
557
644
|
item.style.cursor = 'se-resize';
|
|
645
|
+
} else if (e.clientX - rect.left < cornerSize) {
|
|
646
|
+
item.style.cursor = 'sw-resize';
|
|
558
647
|
} else {
|
|
559
648
|
item.style.cursor = 's-resize';
|
|
560
649
|
}
|
|
561
650
|
} else if (rect.width - (e.clientX - rect.left) < cornerSize) {
|
|
562
651
|
item.style.cursor = 'e-resize';
|
|
652
|
+
} else if (e.clientX - rect.left < cornerSize) {
|
|
653
|
+
item.style.cursor = 'w-resize';
|
|
563
654
|
} else {
|
|
564
655
|
item.style.cursor = '';
|
|
565
656
|
}
|
|
@@ -572,6 +663,22 @@ if (!lemonade && typeof (require) === 'function') {
|
|
|
572
663
|
controls.d = null;
|
|
573
664
|
}
|
|
574
665
|
}
|
|
666
|
+
|
|
667
|
+
if (controls.type == null && isTrue(self.draggable)) {
|
|
668
|
+
if (y - rect.top < 40) {
|
|
669
|
+
item.style.cursor = 'move';
|
|
670
|
+
} else {
|
|
671
|
+
item.style.cursor = '';
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
if (item.style.cursor) {
|
|
675
|
+
controls.type = 'move';
|
|
676
|
+
controls.d = item.style.cursor;
|
|
677
|
+
} else {
|
|
678
|
+
controls.type = null;
|
|
679
|
+
controls.d = null;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
575
682
|
}
|
|
576
683
|
|
|
577
684
|
self.mousedown = function(e) {
|
|
@@ -587,6 +694,8 @@ if (!lemonade && typeof (require) === 'function') {
|
|
|
587
694
|
controls.e = item;
|
|
588
695
|
controls.w = rect.width;
|
|
589
696
|
controls.h = rect.height;
|
|
697
|
+
controls.t = rect.top;
|
|
698
|
+
controls.l = rect.left;
|
|
590
699
|
// If is not minimized
|
|
591
700
|
if (controls.type === 'resize') {
|
|
592
701
|
// Make sure the width and height is defined for the modal
|
|
@@ -601,17 +710,18 @@ if (!lemonade && typeof (require) === 'function') {
|
|
|
601
710
|
self.width = parseInt(item.style.width);
|
|
602
711
|
self.height = parseInt(item.style.height);
|
|
603
712
|
controls.e.classList.remove('action');
|
|
713
|
+
// Event
|
|
714
|
+
Dispatch.call(self, 'onresize', self, self.width, self.height);
|
|
604
715
|
}
|
|
605
716
|
controls.e.classList.add('action');
|
|
606
|
-
} else if (isTrue(self.draggable) &&
|
|
607
|
-
// Action
|
|
608
|
-
controls.type = 'move';
|
|
717
|
+
} else if (isTrue(self.draggable) && y - rect.top < 40) {
|
|
609
718
|
// Callback
|
|
610
719
|
controls.action = function () {
|
|
611
720
|
self.top = parseInt(item.style.top);
|
|
612
721
|
self.left = parseInt(item.style.left);
|
|
613
|
-
|
|
614
722
|
controls.e.classList.remove('action');
|
|
723
|
+
// Event
|
|
724
|
+
Dispatch.call(self, 'onmove', self, self.top, self.left);
|
|
615
725
|
}
|
|
616
726
|
controls.e.classList.add('action');
|
|
617
727
|
// Remove transform
|
|
@@ -621,36 +731,16 @@ if (!lemonade && typeof (require) === 'function') {
|
|
|
621
731
|
}
|
|
622
732
|
|
|
623
733
|
self.click = function(e) {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
// Get the position and dimensions
|
|
627
|
-
let rect = self.el.getBoundingClientRect();
|
|
628
|
-
// Right
|
|
629
|
-
let right = rect.width - (x - rect.left);
|
|
630
|
-
// Corner
|
|
631
|
-
let corner = (y - rect.top) < 40 && right > 10 && right < 34;
|
|
632
|
-
// Check if the click in on close
|
|
633
|
-
if (isTrue(self.closable)) {
|
|
634
|
-
if (corner) {
|
|
635
|
-
self.closed = true;
|
|
636
|
-
|
|
637
|
-
if (isTrue(self.minimizable)) {
|
|
638
|
-
removeMini(self);
|
|
639
|
-
}
|
|
640
|
-
return;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
corner = (y - rect.top) < 40 && right > 10 && right < 65;
|
|
734
|
+
if (e.target.classList.contains('lm-modal-close')) {
|
|
735
|
+
self.closed = true;
|
|
644
736
|
}
|
|
645
|
-
|
|
646
|
-
if (
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
setMini(self);
|
|
653
|
-
}
|
|
737
|
+
|
|
738
|
+
if (e.target.classList.contains('lm-modal-minimize')) {
|
|
739
|
+
// Handles minimized modal positioning
|
|
740
|
+
if (self.minimized === true) {
|
|
741
|
+
removeMini(self);
|
|
742
|
+
} else {
|
|
743
|
+
setMini(self);
|
|
654
744
|
}
|
|
655
745
|
}
|
|
656
746
|
}
|
|
@@ -667,37 +757,35 @@ if (!lemonade && typeof (require) === 'function') {
|
|
|
667
757
|
}
|
|
668
758
|
}
|
|
669
759
|
|
|
670
|
-
|
|
671
|
-
|
|
760
|
+
if (! template) {
|
|
761
|
+
template = '';
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
return `<div class="lm-modal" animation="{{self.animation}}" position="{{self.position}}" closed="{{self.closed}}" closable="{{self.closable}}" minimizable="{{self.minimizable}}" minimized="{{self.minimized}}" overflow="{{self.overflow}}" :top="self.top" :left="self.left" :width="self.width" :height="self.height" onmousedown="self.mousedown" onmousemove="self.mousemove" onclick="self.click" tabindex="-1" role="modal">
|
|
765
|
+
<div class="lm-modal-title" data-title="{{self.title}}" data-icon="{{self.icon}}"><div class="lm-modal-icon">{{self.icon}}</div><div>{{self.title}}</div><div class="lm-modal-icon lm-modal-minimize" tabindex="0"></div><div class="lm-modal-icon lm-modal-close" tabindex="0"></div></div>
|
|
672
766
|
<div>${template}</div>
|
|
673
767
|
</div>`
|
|
674
768
|
}
|
|
675
769
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
return function (root, options, template) {
|
|
770
|
+
const Component = function (root, options, template) {
|
|
679
771
|
if (typeof(root) === 'object') {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
}
|
|
683
|
-
// Keep the DOM elements
|
|
684
|
-
let elements = [];
|
|
685
|
-
while (root.firstChild) {
|
|
686
|
-
elements.push(root.firstChild);
|
|
687
|
-
root.firstChild.remove();
|
|
688
|
-
}
|
|
772
|
+
// Remove elements from the DOM
|
|
773
|
+
let elements = removeElements(root);
|
|
689
774
|
// Create the modal
|
|
690
775
|
let e = lemonade.render(Modal, root, options, template);
|
|
691
|
-
//
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
e.children[1].appendChild(elements[0]);
|
|
695
|
-
elements.shift();
|
|
696
|
-
}
|
|
697
|
-
}
|
|
776
|
+
// Add elements to the container
|
|
777
|
+
appendElements(e.children[1], elements);
|
|
778
|
+
|
|
698
779
|
return options;
|
|
699
780
|
} else {
|
|
700
|
-
return Modal.call(this
|
|
781
|
+
return Modal.call(this);
|
|
701
782
|
}
|
|
702
783
|
}
|
|
784
|
+
|
|
785
|
+
// Create LemonadeJS Component
|
|
786
|
+
lemonade.setComponents({ Modal: Modal });
|
|
787
|
+
// Create Web Component
|
|
788
|
+
lemonade.createWebComponent('modal', Modal)
|
|
789
|
+
|
|
790
|
+
return Component;
|
|
703
791
|
})));
|
package/dist/react.d.ts
CHANGED
|
@@ -5,13 +5,16 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import Component from './index';
|
|
9
9
|
|
|
10
10
|
interface Modal {
|
|
11
|
+
ref?: MutableRefObject<undefined>;
|
|
11
12
|
(): any
|
|
12
13
|
[key: string]: any
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
type Props = IntrinsicAttributes & Component.Options & Modal;
|
|
17
|
+
|
|
18
|
+
declare function Modal<Modal>(props: Props): any;
|
|
16
19
|
|
|
17
20
|
export default Modal;
|
package/dist/style.css
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
box-sizing: border-box;
|
|
9
9
|
box-shadow: 0 0 12px rgb(0 0 0 / 22%);
|
|
10
10
|
opacity: 1;
|
|
11
|
-
will-change: transform;
|
|
12
11
|
border: 1px solid var(--lm-border-color, #ccc);
|
|
13
12
|
outline: none;
|
|
14
13
|
margin: 0;
|
|
@@ -18,6 +17,14 @@
|
|
|
18
17
|
color: var(--lm-font-color, #000);
|
|
19
18
|
}
|
|
20
19
|
|
|
20
|
+
.lm-modal[closed="true"] {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.lm-modal.action {
|
|
25
|
+
user-select: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
21
28
|
.lm-modal-title {
|
|
22
29
|
width: 100%;
|
|
23
30
|
border-bottom: 1px solid var(--lm-border-color, #ccc);
|
|
@@ -27,56 +34,58 @@
|
|
|
27
34
|
line-height: 24px;
|
|
28
35
|
user-select: none;
|
|
29
36
|
display: flex;
|
|
30
|
-
border-radius: 5px;
|
|
37
|
+
border-radius: 5px 5px 0 0;
|
|
31
38
|
}
|
|
32
39
|
|
|
33
|
-
.lm-modal-title
|
|
40
|
+
.lm-modal > .lm-modal-title {
|
|
34
41
|
display: none;
|
|
35
42
|
}
|
|
36
43
|
|
|
37
|
-
.lm-modal-title[data-icon]
|
|
38
|
-
|
|
44
|
+
.lm-modal > .lm-modal-title[data-icon],
|
|
45
|
+
.lm-modal > .lm-modal-title[data-title],
|
|
46
|
+
.lm-modal[closable="true"] > .lm-modal-title,
|
|
47
|
+
.lm-modal[minimizable="true"] > .lm-modal-title {
|
|
48
|
+
display: inherit;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.lm-modal > .lm-modal-title > div:nth-child(2) {
|
|
52
|
+
flex: 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.lm-modal > .lm-modal-title > .lm-modal-icon {
|
|
39
56
|
width: 24px;
|
|
40
57
|
height: 24px;
|
|
41
58
|
font-size: 24px;
|
|
59
|
+
cursor: pointer;
|
|
42
60
|
font-family: "Material Icons";
|
|
61
|
+
text-align: center;
|
|
43
62
|
margin-right: 5px;
|
|
63
|
+
display: none;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.lm-modal > .lm-modal-title > .lm-modal-icon:not(:empty) {
|
|
67
|
+
display: inherit;
|
|
44
68
|
}
|
|
45
69
|
|
|
46
|
-
.lm-modal
|
|
70
|
+
.lm-modal > .lm-modal-title > .lm-modal-close::before {
|
|
47
71
|
content: 'close';
|
|
48
|
-
width: 24px;
|
|
49
|
-
height: 24px;
|
|
50
|
-
font-size: 24px;
|
|
51
|
-
font-family: "Material Icons";
|
|
52
|
-
position: absolute;
|
|
53
|
-
top: 10px;
|
|
54
|
-
right: 10px;
|
|
55
|
-
cursor: pointer;
|
|
56
72
|
}
|
|
57
73
|
|
|
58
|
-
.lm-modal
|
|
74
|
+
.lm-modal > .lm-modal-title > .lm-modal-minimize::before {
|
|
59
75
|
content: '\2500';
|
|
60
|
-
width: 24px;
|
|
61
|
-
height: 24px;
|
|
62
|
-
font-size: 24px;
|
|
63
|
-
font-family: "Material Icons";
|
|
64
|
-
position: absolute;
|
|
65
|
-
top: 10px;
|
|
66
|
-
right: 15px;
|
|
67
|
-
cursor: pointer;
|
|
68
76
|
}
|
|
69
77
|
|
|
70
|
-
.lm-modal[
|
|
71
|
-
|
|
78
|
+
.lm-modal[minimized="true"] > .lm-modal-title > .lm-modal-minimize::before {
|
|
79
|
+
content: '\e5d7';
|
|
72
80
|
}
|
|
73
81
|
|
|
74
|
-
.lm-modal[
|
|
75
|
-
display:
|
|
82
|
+
.lm-modal[minimizable="true"] > .lm-modal-title > .lm-modal-minimize {
|
|
83
|
+
display: block;
|
|
76
84
|
}
|
|
77
85
|
|
|
78
|
-
.lm-modal[
|
|
79
|
-
|
|
86
|
+
.lm-modal[closable="true"] > .lm-modal-title > .lm-modal-close {
|
|
87
|
+
margin-right: 0;
|
|
88
|
+
display: block;
|
|
80
89
|
}
|
|
81
90
|
|
|
82
91
|
.lm-modal.hide {
|
|
@@ -102,7 +111,7 @@
|
|
|
102
111
|
width: 100vw;
|
|
103
112
|
height: 100vh;
|
|
104
113
|
background-color: #00000020;
|
|
105
|
-
z-index:
|
|
114
|
+
z-index: 15;
|
|
106
115
|
}
|
|
107
116
|
|
|
108
117
|
.lm-modal > div:last-child {
|