adverich-kun-ui 0.1.44 → 0.1.46
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,18 +1,23 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
|
|
1
|
+
import { computed as a, createBlock as x, openBlock as o, resolveDynamicComponent as y, mergeProps as m, withCtx as b, renderSlot as l, createElementBlock as s, createCommentVNode as i, createElementVNode as h, createTextVNode as v, toDisplayString as $ } from "vue";
|
|
2
|
+
import { RouterLink as S } from "vue-router";
|
|
3
|
+
const k = {
|
|
3
4
|
key: 1,
|
|
4
5
|
class: "mr-2 flex items-center"
|
|
5
|
-
},
|
|
6
|
+
}, w = {
|
|
6
7
|
key: 2,
|
|
7
8
|
class: "truncate"
|
|
8
|
-
},
|
|
9
|
+
}, B = {
|
|
9
10
|
key: 3,
|
|
10
11
|
class: "ml-2 flex items-center"
|
|
11
|
-
},
|
|
12
|
+
}, z = {
|
|
12
13
|
__name: "KunBtn",
|
|
13
14
|
props: {
|
|
14
15
|
text: { type: String, default: null },
|
|
15
|
-
size: {
|
|
16
|
+
size: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: "md",
|
|
19
|
+
validator: (t) => ["xxs", "xs", "sm", "md", "lg", "xl", "xxl"].includes(t)
|
|
20
|
+
},
|
|
16
21
|
minWidth: { type: String, default: "min-w-[6rem]" },
|
|
17
22
|
fontWeight: { type: String, default: "font-medium" },
|
|
18
23
|
rounded: { type: String, default: "rounded-lg" },
|
|
@@ -25,11 +30,25 @@ const y = ["disabled"], x = {
|
|
|
25
30
|
disabled: { type: Boolean, default: !1 },
|
|
26
31
|
loading: { type: Boolean, default: !1 },
|
|
27
32
|
bgColor: { type: String, default: "bg-indigo-600" },
|
|
28
|
-
textColor: { type: String, default: "text-white" }
|
|
33
|
+
textColor: { type: String, default: "text-white" },
|
|
34
|
+
to: [String, Object],
|
|
35
|
+
href: String,
|
|
36
|
+
replace: { type: Boolean, default: !1 },
|
|
37
|
+
target: { type: String, default: null }
|
|
29
38
|
},
|
|
30
39
|
setup(t) {
|
|
31
|
-
const
|
|
32
|
-
|
|
40
|
+
const e = t, d = a(() => !!e.to || !!e.href), u = a(() => !d.value), c = a(() => e.href ? "a" : e.to ? S : "button"), f = a(() => e.href ? {
|
|
41
|
+
href: e.href,
|
|
42
|
+
target: e.target ?? "_self",
|
|
43
|
+
rel: e.target === "_blank" ? "noopener noreferrer" : null
|
|
44
|
+
} : e.to ? {
|
|
45
|
+
to: e.to,
|
|
46
|
+
replace: e.replace
|
|
47
|
+
} : {
|
|
48
|
+
type: "button",
|
|
49
|
+
disabled: e.loading || e.disabled
|
|
50
|
+
}), g = (n) => {
|
|
51
|
+
switch (n) {
|
|
33
52
|
case "xxs":
|
|
34
53
|
return "px-1 py-1 text-xs";
|
|
35
54
|
case "xs":
|
|
@@ -45,53 +64,55 @@ const y = ["disabled"], x = {
|
|
|
45
64
|
case "xxl":
|
|
46
65
|
return "px-4 py-4 text-base";
|
|
47
66
|
}
|
|
48
|
-
},
|
|
49
|
-
const
|
|
50
|
-
switch (
|
|
67
|
+
}, p = a(() => {
|
|
68
|
+
const n = e.bgColor || "bg-indigo-600", r = e.textColor || "text-white";
|
|
69
|
+
switch (e.variant) {
|
|
51
70
|
case "default":
|
|
52
|
-
return `${
|
|
71
|
+
return `${n} ${r} shadow hover:brightness-90 transition`;
|
|
53
72
|
case "tonal":
|
|
54
|
-
return `${
|
|
73
|
+
return `${n} ${r} bg-opacity-20 hover:bg-opacity-30 transition`;
|
|
55
74
|
case "plain":
|
|
56
|
-
return `bg-transparent ${
|
|
75
|
+
return `bg-transparent ${r} hover:bg-gray-100 transition`;
|
|
57
76
|
case "outline":
|
|
58
|
-
return `bg-transparent border ${
|
|
77
|
+
return `bg-transparent border ${n} ${r} border-opacity-80 hover:bg-opacity-10 transition`;
|
|
59
78
|
case "soft":
|
|
60
|
-
return `${
|
|
79
|
+
return `${n} ${r} shadow-md bg-opacity-30 hover:bg-opacity-40 transition`;
|
|
61
80
|
default:
|
|
62
|
-
return `${
|
|
81
|
+
return `${n} ${r}`;
|
|
63
82
|
}
|
|
64
83
|
});
|
|
65
|
-
return (
|
|
66
|
-
|
|
67
|
-
class: c(["flex items-center justify-center break-keep transition-all", [
|
|
84
|
+
return (n, r) => (o(), x(y(c.value), m(f.value, {
|
|
85
|
+
class: ["flex items-center justify-center break-keep transition-all", [
|
|
68
86
|
t.minWidth,
|
|
69
|
-
|
|
87
|
+
g(t.size),
|
|
70
88
|
t.fontWeight,
|
|
71
|
-
|
|
89
|
+
p.value,
|
|
72
90
|
t.rounded,
|
|
73
91
|
t.textAlign,
|
|
74
92
|
"whitespace-nowrap",
|
|
75
93
|
t.loading || t.disabled ? "opacity-50 cursor-not-allowed" : "hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-offset-2 active:scale-[.98] transition duration-100 ease-in-out cursor-pointer"
|
|
76
|
-
]]
|
|
77
|
-
disabled: t.loading || t.disabled
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
o(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
o(
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
]],
|
|
95
|
+
disabled: u.value && (t.loading || t.disabled)
|
|
96
|
+
}), {
|
|
97
|
+
default: b(() => [
|
|
98
|
+
t.loading ? l(n.$slots, "loader", { key: 0 }, () => [
|
|
99
|
+
r[0] || (r[0] = h("span", { class: "mr-2 h-5 w-5 border-[3px] border-current opacity-100 border-opacity-100 border-t-transparent rounded-full animate-spin" }, null, -1))
|
|
100
|
+
]) : n.$slots.prepend ? (o(), s("span", k, [
|
|
101
|
+
l(n.$slots, "prepend")
|
|
102
|
+
])) : i("", !0),
|
|
103
|
+
!t.loading && (n.$slots.default || t.text) ? (o(), s("span", w, [
|
|
104
|
+
l(n.$slots, "default", {}, () => [
|
|
105
|
+
v($(t.text), 1)
|
|
106
|
+
])
|
|
107
|
+
])) : i("", !0),
|
|
108
|
+
!t.loading && n.$slots.append ? (o(), s("span", B, [
|
|
109
|
+
l(n.$slots, "append")
|
|
110
|
+
])) : i("", !0)
|
|
111
|
+
]),
|
|
112
|
+
_: 3
|
|
113
|
+
}, 16, ["class", "disabled"]));
|
|
93
114
|
}
|
|
94
115
|
};
|
|
95
116
|
export {
|
|
96
|
-
|
|
117
|
+
z as default
|
|
97
118
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adverich-kun-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Una librería de componentes Vue.js con Tailwind CSS",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"tailwindcss": "^4.1.6",
|
|
26
|
-
"vue": "^3.5.13"
|
|
26
|
+
"vue": "^3.5.13",
|
|
27
|
+
"vue-router": "^4.0.0"
|
|
27
28
|
},
|
|
28
29
|
"keywords": [
|
|
29
30
|
"vue",
|
|
@@ -49,5 +50,8 @@
|
|
|
49
50
|
},
|
|
50
51
|
"sideEffects": [
|
|
51
52
|
"*.css"
|
|
52
|
-
]
|
|
53
|
+
],
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"vue-router": "^4.5.1"
|
|
56
|
+
}
|
|
53
57
|
}
|