@veritree/ui 0.19.2 → 0.20.0-0
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 +64 -68
- 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 +71 -0
- package/nuxt.js +30 -23
- package/package.json +9 -4
- package/src/components/Alert/VTAlert.vue +55 -14
- package/src/components/Avatar/VTAvatar.vue +32 -29
- package/src/components/Button/VTButton.vue +9 -6
- package/src/components/Checkbox/VTCheckbox.vue +134 -0
- package/src/components/Checkbox/VTCheckboxLabel.vue +3 -0
- package/src/components/Checkbox/VTCheckboxText.vue +20 -0
- package/src/components/Dialog/VTDialog.vue +22 -32
- package/src/components/Dialog/VTDialogClose.vue +19 -25
- package/src/components/Dialog/VTDialogContent.vue +24 -19
- package/src/components/Dialog/VTDialogFooter.vue +11 -16
- package/src/components/Dialog/VTDialogHeader.vue +16 -18
- package/src/components/Dialog/VTDialogMain.vue +11 -18
- package/src/components/Dialog/VTDialogOverlay.vue +14 -18
- package/src/components/Dialog/VTDialogTitle.vue +10 -7
- package/src/components/Disclosure/VTDisclosureContent.vue +1 -1
- package/src/components/Disclosure/VTDisclosureDetails.vue +1 -1
- package/src/components/Disclosure/VTDisclosureHeader.vue +2 -2
- 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 +45 -28
- package/src/components/DropdownMenu/VTDropdownMenuContent.vue +29 -64
- package/src/components/DropdownMenu/VTDropdownMenuDivider.vue +8 -14
- package/src/components/DropdownMenu/VTDropdownMenuItem.vue +11 -124
- package/src/components/DropdownMenu/VTDropdownMenuLabel.vue +3 -12
- package/src/components/DropdownMenu/VTDropdownMenuTrigger.vue +91 -121
- package/src/components/Form/VTFormFeedback.vue +39 -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 +115 -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 +42 -29
- 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/ProgressBar/VTProgressBar.vue +21 -3
- package/src/components/Skeleton/VTSkeleton.vue +11 -0
- package/src/components/Skeleton/VTSkeletonItem.vue +9 -0
- package/src/components/Tabs/VTTab.vue +4 -3
- package/src/components/Tabs/VTTabGroup.vue +9 -7
- package/src/components/Tabs/VTTabPanel.vue +4 -5
- package/src/components/Tooltip/VTTooltip.vue +65 -0
- package/src/components/Tooltip/VTTooltipContent.vue +59 -0
- package/src/components/Tooltip/VTTooltipTrigger.vue +98 -0
- package/src/components/Transitions/FadeInOut.vue +2 -2
- package/src/components/Utils/FloatingUi.vue +93 -0
- package/package-lock.json +0 -13
- package/src/components/Input/VTInput.vue +0 -82
- package/src/components/Input/VTInputDate.vue +0 -36
- package/src/components/Input/VTInputFile.vue +0 -60
- package/src/components/Input/VTInputUpload.vue +0 -54
- package/src/components/Modal/VTModal.vue +0 -69
- package/src/utils/genId.js +0 -13
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<input
|
|
3
|
-
:class="classes"
|
|
4
|
-
class="form-control"
|
|
5
|
-
:data-theme="theme"
|
|
6
|
-
:type="type"
|
|
7
|
-
:value="value"
|
|
8
|
-
v-on="listeners"
|
|
9
|
-
/>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script>
|
|
13
|
-
export default {
|
|
14
|
-
name: 'VTInput',
|
|
15
|
-
|
|
16
|
-
props: {
|
|
17
|
-
lazy: {
|
|
18
|
-
type: Boolean,
|
|
19
|
-
default: false,
|
|
20
|
-
},
|
|
21
|
-
type: {
|
|
22
|
-
type: String,
|
|
23
|
-
default: 'text',
|
|
24
|
-
},
|
|
25
|
-
theme: {
|
|
26
|
-
type: String,
|
|
27
|
-
default: null,
|
|
28
|
-
validator(value) {
|
|
29
|
-
return ['dark'].includes(value);
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
variant: {
|
|
33
|
-
type: [String, Object],
|
|
34
|
-
default: '',
|
|
35
|
-
validator(value) {
|
|
36
|
-
if (value === '' || typeof value === 'object') {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return ['success', 'warning', 'error'].includes(value);
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
value: {
|
|
44
|
-
type: [String, Number, Object, Array],
|
|
45
|
-
default: null,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
computed: {
|
|
50
|
-
classes() {
|
|
51
|
-
const classes = {};
|
|
52
|
-
|
|
53
|
-
if (this.variant) {
|
|
54
|
-
classes[`form-control--${this.variant}`] = true;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return classes;
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
listeners() {
|
|
61
|
-
// `Object.assign` merges objects together to form a new object
|
|
62
|
-
return Object.assign(
|
|
63
|
-
{},
|
|
64
|
-
// We add all the listeners from the parent
|
|
65
|
-
this.$listeners,
|
|
66
|
-
// Then we can add custom listeners or override the
|
|
67
|
-
// behavior of some listeners.
|
|
68
|
-
{
|
|
69
|
-
// This ensures that the component works with v-model
|
|
70
|
-
input: (event) => {
|
|
71
|
-
if (this.lazy) return;
|
|
72
|
-
this.$emit('input', event.target.value);
|
|
73
|
-
},
|
|
74
|
-
blur: (event) => {
|
|
75
|
-
this.$emit('blur', event);
|
|
76
|
-
},
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
</script>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<VTInput v-model="date" type="date" />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
import VTInput from './VTInput.vue';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
name: 'VTInputDate',
|
|
10
|
-
|
|
11
|
-
components: { VTInput },
|
|
12
|
-
|
|
13
|
-
model: {
|
|
14
|
-
prop: 'value',
|
|
15
|
-
event: 'input',
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
props: {
|
|
19
|
-
value: {
|
|
20
|
-
type: String,
|
|
21
|
-
default: '',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
computed: {
|
|
26
|
-
date: {
|
|
27
|
-
get() {
|
|
28
|
-
return this.$date.format(this.value, 'YYYY-MM-DD');
|
|
29
|
-
},
|
|
30
|
-
set(newDate) {
|
|
31
|
-
this.$emit('input', newDate);
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
</script>
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="flex items-stretch gap-2">
|
|
3
|
-
<VTInput
|
|
4
|
-
ref="input"
|
|
5
|
-
type="file"
|
|
6
|
-
:value="value"
|
|
7
|
-
:theme="theme"
|
|
8
|
-
v-bind="$attrs"
|
|
9
|
-
@change="onChange"
|
|
10
|
-
/>
|
|
11
|
-
<VTButton :theme="theme" @click.stop="onButtonClick">Browse</VTButton>
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script>
|
|
16
|
-
import VTButton from '../Button/VTButton.vue';
|
|
17
|
-
import VTInput from './VTInput.vue';
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
name: 'VTInputFile',
|
|
21
|
-
|
|
22
|
-
components: {
|
|
23
|
-
VTInput,
|
|
24
|
-
VTButton,
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
inheritAttrs: false,
|
|
28
|
-
|
|
29
|
-
props: {
|
|
30
|
-
theme: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: null,
|
|
33
|
-
validator(value) {
|
|
34
|
-
return ['dark'].includes(value);
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
multiple: {
|
|
38
|
-
type: Boolean,
|
|
39
|
-
default: false,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
data() {
|
|
44
|
-
return {
|
|
45
|
-
value: null,
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
methods: {
|
|
50
|
-
onChange(event) {
|
|
51
|
-
this.value = this.$refs.input.$el.value;
|
|
52
|
-
this.$emit('change', event);
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
onButtonClick() {
|
|
56
|
-
this.$refs.input.$el.click();
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
</script>
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<label
|
|
3
|
-
class="flex h-full w-full flex-col items-center justify-center rounded border-2 border-dotted border-white p-4 text-center hover:border-fl-500 hover:bg-fd-500"
|
|
4
|
-
:class="{ 'border-fl-500 bg-fd-500': isDraggingOver }"
|
|
5
|
-
@drop.prevent="onDrop"
|
|
6
|
-
@dragover.prevent="onDragOver"
|
|
7
|
-
@dragleave.prevent="onDragLeave"
|
|
8
|
-
>
|
|
9
|
-
<IconImagePlaceholder class="mb-3" />
|
|
10
|
-
<span>Drop your images here, or click to browse</span>
|
|
11
|
-
<VTInput type="file" class="sr-only" v-bind="$attrs" @change="onChange" />
|
|
12
|
-
</label>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script>
|
|
16
|
-
import { IconImagePlaceholder } from '@veritree/icons';
|
|
17
|
-
import VTInput from './VTInput.vue';
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
name: 'VTInputFile',
|
|
21
|
-
|
|
22
|
-
components: {
|
|
23
|
-
VTInput,
|
|
24
|
-
IconImagePlaceholder,
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
inheritAttrs: false,
|
|
28
|
-
|
|
29
|
-
data() {
|
|
30
|
-
return {
|
|
31
|
-
isDraggingOver: false,
|
|
32
|
-
};
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
methods: {
|
|
36
|
-
onDrop(event) {
|
|
37
|
-
this.isDraggingOver = false;
|
|
38
|
-
this.$emit('drop', event);
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
onDragOver() {
|
|
42
|
-
this.isDraggingOver = true;
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
onDragLeave() {
|
|
46
|
-
this.isDraggingOver = false;
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
onChange(event) {
|
|
50
|
-
this.$emit('change', event);
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
</script>
|
|
@@ -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
|
-
};
|