adverich-kun-ui 0.1.365 → 0.1.366
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.
|
@@ -62,8 +62,8 @@ const e = {
|
|
|
62
62
|
// ***** STYLE ***** //
|
|
63
63
|
height: { default: "h-[500px]" },
|
|
64
64
|
maxHeight: { default: "max-h-1/2" },
|
|
65
|
-
density: { type: String, default: "
|
|
66
|
-
zIndex: { type: String, default: "z-
|
|
65
|
+
density: { type: String, default: "default" },
|
|
66
|
+
zIndex: { type: String, default: "z-250" },
|
|
67
67
|
hideDetails: {
|
|
68
68
|
type: Boolean,
|
|
69
69
|
default: !0
|
|
@@ -1,48 +1,45 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { kunTextareaProps as
|
|
3
|
-
import { useKunTextarea as
|
|
4
|
-
import { renderIconSlot as
|
|
5
|
-
const
|
|
6
|
-
key: 0,
|
|
7
|
-
class: "block text-sm font-medium mb-1"
|
|
8
|
-
}, _ = { class: "relative" }, ee = {
|
|
1
|
+
import { ref as Q, getCurrentInstance as U, computed as p, createElementBlock as l, openBlock as s, mergeProps as B, renderSlot as i, createElementVNode as a, unref as t, createCommentVNode as d, normalizeClass as g, toDisplayString as y, normalizeProps as w, guardReactiveProps as I, createBlock as m, resolveDynamicComponent as k, Fragment as W, renderList as X, withDirectives as Y, vShow as Z, createTextVNode as x } from "vue";
|
|
2
|
+
import { kunTextareaProps as _ } from "../composables/KunTextareaProps.js";
|
|
3
|
+
import { useKunTextarea as ee } from "../composables/useKunTextareaComposable.js";
|
|
4
|
+
import { renderIconSlot as h } from "../../../../utils/renderIcon.js";
|
|
5
|
+
const oe = { class: "relative" }, re = {
|
|
9
6
|
key: 0,
|
|
10
7
|
class: "absolute left-2 top-2 flex items-center"
|
|
11
|
-
},
|
|
8
|
+
}, te = {
|
|
12
9
|
key: 1,
|
|
13
10
|
class: "absolute left-2 top-2 ml-1"
|
|
14
|
-
},
|
|
11
|
+
}, ne = ["value", "rows", "disabled", "readonly", "placeholder"], se = {
|
|
15
12
|
key: 3,
|
|
16
13
|
class: "absolute right-2 top-2 mr-1"
|
|
17
|
-
},
|
|
14
|
+
}, le = {
|
|
18
15
|
key: 4,
|
|
19
16
|
class: "absolute right-2 top-2 flex items-center"
|
|
20
|
-
},
|
|
17
|
+
}, ae = {
|
|
21
18
|
key: 5,
|
|
22
19
|
class: "mt-1"
|
|
23
|
-
},
|
|
20
|
+
}, ie = { class: "h-1 w-full bg-gray-200 rounded overflow-hidden" }, de = {
|
|
24
21
|
key: 7,
|
|
25
22
|
class: "text-xs text-right mt-1 text-gray-400"
|
|
26
|
-
},
|
|
23
|
+
}, ue = { key: 0 }, ge = {
|
|
27
24
|
__name: "KunTextarea",
|
|
28
|
-
props:
|
|
25
|
+
props: _,
|
|
29
26
|
emits: ["update:modelValue", "click:clear", "click:control", "update:focused", "mousedown:control"],
|
|
30
|
-
setup(
|
|
31
|
-
const
|
|
27
|
+
setup(S, { expose: D, emit: F }) {
|
|
28
|
+
const o = S, R = F, u = Q(null), A = `textarea-${U().uid}`, M = p(() => v.value || !!c.value || o.dirty), {
|
|
32
29
|
isFocused: v,
|
|
33
30
|
internalValue: c,
|
|
34
31
|
rootRef: V,
|
|
35
|
-
updateValue:
|
|
32
|
+
updateValue: P,
|
|
36
33
|
handleClear: z,
|
|
37
|
-
adjustHeight:
|
|
38
|
-
validate:
|
|
39
|
-
reset:
|
|
40
|
-
resetValidation:
|
|
34
|
+
adjustHeight: T,
|
|
35
|
+
validate: E,
|
|
36
|
+
reset: G,
|
|
37
|
+
resetValidation: N,
|
|
41
38
|
hasError: f,
|
|
42
|
-
displayedMessages:
|
|
43
|
-
} =
|
|
44
|
-
const e = !!
|
|
45
|
-
switch (
|
|
39
|
+
displayedMessages: C
|
|
40
|
+
} = ee(o, R, u), H = p(() => {
|
|
41
|
+
const e = !!o.bgColor;
|
|
42
|
+
switch (o.variant) {
|
|
46
43
|
case "filled":
|
|
47
44
|
return [
|
|
48
45
|
e ? "" : "bg-gray-100 dark:bg-gray-900",
|
|
@@ -60,82 +57,76 @@ const x = {
|
|
|
60
57
|
default:
|
|
61
58
|
return "";
|
|
62
59
|
}
|
|
63
|
-
}),
|
|
64
|
-
switch (r.density) {
|
|
65
|
-
case "comfortable":
|
|
66
|
-
return "py-2";
|
|
67
|
-
case "compact":
|
|
68
|
-
return "py-1 text-sm";
|
|
69
|
-
default:
|
|
70
|
-
return "";
|
|
71
|
-
}
|
|
72
|
-
}), N = p(() => [
|
|
60
|
+
}), K = p(() => o.density === "compact" ? "p-1" : o.density === "comfortable" ? "p-2" : "p-3"), j = p(() => [
|
|
73
61
|
"w-full resize-none p-2 transition-colors duration-150",
|
|
74
|
-
|
|
62
|
+
o.inputClass,
|
|
75
63
|
{
|
|
76
|
-
"rounded-md": !
|
|
77
|
-
"rounded-none":
|
|
78
|
-
[`rounded-${
|
|
79
|
-
"shadow-md":
|
|
80
|
-
"shadow-none":
|
|
81
|
-
[`text-${
|
|
82
|
-
[`${
|
|
83
|
-
"text-gray-500 bg-gray-200":
|
|
84
|
-
"focus:outline-none focus:ring-2": !
|
|
85
|
-
[`focus:ring-${
|
|
64
|
+
"rounded-md": !o.tile,
|
|
65
|
+
"rounded-none": o.tile,
|
|
66
|
+
[`rounded-${o.rounded}`]: typeof o.rounded == "string" || typeof o.rounded == "number",
|
|
67
|
+
"shadow-md": o.variant === "solo" && !o.flat,
|
|
68
|
+
"shadow-none": o.flat,
|
|
69
|
+
[`text-${o.textColor}`]: o.textColor,
|
|
70
|
+
[`${o.bgColor}`]: o.bgColor,
|
|
71
|
+
"text-gray-500 bg-gray-200": o.disabled,
|
|
72
|
+
"focus:outline-none focus:ring-2": !o.disabled,
|
|
73
|
+
[`focus:ring-${o.color}`]: o.color && !o.disabled && !f.value,
|
|
86
74
|
"border-red-500 ring-red-500 focus:ring-red-500": f.value,
|
|
87
|
-
"resize-none":
|
|
88
|
-
resize: !
|
|
75
|
+
"resize-none": o.noResize || o.autoGrow,
|
|
76
|
+
resize: !o.noResize && !o.autoGrow
|
|
89
77
|
}
|
|
90
|
-
]),
|
|
91
|
-
"relative w-full",
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
]),
|
|
78
|
+
]), L = p(() => [
|
|
79
|
+
"relative w-full flex flex-col",
|
|
80
|
+
o.class,
|
|
81
|
+
o.wrapperClass
|
|
82
|
+
]), $ = p(() => o.counter === !0 ? 25 : typeof o.counter == "number" || typeof o.counter == "string" ? o.counter : null), q = p(() => o.persistentCounter ? !0 : !!o.counter && v.value), J = p(() => typeof o.clearIcon == "string" ? o.clearIcon : "i-heroicons-x-mark-20-solid");
|
|
95
83
|
function b(e, n) {
|
|
96
84
|
R(`click:${n}`, e);
|
|
97
85
|
}
|
|
98
|
-
return
|
|
99
|
-
validate:
|
|
100
|
-
reset:
|
|
101
|
-
resetValidation:
|
|
102
|
-
errorMessages:
|
|
86
|
+
return D({
|
|
87
|
+
validate: E,
|
|
88
|
+
reset: G,
|
|
89
|
+
resetValidation: N,
|
|
90
|
+
errorMessages: C,
|
|
103
91
|
isValid: p(() => !f.value),
|
|
104
92
|
rootRef: V,
|
|
105
93
|
focus: () => {
|
|
106
94
|
var e;
|
|
107
95
|
return (e = u.value) == null ? void 0 : e.focus();
|
|
108
96
|
}
|
|
109
|
-
}), (e, n) => (s(), l("div",
|
|
110
|
-
class:
|
|
97
|
+
}), (e, n) => (s(), l("div", B({
|
|
98
|
+
class: L.value,
|
|
111
99
|
ref_key: "rootRef",
|
|
112
100
|
ref: V
|
|
113
101
|
}, e.$attrs), [
|
|
114
|
-
i(e.$slots, "label",
|
|
115
|
-
var
|
|
116
|
-
return (
|
|
102
|
+
i(e.$slots, "label", B({ for: A }, { label: e.label, isFocused: t(v), isActive: !!t(c), controlRef: u.value, focus: () => {
|
|
103
|
+
var r;
|
|
104
|
+
return (r = u.value) == null ? void 0 : r.focus();
|
|
117
105
|
}, blur: () => {
|
|
118
|
-
var
|
|
119
|
-
return (
|
|
120
|
-
}, props:
|
|
121
|
-
e.label ? (s(), l("label",
|
|
106
|
+
var r;
|
|
107
|
+
return (r = u.value) == null ? void 0 : r.blur();
|
|
108
|
+
}, props: o }), () => [
|
|
109
|
+
e.label ? (s(), l("label", {
|
|
110
|
+
key: 0,
|
|
111
|
+
class: g(["absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10", M.value || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"])
|
|
112
|
+
}, y(e.label), 3)) : d("", !0)
|
|
122
113
|
]),
|
|
123
|
-
a("div",
|
|
124
|
-
e.prependIcon || e.$slots.prepend ? (s(), l("div",
|
|
125
|
-
i(e.$slots, "prepend",
|
|
114
|
+
a("div", oe, [
|
|
115
|
+
e.prependIcon || e.$slots.prepend ? (s(), l("div", re, [
|
|
116
|
+
i(e.$slots, "prepend", w(I(e.prependSlotBindings)), () => [
|
|
126
117
|
a("div", {
|
|
127
|
-
onClick: n[0] || (n[0] = (
|
|
118
|
+
onClick: n[0] || (n[0] = (r) => b(r, "prepend"))
|
|
128
119
|
}, [
|
|
129
|
-
(s(),
|
|
120
|
+
(s(), m(k(t(h)(e.prependIcon))))
|
|
130
121
|
])
|
|
131
122
|
])
|
|
132
123
|
])) : d("", !0),
|
|
133
|
-
e.prependInnerIcon || e.$slots["prepend-inner"] ? (s(), l("div",
|
|
124
|
+
e.prependInnerIcon || e.$slots["prepend-inner"] ? (s(), l("div", te, [
|
|
134
125
|
i(e.$slots, "prepend-inner", {}, () => [
|
|
135
126
|
a("div", {
|
|
136
|
-
onClick: n[1] || (n[1] = (
|
|
127
|
+
onClick: n[1] || (n[1] = (r) => b(r, "prependInner"))
|
|
137
128
|
}, [
|
|
138
|
-
(s(),
|
|
129
|
+
(s(), m(k(t(h)(e.prependInnerIcon))))
|
|
139
130
|
])
|
|
140
131
|
])
|
|
141
132
|
])) : d("", !0),
|
|
@@ -147,65 +138,65 @@ const x = {
|
|
|
147
138
|
disabled: e.disabled,
|
|
148
139
|
readonly: e.readonly,
|
|
149
140
|
placeholder: e.placeholder,
|
|
150
|
-
onInput: n[2] || (n[2] = (
|
|
151
|
-
t(
|
|
141
|
+
onInput: n[2] || (n[2] = (r) => {
|
|
142
|
+
t(P)(r.target.value), e.autoGrow && t(T)();
|
|
152
143
|
}),
|
|
153
|
-
onFocus: n[3] || (n[3] = (
|
|
144
|
+
onFocus: n[3] || (n[3] = (r) => {
|
|
154
145
|
v.value = !0, e.$emit("update:focused", !0);
|
|
155
146
|
}),
|
|
156
|
-
onBlur: n[4] || (n[4] = (
|
|
147
|
+
onBlur: n[4] || (n[4] = (r) => {
|
|
157
148
|
v.value = !1, e.$emit("update:focused", !1);
|
|
158
149
|
}),
|
|
159
|
-
onClick: n[5] || (n[5] = (
|
|
160
|
-
onMousedown: n[6] || (n[6] = (
|
|
161
|
-
class: g([
|
|
162
|
-
}, null, 42,
|
|
150
|
+
onClick: n[5] || (n[5] = (r) => e.$emit("click:control", r)),
|
|
151
|
+
onMousedown: n[6] || (n[6] = (r) => e.$emit("mousedown:control", r)),
|
|
152
|
+
class: g([[H.value, K.value, j.value], "py-3"])
|
|
153
|
+
}, null, 42, ne),
|
|
163
154
|
e.clearable && t(c) ? (s(), l("div", {
|
|
164
155
|
key: 2,
|
|
165
156
|
class: g(["absolute right-2 top-2", { "opacity-100": e.persistentClear, "hover:opacity-100 opacity-0 transition-opacity duration-200": !e.persistentClear }])
|
|
166
157
|
}, [
|
|
167
|
-
i(e.$slots, "clear",
|
|
168
|
-
var
|
|
169
|
-
return (
|
|
158
|
+
i(e.$slots, "clear", w(I({ isActive: !!t(c), isFocused: t(v), controlRef: u.value, focus: () => {
|
|
159
|
+
var r;
|
|
160
|
+
return (r = u.value) == null ? void 0 : r.focus();
|
|
170
161
|
}, blur: () => {
|
|
171
|
-
var
|
|
172
|
-
return (
|
|
173
|
-
}, props:
|
|
162
|
+
var r;
|
|
163
|
+
return (r = u.value) == null ? void 0 : r.blur();
|
|
164
|
+
}, props: o })), () => [
|
|
174
165
|
a("button", {
|
|
175
166
|
type: "button",
|
|
176
|
-
onClick: n[7] || (n[7] = (...
|
|
167
|
+
onClick: n[7] || (n[7] = (...r) => t(z) && t(z)(...r)),
|
|
177
168
|
class: "text-gray-500 hover:text-gray-700"
|
|
178
169
|
}, [
|
|
179
170
|
a("span", {
|
|
180
|
-
class: g(
|
|
171
|
+
class: g(J.value)
|
|
181
172
|
}, null, 2)
|
|
182
173
|
])
|
|
183
174
|
])
|
|
184
175
|
], 2)) : d("", !0),
|
|
185
|
-
e.appendInnerIcon || e.$slots["append-inner"] ? (s(), l("div",
|
|
176
|
+
e.appendInnerIcon || e.$slots["append-inner"] ? (s(), l("div", se, [
|
|
186
177
|
i(e.$slots, "append-inner", {}, () => [
|
|
187
178
|
a("div", {
|
|
188
|
-
onClick: n[8] || (n[8] = (
|
|
179
|
+
onClick: n[8] || (n[8] = (r) => b(r, "appendInner"))
|
|
189
180
|
}, [
|
|
190
|
-
(s(),
|
|
181
|
+
(s(), m(k(t(h)(e.appendInnerIcon))))
|
|
191
182
|
])
|
|
192
183
|
])
|
|
193
184
|
])) : d("", !0),
|
|
194
|
-
e.appendIcon || e.$slots.append ? (s(), l("div",
|
|
195
|
-
i(e.$slots, "append",
|
|
185
|
+
e.appendIcon || e.$slots.append ? (s(), l("div", le, [
|
|
186
|
+
i(e.$slots, "append", w(I(e.appendSlotBindings)), () => [
|
|
196
187
|
a("div", {
|
|
197
|
-
onClick: n[9] || (n[9] = (
|
|
188
|
+
onClick: n[9] || (n[9] = (r) => b(r, "append"))
|
|
198
189
|
}, [
|
|
199
|
-
(s(),
|
|
190
|
+
(s(), m(k(t(h)(e.appendIcon))))
|
|
200
191
|
])
|
|
201
192
|
])
|
|
202
193
|
])) : d("", !0),
|
|
203
|
-
e.loading ? (s(), l("div",
|
|
194
|
+
e.loading ? (s(), l("div", ae, [
|
|
204
195
|
i(e.$slots, "loader", {
|
|
205
196
|
color: e.loadingColor,
|
|
206
197
|
isActive: !0
|
|
207
198
|
}, () => [
|
|
208
|
-
a("div",
|
|
199
|
+
a("div", ie, [
|
|
209
200
|
a("div", {
|
|
210
201
|
class: g(["h-full transition-all duration-300", [`${e.loadingColor}`]]),
|
|
211
202
|
style: { width: "100%" }
|
|
@@ -213,34 +204,34 @@ const x = {
|
|
|
213
204
|
])
|
|
214
205
|
])
|
|
215
206
|
])) : d("", !0),
|
|
216
|
-
!e.hideDetails || e.hideDetails === "auto" && (t(
|
|
207
|
+
!e.hideDetails || e.hideDetails === "auto" && (t(C).length || e.hint) ? (s(), l("div", {
|
|
217
208
|
key: 6,
|
|
218
209
|
class: g(["text-xs mt-1 space-y-1", { "text-red-500": t(f), "text-gray-500": !t(f) }])
|
|
219
210
|
}, [
|
|
220
211
|
i(e.$slots, "details", {}, () => [
|
|
221
|
-
t(f) ? (s(!0), l(
|
|
222
|
-
key:
|
|
223
|
-
message:
|
|
212
|
+
t(f) ? (s(!0), l(W, { key: 0 }, X(t(C), (r, O) => i(e.$slots, "message", {
|
|
213
|
+
key: O,
|
|
214
|
+
message: r
|
|
224
215
|
}, () => [
|
|
225
|
-
a("div", null,
|
|
216
|
+
a("div", null, y(r), 1)
|
|
226
217
|
])), 128)) : e.hint ? i(e.$slots, "hint", {
|
|
227
218
|
key: 1,
|
|
228
219
|
hint: e.hint
|
|
229
220
|
}, () => [
|
|
230
|
-
|
|
231
|
-
[
|
|
221
|
+
Y(a("div", null, y(e.hint), 513), [
|
|
222
|
+
[Z, e.persistentHint || t(v)]
|
|
232
223
|
])
|
|
233
224
|
]) : d("", !0)
|
|
234
225
|
])
|
|
235
226
|
], 2)) : d("", !0),
|
|
236
|
-
|
|
227
|
+
q.value ? (s(), l("div", de, [
|
|
237
228
|
i(e.$slots, "counter", {
|
|
238
229
|
counter: t(c).length,
|
|
239
|
-
max:
|
|
230
|
+
max: $.value,
|
|
240
231
|
value: t(c).length
|
|
241
232
|
}, () => [
|
|
242
|
-
|
|
243
|
-
|
|
233
|
+
x(y(t(c).length), 1),
|
|
234
|
+
$.value ? (s(), l("span", ue, " / " + y($.value), 1)) : d("", !0)
|
|
244
235
|
])
|
|
245
236
|
])) : d("", !0)
|
|
246
237
|
])
|
|
@@ -248,5 +239,5 @@ const x = {
|
|
|
248
239
|
}
|
|
249
240
|
};
|
|
250
241
|
export {
|
|
251
|
-
|
|
242
|
+
ge as default
|
|
252
243
|
};
|