@veritree/ui 0.87.1 → 0.87.2

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.
@@ -43,7 +43,18 @@ export const floatingUiContentMixin = {
43
43
  this.component.setActive();
44
44
 
45
45
  setTimeout(() => {
46
+ if (!this.id) {
47
+ console.log('No id provided');
48
+ return;
49
+ }
50
+
46
51
  this.el = document.getElementById(this.id);
52
+
53
+ if (!this.el) {
54
+ console.log('Element not found', this.id);
55
+ return;
56
+ }
57
+
47
58
  this.$emit('shown');
48
59
  }, 100);
49
60
  });
@@ -139,6 +139,11 @@ export const floatingUiMixin = {
139
139
  const content = document.getElementById(this.componentContent.id);
140
140
  const minWidthLimit = Number(this.floatingUiMinWidth);
141
141
 
142
+ if (!trigger || !content) {
143
+ console.error('The trigger or content element does not exist.');
144
+ return;
145
+ }
146
+
142
147
  if (this.top || this.left) {
143
148
  this.positionContentToTriggerByTopAndLeft(
144
149
  trigger,
@@ -5,10 +5,6 @@ export const formControlMixin = {
5
5
  },
6
6
 
7
7
  props: {
8
- id: {
9
- type: String,
10
- default: null,
11
- },
12
8
  disabled: {
13
9
  type: Boolean,
14
10
  default: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/ui",
3
- "version": "0.87.1",
3
+ "version": "0.87.2",
4
4
  "description": "veritree ui library",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -19,13 +19,6 @@ export default {
19
19
 
20
20
  mixins: [formControlMixin, formControlStyleMixin],
21
21
 
22
- props: {
23
- dataTestId: {
24
- type: String,
25
- default: null,
26
- },
27
- },
28
-
29
22
  data() {
30
23
  return {
31
24
  name: 'input',
@@ -72,6 +72,10 @@ export default {
72
72
  },
73
73
 
74
74
  props: {
75
+ id: {
76
+ type: String,
77
+ default: null,
78
+ },
75
79
  dataTestid: {
76
80
  type: String,
77
81
  default: null,
@@ -37,6 +37,10 @@ export default {
37
37
  },
38
38
 
39
39
  props: {
40
+ id: {
41
+ type: String,
42
+ default: null,
43
+ },
40
44
  dataTestid: {
41
45
  type: String,
42
46
  default: null,
@@ -118,6 +118,10 @@ export default {
118
118
  },
119
119
 
120
120
  props: {
121
+ id: {
122
+ type: String,
123
+ default: null,
124
+ },
121
125
  /**
122
126
  * The value of the component. Can be a string, number, object, or array.
123
127
  * @type {string|number|object|array}
@@ -171,7 +175,6 @@ export default {
171
175
 
172
176
  data() {
173
177
  return {
174
- componentId: genId(),
175
178
  componentSearch: null,
176
179
  search: '',
177
180
  items: [],
@@ -195,8 +198,8 @@ export default {
195
198
  },
196
199
 
197
200
  computed: {
198
- id() {
199
- return `listbox-${this.componentId}`;
201
+ componentId() {
202
+ return `listbox-${this.id || genId()}`;
200
203
  },
201
204
 
202
205
  valueComputed: {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <button
3
- :id="idComputed"
4
- :data-testid="dataTestid"
3
+ :id="id"
4
+ :data-testid="dataTestidComputed"
5
5
  :class="triggerClassComputed"
6
6
  :disabled="isDisabled"
7
7
  :aria-expanded="expanded"
@@ -47,6 +47,8 @@ export default {
47
47
 
48
48
  inject: ['apiListbox'],
49
49
 
50
+ inheritAttrs: false,
51
+
50
52
  props: {
51
53
  dataTestid: {
52
54
  type: String,
@@ -74,8 +76,12 @@ export default {
74
76
  },
75
77
 
76
78
  computed: {
77
- idComputed() {
78
- return this.id || `listbox-trigger-${this.apiListbox().id}`;
79
+ id() {
80
+ return `listbox-trigger-${this.apiListbox().id}`;
81
+ },
82
+
83
+ dataTestidComputed() {
84
+ return this.dataTestid || `listbox-trigger-${this.apiListbox().id}`;
79
85
  },
80
86
 
81
87
  componentContent() {
@@ -120,7 +126,7 @@ export default {
120
126
  el: this.$el,
121
127
  cancel: this.cancel,
122
128
  focus: this.focus,
123
- id: this.idComputed,
129
+ id: this.id,
124
130
  };
125
131
 
126
132
  this.apiListbox().registerTrigger(trigger);