@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.
@@ -34,6 +34,7 @@ export default class Accordion extends Base {
34
34
  */
35
35
  static config: {
36
36
  name: string;
37
+ emits: string[];
37
38
  options: {
38
39
  autoclose: BooleanConstructor;
39
40
  item: {
@@ -2,6 +2,7 @@ import { Base } from '@studiometa/js-toolkit';
2
2
  export default class Accordion extends Base {
3
3
  static config = {
4
4
  name: 'Accordion',
5
+ emits: ['open', 'close'],
5
6
  options: {
6
7
  autoclose: Boolean,
7
8
  item: {
@@ -44,6 +44,7 @@ export default class AccordionItem extends Base {
44
44
  static config: {
45
45
  name: string;
46
46
  refs: string[];
47
+ emits: string[];
47
48
  options: {
48
49
  isOpen: BooleanConstructor;
49
50
  styles: {
@@ -7,6 +7,7 @@ export default class AccordionItem extends Base {
7
7
  static config = {
8
8
  name: 'AccordionItem',
9
9
  refs: ['btn', 'content', 'container'],
10
+ emits: ['open', 'close'],
10
11
  options: {
11
12
  isOpen: Boolean,
12
13
  styles: {
@@ -14,6 +14,7 @@ declare class Accordion extends AccordionCore {
14
14
  AccordionItem: typeof AccordionItem;
15
15
  };
16
16
  name: string;
17
+ emits: string[];
17
18
  options: {
18
19
  autoclose: BooleanConstructor;
19
20
  item: {
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
- refModalPlaceholder: Comment;
84
- refModalParentBackup: any;
85
- refModalUnbindGetRefFilter: any;
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
- const refsBackup = this.$refs;
48
- this.refModalPlaceholder = document.createComment('');
49
- this.refModalParentBackup = this.$refs.modal.parentElement || this.$el;
50
- this.refModalParentBackup.insertBefore(this.refModalPlaceholder, this.$refs.modal);
51
- this.refModalUnbindGetRefFilter = this.$on('get:refs', refs => {
52
- Object.entries(refsBackup).forEach(([key, ref]) => {
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.refModalParentBackup) {
68
- this.refModalParentBackup.insertBefore(this.$refs.modal, this.refModalPlaceholder);
69
- this.refModalUnbindGetRefFilter();
70
- this.refModalPlaceholder.remove();
71
- delete this.refModalPlaceholder;
72
- delete this.refModalParentBackup;
73
- delete this.refModalUnbindGetRefFilter;
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
@@ -40,6 +40,7 @@ export default class Tabs extends Base {
40
40
  static config: {
41
41
  name: string;
42
42
  refs: string[];
43
+ emits: string[];
43
44
  options: {
44
45
  styles: {
45
46
  type: ObjectConstructor;
package/Tabs.js CHANGED
@@ -4,6 +4,7 @@ export default class Tabs extends Base {
4
4
  static config = {
5
5
  name: 'Tabs',
6
6
  refs: ['btn[]', 'content[]'],
7
+ emits: ['enable', 'disable'],
7
8
  options: {
8
9
  styles: {
9
10
  type: Object,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studiometa/ui",
3
- "version": "0.1.0",
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-alpha.8",
32
+ "@studiometa/js-toolkit": "^2.0.0-beta.8",
33
33
  "deepmerge": "^4.2.2",
34
- "motion": "^10.2.1"
34
+ "motion": "^10.5.0"
35
35
  }
36
36
  }