adverich-kun-ui 0.1.184 → 0.1.186
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ref as L, computed as p, createElementBlock as l, openBlock as s, normalizeClass as
|
|
1
|
+
import { ref as L, computed as p, createElementBlock as l, openBlock as s, normalizeClass as m, renderSlot as i, createElementVNode as a, normalizeProps as y, guardReactiveProps as k, unref as n, createCommentVNode as d, toDisplayString as b, createBlock as h, resolveDynamicComponent as C, Fragment as q, renderList as J, withDirectives as O, vShow as Q, createTextVNode as U } from "vue";
|
|
2
2
|
import { kunTextareaProps as W } from "../composables/KunTextareaProps.js";
|
|
3
3
|
import { useKunTextarea as X } from "../composables/useKunTextareaComposable.js";
|
|
4
|
-
import { renderIconSlot as
|
|
4
|
+
import { renderIconSlot as $ } from "../../../../utils/renderIcon.js";
|
|
5
5
|
const Y = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "block text-sm font-medium mb-1"
|
|
@@ -27,8 +27,8 @@ const Y = {
|
|
|
27
27
|
__name: "KunTextarea",
|
|
28
28
|
props: W,
|
|
29
29
|
emits: ["update:modelValue", "click:clear", "click:control", "update:focused", "mousedown:control"],
|
|
30
|
-
setup(
|
|
31
|
-
const r =
|
|
30
|
+
setup(B, { expose: R, emit: S }) {
|
|
31
|
+
const r = B, V = S, u = L(null), {
|
|
32
32
|
isFocused: v,
|
|
33
33
|
internalValue: c,
|
|
34
34
|
updateValue: D,
|
|
@@ -37,18 +37,25 @@ const Y = {
|
|
|
37
37
|
validate: M,
|
|
38
38
|
reset: T,
|
|
39
39
|
resetValidation: A,
|
|
40
|
-
hasError:
|
|
40
|
+
hasError: f,
|
|
41
41
|
displayedMessages: w
|
|
42
42
|
} = X(r, V, u), E = p(() => {
|
|
43
|
+
const e = !!r.bgColor;
|
|
43
44
|
switch (r.variant) {
|
|
44
45
|
case "filled":
|
|
45
|
-
return
|
|
46
|
+
return [
|
|
47
|
+
e ? "" : "bg-gray-100 dark:bg-gray-900",
|
|
48
|
+
"border border-transparent"
|
|
49
|
+
];
|
|
46
50
|
case "outlined":
|
|
47
51
|
return "border border-gray-300 bg-transparent";
|
|
48
52
|
case "underlined":
|
|
49
53
|
return "border-b border-gray-300 bg-transparent rounded-none";
|
|
50
54
|
case "solo":
|
|
51
|
-
return
|
|
55
|
+
return [
|
|
56
|
+
e ? "" : "bg-white dark:bg-black",
|
|
57
|
+
"shadow-md border-transparent"
|
|
58
|
+
];
|
|
52
59
|
default:
|
|
53
60
|
return "";
|
|
54
61
|
}
|
|
@@ -70,12 +77,12 @@ const Y = {
|
|
|
70
77
|
[`rounded-${r.rounded}`]: typeof r.rounded == "string" || typeof r.rounded == "number",
|
|
71
78
|
"shadow-md": r.variant === "solo" && !r.flat,
|
|
72
79
|
"shadow-none": r.flat,
|
|
73
|
-
[`text-${r.
|
|
74
|
-
[
|
|
80
|
+
[`text-${r.textColor}`]: r.textColor,
|
|
81
|
+
[`${r.bgColor}`]: r.bgColor,
|
|
75
82
|
"text-gray-500 bg-gray-200": r.disabled,
|
|
76
83
|
"focus:outline-none focus:ring-2": !r.disabled,
|
|
77
|
-
[`focus:ring-${r.color}`]: r.color && !r.disabled && !
|
|
78
|
-
"border-red-500 ring-red-500 focus:ring-red-500":
|
|
84
|
+
[`focus:ring-${r.color}`]: r.color && !r.disabled && !f.value,
|
|
85
|
+
"border-red-500 ring-red-500 focus:ring-red-500": f.value,
|
|
79
86
|
"resize-none": r.noResize || r.autoGrow,
|
|
80
87
|
resize: !r.noResize && !r.autoGrow
|
|
81
88
|
}
|
|
@@ -87,14 +94,14 @@ const Y = {
|
|
|
87
94
|
function g(e, t) {
|
|
88
95
|
V(`click:${t}`, e);
|
|
89
96
|
}
|
|
90
|
-
return
|
|
97
|
+
return R({
|
|
91
98
|
validate: M,
|
|
92
99
|
reset: T,
|
|
93
100
|
resetValidation: A,
|
|
94
101
|
errorMessages: w,
|
|
95
|
-
isValid: p(() => !
|
|
102
|
+
isValid: p(() => !f.value)
|
|
96
103
|
}), (e, t) => (s(), l("div", {
|
|
97
|
-
class:
|
|
104
|
+
class: m(P.value)
|
|
98
105
|
}, [
|
|
99
106
|
i(e.$slots, "label", y(k({ label: e.label, isFocused: n(v), isActive: !!n(c), controlRef: u.value, focus: () => {
|
|
100
107
|
var o;
|
|
@@ -103,7 +110,7 @@ const Y = {
|
|
|
103
110
|
var o;
|
|
104
111
|
return (o = u.value) == null ? void 0 : o.blur();
|
|
105
112
|
}, props: r })), () => [
|
|
106
|
-
e.label ? (s(), l("label", Y,
|
|
113
|
+
e.label ? (s(), l("label", Y, b(e.label), 1)) : d("", !0)
|
|
107
114
|
]),
|
|
108
115
|
a("div", Z, [
|
|
109
116
|
e.prependIcon || e.$slots.prepend ? (s(), l("div", x, [
|
|
@@ -111,7 +118,7 @@ const Y = {
|
|
|
111
118
|
a("div", {
|
|
112
119
|
onClick: t[0] || (t[0] = (o) => g(o, "prepend"))
|
|
113
120
|
}, [
|
|
114
|
-
(s(), h(
|
|
121
|
+
(s(), h(C(n($)(e.prependIcon))))
|
|
115
122
|
])
|
|
116
123
|
])
|
|
117
124
|
])) : d("", !0),
|
|
@@ -120,7 +127,7 @@ const Y = {
|
|
|
120
127
|
a("div", {
|
|
121
128
|
onClick: t[1] || (t[1] = (o) => g(o, "prependInner"))
|
|
122
129
|
}, [
|
|
123
|
-
(s(), h(
|
|
130
|
+
(s(), h(C(n($)(e.prependInnerIcon))))
|
|
124
131
|
])
|
|
125
132
|
])
|
|
126
133
|
])) : d("", !0),
|
|
@@ -143,11 +150,11 @@ const Y = {
|
|
|
143
150
|
}),
|
|
144
151
|
onClick: t[5] || (t[5] = (o) => e.$emit("click:control", o)),
|
|
145
152
|
onMousedown: t[6] || (t[6] = (o) => e.$emit("mousedown:control", o)),
|
|
146
|
-
class:
|
|
153
|
+
class: m([E.value, G.value, N.value])
|
|
147
154
|
}, null, 42, ee),
|
|
148
155
|
e.clearable && n(c) ? (s(), l("div", {
|
|
149
156
|
key: 2,
|
|
150
|
-
class:
|
|
157
|
+
class: m(["absolute right-2 top-2", { "opacity-100": e.persistentClear, "hover:opacity-100 opacity-0 transition-opacity duration-200": !e.persistentClear }])
|
|
151
158
|
}, [
|
|
152
159
|
i(e.$slots, "clear", y(k({ isActive: !!n(c), isFocused: n(v), controlRef: u.value, focus: () => {
|
|
153
160
|
var o;
|
|
@@ -162,7 +169,7 @@ const Y = {
|
|
|
162
169
|
class: "text-gray-500 hover:text-gray-700"
|
|
163
170
|
}, [
|
|
164
171
|
a("span", {
|
|
165
|
-
class:
|
|
172
|
+
class: m(K.value)
|
|
166
173
|
}, null, 2)
|
|
167
174
|
])
|
|
168
175
|
])
|
|
@@ -172,7 +179,7 @@ const Y = {
|
|
|
172
179
|
a("div", {
|
|
173
180
|
onClick: t[8] || (t[8] = (o) => g(o, "appendInner"))
|
|
174
181
|
}, [
|
|
175
|
-
(s(), h(
|
|
182
|
+
(s(), h(C(n($)(e.appendInnerIcon))))
|
|
176
183
|
])
|
|
177
184
|
])
|
|
178
185
|
])) : d("", !0),
|
|
@@ -181,7 +188,7 @@ const Y = {
|
|
|
181
188
|
a("div", {
|
|
182
189
|
onClick: t[9] || (t[9] = (o) => g(o, "append"))
|
|
183
190
|
}, [
|
|
184
|
-
(s(), h(
|
|
191
|
+
(s(), h(C(n($)(e.appendIcon))))
|
|
185
192
|
])
|
|
186
193
|
])
|
|
187
194
|
])) : d("", !0),
|
|
@@ -192,7 +199,7 @@ const Y = {
|
|
|
192
199
|
}, () => [
|
|
193
200
|
a("div", te, [
|
|
194
201
|
a("div", {
|
|
195
|
-
class:
|
|
202
|
+
class: m(["h-full transition-all duration-300", [`${e.loadingColor}`]]),
|
|
196
203
|
style: { width: "100%" }
|
|
197
204
|
}, null, 2)
|
|
198
205
|
])
|
|
@@ -200,19 +207,19 @@ const Y = {
|
|
|
200
207
|
])) : d("", !0),
|
|
201
208
|
!e.hideDetails || e.hideDetails === "auto" && (n(w).length || e.hint) ? (s(), l("div", {
|
|
202
209
|
key: 6,
|
|
203
|
-
class:
|
|
210
|
+
class: m(["text-xs mt-1 space-y-1", { "text-red-500": n(f), "text-gray-500": !n(f) }])
|
|
204
211
|
}, [
|
|
205
212
|
i(e.$slots, "details", {}, () => [
|
|
206
|
-
n(
|
|
213
|
+
n(f) ? (s(!0), l(q, { key: 0 }, J(n(w), (o, j) => i(e.$slots, "message", {
|
|
207
214
|
key: j,
|
|
208
215
|
message: o
|
|
209
216
|
}, () => [
|
|
210
|
-
a("div", null,
|
|
217
|
+
a("div", null, b(o), 1)
|
|
211
218
|
])), 128)) : e.hint ? i(e.$slots, "hint", {
|
|
212
219
|
key: 1,
|
|
213
220
|
hint: e.hint
|
|
214
221
|
}, () => [
|
|
215
|
-
O(a("div", null,
|
|
222
|
+
O(a("div", null, b(e.hint), 513), [
|
|
216
223
|
[Q, e.persistentHint || n(v)]
|
|
217
224
|
])
|
|
218
225
|
]) : d("", !0)
|
|
@@ -224,8 +231,8 @@ const Y = {
|
|
|
224
231
|
max: I.value,
|
|
225
232
|
value: n(c).length
|
|
226
233
|
}, () => [
|
|
227
|
-
U(
|
|
228
|
-
I.value ? (s(), l("span", le, " / " +
|
|
234
|
+
U(b(n(c).length), 1),
|
|
235
|
+
I.value ? (s(), l("span", le, " / " + b(I.value), 1)) : d("", !0)
|
|
229
236
|
])
|
|
230
237
|
])) : d("", !0)
|
|
231
238
|
])
|
|
@@ -16,6 +16,7 @@ const e = {
|
|
|
16
16
|
type: [String, Function, Object],
|
|
17
17
|
default: "i-mdi-close"
|
|
18
18
|
},
|
|
19
|
+
persistentClear: Boolean,
|
|
19
20
|
disabled: Boolean,
|
|
20
21
|
readonly: Boolean,
|
|
21
22
|
variant: { type: String, default: "filled" },
|
|
@@ -26,7 +27,7 @@ const e = {
|
|
|
26
27
|
flat: Boolean,
|
|
27
28
|
color: String,
|
|
28
29
|
bgColor: String,
|
|
29
|
-
|
|
30
|
+
textColor: String,
|
|
30
31
|
iconColor: [String, Boolean],
|
|
31
32
|
glow: Boolean,
|
|
32
33
|
class: [String, Array, Object],
|