@veritree/ui 0.73.0 → 0.75.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/mixins/floating-ui-content.js +6 -2
- package/mixins/floating-ui-item.js +4 -4
- package/mixins/form-control.js +9 -9
- package/package.json +1 -1
- package/src/components/Avatar/VTAvatar.vue +4 -4
- package/src/components/Button/VTButton.vue +1 -1
- package/src/components/Carousel/VTCarousel.vue +1 -1
- package/src/components/Listbox/VTListboxItem.vue +2 -2
- package/src/components/Listbox/VTListboxTrigger.vue +2 -13
- package/src/components/Popover/VTPopoverItem.vue +40 -22
- package/src/components/Popover/VTPopoverTrigger.vue +2 -2
- package/src/components/Popover/VTPopoverViewport.vue +33 -0
|
@@ -10,6 +10,10 @@ export const floatingUiContentMixin = {
|
|
|
10
10
|
type: Boolean,
|
|
11
11
|
default: false,
|
|
12
12
|
},
|
|
13
|
+
freeze: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: false,
|
|
16
|
+
},
|
|
13
17
|
},
|
|
14
18
|
|
|
15
19
|
data() {
|
|
@@ -63,7 +67,7 @@ export const floatingUiContentMixin = {
|
|
|
63
67
|
},
|
|
64
68
|
|
|
65
69
|
onDocumentClick(e) {
|
|
66
|
-
if (!e || !this.el) {
|
|
70
|
+
if (!e || !this.el || this.freeze) {
|
|
67
71
|
return;
|
|
68
72
|
}
|
|
69
73
|
|
|
@@ -78,4 +82,4 @@ export const floatingUiContentMixin = {
|
|
|
78
82
|
this.activeDescedant = id;
|
|
79
83
|
},
|
|
80
84
|
},
|
|
81
|
-
}
|
|
85
|
+
};
|
|
@@ -39,8 +39,8 @@ export const floatingUiItemMixin = {
|
|
|
39
39
|
? `${this.componentName}--disabled`
|
|
40
40
|
: null
|
|
41
41
|
: this.disabled
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
? 'pointer-events-none opacity-75'
|
|
43
|
+
: null,
|
|
44
44
|
// selected state styles
|
|
45
45
|
this.headless
|
|
46
46
|
? this.selected
|
|
@@ -49,8 +49,8 @@ export const floatingUiItemMixin = {
|
|
|
49
49
|
: `${this.componentName}--selected`
|
|
50
50
|
: null
|
|
51
51
|
: this.selected
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
? 'bg-gray-200'
|
|
53
|
+
: null,
|
|
54
54
|
];
|
|
55
55
|
},
|
|
56
56
|
},
|
package/mixins/form-control.js
CHANGED
|
@@ -53,7 +53,7 @@ export const formControlMixin = {
|
|
|
53
53
|
blur: (event) => {
|
|
54
54
|
this.$emit('blur', event);
|
|
55
55
|
},
|
|
56
|
-
}
|
|
56
|
+
},
|
|
57
57
|
);
|
|
58
58
|
},
|
|
59
59
|
|
|
@@ -78,18 +78,18 @@ export const formControlStyleMixin = {
|
|
|
78
78
|
this.headless
|
|
79
79
|
? `${this.name}--${this.variant}`
|
|
80
80
|
: this.isError
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
? 'border-error-300'
|
|
82
|
+
: this.isSuccess
|
|
83
|
+
? 'border-success-300'
|
|
84
|
+
: 'border-gray-300',
|
|
85
85
|
// height styles
|
|
86
86
|
this.headless
|
|
87
87
|
? null
|
|
88
88
|
: this.name === 'textarea'
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
? 'min-h-10' // limit it because input type number height can be different from other input types
|
|
90
|
+
: this.size === 'small'
|
|
91
|
+
? 'h-8 text-sm'
|
|
92
|
+
: 'h-10 text-base',
|
|
93
93
|
// disabled styles
|
|
94
94
|
this.disabled
|
|
95
95
|
? this.headless
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
? 'button'
|
|
13
13
|
: isIcon
|
|
14
14
|
? 'relative inline-flex items-center justify-center rounded-full [&_svg]:max-h-full [&_svg]:max-w-full'
|
|
15
|
-
: 'relative inline-flex rounded border border-solid px-4 text-sm font-
|
|
15
|
+
: 'relative inline-flex rounded border border-solid px-4 text-sm font-medium leading-none no-underline transition-all',
|
|
16
16
|
// variant styles
|
|
17
17
|
headless
|
|
18
18
|
? `button--${variant}`
|
|
@@ -133,7 +133,7 @@ export default {
|
|
|
133
133
|
* @type {number}
|
|
134
134
|
*/
|
|
135
135
|
const distanceToLeftEnd = Math.abs(
|
|
136
|
-
scrollWidth - offsetWidth - scrollLeft
|
|
136
|
+
scrollWidth - offsetWidth - scrollLeft,
|
|
137
137
|
);
|
|
138
138
|
|
|
139
139
|
// Check if the calculated distance is less than or equal to 10 pixels
|
|
@@ -88,7 +88,7 @@ export default {
|
|
|
88
88
|
checked() {
|
|
89
89
|
if (this.multiple) {
|
|
90
90
|
return this.apiListbox().valueComputed.some(
|
|
91
|
-
(value) => JSON.stringify(this.value) === JSON.stringify(value)
|
|
91
|
+
(value) => JSON.stringify(this.value) === JSON.stringify(value),
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -164,7 +164,7 @@ export default {
|
|
|
164
164
|
* with any of the items to get its index value
|
|
165
165
|
*/
|
|
166
166
|
const newItemSelectedIndex = this.items.findIndex((item) =>
|
|
167
|
-
item.text.toLowerCase().includes(this.search.toLowerCase())
|
|
167
|
+
item.text.toLowerCase().includes(this.search.toLowerCase()),
|
|
168
168
|
);
|
|
169
169
|
|
|
170
170
|
/**
|
|
@@ -11,17 +11,6 @@
|
|
|
11
11
|
@keydown.up.prevent="onKeyDownOrUp"
|
|
12
12
|
@keydown.esc.stop="onKeyEsc"
|
|
13
13
|
>
|
|
14
|
-
<!-- <template v-if="hasBadge">
|
|
15
|
-
<span
|
|
16
|
-
:class="[
|
|
17
|
-
headless
|
|
18
|
-
? 'listbox-button__badge'
|
|
19
|
-
: 'absolute -right-2 -top-2 grid h-5 min-w-[20px] place-content-center rounded-full bg-gray-800 text-xs font-medium text-white',
|
|
20
|
-
]"
|
|
21
|
-
>
|
|
22
|
-
{{ valueLength }}
|
|
23
|
-
</span>
|
|
24
|
-
</template> -->
|
|
25
14
|
<span :class="[headless ? 'listbox-button__text' : 'truncate text-left']">
|
|
26
15
|
<slot></slot>
|
|
27
16
|
</span>
|
|
@@ -171,8 +160,8 @@ export default {
|
|
|
171
160
|
keyCode === 'ArrowDown'
|
|
172
161
|
? 'firstMenuItem'
|
|
173
162
|
: keyCode === 'ArrowUp'
|
|
174
|
-
|
|
175
|
-
|
|
163
|
+
? 'lastMenuItem'
|
|
164
|
+
: null;
|
|
176
165
|
|
|
177
166
|
// settimeout here is delaying the focusing the element
|
|
178
167
|
// since it is not rendered yet. All items will only
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component
|
|
3
|
-
:is="as"
|
|
4
|
-
:class="[
|
|
5
|
-
// default styles
|
|
6
|
-
headless
|
|
7
|
-
? 'popover-item'
|
|
8
|
-
: 'relative z-10 -mx-3 flex items-center gap-2 px-3 py-2 text-inherit no-underline hover:bg-secondary-200/10',
|
|
9
|
-
]"
|
|
10
|
-
@click="onClick"
|
|
11
|
-
>
|
|
2
|
+
<component :is="as" :class="classComputed">
|
|
12
3
|
<slot></slot>
|
|
13
4
|
</component>
|
|
14
5
|
</template>
|
|
@@ -32,27 +23,54 @@ export default {
|
|
|
32
23
|
type: [String, Object],
|
|
33
24
|
default: null,
|
|
34
25
|
},
|
|
26
|
+
as: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: 'div',
|
|
29
|
+
},
|
|
35
30
|
},
|
|
36
31
|
|
|
37
32
|
computed: {
|
|
38
|
-
|
|
39
|
-
return
|
|
33
|
+
classComputed() {
|
|
34
|
+
return [
|
|
35
|
+
// default styles
|
|
36
|
+
this.headless
|
|
37
|
+
? `${this.componentName}`
|
|
38
|
+
: 'relative z-10 text-sm flex items-center gap-2 px-3 py-2 text-inherit no-underline cursor-pointer',
|
|
39
|
+
// disabled state styles
|
|
40
|
+
this.headless
|
|
41
|
+
? this.disabled
|
|
42
|
+
? `${this.componentName}--disabled`
|
|
43
|
+
: null
|
|
44
|
+
: this.disabled
|
|
45
|
+
? 'pointer-events-none opacity-75'
|
|
46
|
+
: null,
|
|
47
|
+
// selected state styles
|
|
48
|
+
// this.headless
|
|
49
|
+
// ? this.selected
|
|
50
|
+
// ? this.multiple
|
|
51
|
+
// ? null
|
|
52
|
+
// : `${this.componentName}--selected`
|
|
53
|
+
// : null
|
|
54
|
+
// : this.selected
|
|
55
|
+
// ? 'bg-gray-200'
|
|
56
|
+
// : null,
|
|
57
|
+
];
|
|
40
58
|
},
|
|
41
59
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
60
|
+
// tag() {
|
|
61
|
+
// if(this.href) {
|
|
45
62
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
63
|
+
// }
|
|
64
|
+
|
|
65
|
+
// return this.href ? 'a' : this.to ? 'NuxtLink' : 'button';
|
|
66
|
+
// },
|
|
49
67
|
},
|
|
50
68
|
|
|
51
69
|
methods: {
|
|
52
|
-
onClick() {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
},
|
|
70
|
+
// onClick() {
|
|
71
|
+
// if (this.href || this.to) return;
|
|
72
|
+
// this.$emit('click');
|
|
73
|
+
// },
|
|
56
74
|
},
|
|
57
75
|
};
|
|
58
76
|
</script>
|
|
@@ -135,8 +135,8 @@ export default {
|
|
|
135
135
|
keyCode === 'ArrowDown'
|
|
136
136
|
? 'firstMenuItem'
|
|
137
137
|
: keyCode === 'ArrowUp'
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
? 'lastMenuItem'
|
|
139
|
+
: null;
|
|
140
140
|
|
|
141
141
|
// settimeout here is delaying the focusing the element
|
|
142
142
|
// since it is not rendered yet. All items will only
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:id="id"
|
|
4
|
+
:class="[
|
|
5
|
+
headless
|
|
6
|
+
? 'listbox-viewport'
|
|
7
|
+
: '-mx-3 max-h-[200px] w-auto overflow-y-auto scroll-auto',
|
|
8
|
+
]"
|
|
9
|
+
>
|
|
10
|
+
<slot></slot>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
name: 'VTListboxViewport',
|
|
17
|
+
|
|
18
|
+
inject: ['apiPopover'],
|
|
19
|
+
|
|
20
|
+
props: {
|
|
21
|
+
headless: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
computed: {
|
|
28
|
+
id() {
|
|
29
|
+
return `popover-viewport-${this.apiPopover().id}`;
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
</script>
|