adverich-kun-ui 0.1.118 → 0.1.120
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,13 +1,13 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
1
|
+
import { onMounted as h, computed as m, createElementBlock as i, createCommentVNode as n, openBlock as a, mergeProps as w, withKeys as z, withModifiers as B, createElementVNode as u, normalizeClass as r, createVNode as g, toDisplayString as c, createBlock as y, withCtx as x, createTextVNode as f } from "vue";
|
|
2
|
+
import b from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
3
|
+
import C from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
4
|
+
const V = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "flex justify-center py-4"
|
|
7
|
-
},
|
|
7
|
+
}, N = {
|
|
8
8
|
key: 2,
|
|
9
9
|
class: "flex gap-4 mt-4"
|
|
10
|
-
},
|
|
10
|
+
}, K = {
|
|
11
11
|
__name: "KunAlert",
|
|
12
12
|
props: {
|
|
13
13
|
modelValue: Boolean,
|
|
@@ -80,30 +80,20 @@ const B = {
|
|
|
80
80
|
type: String,
|
|
81
81
|
default: "p-2"
|
|
82
82
|
},
|
|
83
|
-
margin: {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
default: !1
|
|
90
|
-
},
|
|
91
|
-
persistent: {
|
|
92
|
-
type: Boolean,
|
|
93
|
-
default: !1
|
|
94
|
-
},
|
|
95
|
-
persistentLabel: {
|
|
96
|
-
type: String,
|
|
97
|
-
default: "Aceptar"
|
|
98
|
-
},
|
|
99
|
-
actionLabel: {
|
|
100
|
-
type: String,
|
|
101
|
-
default: ""
|
|
102
|
-
}
|
|
83
|
+
margin: { type: String, default: "m-2" },
|
|
84
|
+
fullscreen: { type: Boolean, default: !1 },
|
|
85
|
+
persistent: { type: Boolean, default: !1 },
|
|
86
|
+
persistentLabel: { type: String, default: "Aceptar" },
|
|
87
|
+
actionLabel: { type: String, default: "" },
|
|
88
|
+
timeout: { type: Number, default: 2500 }
|
|
103
89
|
},
|
|
104
90
|
emits: ["update:modelValue", "action"],
|
|
105
|
-
setup(e, { emit:
|
|
106
|
-
const l = e,
|
|
91
|
+
setup(e, { emit: S }) {
|
|
92
|
+
const l = e, d = S;
|
|
93
|
+
h(() => setTimeout(() => {
|
|
94
|
+
d("update:modelValue", !1);
|
|
95
|
+
}, l.timeout));
|
|
96
|
+
const p = m(() => {
|
|
107
97
|
if (l.fullscreen) return `fixed inset-0 flex items-center justify-center ${l.margin}`;
|
|
108
98
|
const t = l.margin;
|
|
109
99
|
switch (l.position) {
|
|
@@ -128,35 +118,35 @@ const B = {
|
|
|
128
118
|
default:
|
|
129
119
|
return `fixed top-0 left-1/2 transform -translate-x-1/2 ${t}`;
|
|
130
120
|
}
|
|
131
|
-
}),
|
|
132
|
-
|
|
121
|
+
}), $ = m(() => `${l.fullscreen ? "w-full h-full" : "w-fit"} ${l.transition}`), s = () => {
|
|
122
|
+
d("update:modelValue", !1);
|
|
133
123
|
}, k = () => {
|
|
134
124
|
!l.persistent && !l.fullscreen && s();
|
|
135
125
|
}, v = (t) => {
|
|
136
126
|
!l.persistent && l.fullscreen && s();
|
|
137
127
|
};
|
|
138
|
-
return (t, o) => e.modelValue ? (a(), i("div",
|
|
128
|
+
return (t, o) => e.modelValue ? (a(), i("div", w({
|
|
139
129
|
key: 0,
|
|
140
|
-
class: [
|
|
130
|
+
class: ["px-2", [$.value, p.value]],
|
|
141
131
|
style: { zIndex: e.zIndex },
|
|
142
|
-
onClick:
|
|
143
|
-
onKeydown:
|
|
132
|
+
onClick: B(k, ["self"]),
|
|
133
|
+
onKeydown: z(v, ["esc"]),
|
|
144
134
|
tabindex: "0"
|
|
145
135
|
}, t.$attrs), [
|
|
146
|
-
|
|
136
|
+
u("div", {
|
|
147
137
|
class: r([e.alertClass, e.textColor, e.bgColor, e.borderColor])
|
|
148
138
|
}, [
|
|
149
|
-
e.icon ? (a(), i("div",
|
|
150
|
-
|
|
139
|
+
e.icon ? (a(), i("div", V, [
|
|
140
|
+
u("div", {
|
|
151
141
|
class: r(["rounded-full p-4", e.iconBgColor])
|
|
152
142
|
}, [
|
|
153
|
-
|
|
143
|
+
g(b, {
|
|
154
144
|
icon: e.icon,
|
|
155
145
|
size: e.iconSize
|
|
156
146
|
}, null, 8, ["icon", "size"])
|
|
157
147
|
], 2)
|
|
158
148
|
])) : n("", !0),
|
|
159
|
-
|
|
149
|
+
u("div", {
|
|
160
150
|
class: r(["text-center flex flex-col justify-center items-center", e.paddingContainer])
|
|
161
151
|
}, [
|
|
162
152
|
e.title ? (a(), i("div", {
|
|
@@ -167,37 +157,37 @@ const B = {
|
|
|
167
157
|
key: 1,
|
|
168
158
|
class: r(e.messageClass)
|
|
169
159
|
}, c(e.message), 3)) : n("", !0),
|
|
170
|
-
e.persistent ? (a(), i("div",
|
|
171
|
-
e.actionLabel ? (a(),
|
|
160
|
+
e.persistent ? (a(), i("div", N, [
|
|
161
|
+
e.actionLabel ? (a(), y(C, {
|
|
172
162
|
key: 0,
|
|
173
163
|
onClick: o[0] || (o[0] = (L) => t.$emit("action"))
|
|
174
164
|
}, {
|
|
175
|
-
default:
|
|
176
|
-
|
|
165
|
+
default: x(() => [
|
|
166
|
+
f(c(e.actionLabel), 1)
|
|
177
167
|
]),
|
|
178
168
|
_: 1
|
|
179
169
|
})) : n("", !0),
|
|
180
|
-
e.closable ? n("", !0) : (a(),
|
|
170
|
+
e.closable ? n("", !0) : (a(), y(C, {
|
|
181
171
|
key: 1,
|
|
182
172
|
onClick: s
|
|
183
173
|
}, {
|
|
184
|
-
default:
|
|
185
|
-
|
|
174
|
+
default: x(() => [
|
|
175
|
+
f(c(e.persistentLabel), 1)
|
|
186
176
|
]),
|
|
187
177
|
_: 1
|
|
188
178
|
}))
|
|
189
179
|
])) : n("", !0),
|
|
190
180
|
e.closable ? (a(), i("button", {
|
|
191
181
|
key: 3,
|
|
192
|
-
class: "absolute top-0 right-1 text-xl focus:outline-none cursor-pointer",
|
|
182
|
+
class: "absolute top-0 right-1 px-1 text-xl focus:outline-none cursor-pointer",
|
|
193
183
|
onClick: s
|
|
194
184
|
}, [
|
|
195
|
-
|
|
185
|
+
g(b, {
|
|
196
186
|
icon: "hand",
|
|
197
187
|
size: "text-base",
|
|
198
188
|
class: "mr-1"
|
|
199
189
|
}),
|
|
200
|
-
o[1] || (o[1] =
|
|
190
|
+
o[1] || (o[1] = f(" × "))
|
|
201
191
|
])) : n("", !0)
|
|
202
192
|
], 2)
|
|
203
193
|
], 2)
|
|
@@ -205,5 +195,5 @@ const B = {
|
|
|
205
195
|
}
|
|
206
196
|
};
|
|
207
197
|
export {
|
|
208
|
-
|
|
198
|
+
K as default
|
|
209
199
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getCurrentInstance as F, createElementBlock as s, openBlock as l, createCommentVNode as i, createElementVNode as d, normalizeClass as u, unref as t, toDisplayString as p, mergeProps as M, Fragment as
|
|
2
|
-
import { KunNumberFieldProps as
|
|
3
|
-
import { useKunNumberField as
|
|
1
|
+
import { getCurrentInstance as F, createElementBlock as s, openBlock as l, createCommentVNode as i, createElementVNode as d, normalizeClass as u, unref as t, toDisplayString as p, mergeProps as M, Fragment as m, renderList as N } from "vue";
|
|
2
|
+
import { KunNumberFieldProps as B } from "../composables/KunNumberFieldProps.js";
|
|
3
|
+
import { useKunNumberField as K } from "../composables/useKunNumberFieldComposable.js";
|
|
4
4
|
const D = { class: "w-full flex flex-col relative" }, z = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "h-full"
|
|
@@ -11,19 +11,19 @@ const D = { class: "w-full flex flex-col relative" }, z = {
|
|
|
11
11
|
key: 2,
|
|
12
12
|
class: "flex items-center justify-center min-w-[32px] h-full px-1"
|
|
13
13
|
}, H = ["value", "placeholder", "readonly", "disabled", "maxlength", "aria-invalid"], L = ["disabled"], S = {
|
|
14
|
-
key:
|
|
14
|
+
key: 0,
|
|
15
15
|
class: "flex items-center h-full"
|
|
16
16
|
}, q = ["disabled"], G = ["disabled"], J = {
|
|
17
|
-
key:
|
|
17
|
+
key: 1,
|
|
18
18
|
class: "flex flex-col items-center justify-center border-l border-slate-600"
|
|
19
19
|
}, O = ["disabled"], Q = ["disabled"], R = {
|
|
20
|
-
key:
|
|
20
|
+
key: 5,
|
|
21
21
|
class: "flex items-center justify-center min-w-[32px] h-full px-1 cursor-pointer"
|
|
22
22
|
}, T = {
|
|
23
|
-
key:
|
|
23
|
+
key: 6,
|
|
24
24
|
class: "h-full"
|
|
25
25
|
}, U = ["disabled"], W = {
|
|
26
|
-
key:
|
|
26
|
+
key: 7,
|
|
27
27
|
class: "ml-2"
|
|
28
28
|
}, X = {
|
|
29
29
|
key: 0,
|
|
@@ -36,22 +36,22 @@ const D = { class: "w-full flex flex-col relative" }, z = {
|
|
|
36
36
|
class: "text-xs text-center"
|
|
37
37
|
}, se = {
|
|
38
38
|
__name: "KunNumberField",
|
|
39
|
-
props:
|
|
39
|
+
props: B,
|
|
40
40
|
emits: ["update:modelValue"],
|
|
41
|
-
setup(
|
|
42
|
-
const
|
|
41
|
+
setup(v, { emit: g }) {
|
|
42
|
+
const w = v, C = g, b = `number-input-${F().uid}`, {
|
|
43
43
|
inputValue: y,
|
|
44
|
-
numberInput:
|
|
45
|
-
inputKey:
|
|
46
|
-
updateValue:
|
|
44
|
+
numberInput: x,
|
|
45
|
+
inputKey: I,
|
|
46
|
+
updateValue: V,
|
|
47
47
|
onIncrement: n,
|
|
48
48
|
onDecrement: a,
|
|
49
|
-
onClear:
|
|
50
|
-
focus:
|
|
51
|
-
handleFocus:
|
|
52
|
-
isActive:
|
|
53
|
-
handleBlur:
|
|
54
|
-
} =
|
|
49
|
+
onClear: f,
|
|
50
|
+
focus: c,
|
|
51
|
+
handleFocus: k,
|
|
52
|
+
isActive: j,
|
|
53
|
+
handleBlur: h
|
|
54
|
+
} = K(w, C);
|
|
55
55
|
return (e, o) => (l(), s("div", D, [
|
|
56
56
|
e.label ? (l(), s("label", {
|
|
57
57
|
key: 0,
|
|
@@ -59,7 +59,7 @@ const D = { class: "w-full flex flex-col relative" }, z = {
|
|
|
59
59
|
class: u([
|
|
60
60
|
e.labelColor,
|
|
61
61
|
"absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
|
|
62
|
-
t(
|
|
62
|
+
t(j) || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
|
|
63
63
|
])
|
|
64
64
|
}, p(e.label), 3)) : i("", !0),
|
|
65
65
|
d("div", M({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
|
|
@@ -67,12 +67,12 @@ const D = { class: "w-full flex flex-col relative" }, z = {
|
|
|
67
67
|
class: u(["flex items-center w-full h-full border", [
|
|
68
68
|
e.bgInput,
|
|
69
69
|
e.rounded,
|
|
70
|
-
t(
|
|
70
|
+
t(c) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
|
|
71
71
|
e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
|
|
72
72
|
e.error ? "bg-red-200 dark:bg-red-900" : ""
|
|
73
73
|
]])
|
|
74
74
|
}, [
|
|
75
|
-
e.controlVariant === "split" ? (l(), s("div", z, [
|
|
75
|
+
!e.noArrows && e.controlVariant === "split" ? (l(), s("div", z, [
|
|
76
76
|
d("button", {
|
|
77
77
|
type: "button",
|
|
78
78
|
class: "p-3 text-lg border-r border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
@@ -89,8 +89,8 @@ const D = { class: "w-full flex flex-col relative" }, z = {
|
|
|
89
89
|
(l(), s("input", {
|
|
90
90
|
id: b,
|
|
91
91
|
ref_key: "numberInput",
|
|
92
|
-
ref:
|
|
93
|
-
key: t(
|
|
92
|
+
ref: x,
|
|
93
|
+
key: t(I),
|
|
94
94
|
type: "text",
|
|
95
95
|
value: t(y),
|
|
96
96
|
placeholder: e.placeholder,
|
|
@@ -100,58 +100,61 @@ const D = { class: "w-full flex flex-col relative" }, z = {
|
|
|
100
100
|
autocomplete: "off",
|
|
101
101
|
class: u(["w-full h-full bg-transparent rounded focus:outline-none p-3", [e.textColor, e.placeholderColor, e.textCenter ? "text-center" : ""]]),
|
|
102
102
|
"aria-invalid": e.error ? "true" : "false",
|
|
103
|
-
onInput: o[1] || (o[1] = (r) => t(
|
|
104
|
-
onFocus: o[2] || (o[2] = (...r) => t(
|
|
105
|
-
onBlur: o[3] || (o[3] = (...r) => t(
|
|
103
|
+
onInput: o[1] || (o[1] = (r) => t(V)(r.target.value)),
|
|
104
|
+
onFocus: o[2] || (o[2] = (...r) => t(k) && t(k)(...r)),
|
|
105
|
+
onBlur: o[3] || (o[3] = (...r) => t(h) && t(h)(...r))
|
|
106
106
|
}, null, 42, H)),
|
|
107
107
|
e.clearable && t(y) != null ? (l(), s("button", {
|
|
108
108
|
key: 3,
|
|
109
109
|
type: "button",
|
|
110
|
-
onClick: o[4] || (o[4] = (...r) => t(
|
|
110
|
+
onClick: o[4] || (o[4] = (...r) => t(f) && t(f)(...r)),
|
|
111
111
|
class: u(["ml-2", e.textColor]),
|
|
112
112
|
disabled: e.disabled || e.readonly
|
|
113
113
|
}, " × ", 10, L)) : i("", !0),
|
|
114
|
-
e.
|
|
115
|
-
|
|
116
|
-
type: "button",
|
|
117
|
-
class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
118
|
-
onClick: o[5] || (o[5] = (...r) => t(n) && t(n)(...r)),
|
|
119
|
-
disabled: e.disabled || e.readonly
|
|
120
|
-
}, " ▲ ", 8, q),
|
|
121
|
-
d("button", {
|
|
122
|
-
type: "button",
|
|
123
|
-
class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
124
|
-
onClick: o[6] || (o[6] = (...r) => t(a) && t(a)(...r)),
|
|
125
|
-
disabled: e.disabled || e.readonly
|
|
126
|
-
}, " ▼ ", 8, G)
|
|
127
|
-
])) : e.controlVariant === "stacked" ? (l(), s("div", J, [
|
|
128
|
-
d("div", {
|
|
129
|
-
class: "border-b border-slate-600 pb-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
130
|
-
onClick: o[7] || (o[7] = (...r) => t(n) && t(n)(...r))
|
|
131
|
-
}, [
|
|
114
|
+
e.noArrows ? i("", !0) : (l(), s(m, { key: 4 }, [
|
|
115
|
+
e.controlVariant === "default" ? (l(), s("div", S, [
|
|
132
116
|
d("button", {
|
|
133
117
|
type: "button",
|
|
134
|
-
class: "
|
|
118
|
+
class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
119
|
+
onClick: o[5] || (o[5] = (...r) => t(n) && t(n)(...r)),
|
|
135
120
|
disabled: e.disabled || e.readonly
|
|
136
|
-
}, "▲", 8,
|
|
137
|
-
]),
|
|
138
|
-
d("div", {
|
|
139
|
-
class: "border-t border-slate-600 pt-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
140
|
-
onClick: o[8] || (o[8] = (...r) => t(a) && t(a)(...r))
|
|
141
|
-
}, [
|
|
121
|
+
}, " ▲ ", 8, q),
|
|
142
122
|
d("button", {
|
|
143
123
|
type: "button",
|
|
144
|
-
class: "
|
|
124
|
+
class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
125
|
+
onClick: o[6] || (o[6] = (...r) => t(a) && t(a)(...r)),
|
|
145
126
|
disabled: e.disabled || e.readonly
|
|
146
|
-
}, "▼", 8,
|
|
147
|
-
])
|
|
148
|
-
|
|
127
|
+
}, " ▼ ", 8, G)
|
|
128
|
+
])) : i("", !0),
|
|
129
|
+
e.controlVariant === "stacked" ? (l(), s("div", J, [
|
|
130
|
+
d("div", {
|
|
131
|
+
class: "border-b border-slate-600 pb-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
132
|
+
onClick: o[7] || (o[7] = (...r) => t(n) && t(n)(...r))
|
|
133
|
+
}, [
|
|
134
|
+
d("button", {
|
|
135
|
+
type: "button",
|
|
136
|
+
class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
|
|
137
|
+
disabled: e.disabled || e.readonly
|
|
138
|
+
}, "▲", 8, O)
|
|
139
|
+
]),
|
|
140
|
+
d("div", {
|
|
141
|
+
class: "border-t border-slate-600 pt-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
142
|
+
onClick: o[8] || (o[8] = (...r) => t(a) && t(a)(...r))
|
|
143
|
+
}, [
|
|
144
|
+
d("button", {
|
|
145
|
+
type: "button",
|
|
146
|
+
class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
|
|
147
|
+
disabled: e.disabled || e.readonly
|
|
148
|
+
}, "▼", 8, Q)
|
|
149
|
+
])
|
|
150
|
+
])) : i("", !0)
|
|
151
|
+
], 64)),
|
|
149
152
|
e.appendIcon ? (l(), s("div", R, [
|
|
150
153
|
d("i", {
|
|
151
154
|
class: u(e.appendIcon)
|
|
152
155
|
}, null, 2)
|
|
153
156
|
])) : i("", !0),
|
|
154
|
-
e.controlVariant === "split" ? (l(), s("div", T, [
|
|
157
|
+
!e.noArrows && e.controlVariant === "split" ? (l(), s("div", T, [
|
|
155
158
|
d("button", {
|
|
156
159
|
type: "button",
|
|
157
160
|
class: "p-3 text-lg border-l border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
@@ -164,9 +167,9 @@ const D = { class: "w-full flex flex-col relative" }, z = {
|
|
|
164
167
|
e.hideDetails ? i("", !0) : (l(), s("div", X, [
|
|
165
168
|
e.error || e.errorMessages ? (l(), s("div", Y, [
|
|
166
169
|
Array.isArray(e.errorMessages) ? (l(), s("div", Z, [
|
|
167
|
-
(l(!0), s(
|
|
170
|
+
(l(!0), s(m, null, N(e.errorMessages, (r, A) => (l(), s("div", { key: A }, p(r), 1))), 128))
|
|
168
171
|
])) : typeof e.errorMessages == "string" ? (l(), s("div", _, p(e.errorMessages), 1)) : i("", !0)
|
|
169
|
-
])) : e.hint && (e.persistentHint || t(
|
|
172
|
+
])) : e.hint && (e.persistentHint || t(c)) ? (l(), s("div", ee, p(e.hint), 1)) : i("", !0)
|
|
170
173
|
]))
|
|
171
174
|
], 16)
|
|
172
175
|
]));
|
|
@@ -19,6 +19,7 @@ const e = {
|
|
|
19
19
|
bgInput: { type: String, default: "bg-slate-200 dark:bg-slate-800" },
|
|
20
20
|
textCenter: { type: Boolean, default: !1 },
|
|
21
21
|
controlVariant: { type: String, default: "default" },
|
|
22
|
+
noArrows: { type: Boolean, default: !1 },
|
|
22
23
|
// Estado
|
|
23
24
|
error: { type: Boolean, default: !1 },
|
|
24
25
|
errorMessages: [String, Array],
|