@veritree/ui 0.21.1-5 → 0.21.1-6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/ui",
3
- "version": "0.21.1-5",
3
+ "version": "0.21.1-6",
4
4
  "description": "veritree ui library",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -21,6 +21,13 @@ export default {
21
21
 
22
22
  inject: ['api'],
23
23
 
24
+ props: {
25
+ headless: {
26
+ type: Boolean,
27
+ default: false,
28
+ },
29
+ },
30
+
24
31
  data() {
25
32
  return {
26
33
  visible: false,
@@ -32,8 +39,8 @@ export default {
32
39
  return `dropdown-menu-content-${this.api().id}`;
33
40
  },
34
41
 
35
- headless() {
36
- return this.api().isHeadless;
42
+ el() {
43
+ return document.getElementById(this.id);
37
44
  },
38
45
 
39
46
  component() {
@@ -45,10 +52,19 @@ export default {
45
52
  },
46
53
  },
47
54
 
55
+ created() {
56
+ console.log(this.$attrs);
57
+ },
58
+
48
59
  mounted() {
49
- this.api().registerContent(this);
60
+ const content = {
61
+ id: this.id,
62
+ hide: this.hide,
63
+ show: this.show,
64
+ };
65
+
66
+ this.api().registerContent(content);
50
67
 
51
- // T-218 Create a directive or mixin for this
52
68
  document.addEventListener('click', (e) => {
53
69
  if (!e) {
54
70
  return;
@@ -56,7 +72,7 @@ export default {
56
72
 
57
73
  e.stopPropagation();
58
74
 
59
- if (this.visible && !this.$el.contains(e.target)) {
75
+ if (this.visible && !this.el.contains(e.target)) {
60
76
  this.componentTrigger.cancel();
61
77
  }
62
78
  });
@@ -50,6 +50,10 @@ export default {
50
50
  return `listbox-content-${this.api().id}`;
51
51
  },
52
52
 
53
+ el() {
54
+ return document.getElementById(this.id);
55
+ },
56
+
53
57
  component() {
54
58
  return this.api().component;
55
59
  },
@@ -77,7 +81,7 @@ export default {
77
81
 
78
82
  e.stopPropagation();
79
83
 
80
- if (this.visible && !this.$el.contains(e.target)) {
84
+ if (this.visible && !this.el.contains(e.target)) {
81
85
  this.componentTrigger.cancel();
82
86
  }
83
87
  });
@@ -15,7 +15,7 @@
15
15
  :class="[
16
16
  headless
17
17
  ? null
18
- : 'absolute z-50 grid min-w-[222px] overflow-hidden rounded-md py-2 px-3 border-gray-100 bg-white shadow-300',
18
+ : 'absolute z-50 grid min-w-min overflow-hidden rounded-md py-2 px-3 border-gray-100 bg-white shadow-300',
19
19
  ]"
20
20
  >
21
21
  <slot></slot>