@veritree/ui 0.19.2-20 → 0.19.2-22
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 +1 -22
- package/mixins/floating-ui-item.js +93 -46
- package/mixins/floating-ui.js +5 -12
- package/package.json +1 -1
- package/src/components/Alert/VTAlert.vue +55 -14
- package/src/components/Dialog/VTDialog.vue +13 -11
- package/src/components/Dialog/VTDialogClose.vue +13 -19
- package/src/components/Dialog/VTDialogContent.vue +19 -14
- package/src/components/Dialog/VTDialogFooter.vue +9 -14
- package/src/components/Dialog/VTDialogHeader.vue +11 -13
- package/src/components/Dialog/VTDialogMain.vue +6 -13
- package/src/components/Dialog/VTDialogOverlay.vue +9 -13
- package/src/components/Dialog/VTDialogTitle.vue +8 -5
- package/src/components/Disclosure/VTDisclosureHeader.vue +1 -1
- package/src/components/DropdownMenu/VTDropdownMenu.vue +19 -0
- package/src/components/DropdownMenu/VTDropdownMenuContent.vue +14 -6
- package/src/components/DropdownMenu/VTDropdownMenuDivider.vue +7 -16
- package/src/components/DropdownMenu/VTDropdownMenuItem.vue +3 -7
- package/src/components/DropdownMenu/VTDropdownMenuLabel.vue +1 -10
- package/src/components/DropdownMenu/VTDropdownMenuTrigger.vue +4 -9
- package/src/components/Listbox/VTListbox.vue +105 -14
- package/src/components/Listbox/VTListboxContent.vue +3 -7
- package/src/components/Listbox/VTListboxItem.vue +127 -6
- package/src/components/Listbox/VTListboxLabel.vue +3 -4
- package/src/components/Listbox/VTListboxList.vue +3 -24
- package/src/components/Listbox/VTListboxSearch.vue +60 -53
- package/src/components/Listbox/VTListboxTrigger.vue +12 -6
- package/src/components/Popover/VTPopover.vue +19 -0
- 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 +13 -11
- 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/Utils/FloatingUi.vue +52 -17
- 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
|
@@ -10,22 +10,17 @@ export const floatingUiContentMixin = {
|
|
|
10
10
|
type: Boolean,
|
|
11
11
|
default: false,
|
|
12
12
|
},
|
|
13
|
-
floatingUiClass: {
|
|
14
|
-
type: [String, Function],
|
|
15
|
-
default: null,
|
|
16
|
-
},
|
|
17
13
|
},
|
|
18
14
|
|
|
19
15
|
data() {
|
|
20
16
|
return {
|
|
21
17
|
el: null,
|
|
22
|
-
isMousemove: false,
|
|
23
18
|
visible: false,
|
|
24
19
|
};
|
|
25
20
|
},
|
|
26
21
|
|
|
27
22
|
mounted() {
|
|
28
|
-
document.addEventListener('click',
|
|
23
|
+
document.addEventListener('click', this.onDocumentClick);
|
|
29
24
|
},
|
|
30
25
|
|
|
31
26
|
destroyed() {
|
|
@@ -79,22 +74,6 @@ export const floatingUiContentMixin = {
|
|
|
79
74
|
}
|
|
80
75
|
},
|
|
81
76
|
|
|
82
|
-
// Mousemove instead of mouseover to support keyboard navigation.
|
|
83
|
-
// The problem with mouseover is that when scrolling (scrollIntoView),
|
|
84
|
-
// mouseover event gets triggered.
|
|
85
|
-
setMousemove() {
|
|
86
|
-
this.isMousemove = true;
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
unsetMousemove() {
|
|
90
|
-
this.isMousemove = false;
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
getMousemove() {
|
|
94
|
-
return this.isMousemove;
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
//
|
|
98
77
|
setActiveDescedant(id) {
|
|
99
78
|
this.activeDescedant = id;
|
|
100
79
|
},
|
|
@@ -19,10 +19,6 @@ export const floatingUiItemMixin = {
|
|
|
19
19
|
return this.apiInjected().items;
|
|
20
20
|
},
|
|
21
21
|
|
|
22
|
-
el() {
|
|
23
|
-
return this.$el;
|
|
24
|
-
},
|
|
25
|
-
|
|
26
22
|
componentContent() {
|
|
27
23
|
return this.apiInjected().componentContent;
|
|
28
24
|
},
|
|
@@ -36,7 +32,7 @@ export const floatingUiItemMixin = {
|
|
|
36
32
|
// default styles
|
|
37
33
|
this.headless
|
|
38
34
|
? `${this.componentName}`
|
|
39
|
-
: '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',
|
|
40
36
|
// disabled state styles
|
|
41
37
|
this.headless
|
|
42
38
|
? this.disabled
|
|
@@ -51,7 +47,7 @@ export const floatingUiItemMixin = {
|
|
|
51
47
|
? `${this.componentName}--selected`
|
|
52
48
|
: null
|
|
53
49
|
: this.selected
|
|
54
|
-
? 'bg-
|
|
50
|
+
? 'bg-gray-200'
|
|
55
51
|
: null,
|
|
56
52
|
];
|
|
57
53
|
},
|
|
@@ -62,20 +58,24 @@ export const floatingUiItemMixin = {
|
|
|
62
58
|
index: null,
|
|
63
59
|
selected: false,
|
|
64
60
|
tabIndex: 0,
|
|
61
|
+
eventType: null,
|
|
65
62
|
};
|
|
66
63
|
},
|
|
67
64
|
|
|
68
65
|
watch: {
|
|
69
66
|
selected(newValue) {
|
|
70
|
-
if (!newValue || !this.componentContent)
|
|
67
|
+
if (!newValue || !this.componentContent) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
71
70
|
|
|
72
71
|
this.componentContent.setActiveDescedant(this.id);
|
|
73
72
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
this.el.scrollIntoView({ block: 'nearest' });
|
|
73
|
+
// do not scroll into view if it's a mouse event
|
|
74
|
+
if (this.eventType && this.eventType.includes('mouse')) {
|
|
75
|
+
return;
|
|
78
76
|
}
|
|
77
|
+
|
|
78
|
+
this.$el.scrollIntoView({ block: 'nearest' });
|
|
79
79
|
},
|
|
80
80
|
},
|
|
81
81
|
|
|
@@ -95,8 +95,10 @@ export const floatingUiItemMixin = {
|
|
|
95
95
|
|
|
96
96
|
const item = {
|
|
97
97
|
id: this.id,
|
|
98
|
+
text: '',
|
|
98
99
|
select: this.select,
|
|
99
100
|
unselect: this.unselect,
|
|
101
|
+
isSelected: this.isSelected,
|
|
100
102
|
focus: this.focus,
|
|
101
103
|
onClick: this.onClick,
|
|
102
104
|
};
|
|
@@ -104,17 +106,30 @@ export const floatingUiItemMixin = {
|
|
|
104
106
|
this.apiInjected().registerItem(item);
|
|
105
107
|
},
|
|
106
108
|
|
|
109
|
+
/**
|
|
110
|
+
* mousemove and mouseleave events will be attached to
|
|
111
|
+
* the element here instead of using vue @mousemove
|
|
112
|
+
* and @mouseleave in the element since they did
|
|
113
|
+
* not worker properly
|
|
114
|
+
*/
|
|
107
115
|
addMouseEventListeners() {
|
|
108
|
-
this
|
|
109
|
-
this
|
|
116
|
+
this.$el.addEventListener('mousemove', this.onMousemove);
|
|
117
|
+
this.$el.addEventListener('mouseleave', this.onMouseleave);
|
|
110
118
|
},
|
|
111
119
|
|
|
120
|
+
/**
|
|
121
|
+
* remove the mousemove and mouseleave added for
|
|
122
|
+
* avoiding memory leaks, if @mousemove and
|
|
123
|
+
* @mouseleave were in the element, this
|
|
124
|
+
* wound't be needed
|
|
125
|
+
*/
|
|
112
126
|
removeMouseEventListeners() {
|
|
113
|
-
this
|
|
114
|
-
this
|
|
127
|
+
this.$el.removeEventListener('mousemove', this.onMousemove);
|
|
128
|
+
this.$el.removeEventListener('mouseleave', this.onMouseleave);
|
|
115
129
|
},
|
|
116
130
|
|
|
117
|
-
select() {
|
|
131
|
+
select(eventType) {
|
|
132
|
+
this.eventType = eventType;
|
|
118
133
|
this.selected = true;
|
|
119
134
|
},
|
|
120
135
|
|
|
@@ -122,59 +137,84 @@ export const floatingUiItemMixin = {
|
|
|
122
137
|
this.selected = false;
|
|
123
138
|
},
|
|
124
139
|
|
|
140
|
+
isSelected() {
|
|
141
|
+
return this.selected;
|
|
142
|
+
},
|
|
143
|
+
|
|
125
144
|
focus() {
|
|
126
|
-
if (!this
|
|
145
|
+
if (!this.$el) return;
|
|
127
146
|
|
|
128
147
|
this.tabIndex = -1;
|
|
129
148
|
this.selected = true;
|
|
130
|
-
this
|
|
149
|
+
this.$el.focus();
|
|
131
150
|
},
|
|
132
151
|
|
|
133
152
|
focusFirstItem() {
|
|
134
|
-
this.
|
|
153
|
+
const selectedIndex = this.getItemSelectedIndex();
|
|
154
|
+
const newSelectedIndex = 0;
|
|
155
|
+
|
|
156
|
+
this.setFocusToItem(selectedIndex, newSelectedIndex);
|
|
135
157
|
},
|
|
136
158
|
|
|
137
159
|
focusLastItem() {
|
|
138
|
-
this.
|
|
160
|
+
const selectedIndex = this.getItemSelectedIndex();
|
|
161
|
+
const newSelectedIndex = this.items.length - 1;
|
|
162
|
+
|
|
163
|
+
this.setFocusToItem(selectedIndex, newSelectedIndex);
|
|
139
164
|
},
|
|
140
165
|
|
|
141
166
|
/**
|
|
142
|
-
* Focus the
|
|
143
|
-
* If is the
|
|
167
|
+
* Focus the next item in the menu.
|
|
168
|
+
* If is the last item, jump to the first item.
|
|
144
169
|
*/
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
const
|
|
170
|
+
focusNextItem() {
|
|
171
|
+
const selectedIndex = this.getItemSelectedIndex();
|
|
172
|
+
const isLast = selectedIndex === this.items.length - 1;
|
|
173
|
+
const firstItemIndex = 0;
|
|
174
|
+
const nextItemIndex = selectedIndex + 1;
|
|
175
|
+
const newSelectedIndex = isLast ? firstItemIndex : nextItemIndex;
|
|
148
176
|
|
|
149
|
-
this.setFocusToItem(
|
|
177
|
+
this.setFocusToItem(selectedIndex, newSelectedIndex);
|
|
150
178
|
},
|
|
151
179
|
|
|
152
180
|
/**
|
|
153
|
-
* Focus the
|
|
154
|
-
* If is the
|
|
181
|
+
* Focus the previous item in the menu.
|
|
182
|
+
* If is the first item, jump to the last item.
|
|
155
183
|
*/
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
-
const
|
|
184
|
+
focusPreviousItem() {
|
|
185
|
+
const selectedIndex = this.getItemSelectedIndex();
|
|
186
|
+
const isFirst = selectedIndex === 0;
|
|
187
|
+
const lastItemIndex = this.items.length - 1;
|
|
188
|
+
const previousItemIndex = selectedIndex - 1;
|
|
189
|
+
const newSelectedIndex = isFirst ? lastItemIndex : previousItemIndex;
|
|
159
190
|
|
|
160
|
-
this.setFocusToItem(
|
|
191
|
+
this.setFocusToItem(selectedIndex, newSelectedIndex);
|
|
161
192
|
},
|
|
162
193
|
|
|
163
194
|
/**
|
|
164
|
-
* Focus item by
|
|
195
|
+
* Focus/select item by removing its tabindex and calling
|
|
165
196
|
* focus to the element.
|
|
166
197
|
*
|
|
167
|
-
* @param {Number, String}
|
|
198
|
+
* @param {Number, String} selectedIndex
|
|
199
|
+
* @param {Number, String} newSelectedIndex
|
|
168
200
|
*/
|
|
169
|
-
setFocusToItem(
|
|
201
|
+
setFocusToItem(selectedIndex, newSelectedIndex) {
|
|
170
202
|
this.tabIndex = 0;
|
|
171
|
-
this.selected = false;
|
|
172
203
|
|
|
173
|
-
//
|
|
174
|
-
|
|
204
|
+
// before focusing, let's unselect selected
|
|
205
|
+
// item that were previously focused
|
|
206
|
+
if (selectedIndex >= 0) {
|
|
207
|
+
this.items[selectedIndex].unselect();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// focus new item
|
|
211
|
+
if (this.items[newSelectedIndex]) {
|
|
212
|
+
this.items[newSelectedIndex].focus();
|
|
213
|
+
}
|
|
214
|
+
},
|
|
175
215
|
|
|
176
|
-
|
|
177
|
-
this.items
|
|
216
|
+
getItemSelectedIndex() {
|
|
217
|
+
return this.items.findIndex((item) => item.isSelected());
|
|
178
218
|
},
|
|
179
219
|
|
|
180
220
|
leaveMenu() {
|
|
@@ -200,20 +240,27 @@ export const floatingUiItemMixin = {
|
|
|
200
240
|
this.leaveMenu();
|
|
201
241
|
},
|
|
202
242
|
|
|
203
|
-
onMousemove() {
|
|
243
|
+
onMousemove(event) {
|
|
204
244
|
if (this.selected) {
|
|
205
245
|
return;
|
|
206
246
|
}
|
|
207
247
|
|
|
208
|
-
|
|
248
|
+
// unselect all items before selecting new one
|
|
249
|
+
for (const item of this.items) {
|
|
250
|
+
item.unselect();
|
|
251
|
+
}
|
|
209
252
|
|
|
210
|
-
|
|
211
|
-
|
|
253
|
+
/**
|
|
254
|
+
* Select item passing the event type to decide if
|
|
255
|
+
* scrolling will be disabled or not. It is
|
|
256
|
+
* expected that on mouse move event, the scroll
|
|
257
|
+
* doesn't happen automatically.
|
|
258
|
+
*/
|
|
259
|
+
this.select(event.type);
|
|
212
260
|
},
|
|
213
261
|
|
|
214
262
|
onMouseleave() {
|
|
215
263
|
this.unselect();
|
|
216
|
-
this.componentContent.unsetMousemove();
|
|
217
264
|
},
|
|
218
265
|
},
|
|
219
|
-
};
|
|
266
|
+
};
|
package/mixins/floating-ui.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { computePosition, flip, shift, offset, size } from '@floating-ui/dom';
|
|
2
2
|
|
|
3
3
|
export const floatingUiMixin = {
|
|
4
|
-
props: {
|
|
5
|
-
placement: {
|
|
6
|
-
type: String,
|
|
7
|
-
default: 'bottom-start',
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
|
|
11
4
|
data() {
|
|
12
5
|
return {
|
|
13
6
|
component: null,
|
|
@@ -42,18 +35,18 @@ export const floatingUiMixin = {
|
|
|
42
35
|
positionContentToTrigger() {
|
|
43
36
|
const trigger = document.getElementById(this.componentTrigger.id);
|
|
44
37
|
const content = document.getElementById(this.componentContent.id);
|
|
38
|
+
const minWidthLimit = Number(this.floatingUiMinWidth);
|
|
45
39
|
|
|
46
40
|
computePosition(trigger, content, {
|
|
47
41
|
placement: this.placement,
|
|
48
42
|
middleware: [
|
|
49
|
-
offset(
|
|
43
|
+
offset(5),
|
|
50
44
|
flip(),
|
|
51
45
|
shift({ padding: 5 }),
|
|
52
46
|
size({
|
|
53
47
|
apply({ rects }) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const minWidthLimit = 200;
|
|
48
|
+
if (!minWidthLimit) return;
|
|
49
|
+
|
|
57
50
|
const width = rects.reference.width;
|
|
58
51
|
const minWidth = width < minWidthLimit ? minWidthLimit : width;
|
|
59
52
|
|
|
@@ -71,4 +64,4 @@ export const floatingUiMixin = {
|
|
|
71
64
|
});
|
|
72
65
|
},
|
|
73
66
|
},
|
|
74
|
-
};
|
|
67
|
+
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
v-if="
|
|
3
|
+
v-if="modelValue"
|
|
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
|
};
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
<div
|
|
4
4
|
v-if="modelValue"
|
|
5
5
|
:id="id"
|
|
6
|
-
:class="
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
:class="
|
|
7
|
+
headless
|
|
8
|
+
? 'dialog'
|
|
9
|
+
: `fixed inset-0 z-50 grid grid-cols-1 grid-rows-1 ${classes}`
|
|
10
|
+
"
|
|
10
11
|
aria-modal="true"
|
|
11
12
|
v-bind="$attrs"
|
|
12
13
|
@click="onClick"
|
|
@@ -27,10 +28,7 @@ export default {
|
|
|
27
28
|
provide() {
|
|
28
29
|
return {
|
|
29
30
|
apiDialog: () => {
|
|
30
|
-
const id = this.id;
|
|
31
31
|
const componentId = this.componentId;
|
|
32
|
-
const isDark = this.dark;
|
|
33
|
-
const isHeadless = this.headless;
|
|
34
32
|
|
|
35
33
|
const registerContent = (content) => {
|
|
36
34
|
if (!content) return;
|
|
@@ -46,15 +44,15 @@ export default {
|
|
|
46
44
|
|
|
47
45
|
const emit = () => this.emit();
|
|
48
46
|
|
|
47
|
+
const full = this.full;
|
|
48
|
+
|
|
49
49
|
return {
|
|
50
|
-
id,
|
|
51
50
|
componentId,
|
|
52
|
-
isDark,
|
|
53
|
-
isHeadless,
|
|
54
51
|
hide,
|
|
55
52
|
emit,
|
|
56
53
|
registerContent,
|
|
57
54
|
registerOverlay,
|
|
55
|
+
full,
|
|
58
56
|
};
|
|
59
57
|
},
|
|
60
58
|
};
|
|
@@ -69,7 +67,7 @@ export default {
|
|
|
69
67
|
type: Boolean,
|
|
70
68
|
default: false,
|
|
71
69
|
},
|
|
72
|
-
|
|
70
|
+
full: {
|
|
73
71
|
type: Boolean,
|
|
74
72
|
default: false,
|
|
75
73
|
},
|
|
@@ -88,6 +86,10 @@ export default {
|
|
|
88
86
|
return `dialog-${this.componentId}`;
|
|
89
87
|
},
|
|
90
88
|
|
|
89
|
+
classes() {
|
|
90
|
+
return !this.full ? 'p-4 md:p-6' : '';
|
|
91
|
+
},
|
|
92
|
+
|
|
91
93
|
hasContent() {
|
|
92
94
|
return this.content !== null;
|
|
93
95
|
},
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
<VTButton
|
|
3
3
|
variant="icon"
|
|
4
4
|
:id="id"
|
|
5
|
-
:class="
|
|
6
|
-
'Dialog-close': headless,
|
|
7
|
-
}"
|
|
8
|
-
:theme="theme"
|
|
5
|
+
:class="[headless ? 'dialog-close' : null]"
|
|
9
6
|
@click.prevent="hide"
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
>
|
|
8
|
+
<slot>
|
|
9
|
+
<IconClose class="h-4 w-4" />
|
|
10
|
+
</slot>
|
|
11
|
+
</VTButton>
|
|
12
12
|
</template>
|
|
13
13
|
|
|
14
14
|
<script>
|
|
@@ -22,23 +22,17 @@ export default {
|
|
|
22
22
|
|
|
23
23
|
inject: ['apiDialog'],
|
|
24
24
|
|
|
25
|
+
props: {
|
|
26
|
+
headless: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
|
|
25
32
|
computed: {
|
|
26
33
|
id() {
|
|
27
34
|
return `dialog-close-${this.apiDialog().componentId}`;
|
|
28
35
|
},
|
|
29
|
-
|
|
30
|
-
dark() {
|
|
31
|
-
return this.apiDialog().isDark;
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
headless() {
|
|
35
|
-
return this.apiDialog().isHeadless;
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
// temporary till button theme is implemented
|
|
39
|
-
theme() {
|
|
40
|
-
return this.dark ? 'dark' : null;
|
|
41
|
-
},
|
|
42
36
|
},
|
|
43
37
|
|
|
44
38
|
methods: {
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<transition
|
|
3
3
|
enter-active-class="duration-300 ease-out"
|
|
4
|
-
enter-
|
|
4
|
+
enter-class="translate-y-[50px] opacity-0"
|
|
5
5
|
enter-to-class="translate-y-0 opacity-100"
|
|
6
6
|
leave-active-class="duration-300 ease-out"
|
|
7
|
-
leave-
|
|
7
|
+
leave-class="translate-y-0 opacity-100"
|
|
8
8
|
leave-to-class="translate-y-[50px] opacity-0"
|
|
9
9
|
@after-leave="hideDialog"
|
|
10
10
|
>
|
|
11
11
|
<div
|
|
12
12
|
v-show="visible"
|
|
13
13
|
:id="id"
|
|
14
|
-
:class="
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'bg-fd-600': dark,
|
|
20
|
-
}"
|
|
14
|
+
:class="
|
|
15
|
+
headless
|
|
16
|
+
? 'dialog-content'
|
|
17
|
+
: `relative m-auto flex flex-col overflow-auto rounded bg-white p-4 focus:outline-none lg:p-6 ${classes}`
|
|
18
|
+
"
|
|
21
19
|
tabindex="-1"
|
|
22
|
-
@
|
|
20
|
+
@keydown.esc.stop="hide"
|
|
23
21
|
>
|
|
24
22
|
<slot></slot>
|
|
25
23
|
</div>
|
|
@@ -32,6 +30,13 @@ export default {
|
|
|
32
30
|
|
|
33
31
|
inject: ['apiDialog'],
|
|
34
32
|
|
|
33
|
+
props: {
|
|
34
|
+
headless: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
|
|
35
40
|
data() {
|
|
36
41
|
return {
|
|
37
42
|
visible: false,
|
|
@@ -43,12 +48,12 @@ export default {
|
|
|
43
48
|
return `dialog-content-${this.apiDialog().componentId}`;
|
|
44
49
|
},
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
return this.
|
|
51
|
+
classes() {
|
|
52
|
+
return this.full ? 'h-screen w-screen' : 'max-h-full max-w-full';
|
|
48
53
|
},
|
|
49
54
|
|
|
50
|
-
|
|
51
|
-
return this.apiDialog().
|
|
55
|
+
full() {
|
|
56
|
+
return this.apiDialog().full;
|
|
52
57
|
},
|
|
53
58
|
},
|
|
54
59
|
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component
|
|
3
3
|
:is="as"
|
|
4
|
-
:class="
|
|
4
|
+
:class="[
|
|
5
|
+
headless
|
|
6
|
+
? 'dialog-footer'
|
|
7
|
+
: '-mx-4 -mb-4 flex items-center justify-between gap-x-3 p-4 md:-mx-6 md:-mb-6 md:p-6',
|
|
8
|
+
]"
|
|
5
9
|
>
|
|
6
10
|
<slot></slot>
|
|
7
11
|
</component>
|
|
@@ -10,24 +14,15 @@
|
|
|
10
14
|
<script>
|
|
11
15
|
export default {
|
|
12
16
|
name: 'VTDialogFooter',
|
|
13
|
-
|
|
14
|
-
inject: ['apiDialog'],
|
|
15
|
-
|
|
16
17
|
props: {
|
|
18
|
+
headless: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
17
22
|
as: {
|
|
18
23
|
type: String,
|
|
19
24
|
default: 'footer',
|
|
20
25
|
},
|
|
21
26
|
},
|
|
22
|
-
|
|
23
|
-
computed: {
|
|
24
|
-
dark() {
|
|
25
|
-
return this.apiDialog().isDark;
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
headless() {
|
|
29
|
-
return this.apiDialog().isHeadless;
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
27
|
};
|
|
33
28
|
</script>
|