@veritree/ui 0.22.1 → 0.22.2-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 -22
- package/mixins/floating-ui-item.js +101 -51
- package/mixins/floating-ui.js +7 -9
- package/mixins/form-control-icon.js +5 -5
- package/mixins/form-control.js +17 -18
- package/nuxt.js +30 -23
- package/package.json +14 -6
- package/src/components/Alert/VTAlert.vue +55 -14
- package/src/components/Button/VTButton.vue +20 -12
- package/src/components/Checkbox/VTCheckbox.vue +134 -0
- package/src/components/Checkbox/VTCheckboxLabel.vue +3 -0
- package/src/components/Checkbox/VTCheckboxText.vue +20 -0
- package/src/components/Dialog/VTDialog.vue +22 -32
- package/src/components/Dialog/VTDialogClose.vue +19 -25
- package/src/components/Dialog/VTDialogContent.vue +24 -19
- package/src/components/Dialog/VTDialogFooter.vue +11 -16
- package/src/components/Dialog/VTDialogHeader.vue +16 -18
- package/src/components/Dialog/VTDialogMain.vue +11 -18
- package/src/components/Dialog/VTDialogOverlay.vue +14 -18
- package/src/components/Dialog/VTDialogTitle.vue +10 -7
- package/src/components/Disclosure/VTDisclosureContent.vue +1 -1
- package/src/components/Disclosure/VTDisclosureDetails.vue +1 -1
- package/src/components/Disclosure/VTDisclosureHeader.vue +2 -2
- package/src/components/Disclosure/VTDisclosureIcon.vue +1 -1
- package/src/components/Drawer/VTDrawer.vue +6 -15
- package/src/components/Drawer/VTDrawerClose.vue +5 -5
- package/src/components/Drawer/VTDrawerContent.vue +9 -9
- package/src/components/Drawer/VTDrawerFooter.vue +3 -3
- package/src/components/Drawer/VTDrawerHeader.vue +4 -4
- package/src/components/Drawer/VTDrawerMain.vue +5 -5
- package/src/components/Drawer/VTDrawerOverlay.vue +6 -6
- package/src/components/Drawer/VTDrawerTitle.vue +5 -5
- package/src/components/DropdownMenu/VTDropdownMenu.vue +19 -6
- package/src/components/DropdownMenu/VTDropdownMenuContent.vue +14 -6
- package/src/components/DropdownMenu/VTDropdownMenuDivider.vue +7 -16
- package/src/components/DropdownMenu/VTDropdownMenuItem.vue +7 -3
- package/src/components/DropdownMenu/VTDropdownMenuLabel.vue +1 -10
- package/src/components/DropdownMenu/VTDropdownMenuTrigger.vue +2 -4
- package/src/components/Form/VTFormFeedback.vue +11 -5
- 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 +7 -7
- package/src/components/Form/VTInputIcon.vue +1 -2
- package/src/components/Form/VTInputPassword.vue +14 -5
- package/src/components/Form/VTTextarea.vue +1 -1
- package/src/components/Image/VTImage.vue +33 -4
- 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 +64 -55
- package/src/components/Listbox/VTListboxTrigger.vue +10 -4
- package/src/components/Popover/VTPopover.vue +19 -0
- 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/VTTooltip.vue +65 -0
- package/src/components/Tooltip/VTTooltipContent.vue +59 -0
- package/src/components/Tooltip/VTTooltipTrigger.vue +98 -0
- package/src/components/Transitions/FadeInOut.vue +2 -2
- package/src/components/Utils/FloatingUi.vue +56 -24
- package/src/utils/components.js +18 -0
- 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/nuxt.js
CHANGED
|
@@ -1,26 +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
|
-
|
|
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
|
+
];
|
|
18
22
|
|
|
19
|
-
export default
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
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.22.
|
|
3
|
+
"version": "0.22.2-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
|
};
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
<component
|
|
4
4
|
:is="tag"
|
|
5
5
|
:to="to"
|
|
6
|
-
:href="href"
|
|
7
6
|
:type="type"
|
|
8
7
|
:disabled="isDisabled"
|
|
9
8
|
:class="[
|
|
@@ -17,11 +16,13 @@
|
|
|
17
16
|
headless
|
|
18
17
|
? `button--${variant}`
|
|
19
18
|
: isPrimary
|
|
20
|
-
? '
|
|
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
|
-
? '
|
|
25
|
+
? 'text-secondary-400 hover:text-secondary-500 active:text-secondary-500 border-transparent disabled:text-gray-400'
|
|
25
26
|
: isIcon
|
|
26
27
|
? 'text-primary-100 focus-within:bg-gray-200 hover:bg-gray-200 active:bg-gray-300'
|
|
27
28
|
: null,
|
|
@@ -31,19 +32,18 @@
|
|
|
31
32
|
: isLarge
|
|
32
33
|
? isIcon
|
|
33
34
|
? 'h-8 w-8'
|
|
34
|
-
: 'h-10'
|
|
35
|
+
: 'h-12 sm:h-10'
|
|
35
36
|
: isSmall
|
|
36
37
|
? isIcon
|
|
37
38
|
? 'h-6 w-6 p-1'
|
|
38
39
|
: 'h-8'
|
|
39
40
|
: null,
|
|
40
41
|
]"
|
|
41
|
-
v-on="$listeners"
|
|
42
42
|
>
|
|
43
43
|
<VTSpinner v-if="busy" class="absolute inset-0 m-auto" />
|
|
44
44
|
<span
|
|
45
45
|
:class="[
|
|
46
|
-
headless ? null : 'inline-flex items-center gap-2 self-center
|
|
46
|
+
headless ? null : 'mx-auto inline-flex items-center gap-2 self-center',
|
|
47
47
|
headless && busy ? 'button--busy' : busy ? 'invisible' : null,
|
|
48
48
|
]"
|
|
49
49
|
>
|
|
@@ -73,10 +73,6 @@ export default {
|
|
|
73
73
|
type: [String, Object],
|
|
74
74
|
default: null,
|
|
75
75
|
},
|
|
76
|
-
href: {
|
|
77
|
-
type: [String, Object],
|
|
78
|
-
default: null,
|
|
79
|
-
},
|
|
80
76
|
headless: {
|
|
81
77
|
type: Boolean,
|
|
82
78
|
default: false,
|
|
@@ -89,6 +85,10 @@ export default {
|
|
|
89
85
|
type: Boolean,
|
|
90
86
|
default: false,
|
|
91
87
|
},
|
|
88
|
+
style: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: 'normal', // normal or ghost
|
|
91
|
+
},
|
|
92
92
|
},
|
|
93
93
|
|
|
94
94
|
computed: {
|
|
@@ -120,8 +120,16 @@ export default {
|
|
|
120
120
|
return this.disabled || this.busy;
|
|
121
121
|
},
|
|
122
122
|
|
|
123
|
+
isGhost() {
|
|
124
|
+
return this.style === 'ghost';
|
|
125
|
+
},
|
|
126
|
+
|
|
123
127
|
tag() {
|
|
124
|
-
return this.href
|
|
128
|
+
return this.$attrs.href
|
|
129
|
+
? 'a'
|
|
130
|
+
: this.to
|
|
131
|
+
? resolveComponent('NuxtLink')
|
|
132
|
+
: 'button';
|
|
125
133
|
},
|
|
126
134
|
|
|
127
135
|
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,38 +1,34 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<Teleport to="body">
|
|
3
3
|
<div
|
|
4
|
-
v-if="
|
|
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"
|
|
12
|
+
v-bind="$attrs"
|
|
11
13
|
@click="onClick"
|
|
12
14
|
>
|
|
13
15
|
<slot></slot>
|
|
14
16
|
</div>
|
|
15
|
-
</
|
|
17
|
+
</Teleport>
|
|
16
18
|
</template>
|
|
17
19
|
|
|
18
20
|
<script>
|
|
19
|
-
import { Portal } from '@linusborg/vue-simple-portal';
|
|
20
21
|
import { genId } from '../../utils/ids';
|
|
21
22
|
|
|
22
23
|
export default {
|
|
23
24
|
name: 'VTDialog',
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
Portal,
|
|
27
|
-
},
|
|
26
|
+
inheritAttrs: false,
|
|
28
27
|
|
|
29
28
|
provide() {
|
|
30
29
|
return {
|
|
31
|
-
|
|
32
|
-
const id = this.id;
|
|
30
|
+
apiDialog: () => {
|
|
33
31
|
const componentId = this.componentId;
|
|
34
|
-
const isDark = this.dark;
|
|
35
|
-
const isHeadless = this.headless;
|
|
36
32
|
|
|
37
33
|
const registerContent = (content) => {
|
|
38
34
|
if (!content) return;
|
|
@@ -48,26 +44,22 @@ export default {
|
|
|
48
44
|
|
|
49
45
|
const emit = () => this.emit();
|
|
50
46
|
|
|
47
|
+
const full = this.full;
|
|
48
|
+
|
|
51
49
|
return {
|
|
52
|
-
id,
|
|
53
50
|
componentId,
|
|
54
|
-
isDark,
|
|
55
|
-
isHeadless,
|
|
56
51
|
hide,
|
|
57
52
|
emit,
|
|
58
53
|
registerContent,
|
|
59
54
|
registerOverlay,
|
|
55
|
+
full,
|
|
60
56
|
};
|
|
61
57
|
},
|
|
62
58
|
};
|
|
63
59
|
},
|
|
64
60
|
|
|
65
|
-
model: {
|
|
66
|
-
prop: 'visible',
|
|
67
|
-
},
|
|
68
|
-
|
|
69
61
|
props: {
|
|
70
|
-
|
|
62
|
+
modelValue: {
|
|
71
63
|
type: Boolean,
|
|
72
64
|
default: false,
|
|
73
65
|
},
|
|
@@ -75,7 +67,7 @@ export default {
|
|
|
75
67
|
type: Boolean,
|
|
76
68
|
default: false,
|
|
77
69
|
},
|
|
78
|
-
|
|
70
|
+
full: {
|
|
79
71
|
type: Boolean,
|
|
80
72
|
default: false,
|
|
81
73
|
},
|
|
@@ -94,6 +86,10 @@ export default {
|
|
|
94
86
|
return `dialog-${this.componentId}`;
|
|
95
87
|
},
|
|
96
88
|
|
|
89
|
+
classes() {
|
|
90
|
+
return !this.full ? 'p-4 md:p-6' : '';
|
|
91
|
+
},
|
|
92
|
+
|
|
97
93
|
hasContent() {
|
|
98
94
|
return this.content !== null;
|
|
99
95
|
},
|
|
@@ -103,15 +99,9 @@ export default {
|
|
|
103
99
|
},
|
|
104
100
|
},
|
|
105
101
|
|
|
106
|
-
watch: {
|
|
107
|
-
visible(isVisible) {
|
|
108
|
-
if (!isVisible) this.hide();
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
|
|
112
102
|
mounted() {
|
|
113
103
|
if (this.hasContent) this.content.show();
|
|
114
|
-
if (this.hasOverlay) this.overlay.show();
|
|
104
|
+
// if (this.hasOverlay) this.overlay.show();
|
|
115
105
|
},
|
|
116
106
|
|
|
117
107
|
methods: {
|
|
@@ -122,7 +112,7 @@ export default {
|
|
|
122
112
|
|
|
123
113
|
emit() {
|
|
124
114
|
this.$nextTick(() => {
|
|
125
|
-
this.$emit('
|
|
115
|
+
this.$emit('update:modelValue', false);
|
|
126
116
|
this.$emit('hidden');
|
|
127
117
|
});
|
|
128
118
|
},
|
|
@@ -2,48 +2,42 @@
|
|
|
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>
|
|
15
|
-
import { IconClose } from
|
|
16
|
-
import VTButton from
|
|
15
|
+
import { IconClose } from '@veritree/icons';
|
|
16
|
+
import VTButton from '../Button/VTButton.vue';
|
|
17
17
|
|
|
18
18
|
export default {
|
|
19
|
-
name:
|
|
19
|
+
name: 'VTDialogClose',
|
|
20
20
|
|
|
21
21
|
components: { IconClose, VTButton },
|
|
22
22
|
|
|
23
|
-
inject: [
|
|
23
|
+
inject: ['apiDialog'],
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
dark() {
|
|
31
|
-
return this.api().isDark;
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
headless() {
|
|
35
|
-
return this.api().isHeadless;
|
|
25
|
+
props: {
|
|
26
|
+
headless: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false,
|
|
36
29
|
},
|
|
30
|
+
},
|
|
37
31
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return this.
|
|
32
|
+
computed: {
|
|
33
|
+
id() {
|
|
34
|
+
return `dialog-close-${this.apiDialog().componentId}`;
|
|
41
35
|
},
|
|
42
36
|
},
|
|
43
37
|
|
|
44
38
|
methods: {
|
|
45
39
|
hide() {
|
|
46
|
-
this.
|
|
40
|
+
this.apiDialog().hide();
|
|
47
41
|
},
|
|
48
42
|
},
|
|
49
43
|
};
|