@veritree/ui 0.24.1 → 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 +8 -6
- 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 +7 -6
- 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
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
<component
|
|
4
4
|
:is="tag"
|
|
5
5
|
:to="to"
|
|
6
|
-
:href="href || to"
|
|
7
6
|
:type="type"
|
|
8
7
|
:disabled="isDisabled"
|
|
9
8
|
:class="[
|
|
@@ -17,11 +16,15 @@
|
|
|
17
16
|
headless
|
|
18
17
|
? `button--${variant}`
|
|
19
18
|
: isPrimary
|
|
20
|
-
? 'bg-secondary-400 hover:bg-secondary-500
|
|
19
|
+
? 'bg-secondary-400 hover:bg-secondary-500 active:bg-secondary-600 border-transparent text-white disabled:bg-gray-200 disabled:text-gray-400'
|
|
21
20
|
: isSecondary
|
|
22
|
-
?
|
|
21
|
+
? isGhost
|
|
22
|
+
? 'border-gray-500 text-gray-100 hover:bg-white hover:text-gray-700'
|
|
23
|
+
: 'border-gray-400 bg-white text-gray-700 hover:bg-gray-100 active:bg-gray-200 disabled:border-gray-300 disabled:text-gray-400'
|
|
23
24
|
: isTertiary
|
|
24
|
-
? 'text-secondary-400 hover:text-secondary-500
|
|
25
|
+
? 'text-secondary-400 hover:text-secondary-500 active:text-secondary-500 border-transparent disabled:text-gray-400'
|
|
26
|
+
: isDark
|
|
27
|
+
? 'border-transparent bg-gray-800 text-white hover:bg-gray-700 active:bg-gray-600 disabled:bg-gray-200 disabled:text-gray-400'
|
|
25
28
|
: isIcon
|
|
26
29
|
? 'text-primary-100 focus-within:bg-gray-200 hover:bg-gray-200 active:bg-gray-300'
|
|
27
30
|
: null,
|
|
@@ -31,14 +34,13 @@
|
|
|
31
34
|
: isLarge
|
|
32
35
|
? isIcon
|
|
33
36
|
? 'h-8 w-8'
|
|
34
|
-
: 'h-10'
|
|
37
|
+
: 'h-12 sm:h-10'
|
|
35
38
|
: isSmall
|
|
36
39
|
? isIcon
|
|
37
40
|
? 'h-6 w-6 p-1'
|
|
38
41
|
: 'h-8'
|
|
39
42
|
: null,
|
|
40
43
|
]"
|
|
41
|
-
v-on="$listeners"
|
|
42
44
|
>
|
|
43
45
|
<VTSpinner v-if="busy" class="absolute inset-0 m-auto" />
|
|
44
46
|
<span
|
|
@@ -73,10 +75,6 @@ export default {
|
|
|
73
75
|
type: [String, Object],
|
|
74
76
|
default: null,
|
|
75
77
|
},
|
|
76
|
-
href: {
|
|
77
|
-
type: [String, Object],
|
|
78
|
-
default: null,
|
|
79
|
-
},
|
|
80
78
|
headless: {
|
|
81
79
|
type: Boolean,
|
|
82
80
|
default: false,
|
|
@@ -89,6 +87,10 @@ export default {
|
|
|
89
87
|
type: Boolean,
|
|
90
88
|
default: false,
|
|
91
89
|
},
|
|
90
|
+
style: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: 'normal', // normal or ghost
|
|
93
|
+
},
|
|
92
94
|
},
|
|
93
95
|
|
|
94
96
|
computed: {
|
|
@@ -104,6 +106,10 @@ export default {
|
|
|
104
106
|
return this.variant === 'tertiary';
|
|
105
107
|
},
|
|
106
108
|
|
|
109
|
+
isDark() {
|
|
110
|
+
return this.variant === 'dark';
|
|
111
|
+
},
|
|
112
|
+
|
|
107
113
|
isIcon() {
|
|
108
114
|
return this.variant === 'icon';
|
|
109
115
|
},
|
|
@@ -120,8 +126,16 @@ export default {
|
|
|
120
126
|
return this.disabled || this.busy;
|
|
121
127
|
},
|
|
122
128
|
|
|
129
|
+
isGhost() {
|
|
130
|
+
return this.style === 'ghost';
|
|
131
|
+
},
|
|
132
|
+
|
|
123
133
|
tag() {
|
|
124
|
-
return this.href
|
|
134
|
+
return this.$attrs.href
|
|
135
|
+
? 'a'
|
|
136
|
+
: this.to
|
|
137
|
+
? resolveComponent('NuxtLink')
|
|
138
|
+
: 'button';
|
|
125
139
|
},
|
|
126
140
|
|
|
127
141
|
type() {
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<input
|
|
3
|
+
type="checkbox"
|
|
4
|
+
v-model="modelValueComputed"
|
|
5
|
+
:value="value"
|
|
6
|
+
:checked="checked"
|
|
7
|
+
:disabled="disabled"
|
|
8
|
+
:indeterminate="indeterminate"
|
|
9
|
+
:class="[
|
|
10
|
+
headless
|
|
11
|
+
? 'input-checkbox'
|
|
12
|
+
: 'h-[18px] w-[18px] shrink-0 appearance-none rounded border border-solid bg-no-repeat align-middle focus-visible:ring-2 focus-visible:ring-white',
|
|
13
|
+
headless
|
|
14
|
+
? `input-checkbox--${variant}`
|
|
15
|
+
: isError
|
|
16
|
+
? 'border-error-300'
|
|
17
|
+
: 'border-gray-300',
|
|
18
|
+
checked
|
|
19
|
+
? headless
|
|
20
|
+
? 'input-checkbox--checked'
|
|
21
|
+
: 'border-secondary-300 bg-secondary-300'
|
|
22
|
+
: null,
|
|
23
|
+
disabled
|
|
24
|
+
? headless
|
|
25
|
+
? 'input-checkbox--disabled'
|
|
26
|
+
: 'pointer-events-none bg-gray-100'
|
|
27
|
+
: null,
|
|
28
|
+
indeterminate
|
|
29
|
+
? headless
|
|
30
|
+
? 'input-checkbox--indeterminate'
|
|
31
|
+
: 'border-secondary-200 bg-secondary-200'
|
|
32
|
+
: null,
|
|
33
|
+
]"
|
|
34
|
+
v-bind="$attrs"
|
|
35
|
+
@change="onChange"
|
|
36
|
+
/>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script>
|
|
40
|
+
/**
|
|
41
|
+
* Notes:
|
|
42
|
+
* - Not tested with an array yet
|
|
43
|
+
*/
|
|
44
|
+
export default {
|
|
45
|
+
props: {
|
|
46
|
+
disabled: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
50
|
+
indeterminate: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false,
|
|
53
|
+
},
|
|
54
|
+
headless: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false,
|
|
57
|
+
},
|
|
58
|
+
modelValue: {
|
|
59
|
+
type: [Array, Boolean],
|
|
60
|
+
default: null,
|
|
61
|
+
},
|
|
62
|
+
variant: {
|
|
63
|
+
type: [String, Object, Function],
|
|
64
|
+
default: '',
|
|
65
|
+
},
|
|
66
|
+
value: {
|
|
67
|
+
type: [Boolean, Object],
|
|
68
|
+
default: null,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
data() {
|
|
73
|
+
return {
|
|
74
|
+
checked: false,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
computed: {
|
|
79
|
+
modelValueComputed: {
|
|
80
|
+
get() {
|
|
81
|
+
return this.modelValue;
|
|
82
|
+
},
|
|
83
|
+
set(value) {
|
|
84
|
+
this.$emit('update:modelValue', value);
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
isError() {
|
|
89
|
+
return this.variant === 'error';
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
watch: {
|
|
94
|
+
indeterminate(newVal) {
|
|
95
|
+
this.checked = !newVal;
|
|
96
|
+
this.$el.indeterminate = newVal;
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
checked(newVal) {
|
|
100
|
+
if (newVal) {
|
|
101
|
+
this.$el.indeterminate = false;
|
|
102
|
+
this.$emit('update:indeterminate', false);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
mounted() {
|
|
108
|
+
if (this.indeterminate) {
|
|
109
|
+
this.$el.indeterminate = this.indeterminate;
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
methods: {
|
|
114
|
+
onChange(event) {
|
|
115
|
+
this.checked = event.target.checked;
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<style scoped>
|
|
122
|
+
input:not(.input-checkbox):checked,
|
|
123
|
+
input:not(.input-checkbox):indeterminate {
|
|
124
|
+
background-size: cover;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
input:not(.input-checkbox):checked {
|
|
128
|
+
background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.00016 16.17L4.83016 12L3.41016 13.41L9.00016 19L21.0002 7.00003L19.5902 5.59003L9.00016 16.17Z' fill='%23ffffff'/%3E%3Cpath d='M9.00016 16.17L4.83016 12L3.41016 13.41L9.00016 19L21.0002 7.00003L19.5902 5.59003L9.00016 16.17Z' fill='%23ffffff' /%3E%3C/svg%3E%0A");
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
input:not(.input-checkbox):indeterminate {
|
|
132
|
+
background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M19 13H5V11H19V13Z' fill='%23ffffff'/%3E%3Cpath d='M19 13H5V11H19V13Z' fill='%23ffffff'/%3E%3C/svg%3E%0A");
|
|
133
|
+
}
|
|
134
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="as" :class="[headless ? 'input-checkbox-text' : 'text-sm']"
|
|
3
|
+
><slot />
|
|
4
|
+
</component>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
props: {
|
|
10
|
+
as: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: 'div',
|
|
13
|
+
},
|
|
14
|
+
headless: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: false,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
</script>
|
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<Teleport to="body">
|
|
3
3
|
<div
|
|
4
|
-
v-if="
|
|
4
|
+
v-if="modelValue"
|
|
5
5
|
:id="id"
|
|
6
|
-
:class="
|
|
6
|
+
:class="
|
|
7
7
|
headless
|
|
8
8
|
? 'dialog'
|
|
9
|
-
:
|
|
10
|
-
|
|
9
|
+
: `fixed inset-0 z-50 grid grid-cols-1 grid-rows-1 ${classes}`
|
|
10
|
+
"
|
|
11
11
|
aria-modal="true"
|
|
12
|
+
v-bind="$attrs"
|
|
12
13
|
@click="onClick"
|
|
13
14
|
>
|
|
14
15
|
<slot></slot>
|
|
15
16
|
</div>
|
|
16
|
-
</
|
|
17
|
+
</Teleport>
|
|
17
18
|
</template>
|
|
18
19
|
|
|
19
20
|
<script>
|
|
20
|
-
import { Portal } from '@linusborg/vue-simple-portal';
|
|
21
21
|
import { genId } from '../../utils/ids';
|
|
22
22
|
|
|
23
23
|
export default {
|
|
24
24
|
name: 'VTDialog',
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
Portal,
|
|
28
|
-
},
|
|
26
|
+
inheritAttrs: false,
|
|
29
27
|
|
|
30
28
|
provide() {
|
|
31
29
|
return {
|
|
@@ -46,23 +44,22 @@ export default {
|
|
|
46
44
|
|
|
47
45
|
const emit = () => this.emit();
|
|
48
46
|
|
|
47
|
+
const full = this.full;
|
|
48
|
+
|
|
49
49
|
return {
|
|
50
50
|
componentId,
|
|
51
51
|
hide,
|
|
52
52
|
emit,
|
|
53
53
|
registerContent,
|
|
54
54
|
registerOverlay,
|
|
55
|
+
full,
|
|
55
56
|
};
|
|
56
57
|
},
|
|
57
58
|
};
|
|
58
59
|
},
|
|
59
60
|
|
|
60
|
-
model: {
|
|
61
|
-
prop: 'visible',
|
|
62
|
-
},
|
|
63
|
-
|
|
64
61
|
props: {
|
|
65
|
-
|
|
62
|
+
modelValue: {
|
|
66
63
|
type: Boolean,
|
|
67
64
|
default: false,
|
|
68
65
|
},
|
|
@@ -70,6 +67,10 @@ export default {
|
|
|
70
67
|
type: Boolean,
|
|
71
68
|
default: false,
|
|
72
69
|
},
|
|
70
|
+
full: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: false,
|
|
73
|
+
},
|
|
73
74
|
},
|
|
74
75
|
|
|
75
76
|
data() {
|
|
@@ -85,6 +86,10 @@ export default {
|
|
|
85
86
|
return `dialog-${this.componentId}`;
|
|
86
87
|
},
|
|
87
88
|
|
|
89
|
+
classes() {
|
|
90
|
+
return !this.full ? 'p-4 md:p-6' : '';
|
|
91
|
+
},
|
|
92
|
+
|
|
88
93
|
hasContent() {
|
|
89
94
|
return this.content !== null;
|
|
90
95
|
},
|
|
@@ -94,15 +99,9 @@ export default {
|
|
|
94
99
|
},
|
|
95
100
|
},
|
|
96
101
|
|
|
97
|
-
watch: {
|
|
98
|
-
visible(isVisible) {
|
|
99
|
-
if (!isVisible) this.hide();
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
|
|
103
102
|
mounted() {
|
|
104
103
|
if (this.hasContent) this.content.show();
|
|
105
|
-
if (this.hasOverlay) this.overlay.show();
|
|
104
|
+
// if (this.hasOverlay) this.overlay.show();
|
|
106
105
|
},
|
|
107
106
|
|
|
108
107
|
methods: {
|
|
@@ -113,7 +112,7 @@ export default {
|
|
|
113
112
|
|
|
114
113
|
emit() {
|
|
115
114
|
this.$nextTick(() => {
|
|
116
|
-
this.$emit('
|
|
115
|
+
this.$emit('update:modelValue', false);
|
|
117
116
|
this.$emit('hidden');
|
|
118
117
|
});
|
|
119
118
|
},
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<transition
|
|
3
3
|
enter-active-class="duration-300 ease-out"
|
|
4
|
-
enter-class="translate-y-[50px] opacity-0"
|
|
4
|
+
enter-from-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-class="translate-y-0 opacity-100"
|
|
7
|
+
leave-from-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="
|
|
14
|
+
:class="
|
|
15
15
|
headless
|
|
16
16
|
? 'dialog-content'
|
|
17
|
-
:
|
|
18
|
-
|
|
17
|
+
: `relative m-auto flex flex-col overflow-auto rounded bg-white p-4 focus:outline-none lg:p-6 ${classes}`
|
|
18
|
+
"
|
|
19
19
|
tabindex="-1"
|
|
20
20
|
@keydown.esc.stop="hide"
|
|
21
21
|
>
|
|
@@ -47,6 +47,14 @@ export default {
|
|
|
47
47
|
id() {
|
|
48
48
|
return `dialog-content-${this.apiDialog().componentId}`;
|
|
49
49
|
},
|
|
50
|
+
|
|
51
|
+
classes() {
|
|
52
|
+
return this.full ? 'h-screen w-screen' : 'max-h-full max-w-full';
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
full() {
|
|
56
|
+
return this.apiDialog().full;
|
|
57
|
+
},
|
|
50
58
|
},
|
|
51
59
|
|
|
52
60
|
mounted() {
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component
|
|
2
|
+
<component
|
|
3
|
+
:is="as"
|
|
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
|
+
]"
|
|
9
|
+
>
|
|
3
10
|
<slot></slot>
|
|
4
11
|
</component>
|
|
5
12
|
</template>
|
|
@@ -7,7 +14,6 @@
|
|
|
7
14
|
<script>
|
|
8
15
|
export default {
|
|
9
16
|
name: 'VTDialogFooter',
|
|
10
|
-
|
|
11
17
|
props: {
|
|
12
18
|
headless: {
|
|
13
19
|
type: Boolean,
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
<div
|
|
4
4
|
v-if="visible"
|
|
5
5
|
:id="id"
|
|
6
|
-
:class="[
|
|
6
|
+
:class="[
|
|
7
|
+
headless
|
|
8
|
+
? 'dialog-overlay'
|
|
9
|
+
: 'bg-primary-200/80 dark:bg-primary-100/80 fixed inset-0',
|
|
10
|
+
]"
|
|
7
11
|
/>
|
|
8
12
|
</FadeInOut>
|
|
9
13
|
</template>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
:class="[
|
|
5
5
|
headless
|
|
6
6
|
? 'details-header'
|
|
7
|
-
: 'flex cursor-pointer justify-between gap-3
|
|
7
|
+
: 'text-body flex cursor-pointer justify-between gap-3 font-semibold',
|
|
8
8
|
]"
|
|
9
9
|
:aria-controls="ariaControls"
|
|
10
10
|
:aria-expanded="String(ariaExpanded)"
|
|
@@ -78,7 +78,7 @@ export default {
|
|
|
78
78
|
this.apiDisclosure().register('headers', header);
|
|
79
79
|
},
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
beforeUnmount() {
|
|
82
82
|
this.apiDisclosure().unregister('headers', this.id);
|
|
83
83
|
},
|
|
84
84
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<Teleport to="body">
|
|
3
3
|
<div
|
|
4
|
-
v-if="
|
|
4
|
+
v-if="modelValue"
|
|
5
5
|
:id="id"
|
|
6
6
|
:class="{ Drawer: headless, 'fixed inset-0 z-50 h-screen': !headless }"
|
|
7
7
|
aria-modal="true"
|
|
@@ -9,23 +9,18 @@
|
|
|
9
9
|
>
|
|
10
10
|
<slot></slot>
|
|
11
11
|
</div>
|
|
12
|
-
</
|
|
12
|
+
</Teleport>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script>
|
|
16
|
-
import { Portal } from '@linusborg/vue-simple-portal';
|
|
17
16
|
import { genId } from '../../utils/ids';
|
|
18
17
|
|
|
19
18
|
export default {
|
|
20
19
|
name: 'VTDrawer',
|
|
21
20
|
|
|
22
|
-
components: {
|
|
23
|
-
Portal,
|
|
24
|
-
},
|
|
25
|
-
|
|
26
21
|
provide() {
|
|
27
22
|
return {
|
|
28
|
-
|
|
23
|
+
apiDrawer: () => {
|
|
29
24
|
const id = this.id;
|
|
30
25
|
const isDark = this.dark;
|
|
31
26
|
const isHeadless = this.headless;
|
|
@@ -58,12 +53,8 @@ export default {
|
|
|
58
53
|
};
|
|
59
54
|
},
|
|
60
55
|
|
|
61
|
-
model: {
|
|
62
|
-
prop: 'visible',
|
|
63
|
-
},
|
|
64
|
-
|
|
65
56
|
props: {
|
|
66
|
-
|
|
57
|
+
modelValue: {
|
|
67
58
|
type: Boolean,
|
|
68
59
|
default: false,
|
|
69
60
|
},
|
|
@@ -117,7 +108,7 @@ export default {
|
|
|
117
108
|
|
|
118
109
|
emit() {
|
|
119
110
|
this.$nextTick(() => {
|
|
120
|
-
this.$emit('
|
|
111
|
+
this.$emit('update:modelValue', false);
|
|
121
112
|
this.$emit('hidden');
|
|
122
113
|
});
|
|
123
114
|
},
|
|
@@ -20,19 +20,19 @@ export default {
|
|
|
20
20
|
|
|
21
21
|
components: { IconLeft, VTButton },
|
|
22
22
|
|
|
23
|
-
inject: ['
|
|
23
|
+
inject: ['apiDrawer'],
|
|
24
24
|
|
|
25
25
|
computed: {
|
|
26
26
|
dark() {
|
|
27
|
-
return this.
|
|
27
|
+
return this.apiDrawer().isDark;
|
|
28
28
|
},
|
|
29
29
|
|
|
30
30
|
headless() {
|
|
31
|
-
return this.
|
|
31
|
+
return this.apiDrawer().isHeadless;
|
|
32
32
|
},
|
|
33
33
|
|
|
34
34
|
right() {
|
|
35
|
-
return this.
|
|
35
|
+
return this.apiDrawer().isRight;
|
|
36
36
|
},
|
|
37
37
|
|
|
38
38
|
// temporary till button theme is implemented
|
|
@@ -43,7 +43,7 @@ export default {
|
|
|
43
43
|
|
|
44
44
|
methods: {
|
|
45
45
|
hide() {
|
|
46
|
-
this.
|
|
46
|
+
this.apiDrawer().hide();
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<transition
|
|
3
3
|
:enter-active-class="activeClass"
|
|
4
|
-
:enter-class="enterClass"
|
|
4
|
+
:enter-from-class="enterClass"
|
|
5
5
|
:enter-to-class="enterToClass"
|
|
6
6
|
:leave-active-class="activeClass"
|
|
7
|
-
:leave-class="leaveClass"
|
|
7
|
+
:leave-from-class="leaveClass"
|
|
8
8
|
:leave-to-class="leaveToClass"
|
|
9
9
|
@after-leave="hideDrawer"
|
|
10
10
|
>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
v-show="visible"
|
|
13
13
|
:class="{
|
|
14
14
|
'Drawer-content': headless,
|
|
15
|
-
'
|
|
15
|
+
'absolute z-20 flex h-screen max-h-full max-w-full flex-col overflow-auto p-5 outline-0 sm:px-10 sm:py-6':
|
|
16
16
|
!headless,
|
|
17
17
|
'bg-white text-gray-600': !dark,
|
|
18
18
|
'bg-fd-600': dark,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
'bottom-0': position === 'bottom',
|
|
23
23
|
}"
|
|
24
24
|
tabindex="-1"
|
|
25
|
-
@
|
|
25
|
+
@keyup.esc="hide"
|
|
26
26
|
>
|
|
27
27
|
<slot></slot>
|
|
28
28
|
</div>
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
export default {
|
|
34
34
|
name: 'VTDrawerContent',
|
|
35
35
|
|
|
36
|
-
inject: ['
|
|
36
|
+
inject: ['apiDrawer'],
|
|
37
37
|
|
|
38
38
|
data() {
|
|
39
39
|
return {
|
|
@@ -43,15 +43,15 @@ export default {
|
|
|
43
43
|
|
|
44
44
|
computed: {
|
|
45
45
|
dark() {
|
|
46
|
-
return this.
|
|
46
|
+
return this.apiDrawer().isDark;
|
|
47
47
|
},
|
|
48
48
|
|
|
49
49
|
headless() {
|
|
50
|
-
return this.
|
|
50
|
+
return this.apiDrawer().isHeadless;
|
|
51
51
|
},
|
|
52
52
|
|
|
53
53
|
position() {
|
|
54
|
-
return this.
|
|
54
|
+
return this.apiDrawer().position;
|
|
55
55
|
},
|
|
56
56
|
|
|
57
57
|
activeClass() {
|
|
@@ -132,7 +132,7 @@ export default {
|
|
|
132
132
|
},
|
|
133
133
|
|
|
134
134
|
mounted() {
|
|
135
|
-
this.
|
|
135
|
+
this.apiDrawer().registerContent(this);
|
|
136
136
|
this.show();
|
|
137
137
|
|
|
138
138
|
this.$nextTick(() => this.$el.focus());
|
|
@@ -148,7 +148,7 @@ export default {
|
|
|
148
148
|
},
|
|
149
149
|
|
|
150
150
|
hideDrawer() {
|
|
151
|
-
this.
|
|
151
|
+
this.apiDrawer().emit();
|
|
152
152
|
},
|
|
153
153
|
},
|
|
154
154
|
};
|