adverich-kun-ui 0.1.119 → 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,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],
|