adverich-kun-ui 0.1.628 → 0.1.630
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/AGENTS.md +4 -0
- package/dist/AGENTS.md +4 -0
- package/dist/components/KunFileInput/src/components/KunFileInput.js +126 -66
- package/dist/components/KunFileInput/src/composables/kunFileInputProps.js +36 -3
- package/dist/components/KunTextarea/src/components/KunTextarea.js +92 -92
- package/dist/utils/renderIcon.js +10 -9
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -672,6 +672,10 @@ Input de archivos.
|
|
|
672
672
|
<KunFileInput v-model="files" label="Subir archivo" multiple clearable />
|
|
673
673
|
```
|
|
674
674
|
|
|
675
|
+
**Eventos:** update:modelValue, change, click:clear, click:control, update:focused
|
|
676
|
+
|
|
677
|
+
**Nota:** usa `inheritAttrs: false` y reenvía `$attrs` al contenedor interno, de modo que `@change`/`@click` y `id`/`aria-*` no se duplican en el DOM.
|
|
678
|
+
|
|
675
679
|
---
|
|
676
680
|
|
|
677
681
|
### KunDatePicker
|
package/dist/AGENTS.md
CHANGED
|
@@ -672,6 +672,10 @@ Input de archivos.
|
|
|
672
672
|
<KunFileInput v-model="files" label="Subir archivo" multiple clearable />
|
|
673
673
|
```
|
|
674
674
|
|
|
675
|
+
**Eventos:** update:modelValue, change, click:clear, click:control, update:focused
|
|
676
|
+
|
|
677
|
+
**Nota:** usa `inheritAttrs: false` y reenvía `$attrs` al contenedor interno, de modo que `@change`/`@click` y `id`/`aria-*` no se duplican en el DOM.
|
|
678
|
+
|
|
675
679
|
---
|
|
676
680
|
|
|
677
681
|
### KunDatePicker
|
|
@@ -1,54 +1,62 @@
|
|
|
1
1
|
import { __exportAll as e } from "../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import t from "../../../KunIcon/src/components/KunIcon.js";
|
|
3
|
+
import { icons as n } from "../../../../icons/index.js";
|
|
4
|
+
import { kunFileInputProps as r } from "../composables/kunFileInputProps.js";
|
|
5
|
+
import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, mergeProps as f, normalizeClass as p, openBlock as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, unref as y, watch as b, withModifiers as x } from "vue";
|
|
5
6
|
//#region src/components/KunFileInput/src/components/KunFileInput.vue
|
|
6
|
-
var
|
|
7
|
+
var S = /* @__PURE__ */ e({ default: () => F }), C = { class: "relative flex w-full flex-col" }, w = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "flex items-center"
|
|
10
|
+
}, T = ["multiple", "disabled"], E = { class: "flex-1 truncate" }, D = { key: 0 }, O = {
|
|
7
11
|
key: 1,
|
|
8
12
|
class: "text-ui-disabled"
|
|
9
|
-
},
|
|
13
|
+
}, k = {
|
|
14
|
+
key: 3,
|
|
15
|
+
class: "flex items-center"
|
|
16
|
+
}, A = {
|
|
10
17
|
key: 1,
|
|
11
18
|
class: "mt-1 text-sm"
|
|
12
|
-
},
|
|
19
|
+
}, j = {
|
|
13
20
|
key: 0,
|
|
14
21
|
class: "text-ui-error"
|
|
15
|
-
},
|
|
22
|
+
}, M = {
|
|
16
23
|
key: 1,
|
|
17
24
|
class: "text-ui-muted"
|
|
18
|
-
},
|
|
25
|
+
}, N = {
|
|
19
26
|
key: 2,
|
|
20
27
|
class: "mt-1 text-xs text-ui-disabled text-right"
|
|
21
|
-
},
|
|
28
|
+
}, P = { key: 0 }, F = /*@__PURE__*/ Object.assign({ inheritAttrs: !1 }, {
|
|
22
29
|
__name: "KunFileInput",
|
|
23
|
-
props:
|
|
30
|
+
props: r,
|
|
24
31
|
emits: [
|
|
25
32
|
"update:modelValue",
|
|
26
33
|
"click:clear",
|
|
27
34
|
"click:control",
|
|
28
|
-
"update:focused"
|
|
35
|
+
"update:focused",
|
|
36
|
+
"change"
|
|
29
37
|
],
|
|
30
|
-
setup(e, { expose:
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
setup(e, { expose: r, emit: S }) {
|
|
39
|
+
let F = e, I = S, L = h(null), R = h(!1), z = h([]), B = h([]);
|
|
40
|
+
b(() => F.modelValue, (e) => {
|
|
41
|
+
z.value = Array.isArray(e) ? e : e ? [e] : [];
|
|
34
42
|
}, { immediate: !0 });
|
|
35
|
-
function
|
|
43
|
+
function V(e) {
|
|
36
44
|
let t = e.target.files;
|
|
37
45
|
if (!t) return;
|
|
38
46
|
let n = Array.from(t);
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
function V() {
|
|
42
|
-
R.value = [], F("update:modelValue", P.multiple ? [] : null), F("click:clear"), z.value = [];
|
|
47
|
+
z.value = F.multiple ? n : [n[0]], I("update:modelValue", F.multiple ? n : n[0]), I("change", e), Y();
|
|
43
48
|
}
|
|
44
49
|
function H() {
|
|
45
|
-
|
|
50
|
+
z.value = [], I("update:modelValue", F.multiple ? [] : null), I("click:clear"), B.value = [];
|
|
46
51
|
}
|
|
47
52
|
function U() {
|
|
48
|
-
|
|
53
|
+
R.value = !0, I("update:focused", !0);
|
|
54
|
+
}
|
|
55
|
+
function W() {
|
|
56
|
+
R.value = !1, I("update:focused", !1);
|
|
49
57
|
}
|
|
50
|
-
let
|
|
51
|
-
let e =
|
|
58
|
+
let G = a(() => z.value.map((e) => e.name)), K = a(() => F.dirty || R.value || G.value.length > 0), q = a(() => z.value.reduce((e, t) => e + t.size, 0)), J = a(() => {
|
|
59
|
+
let e = q.value, t = F.showSize === 1024 ? 1024 : 1e3, n = [
|
|
52
60
|
"B",
|
|
53
61
|
"KB",
|
|
54
62
|
"MB",
|
|
@@ -57,67 +65,119 @@ var y = /* @__PURE__ */ e({ default: () => P }), b = { class: "relative flex w-f
|
|
|
57
65
|
for (; i >= t && r < n.length - 1;) i /= t, r++;
|
|
58
66
|
return `${i.toFixed(1)} ${n[r]}`;
|
|
59
67
|
});
|
|
60
|
-
async function
|
|
68
|
+
async function Y(e = !1) {
|
|
61
69
|
let t = [];
|
|
62
|
-
for (let e of
|
|
63
|
-
let n = typeof e != "function" || e(
|
|
70
|
+
for (let e of F.rules) {
|
|
71
|
+
let n = typeof e != "function" || e(F.multiple ? z.value : z.value[0]);
|
|
64
72
|
typeof n == "string" ? t.push(n) : n === !1 && t.push("Valor inválido");
|
|
65
73
|
}
|
|
66
|
-
return
|
|
67
|
-
}
|
|
68
|
-
async function Y() {
|
|
69
|
-
V();
|
|
74
|
+
return B.value = t, !e && t.length && I("update:focused", !0), t;
|
|
70
75
|
}
|
|
71
76
|
async function X() {
|
|
72
|
-
|
|
77
|
+
H();
|
|
78
|
+
}
|
|
79
|
+
async function Z() {
|
|
80
|
+
B.value = [];
|
|
73
81
|
}
|
|
74
|
-
return
|
|
75
|
-
reset:
|
|
76
|
-
resetValidation:
|
|
77
|
-
validate:
|
|
78
|
-
isValid:
|
|
79
|
-
errorMessages:
|
|
80
|
-
}), (e,
|
|
81
|
-
e.label ? (
|
|
82
|
+
return r({
|
|
83
|
+
reset: X,
|
|
84
|
+
resetValidation: Z,
|
|
85
|
+
validate: Y,
|
|
86
|
+
isValid: a(() => B.value.length === 0),
|
|
87
|
+
errorMessages: B
|
|
88
|
+
}), (e, r) => (m(), c("div", C, [
|
|
89
|
+
e.label ? (m(), c("label", {
|
|
82
90
|
key: 0,
|
|
83
|
-
class:
|
|
84
|
-
},
|
|
85
|
-
|
|
91
|
+
class: p(["absolute left-2 z-10 px-1 text-ui transition-all duration-200 ease-in-out pointer-events-none select-none", K.value ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"])
|
|
92
|
+
}, v(e.label), 3)) : s("", !0),
|
|
93
|
+
l("div", f({ class: ["flex items-center gap-2 rounded px-3 py-2 cursor-pointer transition", [
|
|
86
94
|
e.variant === "outlined" ? "border border-ui" : e.variant === "solo" ? "border-ui shadow-inner" : "bg-surface border border-ui",
|
|
87
95
|
e.disabled ? "border-ui cursor-not-allowed" : "hover:border-ui-primary",
|
|
88
|
-
e.error ||
|
|
89
|
-
|
|
96
|
+
e.error || B.value.length ? "border-error" : "",
|
|
97
|
+
R.value ? "ring-2 ring-ui-focus" : ""
|
|
90
98
|
]] }, e.$attrs, {
|
|
91
|
-
onClick:
|
|
92
|
-
onFocusin:
|
|
93
|
-
onFocusout:
|
|
99
|
+
onClick: r[0] ||= () => L.value?.click(),
|
|
100
|
+
onFocusin: U,
|
|
101
|
+
onFocusout: W
|
|
94
102
|
}), [
|
|
95
|
-
m(e.$slots, "prepend", {}, () => [e.prependIcon ? (
|
|
96
|
-
|
|
103
|
+
e.prependIcon || e.$slots.prepend ? (m(), c("span", w, [_(e.$slots, "prepend", {}, () => [e.prependIcon ? (m(), o(t, {
|
|
104
|
+
key: 0,
|
|
105
|
+
icon: e.prependIcon,
|
|
106
|
+
size: e.iconSize,
|
|
107
|
+
disabled: e.disabled
|
|
108
|
+
}, null, 8, [
|
|
109
|
+
"icon",
|
|
110
|
+
"size",
|
|
111
|
+
"disabled"
|
|
112
|
+
])) : s("", !0)])])) : s("", !0),
|
|
113
|
+
e.prependInnerIcon || e.$slots["prepend-inner"] ? (m(), c("span", {
|
|
114
|
+
key: 1,
|
|
115
|
+
class: p([e.prependInnerClass, "flex items-center"])
|
|
116
|
+
}, [_(e.$slots, "prepend-inner", {}, () => [e.prependInnerIcon ? (m(), o(t, {
|
|
117
|
+
key: 0,
|
|
118
|
+
icon: e.prependInnerIcon,
|
|
119
|
+
size: e.iconSize,
|
|
120
|
+
disabled: e.disabled
|
|
121
|
+
}, null, 8, [
|
|
122
|
+
"icon",
|
|
123
|
+
"size",
|
|
124
|
+
"disabled"
|
|
125
|
+
])) : s("", !0)])], 2)) : s("", !0),
|
|
126
|
+
l("input", {
|
|
97
127
|
ref_key: "inputRef",
|
|
98
|
-
ref:
|
|
128
|
+
ref: L,
|
|
99
129
|
type: "file",
|
|
100
130
|
class: "hidden",
|
|
101
131
|
multiple: e.multiple,
|
|
102
132
|
disabled: e.disabled,
|
|
103
|
-
onChange:
|
|
104
|
-
}, null, 40,
|
|
105
|
-
|
|
106
|
-
fileNames:
|
|
107
|
-
totalBytes:
|
|
108
|
-
totalBytesReadable:
|
|
109
|
-
}, () => [
|
|
110
|
-
|
|
111
|
-
|
|
133
|
+
onChange: V
|
|
134
|
+
}, null, 40, T),
|
|
135
|
+
l("div", E, [_(e.$slots, "selection", {
|
|
136
|
+
fileNames: G.value,
|
|
137
|
+
totalBytes: q.value,
|
|
138
|
+
totalBytesReadable: J.value
|
|
139
|
+
}, () => [G.value.length ? (m(), c("span", D, v(G.value.join(", ")), 1)) : (m(), c("span", O, "Seleccionar archivo"))])]),
|
|
140
|
+
e.appendInnerIcon || e.$slots["append-inner"] ? (m(), c("span", {
|
|
141
|
+
key: 2,
|
|
142
|
+
class: p([e.appendInnerClass, "flex items-center"])
|
|
143
|
+
}, [_(e.$slots, "append-inner", {}, () => [e.appendInnerIcon ? (m(), o(t, {
|
|
144
|
+
key: 0,
|
|
145
|
+
icon: e.appendInnerIcon,
|
|
146
|
+
size: e.iconSize,
|
|
147
|
+
disabled: e.disabled
|
|
148
|
+
}, null, 8, [
|
|
149
|
+
"icon",
|
|
150
|
+
"size",
|
|
151
|
+
"disabled"
|
|
152
|
+
])) : s("", !0)])], 2)) : s("", !0),
|
|
153
|
+
e.appendIcon || e.$slots.append ? (m(), c("span", k, [_(e.$slots, "append", {}, () => [e.appendIcon ? (m(), o(t, {
|
|
112
154
|
key: 0,
|
|
113
|
-
|
|
155
|
+
icon: e.appendIcon,
|
|
156
|
+
size: e.iconSize,
|
|
157
|
+
disabled: e.disabled
|
|
158
|
+
}, null, 8, [
|
|
159
|
+
"icon",
|
|
160
|
+
"size",
|
|
161
|
+
"disabled"
|
|
162
|
+
])) : s("", !0)])])) : s("", !0),
|
|
163
|
+
e.clearable && G.value.length ? (m(), c("button", {
|
|
164
|
+
key: 4,
|
|
165
|
+
onClick: x(H, ["stop"]),
|
|
114
166
|
class: "cursor-pointer text-ui-muted hover:text-ui-error"
|
|
115
|
-
}, [
|
|
167
|
+
}, [d(t, {
|
|
168
|
+
icon: e.clearIcon || y(n).close,
|
|
169
|
+
size: e.iconSize,
|
|
170
|
+
disabled: e.disabled
|
|
171
|
+
}, null, 8, [
|
|
172
|
+
"icon",
|
|
173
|
+
"size",
|
|
174
|
+
"disabled"
|
|
175
|
+
])])) : s("", !0)
|
|
116
176
|
], 16),
|
|
117
|
-
e.hint ||
|
|
118
|
-
e.counter ? (
|
|
177
|
+
e.hint || B.value.length ? (m(), c("div", A, [B.value.length ? (m(), c("div", j, [(m(!0), c(i, null, g(B.value, (e, t) => (m(), c("div", { key: t }, v(e), 1))), 128))])) : e.hint ? (m(), c("div", M, v(e.hint), 1)) : s("", !0)])) : s("", !0),
|
|
178
|
+
e.counter ? (m(), c("div", N, [u(v(e.counterString ?? `${G.value.length} archivo(s)`) + " ", 1), e.showSize ? (m(), c("span", P, " — " + v(J.value), 1)) : s("", !0)])) : s("", !0)
|
|
119
179
|
]));
|
|
120
180
|
}
|
|
121
|
-
};
|
|
181
|
+
});
|
|
122
182
|
//#endregion
|
|
123
|
-
export {
|
|
183
|
+
export { S as KunFileInput_exports, F as default };
|
|
@@ -18,9 +18,42 @@ var e = {
|
|
|
18
18
|
counter: Boolean,
|
|
19
19
|
counterString: String,
|
|
20
20
|
counterSizeString: String,
|
|
21
|
-
prependIcon:
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
prependIcon: [
|
|
22
|
+
String,
|
|
23
|
+
Object,
|
|
24
|
+
Function,
|
|
25
|
+
Array
|
|
26
|
+
],
|
|
27
|
+
appendIcon: [
|
|
28
|
+
String,
|
|
29
|
+
Object,
|
|
30
|
+
Function,
|
|
31
|
+
Array
|
|
32
|
+
],
|
|
33
|
+
prependInnerIcon: [
|
|
34
|
+
String,
|
|
35
|
+
Object,
|
|
36
|
+
Function,
|
|
37
|
+
Array
|
|
38
|
+
],
|
|
39
|
+
appendInnerIcon: [
|
|
40
|
+
String,
|
|
41
|
+
Object,
|
|
42
|
+
Function,
|
|
43
|
+
Array
|
|
44
|
+
],
|
|
45
|
+
prependInnerClass: String,
|
|
46
|
+
appendInnerClass: String,
|
|
47
|
+
clearIcon: [
|
|
48
|
+
String,
|
|
49
|
+
Object,
|
|
50
|
+
Function,
|
|
51
|
+
Array
|
|
52
|
+
],
|
|
53
|
+
iconSize: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: "text-base"
|
|
56
|
+
},
|
|
24
57
|
variant: {
|
|
25
58
|
type: String,
|
|
26
59
|
default: "filled"
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { __exportAll as e } from "../../../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { debounce as t } from "../../../../utils/utils.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import i from "
|
|
6
|
-
import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, guardReactiveProps as f, mergeProps as p, normalizeClass as m, normalizeProps as h, openBlock as g, ref as
|
|
3
|
+
import { kunTextareaProps as n } from "../composables/kunTextareaProps.js";
|
|
4
|
+
import r from "../composables/useKunTextareaComposable.js";
|
|
5
|
+
import { renderIconSlot as i } from "../../../../utils/renderIcon.js";
|
|
6
|
+
import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, guardReactiveProps as f, mergeProps as p, normalizeClass as m, normalizeProps as h, openBlock as g, ref as _, renderList as v, renderSlot as y, resolveDynamicComponent as b, toDisplayString as x, unref as S, useAttrs as C, useId as w, vShow as T, withDirectives as ee, withKeys as te } from "vue";
|
|
7
7
|
//#region src/components/KunTextarea/src/components/KunTextarea.vue
|
|
8
|
-
var
|
|
8
|
+
var E = /* @__PURE__ */ e({ default: () => N }), ne = ["for"], re = { class: "relative" }, D = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "absolute left-2 top-2 flex items-center"
|
|
11
|
-
},
|
|
11
|
+
}, O = {
|
|
12
12
|
key: 1,
|
|
13
13
|
class: "absolute left-2 top-2 ml-1"
|
|
14
|
-
},
|
|
14
|
+
}, ie = [
|
|
15
15
|
"id",
|
|
16
16
|
"value",
|
|
17
17
|
"rows",
|
|
18
18
|
"disabled",
|
|
19
19
|
"readonly",
|
|
20
20
|
"placeholder"
|
|
21
|
-
],
|
|
21
|
+
], ae = {
|
|
22
22
|
key: 3,
|
|
23
23
|
class: "absolute right-2 top-2 mr-1"
|
|
24
|
-
},
|
|
24
|
+
}, oe = {
|
|
25
25
|
key: 4,
|
|
26
26
|
class: "absolute right-2 top-2 flex items-center"
|
|
27
|
-
},
|
|
27
|
+
}, k = {
|
|
28
28
|
key: 5,
|
|
29
29
|
class: "mt-1"
|
|
30
|
-
},
|
|
30
|
+
}, A = { class: "h-1 w-full bg-field-background rounded overflow-hidden" }, j = {
|
|
31
31
|
key: 7,
|
|
32
32
|
class: "text-xs text-right mt-1 text-ui-disabled"
|
|
33
|
-
},
|
|
33
|
+
}, M = { key: 0 }, N = {
|
|
34
34
|
__name: "KunTextarea",
|
|
35
|
-
props: { ...
|
|
35
|
+
props: { ...n },
|
|
36
36
|
emits: [
|
|
37
37
|
"update:modelValue",
|
|
38
38
|
"click:clear",
|
|
@@ -40,12 +40,12 @@ var D = /* @__PURE__ */ e({ default: () => P }), te = ["for"], ne = { class: "re
|
|
|
40
40
|
"update:focused",
|
|
41
41
|
"mousedown:control"
|
|
42
42
|
],
|
|
43
|
-
setup(e, { expose:
|
|
44
|
-
let
|
|
45
|
-
let t =
|
|
43
|
+
setup(e, { expose: n, emit: E }) {
|
|
44
|
+
let N = e, P = E, F = C(), I = _(null), L = N.id || `textarea-${w()}`, { isFocused: R, internalValue: z, updateModel: B, handleClear: V, validate: H, reset: U, resetValidation: W, hasError: G, displayedMessages: K, adjustHeight: q, handleJsonEnter: J, isLocalChange: se } = r(N, P, I), ce = (e) => {
|
|
45
|
+
let t = I.value;
|
|
46
46
|
t && e !== null && t.setSelectionRange(e.start, e.end);
|
|
47
47
|
}, le = () => {
|
|
48
|
-
let e = [], t =
|
|
48
|
+
let e = [], t = I.value?.parentElement;
|
|
49
49
|
for (; t;) t.scrollHeight > t.clientHeight && e.push({
|
|
50
50
|
el: t,
|
|
51
51
|
scrollTop: t.scrollTop
|
|
@@ -63,89 +63,89 @@ var D = /* @__PURE__ */ e({ default: () => P }), te = ["for"], ne = { class: "re
|
|
|
63
63
|
start: e.target.selectionStart,
|
|
64
64
|
end: e.target.selectionEnd
|
|
65
65
|
}, r = le();
|
|
66
|
-
se.value = !0,
|
|
67
|
-
|
|
66
|
+
se.value = !0, N.autoGrow && requestAnimationFrame(() => {
|
|
67
|
+
q(), ce(n), ue(r);
|
|
68
68
|
}), fe(t);
|
|
69
69
|
}, fe = t((e) => {
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
|
|
70
|
+
B(e);
|
|
71
|
+
}, N.debounceTime), pe = () => {
|
|
72
|
+
R.value = !0, P("update:focused", !0);
|
|
73
73
|
}, me = () => {
|
|
74
|
-
|
|
75
|
-
}, Y = o(() =>
|
|
74
|
+
R.value = !1, P("update:focused", !1);
|
|
75
|
+
}, Y = o(() => R.value || !!z.value || N.dirty), X = o(() => typeof z.value == "string" ? z.value.length : 0), Z = o(() => N.counter === !0 ? 25 : N.counter || null), he = o(() => N.persistentCounter || N.counter && R.value), ge = o(() => [
|
|
76
76
|
"relative w-full flex flex-col",
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
]),
|
|
80
|
-
let e =
|
|
81
|
-
switch (
|
|
77
|
+
N.class,
|
|
78
|
+
N.wrapperClass
|
|
79
|
+
]), _e = o(() => N.persistentClear ? "opacity-100" : "hover:opacity-100 opacity-0 transition-opacity duration-200"), ve = o(() => {
|
|
80
|
+
let e = N.bgColor ? "" : N.variant === "filled" ? "bg-field-background" : "";
|
|
81
|
+
switch (N.variant) {
|
|
82
82
|
case "filled": return [e, "border border-transparent"];
|
|
83
83
|
case "outlined": return "border border-ui bg-transparent";
|
|
84
84
|
case "underlined": return "border-b border-ui bg-transparent rounded-none";
|
|
85
85
|
case "solo": return [e || "bg-ui-surface-raised", "shadow-md border-transparent"];
|
|
86
86
|
default: return "";
|
|
87
87
|
}
|
|
88
|
-
}),
|
|
88
|
+
}), Q = o(() => N.density === "compact" ? "p-1" : N.density === "comfortable" ? "p-2" : "p-3"), ye = o(() => [
|
|
89
89
|
"w-full resize-none p-2 transition-colors duration-150 text-ui",
|
|
90
|
-
|
|
90
|
+
N.inputClass,
|
|
91
91
|
{
|
|
92
|
-
rounded: !
|
|
93
|
-
"rounded-none":
|
|
94
|
-
[`rounded-${
|
|
95
|
-
"shadow-md":
|
|
96
|
-
"shadow-none":
|
|
97
|
-
[
|
|
98
|
-
"text-ui-disabled bg-surface":
|
|
99
|
-
"focus:outline-none focus:ring-1": !
|
|
100
|
-
[`${
|
|
101
|
-
"border-error ring-ui-focus":
|
|
102
|
-
"resize-none":
|
|
103
|
-
resize: !
|
|
92
|
+
rounded: !N.tile,
|
|
93
|
+
"rounded-none": N.tile,
|
|
94
|
+
[`rounded-${N.rounded}`]: typeof N.rounded == "string" || typeof N.rounded == "number",
|
|
95
|
+
"shadow-md": N.variant === "solo" && !N.flat,
|
|
96
|
+
"shadow-none": N.flat,
|
|
97
|
+
[N.bgColor]: N.bgColor,
|
|
98
|
+
"text-ui-disabled bg-surface": N.disabled,
|
|
99
|
+
"focus:outline-none focus:ring-1": !N.disabled,
|
|
100
|
+
[`${N.focusRingColor}`]: N.focusRingColor && !N.disabled && !G.value,
|
|
101
|
+
"border-error ring-ui-focus": G.value,
|
|
102
|
+
"resize-none": N.noResize || N.autoGrow,
|
|
103
|
+
resize: !N.noResize && !N.autoGrow
|
|
104
104
|
},
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
ve.value,
|
|
106
|
+
Q.value
|
|
107
107
|
]), be = {
|
|
108
|
-
label:
|
|
109
|
-
isFocused:
|
|
108
|
+
label: N.label,
|
|
109
|
+
isFocused: R,
|
|
110
110
|
isActive: Y,
|
|
111
|
-
controlRef:
|
|
112
|
-
focus: () =>
|
|
113
|
-
blur: () =>
|
|
114
|
-
props:
|
|
111
|
+
controlRef: I,
|
|
112
|
+
focus: () => I.value?.focus(),
|
|
113
|
+
blur: () => I.value?.blur(),
|
|
114
|
+
props: N
|
|
115
115
|
}, $ = {
|
|
116
|
-
isActive: !!
|
|
117
|
-
isFocused:
|
|
118
|
-
controlRef:
|
|
119
|
-
focus: () =>
|
|
120
|
-
blur: () =>
|
|
121
|
-
props:
|
|
116
|
+
isActive: !!z.value,
|
|
117
|
+
isFocused: R,
|
|
118
|
+
controlRef: I,
|
|
119
|
+
focus: () => I.value?.focus(),
|
|
120
|
+
blur: () => I.value?.blur(),
|
|
121
|
+
props: N
|
|
122
122
|
}, xe = $, Se = $, Ce = o(() => {
|
|
123
|
-
let { class: e, ...t } =
|
|
123
|
+
let { class: e, ...t } = F;
|
|
124
124
|
return t;
|
|
125
125
|
});
|
|
126
|
-
return
|
|
127
|
-
validate:
|
|
128
|
-
reset:
|
|
129
|
-
resetValidation:
|
|
130
|
-
errorMessages:
|
|
131
|
-
isValid: o(() => !
|
|
132
|
-
focus: () =>
|
|
133
|
-
rootRef:
|
|
126
|
+
return n({
|
|
127
|
+
validate: H,
|
|
128
|
+
reset: U,
|
|
129
|
+
resetValidation: W,
|
|
130
|
+
errorMessages: K,
|
|
131
|
+
isValid: o(() => !G.value),
|
|
132
|
+
focus: () => I.value?.focus(),
|
|
133
|
+
rootRef: I
|
|
134
134
|
}), (e, t) => (g(), l("div", p({
|
|
135
135
|
class: ge.value,
|
|
136
136
|
ref: "rootRef"
|
|
137
|
-
}, Ce.value), [
|
|
137
|
+
}, Ce.value), [y(e.$slots, "label", p({ for: S(L) }, be), () => [e.label ? (g(), l("label", {
|
|
138
138
|
key: 0,
|
|
139
|
-
for:
|
|
139
|
+
for: S(L),
|
|
140
140
|
class: m(["absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10", Y.value || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"])
|
|
141
|
-
},
|
|
142
|
-
e.prependIcon || e.$slots.prepend ? (g(), l("div",
|
|
143
|
-
e.prependInnerIcon || e.$slots["prepend-inner"] ? (g(), l("div",
|
|
141
|
+
}, x(e.label), 11, ne)) : c("", !0)]), u("div", re, [
|
|
142
|
+
e.prependIcon || e.$slots.prepend ? (g(), l("div", D, [y(e.$slots, "prepend", h(f(S(xe))), () => [u("div", { onClick: t[0] ||= (t) => e.handleIconClick(t, "prepend") }, [(g(), s(b(S(i)(e.prependIcon))))])])])) : c("", !0),
|
|
143
|
+
e.prependInnerIcon || e.$slots["prepend-inner"] ? (g(), l("div", O, [y(e.$slots, "prepend-inner", {}, () => [u("div", { onClick: t[1] ||= (t) => e.handleIconClick(t, "prependInner") }, [(g(), s(b(S(i)(e.prependInnerIcon))))])])])) : c("", !0),
|
|
144
144
|
u("textarea", {
|
|
145
145
|
ref_key: "textareaRef",
|
|
146
|
-
ref:
|
|
147
|
-
id:
|
|
148
|
-
value:
|
|
146
|
+
ref: I,
|
|
147
|
+
id: S(L),
|
|
148
|
+
value: S(z),
|
|
149
149
|
rows: e.autoGrow ? void 0 : e.rows,
|
|
150
150
|
disabled: e.disabled,
|
|
151
151
|
readonly: e.readonly,
|
|
@@ -153,7 +153,7 @@ var D = /* @__PURE__ */ e({ default: () => P }), te = ["for"], ne = { class: "re
|
|
|
153
153
|
onInput: de,
|
|
154
154
|
onFocus: pe,
|
|
155
155
|
onBlur: me,
|
|
156
|
-
onKeydown: t[2] ||=
|
|
156
|
+
onKeydown: t[2] ||= te((...e) => S(J) && S(J)(...e), ["enter"]),
|
|
157
157
|
onClick: t[3] ||= (t) => e.$emit("click:control", t),
|
|
158
158
|
onMousedown: t[4] ||= (t) => e.$emit("mousedown:control", t),
|
|
159
159
|
class: m(["bg-field-background", [ye.value]]),
|
|
@@ -162,39 +162,39 @@ var D = /* @__PURE__ */ e({ default: () => P }), te = ["for"], ne = { class: "re
|
|
|
162
162
|
"box-sizing": "border-box",
|
|
163
163
|
"overflow-y": "hidden"
|
|
164
164
|
}
|
|
165
|
-
}, null, 42,
|
|
166
|
-
e.clearable &&
|
|
165
|
+
}, null, 42, ie),
|
|
166
|
+
e.clearable && S(z) ? (g(), l("div", {
|
|
167
167
|
key: 2,
|
|
168
|
-
class: m(["absolute right-2 top-2",
|
|
169
|
-
}, [
|
|
168
|
+
class: m(["absolute right-2 top-2", _e.value])
|
|
169
|
+
}, [y(e.$slots, "clear", h(f($)), () => [e.clearIcon ? (g(), l("button", {
|
|
170
170
|
key: 0,
|
|
171
171
|
type: "button",
|
|
172
|
-
onClick: t[5] ||= (...e) =>
|
|
172
|
+
onClick: t[5] ||= (...e) => S(V) && S(V)(...e),
|
|
173
173
|
class: "text-ui-muted hover:text-ui"
|
|
174
|
-
}, [(g(), s(
|
|
175
|
-
e.appendInnerIcon || e.$slots["append-inner"] ? (g(), l("div",
|
|
176
|
-
e.appendIcon || e.$slots.append ? (g(), l("div",
|
|
177
|
-
e.loading ? (g(), l("div",
|
|
174
|
+
}, [(g(), s(b(S(i)(e.clearIcon))))])) : c("", !0)])], 2)) : c("", !0),
|
|
175
|
+
e.appendInnerIcon || e.$slots["append-inner"] ? (g(), l("div", ae, [y(e.$slots, "append-inner", {}, () => [u("div", { onClick: t[6] ||= (t) => e.handleIconClick(t, "appendInner") }, [(g(), s(b(S(i)(e.appendInnerIcon))))])])])) : c("", !0),
|
|
176
|
+
e.appendIcon || e.$slots.append ? (g(), l("div", oe, [y(e.$slots, "append", h(f(S(Se))), () => [u("div", { onClick: t[7] ||= (t) => e.handleIconClick(t, "append") }, [(g(), s(b(S(i)(e.appendIcon))))])])])) : c("", !0),
|
|
177
|
+
e.loading ? (g(), l("div", k, [y(e.$slots, "loader", {
|
|
178
178
|
color: e.loadingColor,
|
|
179
179
|
isActive: !0
|
|
180
|
-
}, () => [u("div",
|
|
180
|
+
}, () => [u("div", A, [u("div", {
|
|
181
181
|
class: m(["h-full transition-all duration-300", [e.loadingColor]]),
|
|
182
182
|
style: { width: "100%" }
|
|
183
183
|
}, null, 2)])])])) : c("", !0),
|
|
184
|
-
!e.hideDetails || e.hideDetails === "auto" && (
|
|
184
|
+
!e.hideDetails || e.hideDetails === "auto" && (S(K).length || e.hint) ? (g(), l("div", {
|
|
185
185
|
key: 6,
|
|
186
186
|
class: m(["text-xs mt-1 space-y-1", {
|
|
187
|
-
"text-ui-error":
|
|
188
|
-
"text-ui-muted": !
|
|
187
|
+
"text-ui-error": S(G),
|
|
188
|
+
"text-ui-muted": !S(G)
|
|
189
189
|
}])
|
|
190
|
-
}, [
|
|
191
|
-
he.value ? (g(), l("div",
|
|
190
|
+
}, [y(e.$slots, "details", {}, () => [S(G) ? (g(!0), l(a, { key: 0 }, v(S(K), (t, n) => y(e.$slots, "message", { message: t }, () => [u("div", null, x(t), 1)], void 0, n)), 128)) : e.hint ? y(e.$slots, "hint", { hint: e.hint }, () => [ee(u("div", null, x(e.hint), 513), [[T, e.persistentHint || S(R)]])], void 0, 1) : c("", !0)])], 2)) : c("", !0),
|
|
191
|
+
he.value ? (g(), l("div", j, [y(e.$slots, "counter", {
|
|
192
192
|
counter: X.value,
|
|
193
193
|
max: Z.value,
|
|
194
194
|
value: X.value
|
|
195
|
-
}, () => [d(
|
|
195
|
+
}, () => [d(x(X.value), 1), Z.value ? (g(), l("span", M, " / " + x(Z.value), 1)) : c("", !0)])])) : c("", !0)
|
|
196
196
|
])], 16));
|
|
197
197
|
}
|
|
198
198
|
};
|
|
199
199
|
//#endregion
|
|
200
|
-
export {
|
|
200
|
+
export { E as KunTextarea_exports, N as default };
|
package/dist/utils/renderIcon.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { h as e, resolveComponent as t } from "vue";
|
|
1
2
|
//#region src/utils/renderIcon.js
|
|
2
|
-
function
|
|
3
|
-
return
|
|
4
|
-
class:
|
|
5
|
-
...
|
|
6
|
-
}) : typeof
|
|
7
|
-
icon:
|
|
8
|
-
...
|
|
9
|
-
}) :
|
|
3
|
+
function n(n, r = {}, i = null) {
|
|
4
|
+
return n ? typeof n == "string" ? e("span", {
|
|
5
|
+
class: n,
|
|
6
|
+
...r
|
|
7
|
+
}) : typeof n == "function" ? e(n, r) : e(t("KunIcon"), {
|
|
8
|
+
icon: n,
|
|
9
|
+
...r
|
|
10
|
+
}) : i;
|
|
10
11
|
}
|
|
11
12
|
//#endregion
|
|
12
|
-
export {
|
|
13
|
+
export { n as renderIconSlot };
|