@veritree/ui 0.90.0 → 0.90.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.
- package/mixins/floating-ui-content.js +0 -2
- package/package.json +1 -1
- package/src/components/Button/VTButton.vue +3 -1
- package/src/components/Disclosure/VTDisclosureDetails.vue +0 -1
- package/src/components/Disclosure/VTDisclosureHeader.vue +58 -12
- package/src/components/Disclosure/VTDisclosureIcon.vue +13 -1
|
@@ -44,14 +44,12 @@ export const floatingUiContentMixin = {
|
|
|
44
44
|
|
|
45
45
|
setTimeout(() => {
|
|
46
46
|
if (!this.id) {
|
|
47
|
-
console.log('No id provided');
|
|
48
47
|
return;
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
this.el = document.getElementById(this.id);
|
|
52
51
|
|
|
53
52
|
if (!this.el) {
|
|
54
|
-
console.log('Element not found', this.id);
|
|
55
53
|
return;
|
|
56
54
|
}
|
|
57
55
|
|
package/package.json
CHANGED
|
@@ -205,7 +205,9 @@ export default {
|
|
|
205
205
|
const classes = [];
|
|
206
206
|
|
|
207
207
|
if (!this.headless) {
|
|
208
|
-
classes.push(
|
|
208
|
+
classes.push(
|
|
209
|
+
'mx-auto inline-flex items-center gap-2 self-center pointer-events-none',
|
|
210
|
+
);
|
|
209
211
|
}
|
|
210
212
|
|
|
211
213
|
if (this.headless && this.busy) {
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<header
|
|
3
3
|
:id="id"
|
|
4
|
-
:class="
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
:aria-controls="ariaControls"
|
|
10
|
-
:aria-expanded="ariaExpanded"
|
|
11
|
-
role="button"
|
|
12
|
-
tabindex="0"
|
|
13
|
-
@click.prevent="toggle"
|
|
14
|
-
@keydown.enter="toggle"
|
|
4
|
+
:class="headerClasses"
|
|
5
|
+
v-bind="ariaAttributes"
|
|
6
|
+
@click.prevent="handleClick"
|
|
7
|
+
@keydown.enter.prevent="handleKeydown"
|
|
8
|
+
@keydown.space.prevent="handleKeydown"
|
|
15
9
|
>
|
|
16
10
|
<slot></slot>
|
|
17
11
|
</header>
|
|
@@ -24,6 +18,18 @@ export default {
|
|
|
24
18
|
inject: ['apiDisclosure', 'apiDetails'],
|
|
25
19
|
|
|
26
20
|
props: {
|
|
21
|
+
/**
|
|
22
|
+
* If true, the header will not toggle visibility of the content.
|
|
23
|
+
* Useful for headers that are purely informational.
|
|
24
|
+
*/
|
|
25
|
+
actionless: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* If true, the header will not have any visual styles applied.
|
|
31
|
+
* Useful for headless implementations where you want to style it yourself.
|
|
32
|
+
*/
|
|
27
33
|
headless: {
|
|
28
34
|
type: Boolean,
|
|
29
35
|
default: false,
|
|
@@ -31,6 +37,30 @@ export default {
|
|
|
31
37
|
},
|
|
32
38
|
|
|
33
39
|
computed: {
|
|
40
|
+
headerClasses() {
|
|
41
|
+
if (this.headless) {
|
|
42
|
+
return 'details-header';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const classes = ['flex justify-between gap-3 text-body font-semibold'];
|
|
46
|
+
classes.push(this.actionless ? 'cursor-default' : 'cursor-pointer');
|
|
47
|
+
|
|
48
|
+
return classes;
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
ariaAttributes() {
|
|
52
|
+
if (this.actionless) {
|
|
53
|
+
return {};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
'aria-controls': this.ariaControls,
|
|
58
|
+
'aria-expanded': this.ariaExpanded,
|
|
59
|
+
'role': 'button',
|
|
60
|
+
'tabindex': '0',
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
|
|
34
64
|
id() {
|
|
35
65
|
return this.apiDetails().idSummary;
|
|
36
66
|
},
|
|
@@ -40,7 +70,7 @@ export default {
|
|
|
40
70
|
},
|
|
41
71
|
|
|
42
72
|
isVisible() {
|
|
43
|
-
return this.apiDetails().
|
|
73
|
+
return this.apiDetails().visible;
|
|
44
74
|
},
|
|
45
75
|
|
|
46
76
|
ariaExpanded() {
|
|
@@ -50,8 +80,24 @@ export default {
|
|
|
50
80
|
|
|
51
81
|
methods: {
|
|
52
82
|
toggle() {
|
|
83
|
+
if (this.actionless) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
53
87
|
this.apiDetails().setVisible(!this.isVisible);
|
|
54
88
|
},
|
|
89
|
+
|
|
90
|
+
handleClick() {
|
|
91
|
+
if (!this.actionless) {
|
|
92
|
+
this.toggle();
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
handleKeydown() {
|
|
97
|
+
if (!this.actionless) {
|
|
98
|
+
this.toggle();
|
|
99
|
+
}
|
|
100
|
+
},
|
|
55
101
|
},
|
|
56
102
|
};
|
|
57
103
|
</script>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<component
|
|
3
3
|
:is="as"
|
|
4
4
|
:class="iconClasses"
|
|
5
|
-
|
|
5
|
+
v-bind="ariaAttributes"
|
|
6
6
|
@click.stop="onClick"
|
|
7
7
|
@keydown.enter="onClick"
|
|
8
8
|
@keydown.space.prevent="onClick"
|
|
@@ -32,6 +32,17 @@ export default {
|
|
|
32
32
|
},
|
|
33
33
|
|
|
34
34
|
computed: {
|
|
35
|
+
ariaAttributes() {
|
|
36
|
+
if (this.as !== 'button') {
|
|
37
|
+
return {};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
'aria-expanded': String(this.expanded),
|
|
42
|
+
'aria-controls': this.apiDetails().idContent,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
|
|
35
46
|
iconClasses() {
|
|
36
47
|
const classes = [];
|
|
37
48
|
|
|
@@ -40,6 +51,7 @@ export default {
|
|
|
40
51
|
} else {
|
|
41
52
|
classes.push('shrink-0 transition-all');
|
|
42
53
|
classes.push(this.expanded ? 'rotate-180' : 'rotate-0');
|
|
54
|
+
classes.push(this.as === 'button' ? null : 'pointer-events-none');
|
|
43
55
|
}
|
|
44
56
|
|
|
45
57
|
return classes.filter(Boolean);
|