@veritree/ui 0.19.2-9 → 0.20.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 -68
- package/mixins/floating-ui-content.js +81 -0
- package/mixins/floating-ui-item.js +266 -0
- package/mixins/floating-ui.js +67 -0
- package/mixins/form-control-icon.js +53 -0
- package/mixins/form-control.js +71 -0
- package/nuxt.js +3 -0
- package/package.json +7 -3
- package/src/components/Alert/VTAlert.vue +55 -14
- package/src/components/Avatar/VTAvatar.vue +32 -29
- package/src/components/Button/VTButton.vue +9 -5
- 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 +16 -21
- package/src/components/Dialog/VTDialogClose.vue +13 -19
- package/src/components/Dialog/VTDialogContent.vue +17 -12
- 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/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/DropdownMenu/VTDropdownMenu.vue +42 -25
- package/src/components/DropdownMenu/VTDropdownMenuContent.vue +29 -64
- package/src/components/DropdownMenu/VTDropdownMenuDivider.vue +7 -13
- package/src/components/DropdownMenu/VTDropdownMenuItem.vue +11 -135
- package/src/components/DropdownMenu/VTDropdownMenuLabel.vue +3 -12
- package/src/components/DropdownMenu/VTDropdownMenuTrigger.vue +95 -115
- package/src/components/Form/VTFormFeedback.vue +39 -22
- 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 +40 -0
- package/src/components/Form/VTInputIcon.vue +35 -0
- package/src/components/Form/VTInputPassword.vue +55 -0
- package/src/components/Form/VTTextarea.vue +22 -0
- package/src/components/Listbox/VTListbox.vue +119 -47
- package/src/components/Listbox/VTListboxContent.vue +18 -114
- package/src/components/Listbox/VTListboxItem.vue +112 -163
- package/src/components/Listbox/VTListboxLabel.vue +3 -14
- package/src/components/Listbox/VTListboxList.vue +8 -38
- package/src/components/Listbox/VTListboxSearch.vue +75 -67
- package/src/components/Listbox/VTListboxTrigger.vue +73 -84
- package/src/components/Popover/VTPopover.vue +39 -26
- package/src/components/Popover/VTPopoverContent.vue +23 -58
- package/src/components/Popover/VTPopoverDivider.vue +4 -11
- package/src/components/Popover/VTPopoverItem.vue +13 -10
- package/src/components/Popover/VTPopoverTrigger.vue +120 -20
- 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 +14 -12
- package/src/components/Tabs/VTTabPanel.vue +1 -1
- 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 +93 -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
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export const formControlMixin = {
|
|
2
|
+
props: {
|
|
3
|
+
disabled: {
|
|
4
|
+
type: Boolean,
|
|
5
|
+
default: false,
|
|
6
|
+
},
|
|
7
|
+
headless: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
default: false,
|
|
10
|
+
},
|
|
11
|
+
modelValue: {
|
|
12
|
+
type: [String, Number, Object, Array],
|
|
13
|
+
default: null,
|
|
14
|
+
},
|
|
15
|
+
variant: {
|
|
16
|
+
type: [String, Object, Function],
|
|
17
|
+
default: '',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
computed: {
|
|
22
|
+
attrsComputed() {
|
|
23
|
+
// `Object.assign` merges objects together to form a new object
|
|
24
|
+
return Object.assign(
|
|
25
|
+
{},
|
|
26
|
+
// We add all the listeners from the parent
|
|
27
|
+
this.$attrs,
|
|
28
|
+
// Then we can add custom listeners or override the
|
|
29
|
+
// behavior of some listeners.
|
|
30
|
+
{
|
|
31
|
+
// This ensures that the component works with v-model
|
|
32
|
+
onInput: (event) => {
|
|
33
|
+
// if (this.lazy) return;
|
|
34
|
+
this.$emit('update:modelValue', event.target.value);
|
|
35
|
+
},
|
|
36
|
+
onBlur: (event) => {
|
|
37
|
+
this.$emit('blur', event);
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
isError() {
|
|
44
|
+
return this.variant === 'error';
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const formControlStyleMixin = {
|
|
50
|
+
computed: {
|
|
51
|
+
classComputed() {
|
|
52
|
+
return [
|
|
53
|
+
this.headless
|
|
54
|
+
? `${this.name}`
|
|
55
|
+
: 'leading-0 flex outline-none w-full max-w-full appearance-none items-center justify-between rounded border border-solid px-3 py-2 font-inherit text-base text-inherit file:hidden focus:border-secondary-200 appearance-none',
|
|
56
|
+
// variant styles
|
|
57
|
+
this.headless
|
|
58
|
+
? `${this.name}--${this.variant}`
|
|
59
|
+
: this.isError
|
|
60
|
+
? 'border-error-300'
|
|
61
|
+
: 'border-gray-300',
|
|
62
|
+
// height styles
|
|
63
|
+
this.headless
|
|
64
|
+
? null
|
|
65
|
+
: this.name === 'textarea'
|
|
66
|
+
? 'min-h-10' // limit it because input type number height can be different from other input types
|
|
67
|
+
: 'h-12 md:h-10',
|
|
68
|
+
];
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
package/nuxt.js
CHANGED
|
@@ -5,6 +5,7 @@ const components = [
|
|
|
5
5
|
'./src/components/Alert',
|
|
6
6
|
'./src/components/Avatar',
|
|
7
7
|
'./src/components/Button',
|
|
8
|
+
'./src/components/Checkbox',
|
|
8
9
|
'./src/components/Drawer',
|
|
9
10
|
'./src/components/Dialog',
|
|
10
11
|
'./src/components/Disclosure',
|
|
@@ -14,7 +15,9 @@ const components = [
|
|
|
14
15
|
'./src/components/Image',
|
|
15
16
|
'./src/components/Popover',
|
|
16
17
|
'./src/components/ProgressBar',
|
|
18
|
+
'./src/components/Skeleton',
|
|
17
19
|
'./src/components/Tabs',
|
|
20
|
+
'./src/components/Tooltip',
|
|
18
21
|
];
|
|
19
22
|
|
|
20
23
|
export default defineNuxtModule({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veritree/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0-0",
|
|
4
4
|
"description": "veritree ui library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -11,9 +11,13 @@
|
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@
|
|
14
|
+
"@floating-ui/dom": "^1.0.4",
|
|
15
|
+
"@veritree/icons": "^0.45.1"
|
|
15
16
|
},
|
|
16
17
|
"devDependencies": {
|
|
17
|
-
"@nuxt/kit": "^3.0.0"
|
|
18
|
+
"@nuxt/kit": "^3.0.0",
|
|
19
|
+
"prettier": "^2.7.1",
|
|
20
|
+
"prettier-plugin-tailwindcss": "^0.1.13",
|
|
21
|
+
"tailwindcss": "^3.2.4"
|
|
18
22
|
}
|
|
19
23
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
v-if="
|
|
3
|
+
v-if="isVisible"
|
|
4
4
|
:class="[
|
|
5
5
|
// default styles
|
|
6
|
-
headless
|
|
7
|
-
? 'alert'
|
|
8
|
-
: 'flex items-start gap-3 rounded border border-solid p-3',
|
|
6
|
+
headless ? 'alert' : 'flex items-start gap-3 rounded border border-solid',
|
|
9
7
|
// variant styles
|
|
10
8
|
headless
|
|
11
9
|
? `alert--${variant}`
|
|
@@ -16,6 +14,14 @@
|
|
|
16
14
|
: isWarning
|
|
17
15
|
? 'border-warning-300 bg-warning-200 text-warning-700'
|
|
18
16
|
: null,
|
|
17
|
+
// sizes styles
|
|
18
|
+
headless
|
|
19
|
+
? `alert--${size}`
|
|
20
|
+
: isLarge
|
|
21
|
+
? 'p-3'
|
|
22
|
+
: isSmall
|
|
23
|
+
? 'py-1 px-2 text-sm'
|
|
24
|
+
: null,
|
|
19
25
|
]"
|
|
20
26
|
role="alert"
|
|
21
27
|
>
|
|
@@ -23,9 +29,15 @@
|
|
|
23
29
|
<button
|
|
24
30
|
v-if="dismissable"
|
|
25
31
|
:class="[
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
// default styles
|
|
33
|
+
headless ? 'alert-close' : 'ml-auto h-4 w-4 shrink-0 text-current',
|
|
34
|
+
headless
|
|
35
|
+
? `alert-close--${variant}`
|
|
36
|
+
: isLarge
|
|
37
|
+
? 'mt-1'
|
|
38
|
+
: isSmall
|
|
39
|
+
? 'mt-0.5'
|
|
40
|
+
: null,
|
|
29
41
|
]"
|
|
30
42
|
@click="hide"
|
|
31
43
|
>
|
|
@@ -35,14 +47,30 @@
|
|
|
35
47
|
</template>
|
|
36
48
|
|
|
37
49
|
<script>
|
|
50
|
+
import IconClose from '@veritree/icons/src/components/IconClose.vue';
|
|
51
|
+
|
|
38
52
|
export default {
|
|
39
53
|
name: 'VTAlert',
|
|
40
54
|
|
|
55
|
+
components: {
|
|
56
|
+
IconClose,
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
data() {
|
|
60
|
+
return {
|
|
61
|
+
modelValueLocal: true,
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
|
|
41
65
|
props: {
|
|
42
66
|
variant: {
|
|
43
67
|
type: String,
|
|
44
68
|
default: 'success',
|
|
45
69
|
},
|
|
70
|
+
size: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: 'large',
|
|
73
|
+
},
|
|
46
74
|
headless: {
|
|
47
75
|
type: Boolean,
|
|
48
76
|
default: false,
|
|
@@ -51,12 +79,10 @@ export default {
|
|
|
51
79
|
type: Boolean,
|
|
52
80
|
default: false,
|
|
53
81
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
show: true,
|
|
59
|
-
};
|
|
82
|
+
modelValue: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: null,
|
|
85
|
+
},
|
|
60
86
|
},
|
|
61
87
|
|
|
62
88
|
computed: {
|
|
@@ -71,12 +97,27 @@ export default {
|
|
|
71
97
|
isWarning() {
|
|
72
98
|
return this.variant === 'warning';
|
|
73
99
|
},
|
|
100
|
+
|
|
101
|
+
isLarge() {
|
|
102
|
+
return this.size === 'large';
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
isSmall() {
|
|
106
|
+
return this.size === 'small';
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
isVisible() {
|
|
110
|
+
return this.modelValue !== null ? this.modelValue : this.modelValueLocal;
|
|
111
|
+
},
|
|
74
112
|
},
|
|
75
113
|
|
|
76
114
|
methods: {
|
|
77
115
|
hide() {
|
|
116
|
+
this.modelValue !== null
|
|
117
|
+
? this.$emit('update:modelValue', false)
|
|
118
|
+
: (this.modelValueLocal = false);
|
|
119
|
+
|
|
78
120
|
this.$emit('dismiss');
|
|
79
|
-
this.show = false;
|
|
80
121
|
},
|
|
81
122
|
},
|
|
82
123
|
};
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
:class="
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
:class="[
|
|
4
|
+
// default styles
|
|
5
|
+
headless
|
|
6
|
+
? 'avatar'
|
|
7
|
+
: 'flex items-center justify-center overflow-hidden rounded-full bg-white border border-solid',
|
|
8
|
+
// variant styles
|
|
9
|
+
headless ? `avatar--${variant}` : null,
|
|
10
|
+
// sizes styles
|
|
11
|
+
headless
|
|
12
|
+
? `avatar--${size}`
|
|
13
|
+
: isSmall
|
|
14
|
+
? 'h-8 w-8'
|
|
15
|
+
: isLarge
|
|
16
|
+
? 'h-10 w-10'
|
|
17
|
+
: null,
|
|
18
|
+
]"
|
|
12
19
|
>
|
|
13
20
|
<slot></slot>
|
|
14
21
|
</div>
|
|
@@ -18,32 +25,28 @@
|
|
|
18
25
|
export default {
|
|
19
26
|
name: 'VTAvatar',
|
|
20
27
|
|
|
21
|
-
provide() {
|
|
22
|
-
return {
|
|
23
|
-
api: () => {
|
|
24
|
-
const { dark: isDark, headless: isHeadless, light: isLight } = this;
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
isDark,
|
|
28
|
-
isHeadless,
|
|
29
|
-
isLight,
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
},
|
|
34
|
-
|
|
35
28
|
props: {
|
|
36
29
|
headless: {
|
|
37
30
|
type: Boolean,
|
|
38
31
|
default: false,
|
|
39
32
|
},
|
|
40
|
-
|
|
41
|
-
type:
|
|
42
|
-
default:
|
|
33
|
+
variant: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: 'primary',
|
|
43
36
|
},
|
|
44
|
-
|
|
45
|
-
type:
|
|
46
|
-
default:
|
|
37
|
+
size: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'large',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
computed: {
|
|
44
|
+
isLarge() {
|
|
45
|
+
return this.size === 'large';
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
isSmall() {
|
|
49
|
+
return this.size === 'small';
|
|
47
50
|
},
|
|
48
51
|
},
|
|
49
52
|
};
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
headless
|
|
17
17
|
? `button--${variant}`
|
|
18
18
|
: isPrimary
|
|
19
|
-
? '
|
|
19
|
+
? 'bg-secondary-400 hover:bg-secondary-500 active:bg-secondary-600 border-transparent text-white disabled:bg-gray-200 disabled:text-gray-400'
|
|
20
20
|
: isSecondary
|
|
21
21
|
? 'border-gray-400 bg-white text-gray-700 hover:bg-gray-100 active:bg-gray-200 disabled:border-gray-300 disabled:text-gray-400'
|
|
22
22
|
: isTertiary
|
|
23
|
-
? '
|
|
23
|
+
? 'text-secondary-400 hover:text-secondary-500 active:text-secondary-500 border-transparent disabled:text-gray-400'
|
|
24
24
|
: isIcon
|
|
25
25
|
? 'text-primary-100 focus-within:bg-gray-200 hover:bg-gray-200 active:bg-gray-300'
|
|
26
26
|
: null,
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
: isLarge
|
|
31
31
|
? isIcon
|
|
32
32
|
? 'h-8 w-8'
|
|
33
|
-
: 'h-10'
|
|
33
|
+
: 'h-12 sm:h-10'
|
|
34
34
|
: isSmall
|
|
35
35
|
? isIcon
|
|
36
36
|
? 'h-6 w-6 p-1'
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
<VTSpinner v-if="busy" class="absolute inset-0 m-auto" />
|
|
42
42
|
<span
|
|
43
43
|
:class="[
|
|
44
|
-
headless ? null : 'inline-flex items-center gap-2 self-center
|
|
44
|
+
headless ? null : 'mx-auto inline-flex items-center gap-2 self-center',
|
|
45
45
|
headless && busy ? 'button--busy' : busy ? 'invisible' : null,
|
|
46
46
|
]"
|
|
47
47
|
>
|
|
@@ -115,7 +115,11 @@ export default {
|
|
|
115
115
|
},
|
|
116
116
|
|
|
117
117
|
tag() {
|
|
118
|
-
return this.$attrs.href
|
|
118
|
+
return this.$attrs.href
|
|
119
|
+
? 'a'
|
|
120
|
+
: this.to
|
|
121
|
+
? resolveComponent('NuxtLink')
|
|
122
|
+
: 'button';
|
|
119
123
|
},
|
|
120
124
|
|
|
121
125
|
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>
|
|
@@ -3,11 +3,13 @@
|
|
|
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"
|
|
12
|
+
v-bind="$attrs"
|
|
11
13
|
@click="onClick"
|
|
12
14
|
>
|
|
13
15
|
<slot></slot>
|
|
@@ -21,17 +23,12 @@ import { genId } from '../../utils/ids';
|
|
|
21
23
|
export default {
|
|
22
24
|
name: 'VTDialog',
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
Portal,
|
|
26
|
-
},
|
|
26
|
+
inheritAttrs: false,
|
|
27
27
|
|
|
28
28
|
provide() {
|
|
29
29
|
return {
|
|
30
30
|
apiDialog: () => {
|
|
31
|
-
const id = this.id;
|
|
32
31
|
const componentId = this.componentId;
|
|
33
|
-
const isDark = this.dark;
|
|
34
|
-
const isHeadless = this.headless;
|
|
35
32
|
|
|
36
33
|
const registerContent = (content) => {
|
|
37
34
|
if (!content) return;
|
|
@@ -47,15 +44,15 @@ export default {
|
|
|
47
44
|
|
|
48
45
|
const emit = () => this.emit();
|
|
49
46
|
|
|
47
|
+
const full = this.full;
|
|
48
|
+
|
|
50
49
|
return {
|
|
51
|
-
id,
|
|
52
50
|
componentId,
|
|
53
|
-
isDark,
|
|
54
|
-
isHeadless,
|
|
55
51
|
hide,
|
|
56
52
|
emit,
|
|
57
53
|
registerContent,
|
|
58
54
|
registerOverlay,
|
|
55
|
+
full,
|
|
59
56
|
};
|
|
60
57
|
},
|
|
61
58
|
};
|
|
@@ -70,7 +67,7 @@ export default {
|
|
|
70
67
|
type: Boolean,
|
|
71
68
|
default: false,
|
|
72
69
|
},
|
|
73
|
-
|
|
70
|
+
full: {
|
|
74
71
|
type: Boolean,
|
|
75
72
|
default: false,
|
|
76
73
|
},
|
|
@@ -89,6 +86,10 @@ export default {
|
|
|
89
86
|
return `dialog-${this.componentId}`;
|
|
90
87
|
},
|
|
91
88
|
|
|
89
|
+
classes() {
|
|
90
|
+
return !this.full ? 'p-4 md:p-6' : '';
|
|
91
|
+
},
|
|
92
|
+
|
|
92
93
|
hasContent() {
|
|
93
94
|
return this.content !== null;
|
|
94
95
|
},
|
|
@@ -98,15 +99,9 @@ export default {
|
|
|
98
99
|
},
|
|
99
100
|
},
|
|
100
101
|
|
|
101
|
-
watch: {
|
|
102
|
-
visible(isVisible) {
|
|
103
|
-
if (!isVisible) this.hide();
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
|
|
107
102
|
mounted() {
|
|
108
103
|
if (this.hasContent) this.content.show();
|
|
109
|
-
if (this.hasOverlay) this.overlay.show();
|
|
104
|
+
// if (this.hasOverlay) this.overlay.show();
|
|
110
105
|
},
|
|
111
106
|
|
|
112
107
|
methods: {
|
|
@@ -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: {
|