@veritree/ui 0.18.1 → 0.19.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 +1 -1
- package/src/components/Dialog/VTDialog.vue +1 -1
- package/src/components/Drawer/VTDrawer.vue +1 -1
- package/src/components/DropdownMenu/VTDropdownMenuContent.vue +7 -6
- package/src/components/DropdownMenu/VTDropdownMenuTrigger.vue +19 -0
- package/src/components/Listbox/VTListboxTrigger.vue +13 -2
package/package.json
CHANGED
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
29
|
<script>
|
|
30
|
-
import { genId } from
|
|
30
|
+
import { genId } from '../../utils/ids';
|
|
31
31
|
|
|
32
32
|
export default {
|
|
33
|
-
name:
|
|
33
|
+
name: 'VTDropdownMenuContent',
|
|
34
34
|
|
|
35
|
-
inject: [
|
|
35
|
+
inject: ['api'],
|
|
36
36
|
|
|
37
37
|
data() {
|
|
38
38
|
return {
|
|
@@ -67,7 +67,7 @@ export default {
|
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
// TODO: Create a directive or mixin for this
|
|
70
|
-
document.addEventListener(
|
|
70
|
+
document.addEventListener('click', (e) => {
|
|
71
71
|
e.stopPropagation();
|
|
72
72
|
if (this.visible && !this.$el.contains(e.target)) this.trigger.onClick();
|
|
73
73
|
});
|
|
@@ -75,17 +75,18 @@ export default {
|
|
|
75
75
|
|
|
76
76
|
destroyed() {
|
|
77
77
|
// TODO: Create a directive or mixin for this
|
|
78
|
-
document.removeEventListener(
|
|
78
|
+
document.removeEventListener('click', this.trigger.onClick());
|
|
79
79
|
},
|
|
80
80
|
|
|
81
81
|
methods: {
|
|
82
82
|
show() {
|
|
83
83
|
this.visible = true;
|
|
84
|
+
this.$emit('shown');
|
|
84
85
|
},
|
|
85
86
|
|
|
86
87
|
hide() {
|
|
87
88
|
this.visible = false;
|
|
88
|
-
this.$emit(
|
|
89
|
+
this.$emit('hidden');
|
|
89
90
|
this.api().unregisterItems();
|
|
90
91
|
},
|
|
91
92
|
},
|
|
@@ -112,6 +112,13 @@ export default {
|
|
|
112
112
|
this.expanded = !this.expanded;
|
|
113
113
|
},
|
|
114
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Sets aria expanded attribute/state to false
|
|
117
|
+
*/
|
|
118
|
+
hideExpanded() {
|
|
119
|
+
this.expanded = false;
|
|
120
|
+
},
|
|
121
|
+
|
|
115
122
|
/**
|
|
116
123
|
* Toggles aria popup/controls attribute/state
|
|
117
124
|
*/
|
|
@@ -146,6 +153,18 @@ export default {
|
|
|
146
153
|
});
|
|
147
154
|
},
|
|
148
155
|
|
|
156
|
+
/**
|
|
157
|
+
* 1. Set aria expanded attribute/state to false
|
|
158
|
+
* 2. Close the menu
|
|
159
|
+
*/
|
|
160
|
+
hide() {
|
|
161
|
+
this.hideExpanded();
|
|
162
|
+
|
|
163
|
+
this.$nextTick(() => {
|
|
164
|
+
this.content.hide();
|
|
165
|
+
});
|
|
166
|
+
},
|
|
167
|
+
|
|
149
168
|
/**
|
|
150
169
|
* On key arrow down, do the following:
|
|
151
170
|
*
|
|
@@ -16,8 +16,19 @@
|
|
|
16
16
|
@keydown.up.prevent="onKeyArrowUp"
|
|
17
17
|
@keydown.esc.stop="onKeyEsc"
|
|
18
18
|
>
|
|
19
|
-
<span
|
|
20
|
-
|
|
19
|
+
<span
|
|
20
|
+
:class="{
|
|
21
|
+
'Listbox-button__text': headless,
|
|
22
|
+
'text-left': !headless,
|
|
23
|
+
}"
|
|
24
|
+
>
|
|
25
|
+
<slot></slot>
|
|
26
|
+
</span>
|
|
27
|
+
<span
|
|
28
|
+
:class="{
|
|
29
|
+
'Listbox-button__icon': headless,
|
|
30
|
+
}"
|
|
31
|
+
>
|
|
21
32
|
<IconChevronDown
|
|
22
33
|
class="transition-transform"
|
|
23
34
|
:class="{ 'rotate-180': expanded }"
|