@veritree/ui 0.91.11 → 0.93.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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="
|
|
2
|
+
<div :class="classList">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
@@ -101,6 +101,7 @@ export default {
|
|
|
101
101
|
items: this.items,
|
|
102
102
|
multiple: this.multiple,
|
|
103
103
|
search: this.search,
|
|
104
|
+
version: this.version,
|
|
104
105
|
valueComputed: this.valueComputed,
|
|
105
106
|
registerTrigger,
|
|
106
107
|
registerContent,
|
|
@@ -171,6 +172,15 @@ export default {
|
|
|
171
172
|
type: Boolean,
|
|
172
173
|
default: false,
|
|
173
174
|
},
|
|
175
|
+
/**
|
|
176
|
+
* The version of the component to use.
|
|
177
|
+
* @type {number|string}
|
|
178
|
+
* @default '1'
|
|
179
|
+
*/
|
|
180
|
+
version: {
|
|
181
|
+
type: [Number, String],
|
|
182
|
+
default: '1',
|
|
183
|
+
},
|
|
174
184
|
},
|
|
175
185
|
|
|
176
186
|
data() {
|
|
@@ -211,6 +221,27 @@ export default {
|
|
|
211
221
|
this.$emit('change', newValue);
|
|
212
222
|
},
|
|
213
223
|
},
|
|
224
|
+
|
|
225
|
+
classList() {
|
|
226
|
+
const list = [];
|
|
227
|
+
|
|
228
|
+
// This will be refactor by moving the inline tailwind styling to its own file
|
|
229
|
+
if (this.headless || this.version === '2') {
|
|
230
|
+
// use semantic list
|
|
231
|
+
list.push('listbox');
|
|
232
|
+
list.push(`listbox--version-${this.version}`);
|
|
233
|
+
|
|
234
|
+
if (this.variant) {
|
|
235
|
+
list.push(`listbox--${this.variant}`);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (this.size) {
|
|
239
|
+
list.push(`listbox--${this.size}`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return list;
|
|
244
|
+
},
|
|
214
245
|
},
|
|
215
246
|
};
|
|
216
247
|
</script>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
:visible="visible"
|
|
5
5
|
:headless="headless"
|
|
6
6
|
:aria-activedescendant="activeDescedant"
|
|
7
|
-
:portal-class="$vnode.data.staticClass"
|
|
7
|
+
:portal-class="`${$vnode.data.staticClass} ${portalClassList}`"
|
|
8
8
|
component="listbox"
|
|
9
9
|
role="listbox"
|
|
10
10
|
@shown="$emit('shown')"
|
|
@@ -43,6 +43,16 @@ export default {
|
|
|
43
43
|
componentTrigger() {
|
|
44
44
|
return this.apiListbox().componentTrigger;
|
|
45
45
|
},
|
|
46
|
+
|
|
47
|
+
portalClassList() {
|
|
48
|
+
const staticClass = this.$attrs.class || this.$attrs.staticClass || '';
|
|
49
|
+
|
|
50
|
+
if (this.apiListbox().version === '2') {
|
|
51
|
+
return `${staticClass} listbox-content--version-2`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return staticClass;
|
|
55
|
+
},
|
|
46
56
|
},
|
|
47
57
|
|
|
48
58
|
mounted() {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<button
|
|
3
3
|
:id="id"
|
|
4
4
|
:data-testid="dataTestidComputed"
|
|
5
|
-
:class="
|
|
5
|
+
:class="classList"
|
|
6
6
|
:disabled="isDisabled"
|
|
7
7
|
:aria-expanded="expanded"
|
|
8
8
|
:aria-haspopup="hasPopup"
|
|
@@ -22,6 +22,25 @@
|
|
|
22
22
|
]"
|
|
23
23
|
>
|
|
24
24
|
<VTSpinner v-if="loading" class="mr-0.5 max-w-4 max-h-4" />
|
|
25
|
+
<svg
|
|
26
|
+
v-else-if="apiListbox().version === '2'"
|
|
27
|
+
:class="{ 'rotate-180': expanded }"
|
|
28
|
+
class="text-gray-700 transition-transform"
|
|
29
|
+
width="16"
|
|
30
|
+
height="16"
|
|
31
|
+
viewBox="0 0 16 16"
|
|
32
|
+
fill="none"
|
|
33
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
34
|
+
>
|
|
35
|
+
<path
|
|
36
|
+
d="M13 6L8 11L3 6"
|
|
37
|
+
stroke="currentColor"
|
|
38
|
+
stroke-width="1.5"
|
|
39
|
+
stroke-linecap="round"
|
|
40
|
+
stroke-linejoin="round"
|
|
41
|
+
fill="transparent"
|
|
42
|
+
/>
|
|
43
|
+
</svg>
|
|
25
44
|
<IconChevronDown
|
|
26
45
|
v-else
|
|
27
46
|
class="w-5 text-gray-700 transition-transform"
|
|
@@ -104,13 +123,32 @@ export default {
|
|
|
104
123
|
return this.items[this.items.length - 1];
|
|
105
124
|
},
|
|
106
125
|
|
|
107
|
-
|
|
126
|
+
classList() {
|
|
108
127
|
if (this.headless) {
|
|
109
128
|
return null;
|
|
110
129
|
}
|
|
111
130
|
|
|
131
|
+
// TODO: role isn't the best way to determine button styles, we should have a better prop for that
|
|
112
132
|
if (this.role === 'combobox') {
|
|
113
|
-
|
|
133
|
+
const version2Classes = [];
|
|
134
|
+
|
|
135
|
+
if (this.apiListbox().version === '2') {
|
|
136
|
+
version2Classes.push('listbox-trigger--version-2');
|
|
137
|
+
|
|
138
|
+
if (this.variant) {
|
|
139
|
+
version2Classes.push(`listbox-trigger--${this.variant}`);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (this.size) {
|
|
143
|
+
version2Classes.push(`listbox-trigger--${this.size}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return [
|
|
148
|
+
this.classComputed,
|
|
149
|
+
this.headless ? null : 'hover:bg-gray-200',
|
|
150
|
+
...version2Classes,
|
|
151
|
+
];
|
|
114
152
|
}
|
|
115
153
|
|
|
116
154
|
return `button-base button--${this.variant} button--${this.size}`;
|