@veritree/ui 0.4.2 → 0.5.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/index.js
CHANGED
|
@@ -44,6 +44,7 @@ import VTDrawerClose from './src/Drawer/VTDrawerClose.vue';
|
|
|
44
44
|
import VTDrawerContent from './src/Drawer/VTDrawerContent.vue';
|
|
45
45
|
import VTDrawerFooter from './src/Drawer/VTDrawerFooter.vue';
|
|
46
46
|
import VTDrawerHeader from './src/Drawer/VTDrawerHeader.vue';
|
|
47
|
+
import VTDrawerTitle from './src/Drawer/VTDrawerTitle.vue';
|
|
47
48
|
import VTDrawerMain from './src/Drawer/VTDrawerMain.vue';
|
|
48
49
|
import VTDrawerOverlay from './src/Drawer/VTDrawerOverlay.vue';
|
|
49
50
|
|
|
@@ -76,6 +77,7 @@ export {
|
|
|
76
77
|
VTDrawerContent,
|
|
77
78
|
VTDrawerFooter,
|
|
78
79
|
VTDrawerHeader,
|
|
80
|
+
VTDrawerTitle,
|
|
79
81
|
VTDrawerMain,
|
|
80
82
|
VTDrawerOverlay,
|
|
81
83
|
VTDialog,
|
package/package.json
CHANGED
package/src/Drawer/VTDrawer.vue
CHANGED
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
:id="id"
|
|
5
5
|
:class="{ Drawer: headless, 'fixed inset-0 z-50 h-screen': !headless }"
|
|
6
6
|
aria-modal="true"
|
|
7
|
-
@click="
|
|
7
|
+
@click="onClick"
|
|
8
8
|
>
|
|
9
9
|
<slot></slot>
|
|
10
10
|
</div>
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script>
|
|
14
|
-
import { genId } from
|
|
14
|
+
import { genId } from "~/utils/ids";
|
|
15
15
|
|
|
16
16
|
export default {
|
|
17
|
-
name:
|
|
17
|
+
name: "VTDrawer",
|
|
18
18
|
|
|
19
19
|
provide() {
|
|
20
20
|
return {
|
|
@@ -53,7 +53,7 @@ export default {
|
|
|
53
53
|
},
|
|
54
54
|
|
|
55
55
|
model: {
|
|
56
|
-
prop:
|
|
56
|
+
prop: "visible",
|
|
57
57
|
},
|
|
58
58
|
|
|
59
59
|
props: {
|
|
@@ -104,10 +104,20 @@ export default {
|
|
|
104
104
|
|
|
105
105
|
emit() {
|
|
106
106
|
this.$nextTick(() => {
|
|
107
|
-
this.$emit(
|
|
108
|
-
this.$emit(
|
|
107
|
+
this.$emit("input", false);
|
|
108
|
+
this.$emit("hidden");
|
|
109
109
|
});
|
|
110
110
|
},
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Hides the dialog when clicking outside its content.
|
|
114
|
+
*
|
|
115
|
+
* @param {object} event
|
|
116
|
+
*/
|
|
117
|
+
onClick(ev) {
|
|
118
|
+
if (!ev || ev.target.id !== this.overlay.id) return;
|
|
119
|
+
this.hide();
|
|
120
|
+
},
|
|
111
121
|
},
|
|
112
122
|
};
|
|
113
123
|
</script>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
:id="id"
|
|
5
5
|
:class="{
|
|
6
6
|
'Drawer-header': headless,
|
|
7
|
-
'
|
|
7
|
+
'flex items-center justify-between': !headless,
|
|
8
8
|
}"
|
|
9
9
|
>
|
|
10
10
|
<slot></slot>
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
|
|
14
14
|
<script>
|
|
15
15
|
export default {
|
|
16
|
-
name:
|
|
16
|
+
name: "VTDrawerHeader",
|
|
17
17
|
|
|
18
|
-
inject: [
|
|
18
|
+
inject: ["api"],
|
|
19
19
|
|
|
20
20
|
props: {
|
|
21
21
|
as: {
|
|
22
22
|
type: String,
|
|
23
|
-
default:
|
|
23
|
+
default: "header",
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
|
|
@@ -37,20 +37,5 @@ export default {
|
|
|
37
37
|
return `${this.api().id}-header`;
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
|
-
|
|
41
|
-
mounted() {
|
|
42
|
-
this.setDialogLabelledby();
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
methods: {
|
|
46
|
-
// In here because if there is no header, the dialog will not be labelled by
|
|
47
|
-
setDialogLabelledby() {
|
|
48
|
-
const dialog = document.getElementById(this.api().id);
|
|
49
|
-
|
|
50
|
-
if (dialog) {
|
|
51
|
-
dialog.setAttribute('aria-labelledby', this.id);
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
40
|
};
|
|
56
41
|
</script>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<FadeInOut>
|
|
3
3
|
<div
|
|
4
4
|
v-if="visible"
|
|
5
|
+
:id="id"
|
|
5
6
|
:class="{
|
|
6
7
|
'Drawer-overlay': headless,
|
|
7
8
|
'fixed inset-0 z-10 bg-fd-450/80': !headless,
|
|
@@ -11,14 +12,14 @@
|
|
|
11
12
|
</template>
|
|
12
13
|
|
|
13
14
|
<script>
|
|
14
|
-
import FadeInOut from
|
|
15
|
+
import FadeInOut from "../Transitions/FadeInOut.vue";
|
|
15
16
|
|
|
16
17
|
export default {
|
|
17
18
|
components: {
|
|
18
19
|
FadeInOut,
|
|
19
20
|
},
|
|
20
21
|
|
|
21
|
-
inject: [
|
|
22
|
+
inject: ["api"],
|
|
22
23
|
|
|
23
24
|
data() {
|
|
24
25
|
return {
|
|
@@ -34,6 +35,10 @@ export default {
|
|
|
34
35
|
headless() {
|
|
35
36
|
return this.api().isHeadless;
|
|
36
37
|
},
|
|
38
|
+
|
|
39
|
+
id() {
|
|
40
|
+
return `${this.api().id}-overlay`;
|
|
41
|
+
},
|
|
37
42
|
},
|
|
38
43
|
|
|
39
44
|
mounted() {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="as"
|
|
4
|
+
:id="id"
|
|
5
|
+
:class="{
|
|
6
|
+
'Drawer-title': headless,
|
|
7
|
+
'mb-8 text-2xl font-semibold': !headless,
|
|
8
|
+
}"
|
|
9
|
+
>
|
|
10
|
+
<slot></slot>
|
|
11
|
+
</component>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
name: "VTDrawerTitle",
|
|
17
|
+
|
|
18
|
+
inject: ["api"],
|
|
19
|
+
|
|
20
|
+
props: {
|
|
21
|
+
as: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "div",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
computed: {
|
|
28
|
+
dark() {
|
|
29
|
+
return this.api().isDark;
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
headless() {
|
|
33
|
+
return this.api().isHeadless;
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
id() {
|
|
37
|
+
return `${this.api().id}-title`;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
mounted() {
|
|
42
|
+
this.setDialogLabelledby();
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
methods: {
|
|
46
|
+
// In here because if there is no header, the dialog will not be labelled by
|
|
47
|
+
setDialogLabelledby() {
|
|
48
|
+
const dialog = document.getElementById(this.api().id);
|
|
49
|
+
|
|
50
|
+
if (dialog) {
|
|
51
|
+
dialog.setAttribute("aria-labelledby", this.id);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
</script>
|