@veritree/ui 0.24.0 → 0.25.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 -72
- package/mixins/floating-ui-content.js +1 -1
- package/mixins/floating-ui-item.js +11 -7
- package/mixins/floating-ui.js +8 -1
- package/mixins/form-control-icon.js +3 -3
- package/mixins/form-control.js +9 -14
- package/nuxt.js +30 -24
- package/package.json +14 -6
- package/src/components/Alert/VTAlert.vue +55 -14
- package/src/components/Avatar/VTAvatarImage.vue +6 -26
- package/src/components/Button/VTButton.vue +25 -11
- 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 -23
- package/src/components/Dialog/VTDialogClose.vue +1 -1
- package/src/components/Dialog/VTDialogContent.vue +13 -5
- package/src/components/Dialog/VTDialogFooter.vue +8 -2
- package/src/components/Dialog/VTDialogHeader.vue +2 -1
- package/src/components/Dialog/VTDialogMain.vue +1 -1
- package/src/components/Dialog/VTDialogOverlay.vue +5 -1
- 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 +6 -15
- package/src/components/Drawer/VTDrawerClose.vue +5 -5
- package/src/components/Drawer/VTDrawerContent.vue +10 -10
- package/src/components/Drawer/VTDrawerFooter.vue +4 -4
- 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 +0 -6
- package/src/components/DropdownMenu/VTDropdownMenuContent.vue +10 -1
- package/src/components/DropdownMenu/VTDropdownMenuDivider.vue +7 -16
- package/src/components/DropdownMenu/VTDropdownMenuItem.vue +5 -1
- package/src/components/DropdownMenu/VTDropdownMenuLabel.vue +1 -10
- package/src/components/DropdownMenu/VTDropdownMenuTrigger.vue +2 -4
- package/src/components/Form/VTFormFeedback.vue +7 -1
- 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 +2 -5
- package/src/components/Form/VTInputIcon.vue +1 -2
- package/src/components/Form/VTInputPassword.vue +14 -5
- package/src/components/Form/VTTextarea.vue +3 -6
- package/src/components/Image/VTImage.vue +39 -8
- package/src/components/Listbox/VTListbox.vue +72 -5
- package/src/components/Listbox/VTListboxContent.vue +0 -1
- package/src/components/Listbox/VTListboxItem.vue +11 -1
- package/src/components/Listbox/VTListboxLabel.vue +3 -4
- package/src/components/Listbox/VTListboxList.vue +3 -1
- package/src/components/Listbox/VTListboxSearch.vue +10 -7
- package/src/components/Listbox/VTListboxTrigger.vue +2 -0
- package/src/components/Popover/VTPopoverContent.vue +3 -3
- package/src/components/Popover/VTPopoverItem.vue +6 -2
- 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 +6 -5
- package/src/components/Tabs/VTTabGroup.vue +9 -7
- package/src/components/Tabs/VTTabPanel.vue +4 -5
- package/src/components/Tooltip/VTTooltipTrigger.vue +3 -5
- package/src/components/Transitions/FadeInOut.vue +2 -2
- package/src/components/Utils/FloatingUi.vue +31 -13
- package/src/utils/components.js +18 -0
- package/src/utils/images.js +18 -25
- 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
package/index.js
CHANGED
|
@@ -1,69 +1,65 @@
|
|
|
1
|
-
import VTAlert from
|
|
2
|
-
import VTAvatar from
|
|
3
|
-
import VTAvatarImage from
|
|
4
|
-
import VTAvatarText from
|
|
5
|
-
import VTButton from
|
|
6
|
-
import VTImage from
|
|
7
|
-
import VTImageCounter from
|
|
8
|
-
import VTImageHover from
|
|
9
|
-
import VTDropdownMenu from
|
|
10
|
-
import VTDropdownMenuContent from
|
|
11
|
-
import VTDropdownMenuDivider from
|
|
12
|
-
import VTDropdownMenuGroup from
|
|
13
|
-
import VTDropdownMenuItem from
|
|
14
|
-
import VTDropdownMenuLabel from
|
|
15
|
-
import VTDropdownMenuTrigger from
|
|
16
|
-
import VTPopover from
|
|
17
|
-
import VTPopoverContent from
|
|
18
|
-
import VTPopoverDivider from
|
|
19
|
-
import VTPopoverGroup from
|
|
20
|
-
import VTPopoverItem from
|
|
21
|
-
import VTPopoverTrigger from
|
|
22
|
-
import VTFormFeedback from
|
|
23
|
-
import VTFormGroup from
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
import
|
|
49
|
-
import
|
|
50
|
-
import
|
|
51
|
-
import
|
|
52
|
-
import
|
|
53
|
-
import
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import
|
|
57
|
-
import
|
|
58
|
-
import
|
|
59
|
-
import
|
|
60
|
-
import
|
|
61
|
-
import
|
|
62
|
-
import
|
|
63
|
-
import VTDisclosureDetails from "./src/components/Disclosure/VTDisclosureDetails.vue";
|
|
64
|
-
import VTDisclosureHeader from "./src/components/Disclosure/VTDisclosureHeader.vue";
|
|
65
|
-
import VTDisclosureIcon from "./src/components/Disclosure/VTDisclosureIcon.vue";
|
|
66
|
-
import VTDisclosureContent from "./src/components/Disclosure/VTDisclosureContent.vue";
|
|
1
|
+
import VTAlert from './src/components/Alert/VTAlert.vue';
|
|
2
|
+
import VTAvatar from './src/components/Avatar/VTAvatar.vue';
|
|
3
|
+
import VTAvatarImage from './src/components/Avatar/VTAvatarImage.vue';
|
|
4
|
+
import VTAvatarText from './src/components/Avatar/VTAvatarText.vue';
|
|
5
|
+
import VTButton from './src/components/Button/VTButton.vue';
|
|
6
|
+
import VTImage from './src/components/Image/VTImage.vue';
|
|
7
|
+
import VTImageCounter from './src/components/Image/VTImageCounter.vue';
|
|
8
|
+
import VTImageHover from './src/components/Image/VTImageHover.vue';
|
|
9
|
+
import VTDropdownMenu from './src/components/DropdownMenu/VTDropdownMenu.vue';
|
|
10
|
+
import VTDropdownMenuContent from './src/components/DropdownMenu/VTDropdownMenuContent.vue';
|
|
11
|
+
import VTDropdownMenuDivider from './src/components/DropdownMenu/VTDropdownMenuDivider.vue';
|
|
12
|
+
import VTDropdownMenuGroup from './src/components/DropdownMenu/VTDropdownMenuGroup.vue';
|
|
13
|
+
import VTDropdownMenuItem from './src/components/DropdownMenu/VTDropdownMenuItem.vue';
|
|
14
|
+
import VTDropdownMenuLabel from './src/components/DropdownMenu/VTDropdownMenuLabel.vue';
|
|
15
|
+
import VTDropdownMenuTrigger from './src/components/DropdownMenu/VTDropdownMenuTrigger.vue';
|
|
16
|
+
import VTPopover from './src/components/Popover/VTPopover.vue';
|
|
17
|
+
import VTPopoverContent from './src/components/Popover/VTPopoverContent.vue';
|
|
18
|
+
import VTPopoverDivider from './src/components/Popover/VTPopoverDivider.vue';
|
|
19
|
+
import VTPopoverGroup from './src/components/Popover/VTPopoverGroup.vue';
|
|
20
|
+
import VTPopoverItem from './src/components/Popover/VTPopoverItem.vue';
|
|
21
|
+
import VTPopoverTrigger from './src/components/Popover/VTPopoverTrigger.vue';
|
|
22
|
+
import VTFormFeedback from './src/components/Form/VTFormFeedback.vue';
|
|
23
|
+
import VTFormGroup from './src/components/Form/VTFormGroup.vue';
|
|
24
|
+
import VTListbox from './src/components/Listbox/VTListbox.vue';
|
|
25
|
+
import VTListboxContent from './src/components/Listbox/VTListboxContent.vue';
|
|
26
|
+
import VTListboxItem from './src/components/Listbox/VTListboxItem.vue';
|
|
27
|
+
import VTListboxLabel from './src/components/Listbox/VTListboxLabel.vue';
|
|
28
|
+
import VTListboxList from './src/components/Listbox/VTListboxList.vue';
|
|
29
|
+
import VTListboxSearch from './src/components/Listbox/VTListboxSearch.vue';
|
|
30
|
+
import VTListboxTrigger from './src/components/Listbox/VTListboxTrigger.vue';
|
|
31
|
+
import VTSpinner from './src/components/Spinner/VTSpinner.vue';
|
|
32
|
+
import VTInput from './src/components/Form/VTInput.vue';
|
|
33
|
+
import VTProgressBar from './src/components/ProgressBar/VTProgressBar.vue';
|
|
34
|
+
import VTTextarea from './src/components/Textarea/VTTextarea.vue';
|
|
35
|
+
import VTTab from './src/components/Tabs/VTTab.vue';
|
|
36
|
+
import VTTabGroup from './src/components/Tabs/VTTabGroup.vue';
|
|
37
|
+
import VTTabList from './src/components/Tabs/VTTabList.vue';
|
|
38
|
+
import VTTabPanel from './src/components/Tabs/VTTabPanel.vue';
|
|
39
|
+
import VTTabPanels from './src/components/Tabs/VTTabPanels.vue';
|
|
40
|
+
import VTDialog from './src/components/Dialog/VTDialog.vue';
|
|
41
|
+
import VTDialogClose from './src/components/Dialog/VTDialogClose.vue';
|
|
42
|
+
import VTDialogContent from './src/components/Dialog/VTDialogContent.vue';
|
|
43
|
+
import VTDialogFooter from './src/components/Dialog/VTDialogFooter.vue';
|
|
44
|
+
import VTDialogHeader from './src/components/Dialog/VTDialogHeader.vue';
|
|
45
|
+
import VTDialogMain from './src/components/Dialog/VTDialogMain.vue';
|
|
46
|
+
import VTDialogOverlay from './src/components/Dialog/VTDialogOverlay.vue';
|
|
47
|
+
import VTDialogTitle from './src/components/Dialog/VTDialogTitle.vue';
|
|
48
|
+
import VTDrawer from './src/components/Drawer/VTDrawer.vue';
|
|
49
|
+
import VTDrawerClose from './src/components/Drawer/VTDrawerClose.vue';
|
|
50
|
+
import VTDrawerContent from './src/components/Drawer/VTDrawerContent.vue';
|
|
51
|
+
import VTDrawerFooter from './src/components/Drawer/VTDrawerFooter.vue';
|
|
52
|
+
import VTDrawerHeader from './src/components/Drawer/VTDrawerHeader.vue';
|
|
53
|
+
import VTDrawerTitle from './src/components/Drawer/VTDrawerTitle.vue';
|
|
54
|
+
import VTDrawerMain from './src/components/Drawer/VTDrawerMain.vue';
|
|
55
|
+
import VTDrawerOverlay from './src/components/Drawer/VTDrawerOverlay.vue';
|
|
56
|
+
import VTDisclosure from './src/components/Disclosure/VTDisclosure.vue';
|
|
57
|
+
import VTDisclosureDetails from './src/components/Disclosure/VTDisclosureDetails.vue';
|
|
58
|
+
import VTDisclosureHeader from './src/components/Disclosure/VTDisclosureHeader.vue';
|
|
59
|
+
import VTDisclosureIcon from './src/components/Disclosure/VTDisclosureIcon.vue';
|
|
60
|
+
import VTDisclosureContent from './src/components/Disclosure/VTDisclosureContent.vue';
|
|
61
|
+
import VTSkeleton from './src/components/Skeleton/VTSkeleton.vue';
|
|
62
|
+
import VTSkeletonItem from './src/components/Skeleton/VTSkeletonItem.vue';
|
|
67
63
|
|
|
68
64
|
export {
|
|
69
65
|
VTAvatar,
|
|
@@ -98,14 +94,8 @@ export {
|
|
|
98
94
|
VTListboxTrigger,
|
|
99
95
|
VTButton,
|
|
100
96
|
VTInput,
|
|
101
|
-
VTInputIcon,
|
|
102
|
-
VTInputPassword,
|
|
103
|
-
VTInputDate,
|
|
104
|
-
VTInputFile,
|
|
105
|
-
VTInputUpload,
|
|
106
97
|
VTProgressBar,
|
|
107
98
|
VTTextarea,
|
|
108
|
-
VTModal,
|
|
109
99
|
VTTab,
|
|
110
100
|
VTTabGroup,
|
|
111
101
|
VTTabList,
|
|
@@ -132,4 +122,6 @@ export {
|
|
|
132
122
|
VTDisclosureHeader,
|
|
133
123
|
VTDisclosureIcon,
|
|
134
124
|
VTDisclosureContent,
|
|
125
|
+
VTSkeleton,
|
|
126
|
+
VTSkeletonItem,
|
|
135
127
|
};
|
|
@@ -32,7 +32,7 @@ export const floatingUiItemMixin = {
|
|
|
32
32
|
// default styles
|
|
33
33
|
this.headless
|
|
34
34
|
? `${this.componentName}`
|
|
35
|
-
: 'relative z-10 flex items-center gap-2 px-3 py-2 text-inherit no-underline',
|
|
35
|
+
: 'relative z-10 flex items-center gap-2 px-3 py-2 text-inherit no-underline cursor-pointer',
|
|
36
36
|
// disabled state styles
|
|
37
37
|
this.headless
|
|
38
38
|
? this.disabled
|
|
@@ -84,7 +84,7 @@ export const floatingUiItemMixin = {
|
|
|
84
84
|
this.addMouseEventListeners();
|
|
85
85
|
},
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
beforeUnmount() {
|
|
88
88
|
this.apiInjected().unregisterItem(this.id);
|
|
89
89
|
this.removeMouseEventListeners();
|
|
90
90
|
},
|
|
@@ -95,7 +95,7 @@ export const floatingUiItemMixin = {
|
|
|
95
95
|
|
|
96
96
|
const item = {
|
|
97
97
|
id: this.id,
|
|
98
|
-
text:
|
|
98
|
+
text: '',
|
|
99
99
|
select: this.select,
|
|
100
100
|
unselect: this.unselect,
|
|
101
101
|
isSelected: this.isSelected,
|
|
@@ -208,7 +208,9 @@ export const floatingUiItemMixin = {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
// focus new item
|
|
211
|
-
this.items[newSelectedIndex]
|
|
211
|
+
if (this.items[newSelectedIndex]) {
|
|
212
|
+
this.items[newSelectedIndex].focus();
|
|
213
|
+
}
|
|
212
214
|
},
|
|
213
215
|
|
|
214
216
|
getItemSelectedIndex() {
|
|
@@ -243,8 +245,10 @@ export const floatingUiItemMixin = {
|
|
|
243
245
|
return;
|
|
244
246
|
}
|
|
245
247
|
|
|
246
|
-
// unselect all items before selecting new
|
|
247
|
-
|
|
248
|
+
// unselect all items before selecting new one
|
|
249
|
+
for (const item of this.items) {
|
|
250
|
+
item.unselect();
|
|
251
|
+
}
|
|
248
252
|
|
|
249
253
|
/**
|
|
250
254
|
* Select item passing the event type to decide if
|
|
@@ -259,4 +263,4 @@ export const floatingUiItemMixin = {
|
|
|
259
263
|
this.unselect();
|
|
260
264
|
},
|
|
261
265
|
},
|
|
262
|
-
};
|
|
266
|
+
};
|
package/mixins/floating-ui.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { computePosition, flip, shift, offset, size } from '@floating-ui/dom';
|
|
2
2
|
|
|
3
3
|
export const floatingUiMixin = {
|
|
4
|
+
props: {
|
|
5
|
+
offset: {
|
|
6
|
+
type: [Number, String],
|
|
7
|
+
default: 5,
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
|
|
4
11
|
data() {
|
|
5
12
|
return {
|
|
6
13
|
component: null,
|
|
@@ -40,7 +47,7 @@ export const floatingUiMixin = {
|
|
|
40
47
|
computePosition(trigger, content, {
|
|
41
48
|
placement: this.placement,
|
|
42
49
|
middleware: [
|
|
43
|
-
offset(
|
|
50
|
+
offset(Number(this.offset)),
|
|
44
51
|
flip(),
|
|
45
52
|
shift({ padding: 5 }),
|
|
46
53
|
size({
|
package/mixins/form-control.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
export const formControlMixin = {
|
|
2
|
-
model: {
|
|
3
|
-
prop: 'value',
|
|
4
|
-
event: 'input',
|
|
5
|
-
},
|
|
6
|
-
|
|
7
2
|
props: {
|
|
8
3
|
disabled: {
|
|
9
4
|
type: Boolean,
|
|
@@ -13,7 +8,7 @@ export const formControlMixin = {
|
|
|
13
8
|
type: Boolean,
|
|
14
9
|
default: false,
|
|
15
10
|
},
|
|
16
|
-
|
|
11
|
+
modelValue: {
|
|
17
12
|
type: [String, Number, Object, Array],
|
|
18
13
|
default: null,
|
|
19
14
|
},
|
|
@@ -24,21 +19,21 @@ export const formControlMixin = {
|
|
|
24
19
|
},
|
|
25
20
|
|
|
26
21
|
computed: {
|
|
27
|
-
|
|
22
|
+
attrsComputed() {
|
|
28
23
|
// `Object.assign` merges objects together to form a new object
|
|
29
24
|
return Object.assign(
|
|
30
25
|
{},
|
|
31
26
|
// We add all the listeners from the parent
|
|
32
|
-
this.$
|
|
27
|
+
this.$attrs,
|
|
33
28
|
// Then we can add custom listeners or override the
|
|
34
29
|
// behavior of some listeners.
|
|
35
30
|
{
|
|
36
31
|
// This ensures that the component works with v-model
|
|
37
|
-
|
|
32
|
+
onInput: (event) => {
|
|
38
33
|
// if (this.lazy) return;
|
|
39
|
-
this.$emit('
|
|
34
|
+
this.$emit('update:modelValue', event.target.value);
|
|
40
35
|
},
|
|
41
|
-
|
|
36
|
+
onBlur: (event) => {
|
|
42
37
|
this.$emit('blur', event);
|
|
43
38
|
},
|
|
44
39
|
}
|
|
@@ -57,7 +52,7 @@ export const formControlStyleMixin = {
|
|
|
57
52
|
return [
|
|
58
53
|
this.headless
|
|
59
54
|
? `${this.name}`
|
|
60
|
-
: 'leading-0 flex w-full max-w-full appearance-none items-center justify-between rounded border border-solid px-3 py-2 font-inherit text-base text-inherit file:hidden focus:border-secondary-200',
|
|
55
|
+
: 'leading-0 flex outline-none w-full max-w-full appearance-none items-center justify-between rounded border border-solid px-3 py-2 font-inherit text-base text-inherit file:hidden focus:border-secondary-200 appearance-none',
|
|
61
56
|
// variant styles
|
|
62
57
|
this.headless
|
|
63
58
|
? `${this.name}--${this.variant}`
|
|
@@ -69,8 +64,8 @@ export const formControlStyleMixin = {
|
|
|
69
64
|
? null
|
|
70
65
|
: this.name === 'textarea'
|
|
71
66
|
? 'min-h-10' // limit it because input type number height can be different from other input types
|
|
72
|
-
: 'h-10',
|
|
67
|
+
: 'h-12 md:h-10',
|
|
73
68
|
];
|
|
74
69
|
},
|
|
75
70
|
},
|
|
76
|
-
};
|
|
71
|
+
};
|
package/nuxt.js
CHANGED
|
@@ -1,27 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineNuxtModule } from '@nuxt/kit';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
2
3
|
|
|
3
4
|
const components = [
|
|
4
|
-
'src/components/Alert',
|
|
5
|
-
'src/components/Avatar',
|
|
6
|
-
'src/components/Button',
|
|
7
|
-
'src/components/
|
|
8
|
-
'src/components/
|
|
9
|
-
'src/components/
|
|
10
|
-
'src/components/
|
|
11
|
-
'src/components/
|
|
12
|
-
'src/components/
|
|
13
|
-
'src/components/
|
|
14
|
-
'src/components/
|
|
15
|
-
'src/components/
|
|
16
|
-
'src/components/
|
|
17
|
-
'src/components/
|
|
18
|
-
|
|
5
|
+
'./src/components/Alert',
|
|
6
|
+
'./src/components/Avatar',
|
|
7
|
+
'./src/components/Button',
|
|
8
|
+
'./src/components/Checkbox',
|
|
9
|
+
'./src/components/Drawer',
|
|
10
|
+
'./src/components/Dialog',
|
|
11
|
+
'./src/components/Disclosure',
|
|
12
|
+
'./src/components/DropdownMenu',
|
|
13
|
+
'./src/components/Form',
|
|
14
|
+
'./src/components/Listbox',
|
|
15
|
+
'./src/components/Image',
|
|
16
|
+
'./src/components/Popover',
|
|
17
|
+
'./src/components/ProgressBar',
|
|
18
|
+
'./src/components/Skeleton',
|
|
19
|
+
'./src/components/Tabs',
|
|
20
|
+
'./src/components/Tooltip',
|
|
21
|
+
];
|
|
19
22
|
|
|
20
|
-
export default
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
23
|
+
export default defineNuxtModule({
|
|
24
|
+
hooks: {
|
|
25
|
+
'components:dirs'(dirs) {
|
|
26
|
+
components.forEach((component) => {
|
|
27
|
+
dirs.push({
|
|
28
|
+
path: fileURLToPath(new URL(component, import.meta.url)),
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
});
|
package/package.json
CHANGED
|
@@ -1,23 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veritree/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0-0",
|
|
4
4
|
"description": "veritree ui library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"repository": "https://github.com/tentree-org/veritree-ui.git",
|
|
8
|
-
"author": "
|
|
8
|
+
"author": "jb",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"publishConfig": {
|
|
11
|
-
"
|
|
11
|
+
"registry": "https://registry.npmjs.org"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"release": "np --no-tests --no-2fa --branch=next"
|
|
12
15
|
},
|
|
13
16
|
"dependencies": {
|
|
14
|
-
"@floating-ui/dom": "^1.
|
|
15
|
-
"@
|
|
16
|
-
"@veritree/icons": "^0.39.0"
|
|
17
|
+
"@floating-ui/dom": "^1.4.5",
|
|
18
|
+
"@veritree/icons": "^0.45.1"
|
|
17
19
|
},
|
|
18
20
|
"devDependencies": {
|
|
21
|
+
"@nuxt/kit": "^3.0.0",
|
|
22
|
+
"np": "^8.0.4",
|
|
19
23
|
"prettier": "^2.7.1",
|
|
20
24
|
"prettier-plugin-tailwindcss": "^0.1.13",
|
|
21
25
|
"tailwindcss": "^3.2.4"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"npm": ">=8.0.0",
|
|
29
|
+
"node": ">=18.0.0"
|
|
22
30
|
}
|
|
23
31
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
v-if="
|
|
3
|
+
v-if="isVisible"
|
|
4
4
|
:class="[
|
|
5
5
|
// default styles
|
|
6
|
-
headless
|
|
7
|
-
? 'alert'
|
|
8
|
-
: 'flex items-start gap-3 rounded border border-solid p-3',
|
|
6
|
+
headless ? 'alert' : 'flex items-start gap-3 rounded border border-solid',
|
|
9
7
|
// variant styles
|
|
10
8
|
headless
|
|
11
9
|
? `alert--${variant}`
|
|
@@ -16,6 +14,14 @@
|
|
|
16
14
|
: isWarning
|
|
17
15
|
? 'border-warning-300 bg-warning-200 text-warning-700'
|
|
18
16
|
: null,
|
|
17
|
+
// sizes styles
|
|
18
|
+
headless
|
|
19
|
+
? `alert--${size}`
|
|
20
|
+
: isLarge
|
|
21
|
+
? 'p-3'
|
|
22
|
+
: isSmall
|
|
23
|
+
? 'py-1 px-2 text-sm'
|
|
24
|
+
: null,
|
|
19
25
|
]"
|
|
20
26
|
role="alert"
|
|
21
27
|
>
|
|
@@ -23,9 +29,15 @@
|
|
|
23
29
|
<button
|
|
24
30
|
v-if="dismissable"
|
|
25
31
|
:class="[
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
// default styles
|
|
33
|
+
headless ? 'alert-close' : 'ml-auto h-4 w-4 shrink-0 text-current',
|
|
34
|
+
headless
|
|
35
|
+
? `alert-close--${variant}`
|
|
36
|
+
: isLarge
|
|
37
|
+
? 'mt-1'
|
|
38
|
+
: isSmall
|
|
39
|
+
? 'mt-0.5'
|
|
40
|
+
: null,
|
|
29
41
|
]"
|
|
30
42
|
@click="hide"
|
|
31
43
|
>
|
|
@@ -35,14 +47,30 @@
|
|
|
35
47
|
</template>
|
|
36
48
|
|
|
37
49
|
<script>
|
|
50
|
+
import IconClose from '@veritree/icons/src/components/IconClose.vue';
|
|
51
|
+
|
|
38
52
|
export default {
|
|
39
53
|
name: 'VTAlert',
|
|
40
54
|
|
|
55
|
+
components: {
|
|
56
|
+
IconClose,
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
data() {
|
|
60
|
+
return {
|
|
61
|
+
modelValueLocal: true,
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
|
|
41
65
|
props: {
|
|
42
66
|
variant: {
|
|
43
67
|
type: String,
|
|
44
68
|
default: 'success',
|
|
45
69
|
},
|
|
70
|
+
size: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: 'large',
|
|
73
|
+
},
|
|
46
74
|
headless: {
|
|
47
75
|
type: Boolean,
|
|
48
76
|
default: false,
|
|
@@ -51,12 +79,10 @@ export default {
|
|
|
51
79
|
type: Boolean,
|
|
52
80
|
default: false,
|
|
53
81
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
show: true,
|
|
59
|
-
};
|
|
82
|
+
modelValue: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: null,
|
|
85
|
+
},
|
|
60
86
|
},
|
|
61
87
|
|
|
62
88
|
computed: {
|
|
@@ -71,12 +97,27 @@ export default {
|
|
|
71
97
|
isWarning() {
|
|
72
98
|
return this.variant === 'warning';
|
|
73
99
|
},
|
|
100
|
+
|
|
101
|
+
isLarge() {
|
|
102
|
+
return this.size === 'large';
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
isSmall() {
|
|
106
|
+
return this.size === 'small';
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
isVisible() {
|
|
110
|
+
return this.modelValue !== null ? this.modelValue : this.modelValueLocal;
|
|
111
|
+
},
|
|
74
112
|
},
|
|
75
113
|
|
|
76
114
|
methods: {
|
|
77
115
|
hide() {
|
|
116
|
+
this.modelValue !== null
|
|
117
|
+
? this.$emit('update:modelValue', false)
|
|
118
|
+
: (this.modelValueLocal = false);
|
|
119
|
+
|
|
78
120
|
this.$emit('dismiss');
|
|
79
|
-
this.show = false;
|
|
80
121
|
},
|
|
81
122
|
},
|
|
82
123
|
};
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<VTImage
|
|
3
|
-
|
|
4
|
-
:src="src"
|
|
5
|
-
v-bind="attrs"
|
|
6
|
-
:width="width"
|
|
7
|
-
:height="height"
|
|
8
|
-
/>
|
|
9
|
-
<VTImage
|
|
10
|
-
v-else-if="cdnSrc"
|
|
11
|
-
:cdn-src="cdnSrc"
|
|
12
|
-
v-bind="attrs"
|
|
13
|
-
:width="width"
|
|
14
|
-
:height="height"
|
|
15
|
-
/>
|
|
2
|
+
<VTImage v-if="src" :src="src" v-bind="attrs" width="40" />
|
|
3
|
+
<VTImage v-else-if="cdnSrc" :cdn-src="cdnSrc" v-bind="attrs" width="40" />
|
|
16
4
|
</template>
|
|
17
5
|
|
|
18
6
|
<script>
|
|
19
|
-
import VTImage from
|
|
7
|
+
import VTImage from "../Image/VTImage.vue";
|
|
20
8
|
|
|
21
9
|
export default {
|
|
22
|
-
name:
|
|
10
|
+
name: "VTAvatarImage",
|
|
23
11
|
|
|
24
12
|
components: { VTImage },
|
|
25
13
|
|
|
@@ -30,27 +18,19 @@ export default {
|
|
|
30
18
|
},
|
|
31
19
|
src: {
|
|
32
20
|
type: String,
|
|
33
|
-
default:
|
|
21
|
+
default: "",
|
|
34
22
|
},
|
|
35
23
|
cdnSrc: {
|
|
36
24
|
type: [String, Object],
|
|
37
25
|
default: null,
|
|
38
26
|
},
|
|
39
|
-
width: {
|
|
40
|
-
type: String,
|
|
41
|
-
default: '40',
|
|
42
|
-
},
|
|
43
|
-
height: {
|
|
44
|
-
type: String || null,
|
|
45
|
-
default: null,
|
|
46
|
-
},
|
|
47
27
|
},
|
|
48
28
|
|
|
49
29
|
computed: {
|
|
50
30
|
attrs() {
|
|
51
31
|
return {
|
|
52
32
|
alt: this.alt,
|
|
53
|
-
class:
|
|
33
|
+
class: "h-auto w-full",
|
|
54
34
|
};
|
|
55
35
|
},
|
|
56
36
|
},
|