adverich-kun-ui 0.1.176 → 0.1.177
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 {
|
|
2
|
-
import { RouterLink as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
import { useSlots as B, useAttrs as C, computed as s, createBlock as l, openBlock as a, resolveDynamicComponent as o, mergeProps as j, unref as z, withCtx as I, createElementVNode as p, renderSlot as i, createCommentVNode as c, createVNode as A, normalizeClass as O, createElementBlock as f, createTextVNode as N, toDisplayString as V, h as W } from "vue";
|
|
2
|
+
import { RouterLink as F } from "vue-router";
|
|
3
|
+
import T from "../../../KunLoaderCircular/src/components/KunLoaderCircular.vue.js";
|
|
4
|
+
import D from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
5
|
+
const E = { class: "relative flex items-center justify-center w-full h-full" }, L = { class: "absolute inset-0 flex items-center justify-center z-10" }, q = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "mr-2 flex items-center"
|
|
8
|
-
},
|
|
8
|
+
}, K = {
|
|
9
9
|
key: 1,
|
|
10
10
|
class: "truncate flex items-center justify-center"
|
|
11
|
-
},
|
|
11
|
+
}, P = {
|
|
12
12
|
key: 2,
|
|
13
13
|
class: "ml-2 flex items-center"
|
|
14
|
-
},
|
|
14
|
+
}, M = {
|
|
15
15
|
__name: "KunBtn",
|
|
16
16
|
props: {
|
|
17
17
|
text: String,
|
|
@@ -49,12 +49,12 @@ const T = { class: "relative flex items-center justify-center w-full h-full" },
|
|
|
49
49
|
appendIcon: [String, Function, Object, Array]
|
|
50
50
|
},
|
|
51
51
|
setup(n) {
|
|
52
|
-
const t = n, u =
|
|
52
|
+
const x = B(), t = n, u = C(), g = s(() => !!t.to || !!t.href), m = s(() => !g.value), h = s(() => t.href ? "a" : t.to ? F : "button"), d = (e) => !e || e === !1 || e === !0 && !t.icon ? null : W(D, {
|
|
53
53
|
icon: e,
|
|
54
54
|
size: v.value,
|
|
55
55
|
color: t.textColor ?? "text-font-color",
|
|
56
56
|
disabled: t.disabled
|
|
57
|
-
}), b =
|
|
57
|
+
}), b = s(() => t.href ? {
|
|
58
58
|
href: t.href,
|
|
59
59
|
target: t.target ?? "_self",
|
|
60
60
|
rel: t.target === "_blank" ? "noopener noreferrer" : null
|
|
@@ -83,7 +83,7 @@ const T = { class: "relative flex items-center justify-center w-full h-full" },
|
|
|
83
83
|
default:
|
|
84
84
|
return "px-3 py-2 text-sm";
|
|
85
85
|
}
|
|
86
|
-
}, v =
|
|
86
|
+
}, v = s(() => {
|
|
87
87
|
switch (t.size) {
|
|
88
88
|
case "xxs":
|
|
89
89
|
return "text-xs";
|
|
@@ -102,25 +102,25 @@ const T = { class: "relative flex items-center justify-center w-full h-full" },
|
|
|
102
102
|
default:
|
|
103
103
|
return "text-base";
|
|
104
104
|
}
|
|
105
|
-
}), k =
|
|
106
|
-
const e = t.bgColor,
|
|
105
|
+
}), k = s(() => {
|
|
106
|
+
const e = t.bgColor, r = t.textColor;
|
|
107
107
|
switch (t.variant) {
|
|
108
108
|
case "default":
|
|
109
|
-
return `${e} ${
|
|
109
|
+
return `${e} ${r} shadow hover:brightness-95`;
|
|
110
110
|
case "tonal":
|
|
111
|
-
return `${e} ${
|
|
111
|
+
return `${e} ${r} shadow-sm hover:shadow-md`;
|
|
112
112
|
case "soft":
|
|
113
|
-
return `${e} ${
|
|
113
|
+
return `${e} ${r} hover:bg-opacity-30 shadow-sm`;
|
|
114
114
|
case "outlined":
|
|
115
|
-
return `bg-transparent ${
|
|
115
|
+
return `bg-transparent ${r} border ${e} border-opacity-40 hover:bg-black/5`;
|
|
116
116
|
case "plain":
|
|
117
|
-
return `bg-transparent ${
|
|
117
|
+
return `bg-transparent ${r} hover:bg-transparent active:bg-black/10`;
|
|
118
118
|
case "text":
|
|
119
|
-
return `${e} ${
|
|
119
|
+
return `${e} ${r} hover:bg-opacity-10 active:bg-black/5`;
|
|
120
120
|
default:
|
|
121
|
-
return `${e} ${
|
|
121
|
+
return `${e} ${r}`;
|
|
122
122
|
}
|
|
123
|
-
}), $ =
|
|
123
|
+
}), $ = s(() => !!t.text), S = s(() => {
|
|
124
124
|
const e = [
|
|
125
125
|
"inline-flex items-center justify-center break-keep transition-all whitespace-nowrap",
|
|
126
126
|
y(t.size),
|
|
@@ -165,35 +165,35 @@ const T = { class: "relative flex items-center justify-center w-full h-full" },
|
|
|
165
165
|
"transition duration-100 ease-in-out",
|
|
166
166
|
"cursor-pointer"
|
|
167
167
|
) : (e.push("pointer-events-none"), t.disabled && e.push("opacity-50 cursor-not-allowed")), $.value && e.push(t.minWidth), u.class && e.push(u.class), e.filter(Boolean);
|
|
168
|
-
}), w =
|
|
169
|
-
return (e,
|
|
168
|
+
}), w = s(() => !!t.icon && !t.text && !x.default);
|
|
169
|
+
return (e, r) => (a(), l(o(h.value), j(b.value, {
|
|
170
170
|
class: S.value,
|
|
171
|
-
style:
|
|
172
|
-
disabled:
|
|
171
|
+
style: z(u).style,
|
|
172
|
+
disabled: m.value && (n.loading || n.disabled)
|
|
173
173
|
}), {
|
|
174
|
-
default:
|
|
175
|
-
p("div",
|
|
174
|
+
default: I(() => [
|
|
175
|
+
p("div", E, [
|
|
176
176
|
n.loading ? i(e.$slots, "loader", { key: 0 }, () => [
|
|
177
|
-
p("div",
|
|
178
|
-
|
|
177
|
+
p("div", L, [
|
|
178
|
+
A(T, {
|
|
179
179
|
size: "20",
|
|
180
180
|
width: "5"
|
|
181
181
|
})
|
|
182
182
|
])
|
|
183
183
|
]) : c("", !0),
|
|
184
184
|
p("div", {
|
|
185
|
-
class:
|
|
185
|
+
class: O([{ "opacity-50": n.loading }, "flex items-center justify-center w-full h-full"])
|
|
186
186
|
}, [
|
|
187
|
-
e.$slots.prepend || n.prependIcon ? (a(), f("span",
|
|
187
|
+
e.$slots.prepend || n.prependIcon ? (a(), f("span", q, [
|
|
188
188
|
i(e.$slots, "prepend"),
|
|
189
189
|
(a(), l(o(d(n.prependIcon))))
|
|
190
190
|
])) : c("", !0),
|
|
191
|
-
n.text || e.$slots.default || n.icon ? (a(), f("span",
|
|
191
|
+
n.text || e.$slots.default || n.icon ? (a(), f("span", K, [
|
|
192
192
|
n.icon && !n.text && !e.$slots.default ? (a(), l(o(d(n.icon)), { key: 0 })) : i(e.$slots, "default", { key: 1 }, () => [
|
|
193
|
-
|
|
193
|
+
N(V(n.text), 1)
|
|
194
194
|
])
|
|
195
195
|
])) : c("", !0),
|
|
196
|
-
e.$slots.append || n.appendIcon ? (a(), f("span",
|
|
196
|
+
e.$slots.append || n.appendIcon ? (a(), f("span", P, [
|
|
197
197
|
i(e.$slots, "append"),
|
|
198
198
|
(a(), l(o(d(n.appendIcon))))
|
|
199
199
|
])) : c("", !0)
|
|
@@ -205,5 +205,5 @@ const T = { class: "relative flex items-center justify-center w-full h-full" },
|
|
|
205
205
|
}
|
|
206
206
|
};
|
|
207
207
|
export {
|
|
208
|
-
|
|
208
|
+
M as default
|
|
209
209
|
};
|