@studiometa/ui 0.1.0 → 0.1.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/Accordion/Accordion.d.ts +1 -0
- package/Accordion/Accordion.js +1 -0
- package/Accordion/AccordionItem.d.ts +1 -0
- package/Accordion/AccordionItem.js +1 -0
- package/Accordion/index.d.ts +1 -0
- package/Modal.d.ts +4 -3
- package/Modal.js +28 -18
- package/Tabs.d.ts +1 -0
- package/Tabs.js +1 -0
- package/package.json +3 -3
package/Accordion/Accordion.d.ts
CHANGED
package/Accordion/Accordion.js
CHANGED
package/Accordion/index.d.ts
CHANGED
package/Modal.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export default class Modal extends Base {
|
|
|
40
40
|
static config: {
|
|
41
41
|
name: string;
|
|
42
42
|
refs: string[];
|
|
43
|
+
emits: string[];
|
|
43
44
|
options: {
|
|
44
45
|
move: StringConstructor;
|
|
45
46
|
autofocus: {
|
|
@@ -80,9 +81,9 @@ export default class Modal extends Base {
|
|
|
80
81
|
*/
|
|
81
82
|
mounted(): ModalInterface;
|
|
82
83
|
isOpen: boolean;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
__refsBackup: import("@studiometa/js-toolkit/Base/managers/RefsManager").default & ModalRefs;
|
|
85
|
+
__refModalPlaceholder: Comment;
|
|
86
|
+
__refModalParentBackup: HTMLElement;
|
|
86
87
|
/**
|
|
87
88
|
* Unbind all events on destroy.
|
|
88
89
|
*
|
package/Modal.js
CHANGED
|
@@ -5,6 +5,7 @@ export default class Modal extends Base {
|
|
|
5
5
|
static config = {
|
|
6
6
|
name: 'Modal',
|
|
7
7
|
refs: ['close', 'container', 'content', 'modal', 'open', 'overlay'],
|
|
8
|
+
emits: ['open', 'close'],
|
|
8
9
|
options: {
|
|
9
10
|
move: String,
|
|
10
11
|
autofocus: {
|
|
@@ -44,33 +45,42 @@ export default class Modal extends Base {
|
|
|
44
45
|
|
|
45
46
|
if (this.$options.move) {
|
|
46
47
|
const target = document.querySelector(this.$options.move) || document.body;
|
|
47
|
-
|
|
48
|
-
this.
|
|
49
|
-
this.
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
if (!refs[key]) {
|
|
54
|
-
refs[key] = ref;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
});
|
|
48
|
+
this.__refsBackup = this.$refs;
|
|
49
|
+
this.__refModalPlaceholder = document.createComment('');
|
|
50
|
+
this.__refModalParentBackup = this.$refs.modal.parentElement || this.$el;
|
|
51
|
+
|
|
52
|
+
this.__refModalParentBackup.insertBefore(this.__refModalPlaceholder, this.$refs.modal);
|
|
53
|
+
|
|
58
54
|
target.appendChild(this.$refs.modal);
|
|
59
55
|
}
|
|
60
56
|
|
|
61
57
|
return this;
|
|
62
58
|
}
|
|
63
59
|
|
|
60
|
+
get $refs() {
|
|
61
|
+
const $refs = super.$refs;
|
|
62
|
+
|
|
63
|
+
if (this.$options.move && this.__refsBackup) {
|
|
64
|
+
Object.entries(this.__refsBackup).forEach(([key, ref]) => {
|
|
65
|
+
if (!$refs[key]) {
|
|
66
|
+
$refs[key] = ref;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return $refs;
|
|
72
|
+
}
|
|
73
|
+
|
|
64
74
|
destroyed() {
|
|
65
75
|
this.close();
|
|
66
76
|
|
|
67
|
-
if (this.$options.move && this.
|
|
68
|
-
this.
|
|
69
|
-
|
|
70
|
-
this.
|
|
71
|
-
|
|
72
|
-
delete this.
|
|
73
|
-
delete this.
|
|
77
|
+
if (this.$options.move && this.__refModalParentBackup) {
|
|
78
|
+
this.__refModalParentBackup.insertBefore(this.$refs.modal, this.__refModalPlaceholder);
|
|
79
|
+
|
|
80
|
+
this.__refModalPlaceholder.remove();
|
|
81
|
+
|
|
82
|
+
delete this.__refModalPlaceholder;
|
|
83
|
+
delete this.__refModalParentBackup;
|
|
74
84
|
}
|
|
75
85
|
|
|
76
86
|
return this;
|
package/Tabs.d.ts
CHANGED
package/Tabs.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studiometa/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "A set of opiniated, unstyled and accessible components",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/studiometa/ui#readme",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@studiometa/js-toolkit": "^2.0.0-
|
|
32
|
+
"@studiometa/js-toolkit": "^2.0.0-beta.8",
|
|
33
33
|
"deepmerge": "^4.2.2",
|
|
34
|
-
"motion": "^10.
|
|
34
|
+
"motion": "^10.5.0"
|
|
35
35
|
}
|
|
36
36
|
}
|