adverich-kun-ui 0.1.501 → 0.1.502
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,17 +1,17 @@
|
|
|
1
|
-
import { useSlots as
|
|
2
|
-
import { RouterLink as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
import { useSlots as E, useAttrs as K, computed as a, ref as N, createBlock as u, openBlock as o, resolveDynamicComponent as c, mergeProps as T, unref as V, withCtx as F, createElementVNode as m, normalizeClass as v, renderSlot as d, createCommentVNode as f, createVNode as D, createElementBlock as g, createTextVNode as L, toDisplayString as q, h as H } from "vue";
|
|
2
|
+
import { RouterLink as P } from "vue-router";
|
|
3
|
+
import R from "../../../KunLoaderCircular/src/components/KunLoaderCircular.vue.js";
|
|
4
|
+
import G from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
5
|
+
const J = { class: "absolute inset-0 flex items-center justify-center z-10" }, M = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "mr-2 flex items-center"
|
|
8
|
-
},
|
|
8
|
+
}, Q = {
|
|
9
9
|
key: 1,
|
|
10
10
|
class: "truncate flex items-center justify-center"
|
|
11
|
-
},
|
|
11
|
+
}, U = {
|
|
12
12
|
key: 2,
|
|
13
13
|
class: "ml-2 flex items-center"
|
|
14
|
-
},
|
|
14
|
+
}, ee = {
|
|
15
15
|
__name: "KunBtn",
|
|
16
16
|
props: {
|
|
17
17
|
text: String,
|
|
@@ -47,13 +47,14 @@ const R = { class: "absolute inset-0 flex items-center justify-center z-10" }, G
|
|
|
47
47
|
iconSize: { type: String, default: null },
|
|
48
48
|
focusColor: { type: String, default: null }
|
|
49
49
|
},
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
emits: ["click", "keydown", "keyup", "keypress"],
|
|
51
|
+
setup(n, { expose: k, emit: S }) {
|
|
52
|
+
const y = E(), l = K(), t = n, i = S, $ = a(() => !!t.to || !!t.href), w = a(() => !$.value), C = a(() => t.href ? "a" : t.to ? P : "button"), p = (e) => !e || e === !1 || e === !0 && !t.icon ? null : H(G, {
|
|
52
53
|
icon: e,
|
|
53
|
-
size:
|
|
54
|
+
size: j.value,
|
|
54
55
|
color: t.textColor ?? "text-font-color",
|
|
55
56
|
disabled: t.disabled
|
|
56
|
-
}),
|
|
57
|
+
}), z = a(() => t.href ? {
|
|
57
58
|
href: t.href,
|
|
58
59
|
target: t.target ?? "_self",
|
|
59
60
|
rel: t.target === "_blank" ? "noopener noreferrer" : null
|
|
@@ -63,7 +64,7 @@ const R = { class: "absolute inset-0 flex items-center justify-center z-10" }, G
|
|
|
63
64
|
} : {
|
|
64
65
|
type: "button",
|
|
65
66
|
disabled: t.loading || t.disabled
|
|
66
|
-
}),
|
|
67
|
+
}), B = (e) => {
|
|
67
68
|
switch (e) {
|
|
68
69
|
case "xxs":
|
|
69
70
|
return "px-1 py-1 text-xs";
|
|
@@ -82,7 +83,7 @@ const R = { class: "absolute inset-0 flex items-center justify-center z-10" }, G
|
|
|
82
83
|
default:
|
|
83
84
|
return "px-3 py-2 text-sm";
|
|
84
85
|
}
|
|
85
|
-
},
|
|
86
|
+
}, j = a(() => {
|
|
86
87
|
if (t.iconSize) return t.iconSize;
|
|
87
88
|
switch (t.size) {
|
|
88
89
|
case "xxs":
|
|
@@ -102,7 +103,7 @@ const R = { class: "absolute inset-0 flex items-center justify-center z-10" }, G
|
|
|
102
103
|
default:
|
|
103
104
|
return "text-base";
|
|
104
105
|
}
|
|
105
|
-
}),
|
|
106
|
+
}), I = a(() => {
|
|
106
107
|
const e = t.bgColor, s = t.textColor;
|
|
107
108
|
switch (t.variant) {
|
|
108
109
|
case "default":
|
|
@@ -120,27 +121,27 @@ const R = { class: "absolute inset-0 flex items-center justify-center z-10" }, G
|
|
|
120
121
|
default:
|
|
121
122
|
return `${e} ${s}`;
|
|
122
123
|
}
|
|
123
|
-
}),
|
|
124
|
-
var e, s,
|
|
125
|
-
return ((e =
|
|
126
|
-
}),
|
|
127
|
-
var e, s,
|
|
128
|
-
return ((e =
|
|
129
|
-
}),
|
|
124
|
+
}), A = a(() => !!t.text), h = a(() => {
|
|
125
|
+
var e, s, r;
|
|
126
|
+
return ((e = l.class) == null ? void 0 : e.includes("w-")) || ((s = l.class) == null ? void 0 : s.includes("min-w-")) || ((r = l.class) == null ? void 0 : r.includes("max-w-"));
|
|
127
|
+
}), O = a(() => {
|
|
128
|
+
var e, s, r;
|
|
129
|
+
return ((e = l.class) == null ? void 0 : e.includes("h-")) || ((s = l.class) == null ? void 0 : s.includes("min-h-")) || ((r = l.class) == null ? void 0 : r.includes("max-h-"));
|
|
130
|
+
}), x = a(() => {
|
|
130
131
|
var s;
|
|
131
|
-
const e = ((s = t.text) == null ? void 0 : s.length) === 1 && !
|
|
132
|
-
return !!t.icon && !t.text && !
|
|
133
|
-
}),
|
|
132
|
+
const e = ((s = t.text) == null ? void 0 : s.length) === 1 && !y.default && !t.icon;
|
|
133
|
+
return !!t.icon && !t.text && !y.default || e;
|
|
134
|
+
}), W = a(() => {
|
|
134
135
|
const e = [
|
|
135
136
|
"inline-flex items-center justify-center break-keep transition-all whitespace-nowrap",
|
|
136
|
-
|
|
137
|
+
x.value ? "" : B(t.size),
|
|
137
138
|
t.fontWeight,
|
|
138
139
|
t.rounded,
|
|
139
140
|
t.textAlign,
|
|
140
|
-
|
|
141
|
+
I.value,
|
|
141
142
|
"relative"
|
|
142
143
|
];
|
|
143
|
-
if (
|
|
144
|
+
if (l.class && e.push(l.class), x.value)
|
|
144
145
|
switch (e.push("aspect-square justify-center items-center"), t.size) {
|
|
145
146
|
case "xxs":
|
|
146
147
|
e.push("p-1");
|
|
@@ -174,49 +175,53 @@ const R = { class: "absolute inset-0 flex items-center justify-center z-10" }, G
|
|
|
174
175
|
"transition duration-100 ease-in-out",
|
|
175
176
|
"cursor-pointer",
|
|
176
177
|
t.focusColor ? `${t.focusColor}` : ""
|
|
177
|
-
) : (e.push("pointer-events-none"), t.disabled && e.push("opacity-50 cursor-not-allowed")),
|
|
178
|
-
}), b =
|
|
179
|
-
return
|
|
178
|
+
) : (e.push("pointer-events-none"), t.disabled && e.push("opacity-50 cursor-not-allowed")), A.value && !x.value && !h.value && e.push(t.minWidth), e.filter(Boolean);
|
|
179
|
+
}), b = N(null);
|
|
180
|
+
return k({
|
|
180
181
|
focus: () => {
|
|
181
182
|
var e, s;
|
|
182
183
|
return (s = (e = b.value) == null ? void 0 : e.focus) == null ? void 0 : s.call(e);
|
|
183
184
|
}
|
|
184
|
-
}), (e, s) => (
|
|
185
|
+
}), (e, s) => (o(), u(c(C.value), T({
|
|
185
186
|
ref_key: "rootEl",
|
|
186
187
|
ref: b
|
|
187
|
-
},
|
|
188
|
-
class:
|
|
189
|
-
style:
|
|
190
|
-
disabled:
|
|
188
|
+
}, z.value, {
|
|
189
|
+
class: W.value,
|
|
190
|
+
style: V(l).style,
|
|
191
|
+
disabled: w.value && (n.loading || n.disabled),
|
|
192
|
+
onClick: s[0] || (s[0] = (r) => i("click", r)),
|
|
193
|
+
onKeydown: s[1] || (s[1] = (r) => i("keydown", r)),
|
|
194
|
+
onKeyup: s[2] || (s[2] = (r) => i("keyup", r)),
|
|
195
|
+
onKeypress: s[3] || (s[3] = (r) => i("keypress", r))
|
|
191
196
|
}), {
|
|
192
|
-
default:
|
|
193
|
-
|
|
194
|
-
class:
|
|
197
|
+
default: F(() => [
|
|
198
|
+
m("div", {
|
|
199
|
+
class: v(["relative flex items-center justify-center", h.value ? "" : "w-full", O.value ? "" : "h-full"])
|
|
195
200
|
}, [
|
|
196
|
-
n.loading ?
|
|
197
|
-
|
|
198
|
-
|
|
201
|
+
n.loading ? d(e.$slots, "loader", { key: 0 }, () => [
|
|
202
|
+
m("div", J, [
|
|
203
|
+
D(R, {
|
|
199
204
|
size: "20",
|
|
200
205
|
width: "5"
|
|
201
206
|
})
|
|
202
207
|
])
|
|
203
|
-
]) :
|
|
204
|
-
|
|
205
|
-
class:
|
|
208
|
+
]) : f("", !0),
|
|
209
|
+
m("div", {
|
|
210
|
+
class: v([{ "opacity-50": n.loading }, "flex items-center justify-center w-full h-full"])
|
|
206
211
|
}, [
|
|
207
|
-
e.$slots.prepend || n.prependIcon ? (
|
|
208
|
-
|
|
209
|
-
(
|
|
210
|
-
])) :
|
|
211
|
-
n.text || e.$slots.default || n.icon ? (
|
|
212
|
-
n.icon && !n.text && !e.$slots.default ? (
|
|
213
|
-
|
|
212
|
+
e.$slots.prepend || n.prependIcon ? (o(), g("span", M, [
|
|
213
|
+
d(e.$slots, "prepend"),
|
|
214
|
+
(o(), u(c(p(n.prependIcon))))
|
|
215
|
+
])) : f("", !0),
|
|
216
|
+
n.text || e.$slots.default || n.icon ? (o(), g("span", Q, [
|
|
217
|
+
n.icon && !n.text && !e.$slots.default ? (o(), u(c(p(n.icon)), { key: 0 })) : d(e.$slots, "default", { key: 1 }, () => [
|
|
218
|
+
L(q(n.text), 1)
|
|
214
219
|
])
|
|
215
|
-
])) :
|
|
216
|
-
e.$slots.append || n.appendIcon ? (
|
|
217
|
-
|
|
218
|
-
(
|
|
219
|
-
])) :
|
|
220
|
+
])) : f("", !0),
|
|
221
|
+
e.$slots.append || n.appendIcon ? (o(), g("span", U, [
|
|
222
|
+
d(e.$slots, "append"),
|
|
223
|
+
(o(), u(c(p(n.appendIcon))))
|
|
224
|
+
])) : f("", !0)
|
|
220
225
|
], 2)
|
|
221
226
|
], 2)
|
|
222
227
|
]),
|
|
@@ -225,5 +230,5 @@ const R = { class: "absolute inset-0 flex items-center justify-center z-10" }, G
|
|
|
225
230
|
}
|
|
226
231
|
};
|
|
227
232
|
export {
|
|
228
|
-
|
|
233
|
+
ee as default
|
|
229
234
|
};
|