@veritree/ui 0.27.0-4 → 0.28.0-1
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/.claude/settings.local.json +10 -0
- package/index.js +42 -0
- package/mixins/floating-ui-content.js +16 -3
- package/mixins/floating-ui-item.js +27 -13
- package/mixins/floating-ui.js +136 -25
- package/mixins/form-control.js +40 -10
- package/nuxt.js +10 -2
- package/package.json +4 -3
- package/src/components/Badge/VTBadge.vue +60 -0
- package/src/components/Badge/VTBadgeNew.vue +60 -0
- package/src/components/Breadcrumb/VTBreadcrumbItem.vue +11 -0
- package/src/components/Breadcrumb/VTBreadcrumbLink.vue +40 -0
- package/src/components/Breadcrumb/VTBreadcrumbList.vue +11 -0
- package/src/components/Breadcrumb/VTBreadcrumbRoot.vue +11 -0
- package/src/components/Breadcrumb/VTBreadcrumbSeparator.vue +19 -0
- package/src/components/Button/VTButton.vue +101 -72
- package/src/components/Carousel/VTCarousel.vue +69 -0
- package/src/components/Carousel/VTCarouselBackward.vue +36 -0
- package/src/components/Carousel/VTCarouselForward.vue +38 -0
- package/src/components/Carousel/VTCarouselTracker.vue +80 -0
- package/src/components/Chip/VTChip.vue +29 -0
- package/src/components/Dialog/VTDialog.vue +48 -13
- package/src/components/Dialog/VTDialogClose.vue +2 -1
- package/src/components/Dialog/VTDialogContent.vue +17 -3
- package/src/components/Dialog/VTDialogFooter.vue +11 -2
- package/src/components/Dialog/VTDialogHeader.vue +1 -1
- package/src/components/Dialog/VTDialogMain.vue +5 -1
- package/src/components/Dialog/VTDialogOverlay.vue +1 -1
- package/src/components/Dialog/VTDialogTitle.vue +1 -1
- package/src/components/Divider/VTDivider.vue +9 -0
- package/src/components/Form/VTFieldset.vue +5 -0
- package/src/components/Form/VTForm.vue +11 -0
- package/src/components/Form/VTFormCol.vue +20 -0
- package/src/components/Form/VTFormLabelHelper.vue +22 -0
- package/src/components/Form/VTInputDate.vue +602 -0
- package/src/components/Form/VTInputIcon.vue +2 -7
- package/src/components/Form/VTInputNumber.vue +198 -0
- package/src/components/Form/VTInputRange.vue +92 -0
- package/src/components/Form/VTLegend.vue +24 -0
- package/src/components/Form/VTTextarea.vue +6 -3
- package/src/components/Listbox/VTListbox.vue +70 -18
- package/src/components/Listbox/VTListboxContent.vue +14 -0
- package/src/components/Listbox/VTListboxDivider.vue +21 -0
- package/src/components/Listbox/VTListboxGroup.vue +9 -0
- package/src/components/Listbox/VTListboxItem.vue +51 -19
- package/src/components/Listbox/VTListboxLabel.vue +3 -1
- package/src/components/Listbox/VTListboxList.vue +1 -8
- package/src/components/Listbox/VTListboxPlaceholder.vue +25 -0
- package/src/components/Listbox/VTListboxSearch.vue +13 -10
- package/src/components/Listbox/VTListboxTrigger.vue +86 -7
- package/src/components/Listbox/VTListboxTriggerHighlight.vue +204 -0
- package/src/components/Listbox/VTListboxViewport.vue +33 -0
- package/src/components/ProgressBar/VTProgressBar.vue +16 -9
- package/src/components/ProgressBar/VTProgressBarIndicator.vue +53 -0
- package/src/components/ScrollShadows/VTScrollShadows.vue +76 -0
- package/src/components/Separator/VTSeparator.vue +13 -0
- package/src/components/Switch/VTSwitch.vue +61 -0
- package/src/components/Toast/README.md +263 -0
- package/src/components/Toast/VTToast.vue +145 -0
- package/src/components/Toast/VTToastAction.vue +25 -0
- package/src/components/Toast/VTToastClose.vue +52 -0
- package/src/components/Toast/VTToastContent.vue +25 -0
- package/src/components/Toast/VTToastDescription.vue +36 -0
- package/src/components/Toast/VTToastIcon.vue +72 -0
- package/src/components/Toast/VTToastItem.vue +180 -0
- package/src/components/Toast/VTToastTitle.vue +34 -0
- package/src/helpers/currency.js +21 -0
- package/src/utils/images.js +28 -2
package/index.js
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import VTAlert from './src/components/Alert/VTAlert.vue';
|
|
2
2
|
import VTAvatar from './src/components/Avatar/VTAvatar.vue';
|
|
3
|
+
import VTBadge from './src/components/Badge/VTBadge.vue';
|
|
4
|
+
import VTBreadcrumbRoot from './src/components/Breadcrumb/VTBreadcrumbRoot.vue';
|
|
5
|
+
import VTBreadcrumbList from './src/components/Breadcrumb/VTBreadcrumbList.vue';
|
|
6
|
+
import VTBreadcrumbItem from './src/components/Breadcrumb/VTBreadcrumbItem.vue';
|
|
7
|
+
import VTBreadcrumbLink from './src/components/Breadcrumb/VTBreadcrumbLink.vue';
|
|
8
|
+
import VTBreadcrumbSeparator from './src/components/Breadcrumb/VTBreadcrumbSeparator.vue';
|
|
3
9
|
import VTAvatarImage from './src/components/Avatar/VTAvatarImage.vue';
|
|
4
10
|
import VTAvatarText from './src/components/Avatar/VTAvatarText.vue';
|
|
5
11
|
import VTButton from './src/components/Button/VTButton.vue';
|
|
12
|
+
import VTCarousel from './src/components/Carousel/VTCarousel.vue';
|
|
13
|
+
import VTCarouselBackward from './src/components/Carousel/VTCarouselBackward.vue';
|
|
14
|
+
import VTCarouselForward from './src/components/Carousel/VTCarouselForward.vue';
|
|
15
|
+
import VTCarouselTracker from './src/components/Carousel/VTCarouselTracker.vue';
|
|
16
|
+
import VTChip from './src/components/Chip/VTChip.vue';
|
|
6
17
|
import VTImage from './src/components/Image/VTImage.vue';
|
|
7
18
|
import VTImageCounter from './src/components/Image/VTImageCounter.vue';
|
|
8
19
|
import VTImageHover from './src/components/Image/VTImageHover.vue';
|
|
@@ -28,9 +39,15 @@ import VTListboxLabel from './src/components/Listbox/VTListboxLabel.vue';
|
|
|
28
39
|
import VTListboxList from './src/components/Listbox/VTListboxList.vue';
|
|
29
40
|
import VTListboxSearch from './src/components/Listbox/VTListboxSearch.vue';
|
|
30
41
|
import VTListboxTrigger from './src/components/Listbox/VTListboxTrigger.vue';
|
|
42
|
+
import VTListboxTriggerHighlight from './src/components/Listbox/VTListboxTriggerHighlight.vue';
|
|
43
|
+
import VTListboxDivider from './src/components/Listbox/VTListboxDivider.vue';
|
|
44
|
+
import VTListboxGroup from './src/components/Listbox/VTListboxGroup.vue';
|
|
45
|
+
import VTListboxPlaceholder from './src/components/Listbox/VTListboxPlaceholder.vue';
|
|
46
|
+
import VTListboxViewport from './src/components/Listbox/VTListboxViewport.vue';
|
|
31
47
|
import VTSpinner from './src/components/Spinner/VTSpinner.vue';
|
|
32
48
|
import VTInput from './src/components/Form/VTInput.vue';
|
|
33
49
|
import VTProgressBar from './src/components/ProgressBar/VTProgressBar.vue';
|
|
50
|
+
import VTProgressBarIndicator from './src/components/ProgressBar/VTProgressBarIndicator.vue';
|
|
34
51
|
import VTTextarea from './src/components/Textarea/VTTextarea.vue';
|
|
35
52
|
import VTTab from './src/components/Tabs/VTTab.vue';
|
|
36
53
|
import VTTabGroup from './src/components/Tabs/VTTabGroup.vue';
|
|
@@ -53,13 +70,17 @@ import VTDrawerHeader from './src/components/Drawer/VTDrawerHeader.vue';
|
|
|
53
70
|
import VTDrawerTitle from './src/components/Drawer/VTDrawerTitle.vue';
|
|
54
71
|
import VTDrawerMain from './src/components/Drawer/VTDrawerMain.vue';
|
|
55
72
|
import VTDrawerOverlay from './src/components/Drawer/VTDrawerOverlay.vue';
|
|
73
|
+
import VTDivider from './src/components/Divider/VTDivider.vue';
|
|
56
74
|
import VTDisclosure from './src/components/Disclosure/VTDisclosure.vue';
|
|
57
75
|
import VTDisclosureDetails from './src/components/Disclosure/VTDisclosureDetails.vue';
|
|
58
76
|
import VTDisclosureHeader from './src/components/Disclosure/VTDisclosureHeader.vue';
|
|
59
77
|
import VTDisclosureIcon from './src/components/Disclosure/VTDisclosureIcon.vue';
|
|
60
78
|
import VTDisclosureContent from './src/components/Disclosure/VTDisclosureContent.vue';
|
|
79
|
+
import VTScrollShadows from './src/components/ScrollShadows/VTScrollShadows.vue';
|
|
80
|
+
import VTSeparator from './src/components/Separator/VTSeparator.vue';
|
|
61
81
|
import VTSkeleton from './src/components/Skeleton/VTSkeleton.vue';
|
|
62
82
|
import VTSkeletonItem from './src/components/Skeleton/VTSkeletonItem.vue';
|
|
83
|
+
import VTSwitch from './src/components/Switch/VTSwitch.vue';
|
|
63
84
|
|
|
64
85
|
export {
|
|
65
86
|
VTAvatar,
|
|
@@ -69,6 +90,12 @@ export {
|
|
|
69
90
|
VTImageCounter,
|
|
70
91
|
VTImageHover,
|
|
71
92
|
VTAlert,
|
|
93
|
+
VTBadge,
|
|
94
|
+
VTBreadcrumbRoot,
|
|
95
|
+
VTBreadcrumbList,
|
|
96
|
+
VTBreadcrumbItem,
|
|
97
|
+
VTBreadcrumbLink,
|
|
98
|
+
VTBreadcrumbSeparator,
|
|
72
99
|
VTSpinner,
|
|
73
100
|
VTDropdownMenu,
|
|
74
101
|
VTDropdownMenuContent,
|
|
@@ -92,9 +119,20 @@ export {
|
|
|
92
119
|
VTListboxList,
|
|
93
120
|
VTListboxSearch,
|
|
94
121
|
VTListboxTrigger,
|
|
122
|
+
VTListboxTriggerHighlight,
|
|
123
|
+
VTListboxDivider,
|
|
124
|
+
VTListboxGroup,
|
|
125
|
+
VTListboxPlaceholder,
|
|
126
|
+
VTListboxViewport,
|
|
95
127
|
VTButton,
|
|
128
|
+
VTCarousel,
|
|
129
|
+
VTCarouselBackward,
|
|
130
|
+
VTCarouselForward,
|
|
131
|
+
VTCarouselTracker,
|
|
132
|
+
VTChip,
|
|
96
133
|
VTInput,
|
|
97
134
|
VTProgressBar,
|
|
135
|
+
VTProgressBarIndicator,
|
|
98
136
|
VTTextarea,
|
|
99
137
|
VTTab,
|
|
100
138
|
VTTabGroup,
|
|
@@ -117,11 +155,15 @@ export {
|
|
|
117
155
|
VTDialogMain,
|
|
118
156
|
VTDialogOverlay,
|
|
119
157
|
VTDialogTitle,
|
|
158
|
+
VTDivider,
|
|
120
159
|
VTDisclosure,
|
|
121
160
|
VTDisclosureDetails,
|
|
122
161
|
VTDisclosureHeader,
|
|
123
162
|
VTDisclosureIcon,
|
|
124
163
|
VTDisclosureContent,
|
|
164
|
+
VTScrollShadows,
|
|
165
|
+
VTSeparator,
|
|
125
166
|
VTSkeleton,
|
|
126
167
|
VTSkeletonItem,
|
|
168
|
+
VTSwitch,
|
|
127
169
|
};
|
|
@@ -10,6 +10,10 @@ export const floatingUiContentMixin = {
|
|
|
10
10
|
type: Boolean,
|
|
11
11
|
default: false,
|
|
12
12
|
},
|
|
13
|
+
freeze: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: false,
|
|
16
|
+
},
|
|
13
17
|
},
|
|
14
18
|
|
|
15
19
|
data() {
|
|
@@ -23,7 +27,7 @@ export const floatingUiContentMixin = {
|
|
|
23
27
|
document.addEventListener('click', this.onDocumentClick);
|
|
24
28
|
},
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
unmounted() {
|
|
27
31
|
document.removeEventListener('click', this.onDocumentClick);
|
|
28
32
|
},
|
|
29
33
|
|
|
@@ -39,7 +43,16 @@ export const floatingUiContentMixin = {
|
|
|
39
43
|
this.component.setActive();
|
|
40
44
|
|
|
41
45
|
setTimeout(() => {
|
|
46
|
+
if (!this.id) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
42
50
|
this.el = document.getElementById(this.id);
|
|
51
|
+
|
|
52
|
+
if (!this.el) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
43
56
|
this.$emit('shown');
|
|
44
57
|
}, 100);
|
|
45
58
|
});
|
|
@@ -63,7 +76,7 @@ export const floatingUiContentMixin = {
|
|
|
63
76
|
},
|
|
64
77
|
|
|
65
78
|
onDocumentClick(e) {
|
|
66
|
-
if (!e) {
|
|
79
|
+
if (!e || !this.el || this.freeze) {
|
|
67
80
|
return;
|
|
68
81
|
}
|
|
69
82
|
|
|
@@ -78,4 +91,4 @@ export const floatingUiContentMixin = {
|
|
|
78
91
|
this.activeDescedant = id;
|
|
79
92
|
},
|
|
80
93
|
},
|
|
81
|
-
}
|
|
94
|
+
};
|
|
@@ -32,23 +32,25 @@ 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 cursor-pointer',
|
|
35
|
+
: 'relative z-10 text-sm 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
|
|
39
39
|
? `${this.componentName}--disabled`
|
|
40
40
|
: null
|
|
41
41
|
: this.disabled
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
? 'pointer-events-none opacity-50'
|
|
43
|
+
: null,
|
|
44
44
|
// selected state styles
|
|
45
45
|
this.headless
|
|
46
46
|
? this.selected
|
|
47
|
-
?
|
|
47
|
+
? this.multiple
|
|
48
|
+
? null
|
|
49
|
+
: `${this.componentName}--selected`
|
|
48
50
|
: null
|
|
49
51
|
: this.selected
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
? 'bg-gray-200'
|
|
53
|
+
: null,
|
|
52
54
|
];
|
|
53
55
|
},
|
|
54
56
|
},
|
|
@@ -95,7 +97,7 @@ export const floatingUiItemMixin = {
|
|
|
95
97
|
|
|
96
98
|
const item = {
|
|
97
99
|
id: this.id,
|
|
98
|
-
text: '',
|
|
100
|
+
text: this.$slots.default?.()[0]?.children || this.$el?.textContent?.trim() || '',
|
|
99
101
|
select: this.select,
|
|
100
102
|
unselect: this.unselect,
|
|
101
103
|
isSelected: this.isSelected,
|
|
@@ -217,6 +219,20 @@ export const floatingUiItemMixin = {
|
|
|
217
219
|
return this.items.findIndex((item) => item.isSelected());
|
|
218
220
|
},
|
|
219
221
|
|
|
222
|
+
handleToogle() {
|
|
223
|
+
const checkbox = this.$refs[`${this.id}-checkbox`];
|
|
224
|
+
|
|
225
|
+
if (checkbox) {
|
|
226
|
+
checkbox.click();
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
handleClick() {
|
|
231
|
+
this.value !== undefined
|
|
232
|
+
? this.apiInjected().emit(this.value)
|
|
233
|
+
: this.$emit('click');
|
|
234
|
+
},
|
|
235
|
+
|
|
220
236
|
leaveMenu() {
|
|
221
237
|
if (this.componentTrigger) {
|
|
222
238
|
this.componentTrigger.cancel();
|
|
@@ -229,11 +245,9 @@ export const floatingUiItemMixin = {
|
|
|
229
245
|
return;
|
|
230
246
|
}
|
|
231
247
|
|
|
232
|
-
this
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
this.$nextTick(() => this.leaveMenu());
|
|
248
|
+
this.$emit('click');
|
|
249
|
+
this.multiple ? this.handleToogle() : this.handleClick();
|
|
250
|
+
this.multiple ? null : this.$nextTick(() => this.leaveMenu());
|
|
237
251
|
},
|
|
238
252
|
|
|
239
253
|
onKeyEsc() {
|
|
@@ -263,4 +277,4 @@ export const floatingUiItemMixin = {
|
|
|
263
277
|
this.unselect();
|
|
264
278
|
},
|
|
265
279
|
},
|
|
266
|
-
};
|
|
280
|
+
};
|
package/mixins/floating-ui.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
autoUpdate,
|
|
3
|
+
computePosition,
|
|
4
|
+
flip,
|
|
5
|
+
shift,
|
|
6
|
+
offset,
|
|
7
|
+
size,
|
|
8
|
+
// update,
|
|
9
|
+
} from '@floating-ui/dom';
|
|
2
10
|
|
|
3
11
|
export const floatingUiMixin = {
|
|
4
12
|
props: {
|
|
5
13
|
offset: {
|
|
6
|
-
type: [Number, String],
|
|
14
|
+
type: [Number, String, Object],
|
|
7
15
|
default: 5,
|
|
8
16
|
},
|
|
9
17
|
},
|
|
@@ -14,6 +22,7 @@ export const floatingUiMixin = {
|
|
|
14
22
|
componentTrigger: null,
|
|
15
23
|
componentContent: null,
|
|
16
24
|
active: false,
|
|
25
|
+
floatingUiUpdaterDisposer: null,
|
|
17
26
|
};
|
|
18
27
|
},
|
|
19
28
|
|
|
@@ -30,6 +39,12 @@ export const floatingUiMixin = {
|
|
|
30
39
|
};
|
|
31
40
|
},
|
|
32
41
|
|
|
42
|
+
beforeUnmount() {
|
|
43
|
+
if (this.floatingUiUpdaterDisposer) {
|
|
44
|
+
this.floatingUiUpdaterDisposer();
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
|
|
33
48
|
methods: {
|
|
34
49
|
setActive() {
|
|
35
50
|
this.active = true;
|
|
@@ -39,34 +54,130 @@ export const floatingUiMixin = {
|
|
|
39
54
|
this.active = null;
|
|
40
55
|
},
|
|
41
56
|
|
|
57
|
+
positionContentToTriggerByTopAndLeft(trigger, content, minWidthLimit) {
|
|
58
|
+
/*
|
|
59
|
+
TODO: Try to replace this with the offset object from floating-ui, using mainAxis, crossAxis, and alignmentAxis.
|
|
60
|
+
The problem is that the floating-ui offset values are px values, not percentages, which is the use case I am trying to solve.
|
|
61
|
+
I tried to calculate the percentage based off of the width and height of the trigger element,
|
|
62
|
+
but depending on the placement prop, mainAxis could be x OR y and crossAxis could be x OR y,
|
|
63
|
+
so to calculate the offset based on the width/height of the trigger element
|
|
64
|
+
we would have to calculate it differently for each individual placement preset.
|
|
65
|
+
*/
|
|
66
|
+
const contentRect = content.getBoundingClientRect();
|
|
67
|
+
const contentWidth = contentRect.width;
|
|
68
|
+
const contentHeight = contentRect.height;
|
|
69
|
+
const triggerWidth = trigger.getBoundingClientRect().width;
|
|
70
|
+
let leftObject = this.leftPosition || {};
|
|
71
|
+
let topObject = this.topPosition || {};
|
|
72
|
+
let left = leftObject.value || 0;
|
|
73
|
+
let top = topObject.value || 0;
|
|
74
|
+
|
|
75
|
+
if (leftObject.unit === '%') {
|
|
76
|
+
left = (triggerWidth * left) / 100;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (topObject.unit === '%') {
|
|
80
|
+
top = (triggerWidth * top) / 100;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (leftObject.positionBy === 'center') {
|
|
84
|
+
left = left - contentWidth / 2;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (leftObject.positionBy === 'end') {
|
|
88
|
+
left = left - contentWidth;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (topObject.positionBy === 'top') {
|
|
92
|
+
top = top + contentHeight;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (topObject.positionBy === 'center') {
|
|
96
|
+
top = top + contentHeight / 2;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Initializes the auto-update functionality for positioning the floating UI element.
|
|
101
|
+
* This method sets up an automatic update mechanism that adjusts the position of the
|
|
102
|
+
* content element in relation to the trigger element based on changes in the environment,
|
|
103
|
+
* such as scroll or resize events.
|
|
104
|
+
*
|
|
105
|
+
* @param {Element} trigger - The DOM element that acts as the reference point for positioning.
|
|
106
|
+
* @param {Element} content - The DOM element representing the floating UI content that needs to be positioned.
|
|
107
|
+
* @param {Function} updateFunction - A callback function that executes the update logic for positioning.
|
|
108
|
+
*/
|
|
109
|
+
this.floatingUiUpdaterDisposer = autoUpdate(trigger, content, () => {
|
|
110
|
+
computePosition(trigger, content, {
|
|
111
|
+
placement: 'top-start',
|
|
112
|
+
middleware: [
|
|
113
|
+
flip(),
|
|
114
|
+
shift({ padding: 5 }),
|
|
115
|
+
size({
|
|
116
|
+
apply({ rects }) {
|
|
117
|
+
if (!minWidthLimit) return;
|
|
118
|
+
|
|
119
|
+
const width = rects.reference.width;
|
|
120
|
+
const minWidth = width < minWidthLimit ? minWidthLimit : width;
|
|
121
|
+
|
|
122
|
+
Object.assign(content.style, {
|
|
123
|
+
minWidth: `${minWidth}px`,
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
}),
|
|
127
|
+
],
|
|
128
|
+
}).then(({ x, y }) => {
|
|
129
|
+
Object.assign(content.style, {
|
|
130
|
+
left: `${x + left}px`,
|
|
131
|
+
top: `${y + top}px`,
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
|
|
42
137
|
positionContentToTrigger() {
|
|
43
138
|
const trigger = document.getElementById(this.componentTrigger.id);
|
|
44
139
|
const content = document.getElementById(this.componentContent.id);
|
|
45
140
|
const minWidthLimit = Number(this.floatingUiMinWidth);
|
|
46
141
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
142
|
+
if (!trigger || !content) {
|
|
143
|
+
console.error('The trigger or content element does not exist.');
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (this.top || this.left) {
|
|
148
|
+
this.positionContentToTriggerByTopAndLeft(
|
|
149
|
+
trigger,
|
|
150
|
+
content,
|
|
151
|
+
minWidthLimit,
|
|
152
|
+
);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
this.floatingUiUpdaterDisposer = autoUpdate(trigger, content, () => {
|
|
157
|
+
computePosition(trigger, content, {
|
|
158
|
+
placement: this.placement,
|
|
159
|
+
middleware: [
|
|
160
|
+
offset(Number(this.offset)),
|
|
161
|
+
flip(),
|
|
162
|
+
shift({ padding: 5 }),
|
|
163
|
+
size({
|
|
164
|
+
apply({ rects }) {
|
|
165
|
+
if (!minWidthLimit) return;
|
|
166
|
+
|
|
167
|
+
const width = rects.reference.width;
|
|
168
|
+
const minWidth = width < minWidthLimit ? minWidthLimit : width;
|
|
169
|
+
|
|
170
|
+
Object.assign(content.style, {
|
|
171
|
+
minWidth: `${minWidth}px`,
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
}),
|
|
175
|
+
],
|
|
176
|
+
}).then(({ x, y }) => {
|
|
177
|
+
Object.assign(content.style, {
|
|
178
|
+
left: `${x}px`,
|
|
179
|
+
top: `${y}px`,
|
|
180
|
+
});
|
|
70
181
|
});
|
|
71
182
|
});
|
|
72
183
|
},
|
package/mixins/form-control.js
CHANGED
|
@@ -9,13 +9,29 @@ export const formControlMixin = {
|
|
|
9
9
|
default: false,
|
|
10
10
|
},
|
|
11
11
|
modelValue: {
|
|
12
|
-
type: [String, Number, Object, Array],
|
|
12
|
+
type: [String, Number, Object, Array, Date],
|
|
13
13
|
default: null,
|
|
14
14
|
},
|
|
15
15
|
variant: {
|
|
16
16
|
type: [String, Object, Function],
|
|
17
17
|
default: '',
|
|
18
18
|
},
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Specifies the size of the button
|
|
22
|
+
*
|
|
23
|
+
* @values
|
|
24
|
+
* - 'small': A smaller size for the button
|
|
25
|
+
* - 'large': A larger size for the button
|
|
26
|
+
*/
|
|
27
|
+
size: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: 'large',
|
|
30
|
+
},
|
|
31
|
+
min: {
|
|
32
|
+
type: [String, Number],
|
|
33
|
+
default: null,
|
|
34
|
+
},
|
|
19
35
|
},
|
|
20
36
|
|
|
21
37
|
computed: {
|
|
@@ -36,13 +52,17 @@ export const formControlMixin = {
|
|
|
36
52
|
onBlur: (event) => {
|
|
37
53
|
this.$emit('blur', event);
|
|
38
54
|
},
|
|
39
|
-
}
|
|
55
|
+
},
|
|
40
56
|
);
|
|
41
57
|
},
|
|
42
58
|
|
|
43
59
|
isError() {
|
|
44
60
|
return this.variant === 'error';
|
|
45
61
|
},
|
|
62
|
+
|
|
63
|
+
isSuccess() {
|
|
64
|
+
return this.variant === 'success';
|
|
65
|
+
},
|
|
46
66
|
},
|
|
47
67
|
};
|
|
48
68
|
|
|
@@ -51,21 +71,31 @@ export const formControlStyleMixin = {
|
|
|
51
71
|
classComputed() {
|
|
52
72
|
return [
|
|
53
73
|
this.headless
|
|
54
|
-
? `${this.name}`
|
|
55
|
-
: 'leading-0
|
|
74
|
+
? `${this.name ? this.name : ''}`
|
|
75
|
+
: 'leading-0 bg-white has-[:disabled]:bg-gray-200 disabled:bg-gray-200 flex w-full max-w-full relative appearance-none placeholder:font-light placeholder:text-gray-500 items-center justify-between rounded border border-solid px-3 py-2 font-inherit text-inherit file:hidden focus-within:border-gray-600 focus:border-gray-600 focus-within:placeholder:text-gray-400 focus:placeholder:text-gray-400 has-[:disabled]:text-gray-500 disabled:text-gray-500',
|
|
56
76
|
// variant styles
|
|
57
77
|
this.headless
|
|
58
|
-
? `${this.name}
|
|
78
|
+
? `${this.name ? this.name : ''}${this.variant ? '--' + this.variant : ''}`
|
|
59
79
|
: this.isError
|
|
60
|
-
|
|
61
|
-
|
|
80
|
+
? 'border-error-300'
|
|
81
|
+
: this.isSuccess
|
|
82
|
+
? 'border-success-300'
|
|
83
|
+
: 'border-gray-300',
|
|
62
84
|
// height styles
|
|
63
85
|
this.headless
|
|
64
86
|
? null
|
|
65
87
|
: this.name === 'textarea'
|
|
66
|
-
|
|
67
|
-
|
|
88
|
+
? 'min-h-10' // limit it because input type number height can be different from other input types
|
|
89
|
+
: this.size === 'small'
|
|
90
|
+
? 'h-8 text-sm'
|
|
91
|
+
: 'h-10 text-base',
|
|
92
|
+
// disabled styles
|
|
93
|
+
this.disabled
|
|
94
|
+
? this.headless
|
|
95
|
+
? `${this.name}--disabled`
|
|
96
|
+
: null
|
|
97
|
+
: null,
|
|
68
98
|
];
|
|
69
99
|
},
|
|
70
100
|
},
|
|
71
|
-
};
|
|
101
|
+
};
|
package/nuxt.js
CHANGED
|
@@ -4,18 +4,26 @@ import { fileURLToPath } from 'node:url';
|
|
|
4
4
|
const components = [
|
|
5
5
|
'./src/components/Alert',
|
|
6
6
|
'./src/components/Avatar',
|
|
7
|
+
'./src/components/Badge',
|
|
8
|
+
'./src/components/Breadcrumb',
|
|
7
9
|
'./src/components/Button',
|
|
10
|
+
'./src/components/Carousel',
|
|
8
11
|
'./src/components/Checkbox',
|
|
9
|
-
'./src/components/
|
|
12
|
+
'./src/components/Chip',
|
|
10
13
|
'./src/components/Dialog',
|
|
11
14
|
'./src/components/Disclosure',
|
|
15
|
+
'./src/components/Divider',
|
|
16
|
+
'./src/components/Drawer',
|
|
12
17
|
'./src/components/DropdownMenu',
|
|
13
18
|
'./src/components/Form',
|
|
14
|
-
'./src/components/Listbox',
|
|
15
19
|
'./src/components/Image',
|
|
20
|
+
'./src/components/Listbox',
|
|
16
21
|
'./src/components/Popover',
|
|
17
22
|
'./src/components/ProgressBar',
|
|
23
|
+
'./src/components/ScrollShadows',
|
|
24
|
+
'./src/components/Separator',
|
|
18
25
|
'./src/components/Skeleton',
|
|
26
|
+
'./src/components/Switch',
|
|
19
27
|
'./src/components/Tabs',
|
|
20
28
|
'./src/components/Tooltip',
|
|
21
29
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veritree/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0-1",
|
|
4
4
|
"description": "veritree ui library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -17,10 +17,11 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@floating-ui/dom": "^1.4.5",
|
|
20
|
-
"@
|
|
20
|
+
"@internationalized/date": "^3.12.0",
|
|
21
|
+
"reka-ui": "^2.9.2"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
|
-
"@nuxt/kit": "^
|
|
24
|
+
"@nuxt/kit": "^4.4.2",
|
|
24
25
|
"np": "^8.0.4",
|
|
25
26
|
"prettier": "^2.7.1",
|
|
26
27
|
"prettier-plugin-tailwindcss": "^0.1.13",
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
:class="[
|
|
4
|
+
// default styles
|
|
5
|
+
headless
|
|
6
|
+
? 'badge'
|
|
7
|
+
: 'ml-auto flex min-w-5 place-content-center rounded-xl p-1 text-xs leading-none ',
|
|
8
|
+
// variant styles
|
|
9
|
+
headless
|
|
10
|
+
? `badge--${variant}`
|
|
11
|
+
: isDefault
|
|
12
|
+
? 'bg-gray-800 text-white'
|
|
13
|
+
: isSuccess
|
|
14
|
+
? 'bg-success-200 text-success-700'
|
|
15
|
+
: isError
|
|
16
|
+
? 'bg-error-200 text-error-700'
|
|
17
|
+
: isWarning
|
|
18
|
+
? 'bg-warning-200 text-warning-700'
|
|
19
|
+
: null,
|
|
20
|
+
// sizes styles
|
|
21
|
+
]"
|
|
22
|
+
>
|
|
23
|
+
<slot />
|
|
24
|
+
</span>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
export default {
|
|
29
|
+
name: 'VTBadge',
|
|
30
|
+
|
|
31
|
+
props: {
|
|
32
|
+
headless: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false,
|
|
35
|
+
},
|
|
36
|
+
variant: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'default',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
computed: {
|
|
43
|
+
isDefault() {
|
|
44
|
+
return this.variant === 'default';
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
isSuccess() {
|
|
48
|
+
return this.variant === 'success';
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
isError() {
|
|
52
|
+
return this.variant === 'error';
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
isWarning() {
|
|
56
|
+
return this.variant === 'warning';
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
</script>
|