@veritree/ui 0.91.11 → 0.92.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.
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"
|
|
@@ -104,13 +104,32 @@ export default {
|
|
|
104
104
|
return this.items[this.items.length - 1];
|
|
105
105
|
},
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
classList() {
|
|
108
108
|
if (this.headless) {
|
|
109
109
|
return null;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
// TODO: role isn't the best way to determine button styles, we should have a better prop for that
|
|
112
113
|
if (this.role === 'combobox') {
|
|
113
|
-
|
|
114
|
+
const version2Classes = [];
|
|
115
|
+
|
|
116
|
+
if (this.apiListbox().version === '2') {
|
|
117
|
+
version2Classes.push('listbox-trigger--version-2');
|
|
118
|
+
|
|
119
|
+
if (this.variant) {
|
|
120
|
+
version2Classes.push(`listbox-trigger--${this.variant}`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (this.size) {
|
|
124
|
+
version2Classes.push(`listbox-trigger--${this.size}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return [
|
|
129
|
+
this.classComputed,
|
|
130
|
+
this.headless ? null : 'hover:bg-gray-200',
|
|
131
|
+
...version2Classes,
|
|
132
|
+
];
|
|
114
133
|
}
|
|
115
134
|
|
|
116
135
|
return `button-base button--${this.variant} button--${this.size}`;
|