@veritree/ui 0.19.2-17 → 0.19.2-19
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/form-control.js
CHANGED
|
@@ -40,11 +40,21 @@ export const formControlMixin = {
|
|
|
40
40
|
);
|
|
41
41
|
},
|
|
42
42
|
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
isError() {
|
|
46
|
+
return this.variant === 'error';
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const formControlStyleMixin = {
|
|
52
|
+
computed: {
|
|
43
53
|
classComputed() {
|
|
44
54
|
return [
|
|
45
55
|
this.headless
|
|
46
56
|
? `${this.name}`
|
|
47
|
-
: 'leading-0 flex w-full max-w-full appearance-none items-center justify-between
|
|
57
|
+
: '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',
|
|
48
58
|
// variant styles
|
|
49
59
|
this.headless
|
|
50
60
|
? `${this.name}--${this.variant}`
|
|
@@ -59,9 +69,5 @@ export const formControlMixin = {
|
|
|
59
69
|
: 'h-10',
|
|
60
70
|
];
|
|
61
71
|
},
|
|
62
|
-
|
|
63
|
-
isError() {
|
|
64
|
-
return this.variant === 'error';
|
|
65
|
-
},
|
|
66
72
|
},
|
|
67
73
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
<div
|
|
3
|
+
:class="[
|
|
4
|
+
headless ? 'form-feedback' : 'mt-1 flex items-baseline gap-2',
|
|
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 h-4 w-4 shrink-0',
|
|
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-sm text-gray-500']">
|
|
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() {
|
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
10
|
<script>
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import {
|
|
12
|
+
formControlMixin,
|
|
13
|
+
formControlStyleMixin,
|
|
14
|
+
} from '../../../mixins/form-control';
|
|
13
15
|
export default {
|
|
14
|
-
mixins: [formControlMixin],
|
|
15
|
-
|
|
16
|
+
mixins: [formControlMixin, formControlStyleMixin],
|
|
16
17
|
data() {
|
|
17
18
|
return {
|
|
18
19
|
name: 'input',
|
|
@@ -27,11 +28,9 @@ input[type='date']::-webkit-calendar-picker-indicator {
|
|
|
27
28
|
position: absolute;
|
|
28
29
|
opacity: 0;
|
|
29
30
|
} */
|
|
30
|
-
|
|
31
31
|
input[type='number'] {
|
|
32
32
|
appearance: textfield;
|
|
33
33
|
}
|
|
34
|
-
|
|
35
34
|
input[type='number']::-webkit-inner-spin-button,
|
|
36
35
|
input[type='number']::-webkit-outer-spin-button {
|
|
37
36
|
appearance: none;
|