@veritree/ui 0.20.1 → 0.21.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/package.json
CHANGED
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
<div
|
|
3
|
+
:class="[
|
|
4
|
+
headless ? 'form-feedback' : 'flex gap-2 mt-1 items-baseline',
|
|
5
|
+
// variant styles
|
|
6
|
+
headless ? `form-feedback--{$variant}` : null,
|
|
7
|
+
]"
|
|
8
|
+
>
|
|
9
|
+
<component
|
|
10
|
+
v-if="showIcon"
|
|
11
|
+
:is="icon"
|
|
12
|
+
:class="[
|
|
13
|
+
headless ? 'form-feedback__icon' : 'relative top-1 shrink-0 h-4 w-4',
|
|
14
|
+
// variant styles
|
|
15
|
+
headless
|
|
16
|
+
? `form-feedback__icon--{$variant}`
|
|
17
|
+
: isError
|
|
18
|
+
? 'text-error-500'
|
|
19
|
+
: null,
|
|
20
|
+
]"
|
|
21
|
+
/>
|
|
22
|
+
<span :class="[headless ? 'form-feedback--text' : 'text-gray-500 text-sm']">
|
|
23
|
+
<slot />
|
|
24
|
+
</span>
|
|
5
25
|
</div>
|
|
6
26
|
</template>
|
|
7
27
|
|
|
@@ -17,32 +37,23 @@ export default {
|
|
|
17
37
|
},
|
|
18
38
|
|
|
19
39
|
props: {
|
|
20
|
-
variant: {
|
|
21
|
-
type: [String, Object],
|
|
22
|
-
default: '',
|
|
23
|
-
validator(value) {
|
|
24
|
-
if (value === '' || typeof value === 'object') {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return ['success', 'warning', 'error'].includes(value);
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
40
|
hideIcon: {
|
|
32
41
|
type: Boolean,
|
|
33
42
|
default: false,
|
|
34
43
|
},
|
|
44
|
+
headless: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false,
|
|
47
|
+
},
|
|
48
|
+
variant: {
|
|
49
|
+
type: [String, Object],
|
|
50
|
+
default: '',
|
|
51
|
+
},
|
|
35
52
|
},
|
|
36
53
|
|
|
37
54
|
computed: {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (this.variant) {
|
|
42
|
-
classes[`form-feedback--${this.variant}`] = true;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return classes;
|
|
55
|
+
isError() {
|
|
56
|
+
return this.variant === 'error';
|
|
46
57
|
},
|
|
47
58
|
|
|
48
59
|
icon() {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<input
|
|
3
|
+
v-bind="$attrs"
|
|
4
|
+
:class="[
|
|
5
|
+
headless
|
|
6
|
+
? 'form-control'
|
|
7
|
+
: 'border border-solid py-2 px-3 rounded text-inherit',
|
|
8
|
+
headless
|
|
9
|
+
? `form-control--${variant}`
|
|
10
|
+
: isError
|
|
11
|
+
? 'border-error-300'
|
|
12
|
+
: 'border-gray-300',
|
|
13
|
+
]"
|
|
14
|
+
:value="value"
|
|
15
|
+
@input="$emit('input', $event.target.value)"
|
|
16
|
+
@blur="$emit('blur')"
|
|
17
|
+
/>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
export default {
|
|
22
|
+
model: {
|
|
23
|
+
prop: 'value',
|
|
24
|
+
event: 'input',
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
props: {
|
|
28
|
+
disabled: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false,
|
|
31
|
+
},
|
|
32
|
+
value: {
|
|
33
|
+
type: [String, Number, Object, Array],
|
|
34
|
+
default: null,
|
|
35
|
+
},
|
|
36
|
+
variant: {
|
|
37
|
+
type: [String, Object, Function],
|
|
38
|
+
default: '',
|
|
39
|
+
},
|
|
40
|
+
headless: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
computed: {
|
|
47
|
+
isError() {
|
|
48
|
+
return this.variant === 'error';
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
</script>
|