adverich-kun-ui 0.1.124 → 0.1.126
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/dist/adverich-kun-ui.css +1 -1
- package/dist/components/KunAutocomplete/src/components/KunAutocomplete.vue.js +235 -210
- package/dist/components/KunAutocomplete/src/composables/KunAutocompleteProps.js +5 -11
- package/dist/components/KunAutocomplete/src/composables/useAutocomplete.js +95 -93
- package/dist/components/KunAvatar/src/components/KunAvatar.vue.js +26 -26
- package/dist/components/KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js +41 -30
- package/dist/components/KunNumberField/src/components/KunNumberField.vue.js +135 -137
- package/dist/components/KunTextField/src/components/KunTextField.vue.js +62 -56
- package/dist/components/KunTextField/src/composables/useKunTextFieldComposable.js +25 -24
- package/dist/components/kunMenu/src/components/kunMenu.vue.js +35 -34
- package/dist/components/kunMenu/src/composables/kunMenuProps.js +21 -5
- package/dist/components/kunMenu/src/composables/useKunMenuStyles.js +29 -31
- package/dist/icons/IconAccountOutline.vue.js +20 -0
- package/dist/icons/IconClose.vue.js +14 -10
- package/dist/icons/IconPencil.vue.js +20 -0
- package/dist/icons/IconTrashOutline.vue.js +20 -0
- package/dist/icons/index.js +18 -12
- package/package.json +1 -1
|
@@ -1,177 +1,175 @@
|
|
|
1
|
-
import { getCurrentInstance as
|
|
2
|
-
import { KunNumberFieldProps as
|
|
3
|
-
import { useKunNumberField as
|
|
4
|
-
|
|
1
|
+
import { getCurrentInstance as K, useSlots as D, createElementBlock as l, openBlock as r, createCommentVNode as n, createElementVNode as i, normalizeClass as p, unref as t, toDisplayString as u, mergeProps as z, createBlock as v, renderSlot as g, Fragment as w, renderList as E } from "vue";
|
|
2
|
+
import { KunNumberFieldProps as P } from "../composables/KunNumberFieldProps.js";
|
|
3
|
+
import { useKunNumberField as H } from "../composables/useKunNumberFieldComposable.js";
|
|
4
|
+
import C from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
5
|
+
const L = { class: "w-full flex flex-col relative" }, q = {
|
|
5
6
|
key: 0,
|
|
6
7
|
class: "h-full"
|
|
7
|
-
},
|
|
8
|
+
}, G = ["disabled"], J = {
|
|
8
9
|
key: 1,
|
|
9
10
|
class: "mr-2"
|
|
10
|
-
},
|
|
11
|
+
}, O = {
|
|
11
12
|
key: 2,
|
|
12
13
|
class: "flex items-center justify-center min-w-[32px] h-full px-1"
|
|
13
|
-
},
|
|
14
|
+
}, Q = ["value", "placeholder", "readonly", "disabled", "maxlength", "aria-invalid"], R = ["disabled"], T = {
|
|
14
15
|
key: 0,
|
|
15
16
|
class: "flex items-center h-full"
|
|
16
|
-
},
|
|
17
|
+
}, U = ["disabled"], W = ["disabled"], X = {
|
|
17
18
|
key: 1,
|
|
18
19
|
class: "flex flex-col items-center justify-center border-l border-slate-600"
|
|
19
|
-
},
|
|
20
|
+
}, Y = ["disabled"], Z = ["disabled"], _ = {
|
|
20
21
|
key: 5,
|
|
21
22
|
class: "flex items-center justify-center min-w-[32px] h-full px-1"
|
|
22
|
-
},
|
|
23
|
+
}, ee = {
|
|
23
24
|
key: 6,
|
|
24
25
|
class: "h-full"
|
|
25
|
-
},
|
|
26
|
+
}, te = ["disabled"], re = {
|
|
26
27
|
key: 7,
|
|
27
28
|
class: "ml-2"
|
|
28
|
-
},
|
|
29
|
+
}, oe = {
|
|
29
30
|
key: 0,
|
|
30
31
|
class: "h-[1.25rem]"
|
|
31
|
-
},
|
|
32
|
+
}, se = {
|
|
32
33
|
key: 0,
|
|
33
34
|
class: "text-red-500 text-sm text-center"
|
|
34
|
-
},
|
|
35
|
+
}, le = { key: 0 }, ne = { key: 1 }, ie = {
|
|
35
36
|
key: 1,
|
|
36
37
|
class: "text-xs text-center"
|
|
37
38
|
}, be = {
|
|
38
39
|
__name: "KunNumberField",
|
|
39
|
-
props:
|
|
40
|
+
props: P,
|
|
40
41
|
emits: ["update:modelValue"],
|
|
41
42
|
setup(I, { emit: x }) {
|
|
42
|
-
const V = I, j = x, b = `number-input-${
|
|
43
|
+
const V = I, j = x, b = `number-input-${K().uid}`, y = D(), A = !!y["prepend-icon"], F = !!y["append-icon"], {
|
|
43
44
|
inputValue: c,
|
|
44
|
-
numberInput:
|
|
45
|
-
inputKey:
|
|
46
|
-
updateValue:
|
|
47
|
-
onIncrement:
|
|
45
|
+
numberInput: B,
|
|
46
|
+
inputKey: M,
|
|
47
|
+
updateValue: N,
|
|
48
|
+
onIncrement: d,
|
|
48
49
|
onDecrement: a,
|
|
49
|
-
onClear:
|
|
50
|
-
focus:
|
|
50
|
+
onClear: f,
|
|
51
|
+
focus: k,
|
|
51
52
|
handleFocus: h,
|
|
52
|
-
isActive:
|
|
53
|
+
isActive: S,
|
|
53
54
|
handleBlur: m
|
|
54
|
-
} =
|
|
55
|
-
return (e, s) =>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
55
|
+
} = H(V, j);
|
|
56
|
+
return (e, s) => (r(), l("div", L, [
|
|
57
|
+
e.label ? (r(), l("label", {
|
|
58
|
+
key: 0,
|
|
59
|
+
for: b,
|
|
60
|
+
class: p([
|
|
61
|
+
e.labelColor,
|
|
62
|
+
"absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
|
|
63
|
+
t(S) || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
|
|
64
|
+
])
|
|
65
|
+
}, u(e.label), 3)) : n("", !0),
|
|
66
|
+
i("div", z({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
|
|
67
|
+
i("div", {
|
|
68
|
+
class: p(["flex items-center w-full h-full border", [
|
|
69
|
+
e.bgInput,
|
|
70
|
+
e.rounded,
|
|
71
|
+
t(k) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
|
|
72
|
+
e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
|
|
73
|
+
e.error ? "bg-red-200 dark:bg-red-900" : ""
|
|
74
|
+
]])
|
|
75
|
+
}, [
|
|
76
|
+
!e.noArrows && e.controlVariant === "split" ? (r(), l("div", q, [
|
|
77
|
+
i("button", {
|
|
78
|
+
type: "button",
|
|
79
|
+
class: "p-3 text-lg border-r border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
80
|
+
onClick: s[0] || (s[0] = (...o) => t(a) && t(a)(...o)),
|
|
81
|
+
disabled: e.disabled || e.readonly
|
|
82
|
+
}, "−", 8, G)
|
|
83
|
+
])) : n("", !0),
|
|
84
|
+
e.prefix ? (r(), l("div", J, u(e.prefix), 1)) : n("", !0),
|
|
85
|
+
e.prependIcon || A ? (r(), l("div", O, [
|
|
86
|
+
e.prependIcon ? (r(), v(C, { key: 0 })) : g(e.$slots, "prepend-icon", { key: 1 })
|
|
87
|
+
])) : n("", !0),
|
|
88
|
+
(r(), l("input", {
|
|
89
|
+
id: b,
|
|
90
|
+
ref_key: "numberInput",
|
|
91
|
+
ref: B,
|
|
92
|
+
key: t(M),
|
|
93
|
+
type: "text",
|
|
94
|
+
value: t(c),
|
|
95
|
+
placeholder: e.placeholder,
|
|
96
|
+
readonly: e.readonly,
|
|
97
|
+
disabled: e.disabled,
|
|
98
|
+
maxlength: e.maxlength,
|
|
99
|
+
autocomplete: "off",
|
|
100
|
+
class: p(["w-full h-full bg-transparent rounded focus:outline-none p-3", [e.textColor, e.placeholderColor, e.textCenter ? "text-center" : ""]]),
|
|
101
|
+
"aria-invalid": e.error ? "true" : "false",
|
|
102
|
+
onInput: s[1] || (s[1] = (o) => t(N)(o.target.value)),
|
|
103
|
+
onFocus: s[2] || (s[2] = (...o) => t(h) && t(h)(...o)),
|
|
104
|
+
onBlur: s[3] || (s[3] = (...o) => t(m) && t(m)(...o))
|
|
105
|
+
}, null, 42, Q)),
|
|
106
|
+
e.clearable && t(c) != null ? (r(), l("button", {
|
|
107
|
+
key: 3,
|
|
108
|
+
type: "button",
|
|
109
|
+
onClick: s[4] || (s[4] = (...o) => t(f) && t(f)(...o)),
|
|
110
|
+
class: p(["ml-2", e.textColor]),
|
|
111
|
+
disabled: e.disabled || e.readonly
|
|
112
|
+
}, " × ", 10, R)) : n("", !0),
|
|
113
|
+
e.noArrows ? n("", !0) : (r(), l(w, { key: 4 }, [
|
|
114
|
+
e.controlVariant === "default" ? (r(), l("div", T, [
|
|
115
|
+
i("button", {
|
|
79
116
|
type: "button",
|
|
80
|
-
class: "
|
|
81
|
-
onClick: s[
|
|
117
|
+
class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
118
|
+
onClick: s[5] || (s[5] = (...o) => t(d) && t(d)(...o)),
|
|
82
119
|
disabled: e.disabled || e.readonly
|
|
83
|
-
}, "
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
120
|
+
}, " ▲ ", 8, U),
|
|
121
|
+
i("button", {
|
|
122
|
+
type: "button",
|
|
123
|
+
class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
124
|
+
onClick: s[6] || (s[6] = (...o) => t(a) && t(a)(...o)),
|
|
125
|
+
disabled: e.disabled || e.readonly
|
|
126
|
+
}, " ▼ ", 8, W)
|
|
88
127
|
])) : n("", !0),
|
|
89
|
-
(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
value: t(c),
|
|
96
|
-
placeholder: e.placeholder,
|
|
97
|
-
readonly: e.readonly,
|
|
98
|
-
disabled: e.disabled,
|
|
99
|
-
maxlength: e.maxlength,
|
|
100
|
-
autocomplete: "off",
|
|
101
|
-
class: p(["w-full h-full bg-transparent rounded focus:outline-none p-3", [e.textColor, e.placeholderColor, e.textCenter ? "text-center" : ""]]),
|
|
102
|
-
"aria-invalid": e.error ? "true" : "false",
|
|
103
|
-
onInput: s[1] || (s[1] = (r) => t(M)(r.target.value)),
|
|
104
|
-
onFocus: s[2] || (s[2] = (...r) => t(h) && t(h)(...r)),
|
|
105
|
-
onBlur: s[3] || (s[3] = (...r) => t(m) && t(m)(...r))
|
|
106
|
-
}, null, 42, R)),
|
|
107
|
-
e.clearable && t(c) != null ? (o(), l("button", {
|
|
108
|
-
key: 3,
|
|
109
|
-
type: "button",
|
|
110
|
-
onClick: s[4] || (s[4] = (...r) => t(k) && t(k)(...r)),
|
|
111
|
-
class: p(["ml-2", e.textColor]),
|
|
112
|
-
disabled: e.disabled || e.readonly
|
|
113
|
-
}, " × ", 10, T)) : n("", !0),
|
|
114
|
-
e.noArrows ? n("", !0) : (o(), l(C, { key: 4 }, [
|
|
115
|
-
e.controlVariant === "default" ? (o(), l("div", U, [
|
|
116
|
-
d("button", {
|
|
128
|
+
e.controlVariant === "stacked" ? (r(), l("div", X, [
|
|
129
|
+
i("div", {
|
|
130
|
+
class: "border-b border-slate-600 pb-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
131
|
+
onClick: s[7] || (s[7] = (...o) => t(d) && t(d)(...o))
|
|
132
|
+
}, [
|
|
133
|
+
i("button", {
|
|
117
134
|
type: "button",
|
|
118
|
-
class: "
|
|
119
|
-
onClick: s[5] || (s[5] = (...r) => t(i) && t(i)(...r)),
|
|
135
|
+
class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
|
|
120
136
|
disabled: e.disabled || e.readonly
|
|
121
|
-
}, "
|
|
122
|
-
|
|
137
|
+
}, "▲", 8, Y)
|
|
138
|
+
]),
|
|
139
|
+
i("div", {
|
|
140
|
+
class: "border-t border-slate-600 pt-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
141
|
+
onClick: s[8] || (s[8] = (...o) => t(a) && t(a)(...o))
|
|
142
|
+
}, [
|
|
143
|
+
i("button", {
|
|
123
144
|
type: "button",
|
|
124
|
-
class: "
|
|
125
|
-
onClick: s[6] || (s[6] = (...r) => t(a) && t(a)(...r)),
|
|
145
|
+
class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
|
|
126
146
|
disabled: e.disabled || e.readonly
|
|
127
|
-
}, "
|
|
128
|
-
])
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
e.appendIcon ? (o(), g(v, { key: 0 })) : w(e.$slots, "append-icon", { key: 1 })
|
|
154
|
-
])) : n("", !0),
|
|
155
|
-
!e.noArrows && e.controlVariant === "split" ? (o(), l("div", te, [
|
|
156
|
-
d("button", {
|
|
157
|
-
type: "button",
|
|
158
|
-
class: "p-3 text-lg border-l border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
159
|
-
onClick: s[9] || (s[9] = (...r) => t(i) && t(i)(...r)),
|
|
160
|
-
disabled: e.disabled || e.readonly
|
|
161
|
-
}, "+", 8, oe)
|
|
162
|
-
])) : n("", !0),
|
|
163
|
-
e.suffix ? (o(), l("div", re, u(e.suffix), 1)) : n("", !0)
|
|
164
|
-
], 2),
|
|
165
|
-
e.hideDetails ? n("", !0) : (o(), l("div", se, [
|
|
166
|
-
e.error || e.errorMessages ? (o(), l("div", le, [
|
|
167
|
-
Array.isArray(e.errorMessages) ? (o(), l("div", ne, [
|
|
168
|
-
(o(!0), l(C, null, P(e.errorMessages, (r, S) => (o(), l("div", { key: S }, u(r), 1))), 128))
|
|
169
|
-
])) : typeof e.errorMessages == "string" ? (o(), l("div", de, u(e.errorMessages), 1)) : n("", !0)
|
|
170
|
-
])) : e.hint && (e.persistentHint || t(f)) ? (o(), l("div", ie, u(e.hint), 1)) : n("", !0)
|
|
171
|
-
]))
|
|
172
|
-
], 16)
|
|
173
|
-
]);
|
|
174
|
-
};
|
|
147
|
+
}, "▼", 8, Z)
|
|
148
|
+
])
|
|
149
|
+
])) : n("", !0)
|
|
150
|
+
], 64)),
|
|
151
|
+
e.appendIcon || F ? (r(), l("div", _, [
|
|
152
|
+
e.appendIcon ? (r(), v(C, { key: 0 })) : g(e.$slots, "append-icon", { key: 1 })
|
|
153
|
+
])) : n("", !0),
|
|
154
|
+
!e.noArrows && e.controlVariant === "split" ? (r(), l("div", ee, [
|
|
155
|
+
i("button", {
|
|
156
|
+
type: "button",
|
|
157
|
+
class: "p-3 text-lg border-l border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
158
|
+
onClick: s[9] || (s[9] = (...o) => t(d) && t(d)(...o)),
|
|
159
|
+
disabled: e.disabled || e.readonly
|
|
160
|
+
}, "+", 8, te)
|
|
161
|
+
])) : n("", !0),
|
|
162
|
+
e.suffix ? (r(), l("div", re, u(e.suffix), 1)) : n("", !0)
|
|
163
|
+
], 2),
|
|
164
|
+
e.hideDetails ? n("", !0) : (r(), l("div", oe, [
|
|
165
|
+
e.error || e.errorMessages ? (r(), l("div", se, [
|
|
166
|
+
Array.isArray(e.errorMessages) ? (r(), l("div", le, [
|
|
167
|
+
(r(!0), l(w, null, E(e.errorMessages, (o, $) => (r(), l("div", { key: $ }, u(o), 1))), 128))
|
|
168
|
+
])) : typeof e.errorMessages == "string" ? (r(), l("div", ne, u(e.errorMessages), 1)) : n("", !0)
|
|
169
|
+
])) : e.hint && (e.persistentHint || t(k)) ? (r(), l("div", ie, u(e.hint), 1)) : n("", !0)
|
|
170
|
+
]))
|
|
171
|
+
], 16)
|
|
172
|
+
]));
|
|
175
173
|
}
|
|
176
174
|
};
|
|
177
175
|
export {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getCurrentInstance as
|
|
2
|
-
import { icons as
|
|
1
|
+
import { getCurrentInstance as R, computed as d, useSlots as U, ref as H, createElementBlock as s, openBlock as r, createCommentVNode as o, createElementVNode as h, normalizeClass as a, toDisplayString as i, mergeProps as q, unref as t, renderSlot as c, withModifiers as G, createVNode as J } from "vue";
|
|
2
|
+
import { icons as P } from "../../../../icons/index.js";
|
|
3
3
|
import L from "../composables/KunTextFieldProps.js";
|
|
4
4
|
import Q from "../composables/useKunTextFieldComposable.js";
|
|
5
|
-
import
|
|
6
|
-
const
|
|
5
|
+
import W from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
6
|
+
const X = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "mr-2"
|
|
9
9
|
}, Y = ["type", "value", "placeholder", "disabled", "readonly", "maxlength", "aria-invalid", "aria-describedby"], Z = ["disabled"], _ = {
|
|
@@ -32,65 +32,71 @@ const W = { class: "w-full flex flex-col relative" }, X = {
|
|
|
32
32
|
"keyDown",
|
|
33
33
|
"keyUp"
|
|
34
34
|
],
|
|
35
|
-
setup(
|
|
36
|
-
const u =
|
|
35
|
+
setup(V, { expose: j, emit: B }) {
|
|
36
|
+
const u = V, p = B, {
|
|
37
37
|
inputField: k,
|
|
38
38
|
inputValue: f,
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
rootRef: w,
|
|
40
|
+
inputFocused: b,
|
|
41
|
+
validationError: D,
|
|
41
42
|
hasError: m,
|
|
42
|
-
handleInput:
|
|
43
|
-
handleBlur:
|
|
44
|
-
focusInput:
|
|
45
|
-
validate:
|
|
46
|
-
reset:
|
|
47
|
-
resetValidation:
|
|
48
|
-
clearInput:
|
|
43
|
+
handleInput: g,
|
|
44
|
+
handleBlur: C,
|
|
45
|
+
focusInput: I,
|
|
46
|
+
validate: E,
|
|
47
|
+
reset: K,
|
|
48
|
+
resetValidation: S,
|
|
49
|
+
clearInput: $
|
|
49
50
|
} = Q(u, p);
|
|
50
|
-
|
|
51
|
-
validate:
|
|
52
|
-
reset:
|
|
53
|
-
resetValidation:
|
|
54
|
-
inputField: k
|
|
51
|
+
j({
|
|
52
|
+
validate: E,
|
|
53
|
+
reset: K,
|
|
54
|
+
resetValidation: S,
|
|
55
|
+
inputField: k,
|
|
56
|
+
rootRef: w
|
|
55
57
|
});
|
|
56
|
-
const y = `input-${
|
|
57
|
-
function
|
|
58
|
+
const y = `input-${R().uid}`, T = d(() => b.value || !!f.value || u.dirty), x = U(), N = d(() => !!x["prepend-inner"]), O = d(() => !!x["append-inner"]), v = H(!1), z = d(() => v.value ? P.eyeOffOutline : P.eyeOutline);
|
|
59
|
+
function A() {
|
|
58
60
|
v.value = !v.value;
|
|
59
61
|
}
|
|
60
|
-
const
|
|
62
|
+
const M = d(() => u.type === "password" ? v.value ? "text" : "password" : u.type);
|
|
61
63
|
return (e, l) => {
|
|
62
|
-
var
|
|
63
|
-
return
|
|
64
|
-
|
|
64
|
+
var F;
|
|
65
|
+
return r(), s("div", {
|
|
66
|
+
class: "w-full flex flex-col relative",
|
|
67
|
+
ref_key: "rootRef",
|
|
68
|
+
ref: w
|
|
69
|
+
}, [
|
|
70
|
+
e.label ? (r(), s("label", {
|
|
65
71
|
key: 0,
|
|
66
72
|
for: y,
|
|
67
73
|
class: a([
|
|
68
74
|
e.labelColor,
|
|
69
75
|
"absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
|
|
70
|
-
|
|
76
|
+
T.value || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
|
|
71
77
|
])
|
|
72
|
-
}, i(e.label), 3)) :
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
}, i(e.label), 3)) : o("", !0),
|
|
79
|
+
h("div", q({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
|
|
80
|
+
h("div", {
|
|
75
81
|
class: a(["flex flex-row items-center w-full h-full border", [
|
|
76
82
|
e.bgInput,
|
|
77
83
|
e.rounded,
|
|
78
|
-
t(
|
|
84
|
+
t(b) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
|
|
79
85
|
e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
|
|
80
86
|
t(m) ? "bg-red-200 dark:bg-red-900" : ""
|
|
81
87
|
]])
|
|
82
88
|
}, [
|
|
83
|
-
e.prefix ? (
|
|
84
|
-
|
|
89
|
+
e.prefix ? (r(), s("div", X, i(e.prefix), 1)) : o("", !0),
|
|
90
|
+
N.value ? (r(), s("div", {
|
|
85
91
|
key: 1,
|
|
86
92
|
class: a([e.prependInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
|
|
87
93
|
}, [
|
|
88
94
|
c(e.$slots, "prepend-inner")
|
|
89
|
-
], 2)) :
|
|
90
|
-
|
|
95
|
+
], 2)) : o("", !0),
|
|
96
|
+
h("input", {
|
|
91
97
|
ref_key: "inputField",
|
|
92
98
|
ref: k,
|
|
93
|
-
type:
|
|
99
|
+
type: M.value,
|
|
94
100
|
value: t(f),
|
|
95
101
|
id: y,
|
|
96
102
|
placeholder: e.placeholder,
|
|
@@ -98,48 +104,48 @@ const W = { class: "w-full flex flex-col relative" }, X = {
|
|
|
98
104
|
readonly: e.readonly,
|
|
99
105
|
maxlength: e.maxlength,
|
|
100
106
|
autocomplete: "off",
|
|
101
|
-
class: a(["w-full h-full bg-transparent
|
|
107
|
+
class: a(["w-full h-full bg-transparent focus:outline-none p-3", [e.textColor, e.placeholderColor, e.rounded, e.textCenter ? "text-center" : ""]]),
|
|
102
108
|
"aria-invalid": t(m) ? "true" : "false",
|
|
103
109
|
"aria-describedby": t(m) ? `error-${y}` : null,
|
|
104
|
-
onInput: l[0] || (l[0] = (...n) => t(
|
|
105
|
-
onBlur: l[1] || (l[1] = (...n) => t(
|
|
106
|
-
onFocus: l[2] || (l[2] = (...n) => t(
|
|
110
|
+
onInput: l[0] || (l[0] = (...n) => t(g) && t(g)(...n)),
|
|
111
|
+
onBlur: l[1] || (l[1] = (...n) => t(C) && t(C)(...n)),
|
|
112
|
+
onFocus: l[2] || (l[2] = (...n) => t(I) && t(I)(...n)),
|
|
107
113
|
onClick: l[3] || (l[3] = G((n) => p("handleClick"), ["stop"])),
|
|
108
114
|
onKeydown: l[4] || (l[4] = (n) => p("keyDown", n)),
|
|
109
115
|
onKeyup: l[5] || (l[5] = (n) => p("keyUp", n))
|
|
110
116
|
}, null, 42, Y),
|
|
111
|
-
e.clearable && t(f) ? (
|
|
117
|
+
e.clearable && t(f) ? (r(), s("button", {
|
|
112
118
|
key: 2,
|
|
113
119
|
type: "button",
|
|
114
|
-
onClick: l[6] || (l[6] = (...n) => t(
|
|
120
|
+
onClick: l[6] || (l[6] = (...n) => t($) && t($)(...n)),
|
|
115
121
|
class: a(["ml-2", e.textColor]),
|
|
116
122
|
disabled: e.disabled || e.readonly
|
|
117
|
-
}, " × ", 10, Z)) :
|
|
123
|
+
}, " × ", 10, Z)) : o("", !0),
|
|
118
124
|
c(e.$slots, "default"),
|
|
119
|
-
e.type === "password" && e.showPasswordToggle ? (
|
|
120
|
-
J(
|
|
121
|
-
icon:
|
|
122
|
-
onClick:
|
|
125
|
+
e.type === "password" && e.showPasswordToggle ? (r(), s("div", _, [
|
|
126
|
+
J(W, {
|
|
127
|
+
icon: z.value,
|
|
128
|
+
onClick: A
|
|
123
129
|
}, null, 8, ["icon"])
|
|
124
|
-
])) :
|
|
125
|
-
|
|
130
|
+
])) : o("", !0),
|
|
131
|
+
O.value ? (r(), s("div", {
|
|
126
132
|
key: 4,
|
|
127
133
|
class: a([e.appendInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
|
|
128
134
|
}, [
|
|
129
135
|
c(e.$slots, "append-inner")
|
|
130
|
-
], 2)) :
|
|
131
|
-
e.suffix ? (
|
|
136
|
+
], 2)) : o("", !0),
|
|
137
|
+
e.suffix ? (r(), s("div", ee, i(e.suffix), 1)) : o("", !0)
|
|
132
138
|
], 2),
|
|
133
|
-
e.hideDetails ?
|
|
134
|
-
t(m) ? (
|
|
139
|
+
e.hideDetails ? o("", !0) : (r(), s("div", te, [
|
|
140
|
+
t(m) ? (r(), s("div", {
|
|
135
141
|
key: 0,
|
|
136
142
|
id: `error-${y}`,
|
|
137
143
|
class: "text-red-500 text-sm text-center"
|
|
138
|
-
}, i(t(
|
|
139
|
-
e.counter && e.maxlength ? (
|
|
144
|
+
}, i(t(D) || e.errorMessage), 9, le)) : e.hint && (e.persistentHint || t(b)) ? (r(), s("div", ne, i(e.hint), 1)) : o("", !0),
|
|
145
|
+
e.counter && e.maxlength ? (r(), s("div", se, i(((F = t(f)) == null ? void 0 : F.length) || 0) + " / " + i(e.maxlength), 1)) : o("", !0)
|
|
140
146
|
]))
|
|
141
147
|
], 16)
|
|
142
|
-
]);
|
|
148
|
+
], 512);
|
|
143
149
|
};
|
|
144
150
|
}
|
|
145
151
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { debounce as
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
1
|
+
import { ref as a, inject as V, computed as E, watch as F, onUnmounted as T } from "vue";
|
|
2
|
+
import { debounce as j } from "../../../../utils/utils.js";
|
|
3
|
+
function R(u, r) {
|
|
4
|
+
const t = a(u.modelValue), o = a(!1), l = a(""), n = a(!1), g = a(null), h = a(null), s = a(!1), d = V("registerField", null), v = V("unregisterField", null), y = E(() => u.error || !!l.value && n.value), c = async () => {
|
|
5
5
|
for (const e of u.rules) {
|
|
6
6
|
const m = await Promise.resolve(e(t.value));
|
|
7
7
|
if (m !== !0) return m;
|
|
8
8
|
}
|
|
9
9
|
return !0;
|
|
10
|
-
}, f =
|
|
10
|
+
}, f = j(async () => {
|
|
11
11
|
const e = await c();
|
|
12
12
|
l.value = e === !0 ? "" : e;
|
|
13
13
|
}, u.debounce ?? 300);
|
|
@@ -18,45 +18,46 @@ function P(u, r) {
|
|
|
18
18
|
s.value = !1;
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
n.value = !0, r("update:modelValue", t.value), u.validateOnBlur || f();
|
|
22
22
|
});
|
|
23
|
-
const
|
|
23
|
+
const I = (e) => {
|
|
24
24
|
t.value = e.target.value;
|
|
25
|
-
},
|
|
25
|
+
}, b = async () => {
|
|
26
26
|
if (o.value = !1, r("blurInput"), u.validateOnBlur) {
|
|
27
27
|
const e = await c();
|
|
28
28
|
l.value = e === !0 ? "" : e;
|
|
29
29
|
}
|
|
30
|
-
}, b = () => {
|
|
31
|
-
o.value = !0, r("focusInput");
|
|
32
30
|
}, w = () => {
|
|
33
|
-
|
|
31
|
+
o.value = !0, r("focusInput");
|
|
32
|
+
}, B = () => {
|
|
33
|
+
t.value = "", r("update:modelValue", ""), n.value = !0, u.validateOnBlur || f();
|
|
34
34
|
}, i = async () => {
|
|
35
|
-
|
|
35
|
+
n.value = !0;
|
|
36
36
|
const e = await c();
|
|
37
37
|
return l.value = e === !0 ? "" : e, e === !0;
|
|
38
|
-
}, B = () => {
|
|
39
|
-
t.value = u.modelValue, a.value = !1, l.value = "";
|
|
40
38
|
}, O = () => {
|
|
41
|
-
|
|
39
|
+
t.value = u.modelValue, n.value = !1, l.value = "";
|
|
40
|
+
}, x = () => {
|
|
41
|
+
n.value = !1, l.value = "";
|
|
42
42
|
};
|
|
43
|
-
return d && d({ validate: i }),
|
|
43
|
+
return d && d({ validate: i }), T(() => {
|
|
44
44
|
v && v({ validate: i });
|
|
45
45
|
}), {
|
|
46
46
|
inputField: g,
|
|
47
47
|
inputValue: t,
|
|
48
|
+
rootRef: h,
|
|
48
49
|
inputFocused: o,
|
|
49
50
|
validationError: l,
|
|
50
|
-
hasError:
|
|
51
|
-
handleInput:
|
|
52
|
-
handleBlur:
|
|
53
|
-
focusInput:
|
|
51
|
+
hasError: y,
|
|
52
|
+
handleInput: I,
|
|
53
|
+
handleBlur: b,
|
|
54
|
+
focusInput: w,
|
|
54
55
|
validate: i,
|
|
55
|
-
reset:
|
|
56
|
-
resetValidation:
|
|
57
|
-
clearInput:
|
|
56
|
+
reset: O,
|
|
57
|
+
resetValidation: x,
|
|
58
|
+
clearInput: B
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
61
|
export {
|
|
61
|
-
|
|
62
|
+
R as default
|
|
62
63
|
};
|