@veritree/ui 0.19.2-2 → 0.19.2-21
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 +81 -0
- package/mixins/floating-ui-item.js +266 -0
- package/mixins/floating-ui.js +67 -0
- package/mixins/form-control-icon.js +53 -0
- package/mixins/form-control.js +73 -0
- package/package.json +7 -3
- package/src/components/Avatar/VTAvatar.vue +32 -29
- package/src/components/Button/VTButton.vue +9 -5
- package/src/components/Dialog/VTDialog.vue +6 -11
- package/src/components/Dialog/VTDialogClose.vue +9 -9
- package/src/components/Dialog/VTDialogContent.vue +9 -9
- package/src/components/Dialog/VTDialogFooter.vue +5 -5
- package/src/components/Dialog/VTDialogHeader.vue +8 -8
- package/src/components/Dialog/VTDialogMain.vue +8 -8
- package/src/components/Dialog/VTDialogOverlay.vue +8 -8
- package/src/components/Dialog/VTDialogTitle.vue +4 -4
- package/src/components/Disclosure/VTDisclosureContent.vue +1 -1
- package/src/components/Disclosure/VTDisclosureDetails.vue +2 -2
- package/src/components/Disclosure/VTDisclosureHeader.vue +1 -1
- package/src/components/Disclosure/VTDisclosureIcon.vue +1 -1
- package/src/components/Drawer/VTDrawer.vue +14 -16
- package/src/components/Drawer/VTDrawerClose.vue +9 -9
- package/src/components/Drawer/VTDrawerContent.vue +8 -8
- package/src/components/Drawer/VTDrawerFooter.vue +3 -3
- package/src/components/Drawer/VTDrawerHeader.vue +4 -4
- package/src/components/Drawer/VTDrawerMain.vue +5 -5
- package/src/components/Drawer/VTDrawerOverlay.vue +6 -6
- package/src/components/Drawer/VTDrawerTitle.vue +5 -5
- package/src/components/DropdownMenu/VTDropdownMenu.vue +27 -29
- package/src/components/DropdownMenu/VTDropdownMenuContent.vue +27 -70
- package/src/components/DropdownMenu/VTDropdownMenuDivider.vue +8 -5
- package/src/components/DropdownMenu/VTDropdownMenuItem.vue +14 -123
- package/src/components/DropdownMenu/VTDropdownMenuLabel.vue +3 -3
- package/src/components/DropdownMenu/VTDropdownMenuTrigger.vue +96 -121
- package/src/components/Form/VTFormFeedback.vue +33 -22
- package/src/components/Form/VTFormGroup.vue +5 -7
- package/src/components/Form/VTFormLabel.vue +22 -0
- package/src/components/Form/VTFormRow.vue +5 -0
- package/src/components/Form/VTInput.vue +40 -0
- package/src/components/Form/VTInputIcon.vue +35 -0
- package/src/components/Form/VTInputPassword.vue +55 -0
- package/src/components/Form/VTTextarea.vue +22 -0
- package/src/components/Listbox/VTListbox.vue +122 -50
- package/src/components/Listbox/VTListboxContent.vue +20 -116
- package/src/components/Listbox/VTListboxItem.vue +116 -166
- package/src/components/Listbox/VTListboxLabel.vue +3 -14
- package/src/components/Listbox/VTListboxList.vue +10 -40
- package/src/components/Listbox/VTListboxSearch.vue +76 -68
- package/src/components/Listbox/VTListboxTrigger.vue +75 -86
- package/src/components/Popover/VTPopover.vue +24 -30
- package/src/components/Popover/VTPopoverContent.vue +24 -59
- package/src/components/Popover/VTPopoverDivider.vue +4 -11
- package/src/components/Popover/VTPopoverItem.vue +21 -14
- package/src/components/Popover/VTPopoverTrigger.vue +126 -21
- package/src/components/Tabs/VTTab.vue +10 -11
- package/src/components/Tabs/VTTabGroup.vue +9 -7
- package/src/components/Tabs/VTTabPanel.vue +4 -5
- package/src/components/Transitions/FadeInOut.vue +2 -2
- package/src/components/Utils/FloatingUi.vue +87 -0
- package/package-lock.json +0 -13
- package/src/components/Modal/VTModal.vue +0 -69
- package/src/utils/genId.js +0 -13
|
@@ -32,7 +32,7 @@ import { keys } from '../../utils/keyboard';
|
|
|
32
32
|
export default {
|
|
33
33
|
name: 'VTTabItem',
|
|
34
34
|
|
|
35
|
-
inject: ['
|
|
35
|
+
inject: ['apiTabs'],
|
|
36
36
|
|
|
37
37
|
props: {
|
|
38
38
|
headless: {
|
|
@@ -43,7 +43,6 @@ export default {
|
|
|
43
43
|
|
|
44
44
|
data() {
|
|
45
45
|
return {
|
|
46
|
-
api: this.api(),
|
|
47
46
|
index: null,
|
|
48
47
|
indexFocus: null,
|
|
49
48
|
selected: false,
|
|
@@ -57,11 +56,11 @@ export default {
|
|
|
57
56
|
},
|
|
58
57
|
|
|
59
58
|
mounted() {
|
|
60
|
-
this.
|
|
59
|
+
this.apiTabs().registerTab(this);
|
|
61
60
|
},
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
this.
|
|
62
|
+
beforeUnmount() {
|
|
63
|
+
this.apiTabs().unregisterTab(this.index);
|
|
65
64
|
},
|
|
66
65
|
|
|
67
66
|
methods: {
|
|
@@ -78,11 +77,11 @@ export default {
|
|
|
78
77
|
},
|
|
79
78
|
|
|
80
79
|
focusFirstTab() {
|
|
81
|
-
this.
|
|
80
|
+
this.apiTabs().focusTab(0);
|
|
82
81
|
},
|
|
83
82
|
|
|
84
83
|
focusLastTab(lastTabIndex) {
|
|
85
|
-
this.
|
|
84
|
+
this.apiTabs().focusTab(lastTabIndex);
|
|
86
85
|
},
|
|
87
86
|
|
|
88
87
|
focusPreviousTab(lastTabIndex) {
|
|
@@ -91,7 +90,7 @@ export default {
|
|
|
91
90
|
return;
|
|
92
91
|
}
|
|
93
92
|
|
|
94
|
-
this.
|
|
93
|
+
this.apiTabs().focusTab(this.indexFocus - 1);
|
|
95
94
|
},
|
|
96
95
|
|
|
97
96
|
focusNextTab(lastTabIndex) {
|
|
@@ -100,17 +99,17 @@ export default {
|
|
|
100
99
|
return;
|
|
101
100
|
}
|
|
102
101
|
|
|
103
|
-
this.
|
|
102
|
+
this.apiTabs().focusTab(this.indexFocus + 1);
|
|
104
103
|
},
|
|
105
104
|
|
|
106
105
|
onClick() {
|
|
107
|
-
this.
|
|
106
|
+
this.apiTabs().selectTab(this.index);
|
|
108
107
|
this.$emit('change');
|
|
109
108
|
},
|
|
110
109
|
|
|
111
110
|
onKeyDown(event) {
|
|
112
111
|
const key = event.key;
|
|
113
|
-
const lastTabIndex = this.
|
|
112
|
+
const lastTabIndex = this.apiTabs().getTabsLength() - 1;
|
|
114
113
|
|
|
115
114
|
if (this.indexFocus === null) {
|
|
116
115
|
this.indexFocus = this.index;
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<style scoped>
|
|
8
|
-
.TabGroup.vertical{
|
|
8
|
+
.TabGroup.vertical {
|
|
9
9
|
display: flex;
|
|
10
10
|
}
|
|
11
|
-
.TabGroup.vertical .TabList{
|
|
11
|
+
.TabGroup.vertical .TabList {
|
|
12
12
|
display: flex;
|
|
13
13
|
flex-direction: column;
|
|
14
14
|
}
|
|
@@ -17,15 +17,17 @@
|
|
|
17
17
|
<script>
|
|
18
18
|
export default {
|
|
19
19
|
name: 'VTTabGroup',
|
|
20
|
+
|
|
20
21
|
props: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
vertical: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false,
|
|
25
|
+
},
|
|
25
26
|
},
|
|
27
|
+
|
|
26
28
|
provide() {
|
|
27
29
|
return {
|
|
28
|
-
|
|
30
|
+
apiTabs: () => {
|
|
29
31
|
const registerTab = (tab) => {
|
|
30
32
|
_register(this.tabs, tab);
|
|
31
33
|
if (tab.index === 0) tab.select();
|
|
@@ -14,11 +14,10 @@
|
|
|
14
14
|
export default {
|
|
15
15
|
name: 'VTTabPanel',
|
|
16
16
|
|
|
17
|
-
inject: ['
|
|
17
|
+
inject: ['apiTabs'],
|
|
18
18
|
|
|
19
19
|
data() {
|
|
20
20
|
return {
|
|
21
|
-
api: this.api(),
|
|
22
21
|
index: null,
|
|
23
22
|
visible: false,
|
|
24
23
|
};
|
|
@@ -31,11 +30,11 @@ export default {
|
|
|
31
30
|
},
|
|
32
31
|
|
|
33
32
|
mounted() {
|
|
34
|
-
this.
|
|
33
|
+
this.apiTabs().registerTabPanel(this);
|
|
35
34
|
},
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
this.
|
|
36
|
+
beforeUnmount() {
|
|
37
|
+
this.apiTabs().unregisterTabPanel(this.id);
|
|
39
38
|
},
|
|
40
39
|
|
|
41
40
|
methods: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<transition
|
|
3
3
|
enter-active-class="duration-300 ease-out"
|
|
4
|
-
enter-class="transform opacity-0"
|
|
4
|
+
enter-from-class="transform opacity-0"
|
|
5
5
|
enter-to-class="opacity-100"
|
|
6
6
|
leave-active-class="duration-300 ease-in"
|
|
7
|
-
leave-class="opacity-100"
|
|
7
|
+
leave-from-class="opacity-100"
|
|
8
8
|
leave-to-class="transform opacity-0"
|
|
9
9
|
@after-enter="afterEnter"
|
|
10
10
|
@after-leave="afterLeave"
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<transition
|
|
4
|
+
enter-active-class="duration-200 ease-out"
|
|
5
|
+
:enter-from-class="transitionEnterClass"
|
|
6
|
+
:enter-to-class="transitionEnterToClass"
|
|
7
|
+
leave-active-class="duration-200 ease-in"
|
|
8
|
+
:leave-from-class="transitionLeaveClass"
|
|
9
|
+
:leave-to-class="transitionLeaveToClass"
|
|
10
|
+
@after-leave="hidden"
|
|
11
|
+
@after-enter="shown"
|
|
12
|
+
>
|
|
13
|
+
<div
|
|
14
|
+
v-if="visible"
|
|
15
|
+
:class="[
|
|
16
|
+
headless
|
|
17
|
+
? `${this.component}-content`
|
|
18
|
+
: `absolute z-50 grid overflow-hidden rounded-md shadow-md ${this.classes} ${this.portalClass}`,
|
|
19
|
+
]"
|
|
20
|
+
v-bind="$attrs"
|
|
21
|
+
>
|
|
22
|
+
<slot />
|
|
23
|
+
</div>
|
|
24
|
+
</transition>
|
|
25
|
+
</Teleport>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
export default {
|
|
30
|
+
props: {
|
|
31
|
+
component: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: null,
|
|
34
|
+
},
|
|
35
|
+
headless: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false,
|
|
38
|
+
},
|
|
39
|
+
visible: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
portalClass: {
|
|
44
|
+
type: [String, Function],
|
|
45
|
+
default: null,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
computed: {
|
|
50
|
+
isTooltip() {
|
|
51
|
+
return this.component === 'tooltip';
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
classes() {
|
|
55
|
+
return this.isTooltip
|
|
56
|
+
? 'bg-gray-800 text-sm text-white py-1 px-2'
|
|
57
|
+
: 'bg-white py-2 px-3';
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
transitionEnterClass() {
|
|
61
|
+
return this.isTooltip ? 'opacity-0' : 'translate-y-[15px] opacity-0';
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
transitionEnterToClass() {
|
|
65
|
+
return this.isTooltip ? 'opacity-100' : 'translate-y-0 opacity-100';
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
transitionLeaveClass() {
|
|
69
|
+
return this.transitionEnterToClass;
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
transitionLeaveToClass() {
|
|
73
|
+
return this.transitionEnterClass;
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
methods: {
|
|
78
|
+
shown() {
|
|
79
|
+
this.$emit('shown');
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
hidden() {
|
|
83
|
+
this.$emit('hidden');
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
</script>
|
package/package-lock.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@veritree/ui",
|
|
3
|
-
"version": "0.1.9",
|
|
4
|
-
"lockfileVersion": 1,
|
|
5
|
-
"requires": true,
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"@veritree/icons": {
|
|
8
|
-
"version": "0.12.0",
|
|
9
|
-
"resolved": "https://registry.npmjs.org/@veritree/icons/-/icons-0.12.0.tgz",
|
|
10
|
-
"integrity": "sha512-vunUKzvS9neslSf3R3y6RYQrcfRpxmp8PnhWWe2peYiyElLIJcb7zAsfCZ+I0Fg5PQ6GZG6StqWy0WF7MJ7VOg=="
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<transition
|
|
3
|
-
enter-active-class="duration-300 ease-out"
|
|
4
|
-
enter-class="transform opacity-0"
|
|
5
|
-
enter-to-class="opacity-100"
|
|
6
|
-
leave-active-class="duration-300 ease-in"
|
|
7
|
-
leave-class="opacity-100"
|
|
8
|
-
leave-to-class="transform opacity-0"
|
|
9
|
-
@after-enter="afterEnter"
|
|
10
|
-
@after-leave="afterLeave"
|
|
11
|
-
>
|
|
12
|
-
<div
|
|
13
|
-
v-if="visible"
|
|
14
|
-
class="fixed inset-0 z-50 flex flex-col justify-center bg-fd-700/75"
|
|
15
|
-
tabindex="-1"
|
|
16
|
-
@keyup.esc="close"
|
|
17
|
-
@click="close"
|
|
18
|
-
>
|
|
19
|
-
<div
|
|
20
|
-
class="relative mx-auto flex max-w-lg flex-col justify-center rounded bg-white"
|
|
21
|
-
@click.stop
|
|
22
|
-
>
|
|
23
|
-
<div class="absolute right-4 top-4">
|
|
24
|
-
<VTButton variant="icon" @click.prevent="close"
|
|
25
|
-
><IconClose class="h-4 w-4"
|
|
26
|
-
/></VTButton>
|
|
27
|
-
</div>
|
|
28
|
-
<slot></slot>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
</transition>
|
|
32
|
-
</template>
|
|
33
|
-
|
|
34
|
-
<script>
|
|
35
|
-
import { IconClose } from '@veritree/icons';
|
|
36
|
-
import VTButton from '../Button/VTButton.vue';
|
|
37
|
-
|
|
38
|
-
export default {
|
|
39
|
-
name: 'VTModal',
|
|
40
|
-
|
|
41
|
-
components: { IconClose, VTButton },
|
|
42
|
-
|
|
43
|
-
model: {
|
|
44
|
-
prop: 'visible',
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
props: {
|
|
48
|
-
visible: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
default: false,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
methods: {
|
|
55
|
-
close() {
|
|
56
|
-
this.$emit('input', false);
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
afterEnter() {
|
|
60
|
-
this.$emit('shown');
|
|
61
|
-
this.$nextTick(() => this.$el.focus());
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
afterLeave() {
|
|
65
|
-
this.$emit('hidden');
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
</script>
|
package/src/utils/genId.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Generate id
|
|
2
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*
|
|
3
|
-
let gen = null;
|
|
4
|
-
|
|
5
|
-
function* idMaker() {
|
|
6
|
-
let index = 0;
|
|
7
|
-
while (true) yield index++;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const genId = () => {
|
|
11
|
-
if (!gen) gen = idMaker();
|
|
12
|
-
return gen.next().value;
|
|
13
|
-
};
|