adverich-kun-ui 0.1.8 → 0.1.10
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.
- package/dist/adverich-kun-ui.css +1 -1
- package/dist/kun-ui.es.js +171 -167
- package/dist/kun-ui.umd.js +1 -1
- package/package.json +1 -1
package/dist/adverich-kun-ui.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[data-v-
|
|
1
|
+
[data-v-c3a2b846]::-webkit-scrollbar-track{border-radius:0 0 10px}#txt,#hide{font:inherit;margin:0;padding:0}#txt{padding:0 2px;text-align:center;min-width:50px;max-width:100%;overflow:hidden;text-overflow:ellipsis}#txt:focus-visible{outline:none}#hide{position:absolute;height:0;overflow:hidden;white-space:pre}
|
package/dist/kun-ui.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { resolveComponent as A, createElementBlock as p, openBlock as s, createElementVNode as v, createVNode as V, createCommentVNode as b, toDisplayString as $, normalizeClass as O, createBlock as P, renderSlot as h, ref as
|
|
2
|
-
const
|
|
1
|
+
import { resolveComponent as A, createElementBlock as p, openBlock as s, createElementVNode as v, createVNode as V, createCommentVNode as b, toDisplayString as $, normalizeClass as O, createBlock as P, renderSlot as h, ref as R, computed as k, mergeModels as H, useModel as U, watchEffect as ue, Fragment as ae, unref as c, withDirectives as ie, withKeys as ee, isRef as oe, createSlots as X, withCtx as q, createTextVNode as te, vShow as se, resolveDynamicComponent as re, normalizeStyle as ce } from "vue";
|
|
2
|
+
const de = {
|
|
3
3
|
class: "h-svh top-0 left-0 bg-grey-900 w-full overflow-y-auto opacity-90",
|
|
4
4
|
style: { position: "fixed", "z-index": "2500" }
|
|
5
|
-
},
|
|
5
|
+
}, fe = { class: "rounded-lg px-16 py-14" }, ye = { class: "flex justify-center py-4" }, pe = { class: "rounded-full bg-red-200 p-6" }, me = { class: "text-center flex flex-col justify-center items-center bg-red-500 rounded-lg p-4" }, ge = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "my-4 text-center text-3xl font-semibold"
|
|
8
|
-
},
|
|
8
|
+
}, ve = { class: "text-xl font-normal" }, he = {
|
|
9
9
|
__name: "KunAlert",
|
|
10
10
|
props: {
|
|
11
11
|
modelValue: {
|
|
@@ -23,27 +23,27 @@ const ce = {
|
|
|
23
23
|
},
|
|
24
24
|
emits: ["update:modelValue"],
|
|
25
25
|
setup(e, { emit: o }) {
|
|
26
|
-
return (t,
|
|
26
|
+
return (t, a) => {
|
|
27
27
|
const n = A("KunIcon");
|
|
28
|
-
return s(), p("div",
|
|
29
|
-
v("div",
|
|
30
|
-
v("div",
|
|
31
|
-
v("div",
|
|
28
|
+
return s(), p("div", de, [
|
|
29
|
+
v("div", fe, [
|
|
30
|
+
v("div", ye, [
|
|
31
|
+
v("div", pe, [
|
|
32
32
|
V(n, {
|
|
33
33
|
icon: "exclamation",
|
|
34
34
|
size: "text-9xl"
|
|
35
35
|
})
|
|
36
36
|
])
|
|
37
37
|
]),
|
|
38
|
-
v("div",
|
|
39
|
-
e.title ? (s(), p("div",
|
|
40
|
-
v("div",
|
|
38
|
+
v("div", me, [
|
|
39
|
+
e.title ? (s(), p("div", ge, $(e.title), 1)) : b("", !0),
|
|
40
|
+
v("div", ve, $(e.message), 1)
|
|
41
41
|
])
|
|
42
42
|
])
|
|
43
43
|
]);
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
},
|
|
46
|
+
}, xe = { class: "flex-1" }, be = { class: "flex items-center" }, Se = { class: "flex-1" }, Ce = { class: "w-full flex justify-end" }, Ke = {
|
|
47
47
|
__name: "KunAppbar",
|
|
48
48
|
props: {
|
|
49
49
|
density: {
|
|
@@ -61,29 +61,29 @@ const ce = {
|
|
|
61
61
|
},
|
|
62
62
|
setup(e) {
|
|
63
63
|
return (o, t) => {
|
|
64
|
-
const
|
|
64
|
+
const a = A("KunAppbarTitle");
|
|
65
65
|
return s(), p("div", {
|
|
66
66
|
class: O(["flex py-1 px-2 h-14 items-center", [e.bgColor]])
|
|
67
67
|
}, [
|
|
68
|
-
v("div",
|
|
69
|
-
v("div",
|
|
68
|
+
v("div", xe, [
|
|
69
|
+
v("div", be, [
|
|
70
70
|
h(o.$slots, "appbarButton"),
|
|
71
71
|
h(o.$slots, "prepend")
|
|
72
72
|
])
|
|
73
73
|
]),
|
|
74
|
-
e.title ? (s(), P(
|
|
74
|
+
e.title ? (s(), P(a, {
|
|
75
75
|
key: 0,
|
|
76
76
|
title: e.title
|
|
77
77
|
}, null, 8, ["title"])) : b("", !0),
|
|
78
|
-
v("div",
|
|
79
|
-
v("div",
|
|
78
|
+
v("div", Se, [
|
|
79
|
+
v("div", Ce, [
|
|
80
80
|
h(o.$slots, "append")
|
|
81
81
|
])
|
|
82
82
|
])
|
|
83
83
|
], 2);
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
-
},
|
|
86
|
+
}, _e = {
|
|
87
87
|
label: {
|
|
88
88
|
type: String
|
|
89
89
|
},
|
|
@@ -190,20 +190,20 @@ function _(e) {
|
|
|
190
190
|
function M(e) {
|
|
191
191
|
return Array.isArray(e);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
const n =
|
|
195
|
-
|
|
196
|
-
const F =
|
|
193
|
+
function $e(e, o, t, a) {
|
|
194
|
+
const n = R(null), d = R(null), m = R(null), f = R(!1), g = R(""), x = k(() => !e.searchableKeys.length), I = k(() => e.clearOnSelect);
|
|
195
|
+
k(() => e.clearSearchOnSelect), k(() => e.focusOnSelect);
|
|
196
|
+
const F = k(() => e.closeOnSelect);
|
|
197
197
|
function E() {
|
|
198
|
-
M(t.value) && (t.value.length ? n.value =
|
|
198
|
+
M(t.value) && (t.value.length ? n.value = a.value.filter(
|
|
199
199
|
(l) => _(l) ? t.value.some(
|
|
200
200
|
(u) => u[e.itemTitle].includes(l[e.itemTitle])
|
|
201
201
|
) : t.value.some((u) => u.includes(l))
|
|
202
|
-
) : n.value = []), (_(t.value) && Object.keys(t.value).length || typeof t.value == "number" && t.value || typeof t.value == "string" && t.value || typeof t.value == "boolean") && (n.value =
|
|
202
|
+
) : n.value = []), (_(t.value) && Object.keys(t.value).length || typeof t.value == "number" && t.value || typeof t.value == "string" && t.value || typeof t.value == "boolean") && (n.value = a.value.find(
|
|
203
203
|
(l) => _(l) ? e.returnObject ? e.itemValue ? l[e.itemValue] === t.value[e.itemValue] : l[e.itemTitle] === t.value[e.itemTitle] : l[e.itemValue] === t.value : l === t.value
|
|
204
204
|
));
|
|
205
205
|
}
|
|
206
|
-
const j =
|
|
206
|
+
const j = k(() => n.value ? M(n.value) ? n.value.length ? r(n.value, e.itemTitle, "hasDefault") : e.placeholderText : _(n.value) ? r(n.value, e.itemTitle, "hasDefault") : n.value.toString() : a.value.length ? e.placeholderText : e.textNoItems), w = k(() => e.startEmtpy && g.value.length < 3 ? [] : a.value.filter((u) => {
|
|
207
207
|
if (_(u)) {
|
|
208
208
|
const z = Object.values(u).filter((N) => {
|
|
209
209
|
if (!_(N) && !M(N))
|
|
@@ -214,7 +214,7 @@ function _e(e, o, t, i) {
|
|
|
214
214
|
) : g.value ? u == g.value : u;
|
|
215
215
|
}
|
|
216
216
|
return u.toString().toLowerCase().includes(g.value.toLowerCase());
|
|
217
|
-
}).slice(0, currentBatchStep.value)),
|
|
217
|
+
}).slice(0, currentBatchStep.value)), i = k(() => e.itemText.includes(",") ? e.itemText.split(",") : e.itemText);
|
|
218
218
|
function r(l, u, z) {
|
|
219
219
|
if (_(l)) {
|
|
220
220
|
if (u)
|
|
@@ -240,7 +240,7 @@ function _e(e, o, t, i) {
|
|
|
240
240
|
}
|
|
241
241
|
t.value = n.value;
|
|
242
242
|
}
|
|
243
|
-
|
|
243
|
+
I.value && W(), d.value.focus();
|
|
244
244
|
}
|
|
245
245
|
function B(l) {
|
|
246
246
|
return n.value === null ? !1 : n.value.some(
|
|
@@ -261,8 +261,8 @@ function _e(e, o, t, i) {
|
|
|
261
261
|
function C(l) {
|
|
262
262
|
l.key !== "Tab" && (f.value = !0);
|
|
263
263
|
}
|
|
264
|
-
function
|
|
265
|
-
|
|
264
|
+
function L(l) {
|
|
265
|
+
I.value && (f.value = !1);
|
|
266
266
|
}
|
|
267
267
|
function Y() {
|
|
268
268
|
f.value = !0, m.value && m.value.focus();
|
|
@@ -288,15 +288,15 @@ function _e(e, o, t, i) {
|
|
|
288
288
|
menuModel: f,
|
|
289
289
|
search: g,
|
|
290
290
|
isCloseOnSelect: F,
|
|
291
|
-
isClearOnSelect:
|
|
291
|
+
isClearOnSelect: I,
|
|
292
292
|
setSelectedItemValue: E,
|
|
293
293
|
placeholder: j,
|
|
294
294
|
filteredItems: w,
|
|
295
|
-
textArr:
|
|
295
|
+
textArr: i,
|
|
296
296
|
itemToString: r,
|
|
297
297
|
getSelectedItem: y,
|
|
298
298
|
openMenu: C,
|
|
299
|
-
closeMenu:
|
|
299
|
+
closeMenu: L,
|
|
300
300
|
focusOnMenu: Y,
|
|
301
301
|
createItem: G,
|
|
302
302
|
removeItem: J,
|
|
@@ -304,14 +304,14 @@ function _e(e, o, t, i) {
|
|
|
304
304
|
isDisabled: T
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
|
-
const
|
|
307
|
+
const D = (e, o) => {
|
|
308
308
|
const t = e.__vccOpts || e;
|
|
309
|
-
for (const [
|
|
310
|
-
t[
|
|
309
|
+
for (const [a, n] of o)
|
|
310
|
+
t[a] = n;
|
|
311
311
|
return t;
|
|
312
|
-
},
|
|
312
|
+
}, ke = { class: "relative" }, Ie = ["close-on-content-click", "max-height"], we = { class: "w-full px-2 py-1" }, Be = {
|
|
313
313
|
__name: "KunAutocomplete",
|
|
314
|
-
props: /* @__PURE__ */ H(
|
|
314
|
+
props: /* @__PURE__ */ H(_e, {
|
|
315
315
|
modelValue: { default: null },
|
|
316
316
|
modelModifiers: {},
|
|
317
317
|
items: { default: [], type: Array },
|
|
@@ -320,52 +320,52 @@ const R = (e, o) => {
|
|
|
320
320
|
emits: /* @__PURE__ */ H(["createItem"], ["update:modelValue", "update:items"]),
|
|
321
321
|
setup(e, { emit: o }) {
|
|
322
322
|
const t = e;
|
|
323
|
-
|
|
324
|
-
const
|
|
323
|
+
R(0);
|
|
324
|
+
const a = U(e, "modelValue"), n = U(e, "items"), d = o, {
|
|
325
325
|
selectedItem: m,
|
|
326
326
|
textFieldRef: f,
|
|
327
327
|
menuModel: g,
|
|
328
328
|
search: x,
|
|
329
|
-
isCloseOnSelect:
|
|
329
|
+
isCloseOnSelect: I,
|
|
330
330
|
setSelectedItemValue: F,
|
|
331
331
|
placeholder: E,
|
|
332
332
|
openMenu: j,
|
|
333
333
|
closeMenu: w,
|
|
334
|
-
focusOnMenu:
|
|
334
|
+
focusOnMenu: i,
|
|
335
335
|
createItem: r,
|
|
336
336
|
clearSelection: y
|
|
337
|
-
} =
|
|
338
|
-
|
|
339
|
-
isObject(
|
|
337
|
+
} = $e(t, d, a, n);
|
|
338
|
+
ue(() => {
|
|
339
|
+
isObject(a.value) && !isNotEmpty(a.value) && (m.value = {}), isArray(a.value) && !isNotEmpty(a.value) && (m.value = []), a.value === null && (m.value = null), F();
|
|
340
340
|
});
|
|
341
341
|
function B(S) {
|
|
342
|
-
x.value = "",
|
|
342
|
+
x.value = "", a.value = S, w();
|
|
343
343
|
}
|
|
344
344
|
return (S, C) => {
|
|
345
|
-
const
|
|
346
|
-
return s(), p(
|
|
345
|
+
const L = A("KunIcon"), Y = A("KunTextField"), G = A("KunBtn"), J = A("KunListItem"), W = A("KunVirtualScroller");
|
|
346
|
+
return s(), p(ae, null, [
|
|
347
347
|
c(g) ? (s(), p("div", {
|
|
348
348
|
key: 0,
|
|
349
349
|
class: "fixed opacity-10 w-svw inset-0 h-svh",
|
|
350
350
|
onClick: C[0] || (C[0] = (T) => g.value = !1)
|
|
351
351
|
})) : b("", !0),
|
|
352
|
-
v("div",
|
|
352
|
+
v("div", ke, [
|
|
353
353
|
V(Y, {
|
|
354
354
|
modelValue: c(x),
|
|
355
|
-
"onUpdate:modelValue": C[2] || (C[2] = (T) =>
|
|
355
|
+
"onUpdate:modelValue": C[2] || (C[2] = (T) => oe(x) ? x.value = T : null),
|
|
356
356
|
ref_key: "textFieldRef",
|
|
357
357
|
ref: f,
|
|
358
358
|
placeholder: S.isArray(c(m)) && c(m).length ? "" : c(E),
|
|
359
|
-
onKeyup: ee(c(
|
|
359
|
+
onKeyup: ee(c(i), ["down"]),
|
|
360
360
|
onClickInput: c(j),
|
|
361
361
|
onPressEsc: c(w),
|
|
362
362
|
onChange: C[3] || (C[3] = (T) => console.log("change")),
|
|
363
|
-
onFocusInput: c(
|
|
363
|
+
onFocusInput: c(i)
|
|
364
364
|
}, X({ _: 2 }, [
|
|
365
365
|
S.hasIcons ? {
|
|
366
366
|
name: "append-inner",
|
|
367
367
|
fn: q(() => [
|
|
368
|
-
S.clearable && c(m) ? (s(), P(
|
|
368
|
+
S.clearable && c(m) ? (s(), P(L, {
|
|
369
369
|
key: 0,
|
|
370
370
|
onClick: c(y),
|
|
371
371
|
size: "text-xl",
|
|
@@ -374,14 +374,14 @@ const R = (e, o) => {
|
|
|
374
374
|
class: O(["mr-1", S.isNotEmpty(c(m)) ? "cursor-pointer" : "cursor-default"]),
|
|
375
375
|
disabled: !S.isNotEmpty(c(m))
|
|
376
376
|
}, null, 8, ["onClick", "class", "disabled"])) : b("", !0),
|
|
377
|
-
V(
|
|
377
|
+
V(L, {
|
|
378
378
|
color: "text-accent-button",
|
|
379
379
|
size: "text-xl",
|
|
380
380
|
class: "cursor-pointer",
|
|
381
381
|
icon: c(g) ? "menuUp" : "menuDown",
|
|
382
382
|
onClick: C[1] || (C[1] = (T) => g.value = !c(g))
|
|
383
383
|
}, null, 8, ["icon"]),
|
|
384
|
-
S.required ? (s(), P(
|
|
384
|
+
S.required ? (s(), P(L, {
|
|
385
385
|
key: 1,
|
|
386
386
|
color: "text-red-900",
|
|
387
387
|
size: "text-lg",
|
|
@@ -394,7 +394,7 @@ const R = (e, o) => {
|
|
|
394
394
|
]), 1032, ["modelValue", "placeholder", "onKeyup", "onClickInput", "onPressEsc", "onFocusInput"]),
|
|
395
395
|
ie(v("div", {
|
|
396
396
|
class: "absolute h-fit left-0 w-full z-50 bg-surface rounded-b border border-field-border-focus ring-1 focus:ring-field-ring-focus",
|
|
397
|
-
"close-on-content-click": c(
|
|
397
|
+
"close-on-content-click": c(I),
|
|
398
398
|
"max-height": S.maxHeight
|
|
399
399
|
}, [
|
|
400
400
|
V(W, {
|
|
@@ -417,7 +417,7 @@ const R = (e, o) => {
|
|
|
417
417
|
S.hasCreateItem ? {
|
|
418
418
|
name: "topButton",
|
|
419
419
|
fn: q(() => [
|
|
420
|
-
v("div",
|
|
420
|
+
v("div", we, [
|
|
421
421
|
V(G, {
|
|
422
422
|
onClick: c(r),
|
|
423
423
|
class: "w-full rounded-md bg-accent-button",
|
|
@@ -434,13 +434,13 @@ const R = (e, o) => {
|
|
|
434
434
|
} : void 0
|
|
435
435
|
]), 1032, ["items", "search"])
|
|
436
436
|
], 8, Ie), [
|
|
437
|
-
[
|
|
437
|
+
[se, c(g)]
|
|
438
438
|
])
|
|
439
439
|
])
|
|
440
440
|
], 64);
|
|
441
441
|
};
|
|
442
442
|
}
|
|
443
|
-
},
|
|
443
|
+
}, Oe = /* @__PURE__ */ D(Be, [["__scopeId", "data-v-c3a2b846"]]), je = ["disabled"], Te = "px-1 py-1 text-xs", Ae = "px-2 py-2 text-xs", Fe = "px-1 py-1 text-sm", Ee = "px-2 py-2 text-sm", Ne = "px-3 py-3 text-sm", ze = "px-3 py-3 text-base", Me = "px-4 py-4 text-base", Ve = {
|
|
444
444
|
__name: "KunBtn",
|
|
445
445
|
props: {
|
|
446
446
|
size: {
|
|
@@ -503,21 +503,25 @@ const R = (e, o) => {
|
|
|
503
503
|
setup(e) {
|
|
504
504
|
const o = (t) => {
|
|
505
505
|
switch (t) {
|
|
506
|
+
case "xxs":
|
|
507
|
+
return Te;
|
|
506
508
|
case "xs":
|
|
507
|
-
return
|
|
509
|
+
return Ae;
|
|
508
510
|
case "sm":
|
|
509
|
-
return
|
|
511
|
+
return Fe;
|
|
510
512
|
case "md":
|
|
511
|
-
return
|
|
513
|
+
return Ee;
|
|
512
514
|
case "lg":
|
|
513
|
-
return
|
|
515
|
+
return Ne;
|
|
514
516
|
case "xl":
|
|
515
|
-
return
|
|
517
|
+
return ze;
|
|
518
|
+
case "xxl":
|
|
519
|
+
return Me;
|
|
516
520
|
}
|
|
517
521
|
};
|
|
518
|
-
return (t,
|
|
522
|
+
return (t, a) => (s(), p("button", {
|
|
519
523
|
type: "button",
|
|
520
|
-
class: O(["flex justify-center align-center items-center", [
|
|
524
|
+
class: O(["flex justify-center align-center items-center break-keep", [
|
|
521
525
|
e.width,
|
|
522
526
|
o(e.size),
|
|
523
527
|
e.textColor,
|
|
@@ -537,9 +541,9 @@ const R = (e, o) => {
|
|
|
537
541
|
h(t.$slots, "default", {}, () => [
|
|
538
542
|
te($(e.text), 1)
|
|
539
543
|
])
|
|
540
|
-
], 10,
|
|
544
|
+
], 10, je));
|
|
541
545
|
}
|
|
542
|
-
},
|
|
546
|
+
}, Re = {
|
|
543
547
|
props: {
|
|
544
548
|
text: {
|
|
545
549
|
type: String,
|
|
@@ -571,12 +575,12 @@ const R = (e, o) => {
|
|
|
571
575
|
}
|
|
572
576
|
}
|
|
573
577
|
};
|
|
574
|
-
function
|
|
578
|
+
function De(e, o, t, a, n, d) {
|
|
575
579
|
return s(), p("div", {
|
|
576
580
|
class: O(["flex px-2.5 py-1.5", [t.bgColor, t.textColor, t.textSize, t.fontWeight, t.rounded, t.cursor]])
|
|
577
581
|
}, $(t.text), 3);
|
|
578
582
|
}
|
|
579
|
-
const
|
|
583
|
+
const Le = /* @__PURE__ */ D(Re, [["render", De]]), Pe = {
|
|
580
584
|
props: {
|
|
581
585
|
title: {
|
|
582
586
|
type: String
|
|
@@ -614,16 +618,16 @@ const Ve = /* @__PURE__ */ R(ze, [["render", Me]]), Re = {
|
|
|
614
618
|
default: void 0
|
|
615
619
|
}
|
|
616
620
|
}
|
|
617
|
-
},
|
|
618
|
-
function
|
|
621
|
+
}, We = ["to"];
|
|
622
|
+
function qe(e, o, t, a, n, d) {
|
|
619
623
|
return s(), p("div", {
|
|
620
624
|
class: O(["flex flex-col", [t.rounded, t.variant, t.height, t.width, t.bgColor]]),
|
|
621
625
|
to: t.to
|
|
622
626
|
}, [
|
|
623
627
|
h(e.$slots, "default")
|
|
624
|
-
], 10,
|
|
628
|
+
], 10, We);
|
|
625
629
|
}
|
|
626
|
-
const
|
|
630
|
+
const He = /* @__PURE__ */ D(Pe, [["render", qe]]), Ue = {
|
|
627
631
|
props: {
|
|
628
632
|
title: {
|
|
629
633
|
type: String
|
|
@@ -657,32 +661,32 @@ const Pe = /* @__PURE__ */ R(Re, [["render", Le]]), We = {
|
|
|
657
661
|
default: "text-center rounded-t-lg"
|
|
658
662
|
}
|
|
659
663
|
}
|
|
660
|
-
},
|
|
664
|
+
}, Ye = {
|
|
661
665
|
key: 0,
|
|
662
666
|
class: "flex flex-row uppercase w-full py-2"
|
|
663
|
-
},
|
|
664
|
-
function
|
|
667
|
+
}, Ge = { class: "w-full" }, Je = { key: 1 }, Qe = { key: 2 };
|
|
668
|
+
function Xe(e, o, t, a, n, d) {
|
|
665
669
|
return h(e.$slots, "default", {}, () => [
|
|
666
670
|
v("div", {
|
|
667
671
|
class: O([t.classBase, t.variant, t.height, t.width, t.bgColor])
|
|
668
672
|
}, [
|
|
669
|
-
t.title ? (s(), p("div",
|
|
673
|
+
t.title ? (s(), p("div", Ye, [
|
|
670
674
|
h(e.$slots, "prepend-title"),
|
|
671
|
-
v("span",
|
|
675
|
+
v("span", Ge, $(t.title), 1),
|
|
672
676
|
h(e.$slots, "append-title")
|
|
673
677
|
])) : b("", !0),
|
|
674
|
-
t.subtitle ? (s(), p("span",
|
|
675
|
-
t.text ? (s(), p("span",
|
|
678
|
+
t.subtitle ? (s(), p("span", Je, $(t.subtitle), 1)) : b("", !0),
|
|
679
|
+
t.text ? (s(), p("span", Qe, $(t.text), 1)) : b("", !0)
|
|
676
680
|
], 2)
|
|
677
681
|
]);
|
|
678
682
|
}
|
|
679
|
-
const
|
|
683
|
+
const Ze = /* @__PURE__ */ D(Ue, [["render", Xe]]), et = {
|
|
680
684
|
class: "flex flex-row items-center",
|
|
681
685
|
style: { padding: "2px 2px", "max-width": "200px" }
|
|
682
|
-
},
|
|
686
|
+
}, tt = {
|
|
683
687
|
key: 0,
|
|
684
688
|
class: "mr-1"
|
|
685
|
-
},
|
|
689
|
+
}, nt = ["placeholder", "value"], lt = { key: 1 }, ut = {
|
|
686
690
|
__name: "KunCurrency",
|
|
687
691
|
props: {
|
|
688
692
|
currency: {
|
|
@@ -723,9 +727,9 @@ const Je = /* @__PURE__ */ R(We, [["render", Ge]]), Qe = {
|
|
|
723
727
|
},
|
|
724
728
|
emits: ["update:modelValue"],
|
|
725
729
|
setup(e, { emit: o }) {
|
|
726
|
-
const t = e,
|
|
730
|
+
const t = e, a = o;
|
|
727
731
|
function n(r) {
|
|
728
|
-
d.value = r,
|
|
732
|
+
d.value = r, a("update:modelValue", r);
|
|
729
733
|
}
|
|
730
734
|
const d = ref(t.modelValue);
|
|
731
735
|
let m = null, f = null;
|
|
@@ -738,16 +742,16 @@ const Je = /* @__PURE__ */ R(We, [["render", Ge]]), Qe = {
|
|
|
738
742
|
const x = (r) => {
|
|
739
743
|
const y = r.target.querySelector("input");
|
|
740
744
|
y && y.focus();
|
|
741
|
-
},
|
|
745
|
+
}, I = ref(null), F = (r) => {
|
|
742
746
|
const y = r.target, B = y.value;
|
|
743
747
|
y.value = B.replace(/\D/g, ""), n(y.value);
|
|
744
748
|
};
|
|
745
749
|
let E = t.placeholder;
|
|
746
750
|
const j = () => {
|
|
747
|
-
|
|
751
|
+
i("");
|
|
748
752
|
}, w = () => {
|
|
749
|
-
|
|
750
|
-
},
|
|
753
|
+
i(t.placeholder);
|
|
754
|
+
}, i = (r) => {
|
|
751
755
|
document.getElementById("txt").setAttribute("placeholder", r);
|
|
752
756
|
};
|
|
753
757
|
return (r, y) => (s(), p("div", {
|
|
@@ -755,13 +759,13 @@ const Je = /* @__PURE__ */ R(We, [["render", Ge]]), Qe = {
|
|
|
755
759
|
style: { cursor: "text" },
|
|
756
760
|
onClick: y[1] || (y[1] = (B) => x(B))
|
|
757
761
|
}, [
|
|
758
|
-
v("div",
|
|
759
|
-
e.prefix ? (s(), p("div",
|
|
762
|
+
v("div", et, [
|
|
763
|
+
e.prefix ? (s(), p("div", tt, $(e.prefix), 1)) : b("", !0),
|
|
760
764
|
y[2] || (y[2] = v("span", { id: "hide" }, null, -1)),
|
|
761
765
|
v("input", {
|
|
762
766
|
id: "txt",
|
|
763
767
|
ref_key: "inputField",
|
|
764
|
-
ref:
|
|
768
|
+
ref: I,
|
|
765
769
|
type: "number",
|
|
766
770
|
class: "text-field-style",
|
|
767
771
|
onFocus: j,
|
|
@@ -770,12 +774,12 @@ const Je = /* @__PURE__ */ R(We, [["render", Ge]]), Qe = {
|
|
|
770
774
|
onInput: y[0] || (y[0] = (B) => F(B)),
|
|
771
775
|
value: c(d),
|
|
772
776
|
autocomplete: "off"
|
|
773
|
-
}, null, 40,
|
|
774
|
-
e.suffix ? (s(), p("div",
|
|
777
|
+
}, null, 40, nt),
|
|
778
|
+
e.suffix ? (s(), p("div", lt, $(e.suffix), 1)) : b("", !0)
|
|
775
779
|
])
|
|
776
780
|
]));
|
|
777
781
|
}
|
|
778
|
-
},
|
|
782
|
+
}, at = {
|
|
779
783
|
__name: "KunIcon",
|
|
780
784
|
props: {
|
|
781
785
|
icon: {
|
|
@@ -801,34 +805,34 @@ const Je = /* @__PURE__ */ R(We, [["render", Ge]]), Qe = {
|
|
|
801
805
|
},
|
|
802
806
|
emits: ["click"],
|
|
803
807
|
setup(e, { emit: o }) {
|
|
804
|
-
const t = e,
|
|
808
|
+
const t = e, a = o;
|
|
805
809
|
function n(f) {
|
|
806
|
-
t.disabled ||
|
|
810
|
+
t.disabled || a("click", f);
|
|
807
811
|
}
|
|
808
|
-
const d =
|
|
812
|
+
const d = k(() => {
|
|
809
813
|
if (typeof t.icon == "string" && t.icon.startsWith("$")) {
|
|
810
814
|
const f = t.icon.slice(1);
|
|
811
815
|
return t.aliases[f] || "";
|
|
812
816
|
}
|
|
813
817
|
return t.icon;
|
|
814
|
-
}), m =
|
|
818
|
+
}), m = k(
|
|
815
819
|
() => typeof d.value == "function" || typeof d.value == "object" && d.value !== null
|
|
816
820
|
);
|
|
817
821
|
return (f, g) => (s(), p("span", {
|
|
818
822
|
class: O([e.color, e.size, e.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"]),
|
|
819
823
|
onClick: n
|
|
820
824
|
}, [
|
|
821
|
-
f.$slots.default ? h(f.$slots, "default", { key: 0 }) : m.value ? (s(), P(
|
|
825
|
+
f.$slots.default ? h(f.$slots, "default", { key: 0 }) : m.value ? (s(), P(re(d.value), { key: 1 })) : (s(), p("span", {
|
|
822
826
|
key: 2,
|
|
823
827
|
class: O(d.value)
|
|
824
828
|
}, null, 2))
|
|
825
829
|
], 2));
|
|
826
830
|
}
|
|
827
|
-
},
|
|
828
|
-
function
|
|
831
|
+
}, it = {};
|
|
832
|
+
function ot(e, o) {
|
|
829
833
|
return null;
|
|
830
834
|
}
|
|
831
|
-
const
|
|
835
|
+
const st = /* @__PURE__ */ D(it, [["render", ot]]), rt = {
|
|
832
836
|
props: {
|
|
833
837
|
height: {
|
|
834
838
|
type: [Number, String],
|
|
@@ -842,12 +846,12 @@ const it = /* @__PURE__ */ R(lt, [["render", ut]]), at = {
|
|
|
842
846
|
}
|
|
843
847
|
}
|
|
844
848
|
};
|
|
845
|
-
function
|
|
849
|
+
function ct(e, o, t, a, n, d) {
|
|
846
850
|
return s(), p("div", {
|
|
847
|
-
style:
|
|
851
|
+
style: ce({ height: t.height, width: t.width })
|
|
848
852
|
}, null, 4);
|
|
849
853
|
}
|
|
850
|
-
const
|
|
854
|
+
const dt = /* @__PURE__ */ D(rt, [["render", ct]]), ft = {
|
|
851
855
|
type: {
|
|
852
856
|
type: String,
|
|
853
857
|
default: "text"
|
|
@@ -876,9 +880,9 @@ const st = /* @__PURE__ */ R(at, [["render", ot]]), rt = {
|
|
|
876
880
|
type: String,
|
|
877
881
|
default: "rounded"
|
|
878
882
|
}
|
|
879
|
-
},
|
|
883
|
+
}, yt = { key: 0 }, pt = ["type", "value", "placeholder"], mt = { key: 1 }, gt = {
|
|
880
884
|
__name: "KunTextField",
|
|
881
|
-
props: /* @__PURE__ */ H(
|
|
885
|
+
props: /* @__PURE__ */ H(ft, {
|
|
882
886
|
modelValue: {},
|
|
883
887
|
modelModifiers: {},
|
|
884
888
|
placeholder: {},
|
|
@@ -886,66 +890,66 @@ const st = /* @__PURE__ */ R(at, [["render", ot]]), rt = {
|
|
|
886
890
|
}),
|
|
887
891
|
emits: /* @__PURE__ */ H(["update:modelValue", "focusInput", "blurInput", "pressEsc", "clickInput"], ["update:modelValue", "update:placeholder"]),
|
|
888
892
|
setup(e, { emit: o }) {
|
|
889
|
-
const t = o,
|
|
890
|
-
function m(
|
|
891
|
-
|
|
893
|
+
const t = o, a = U(e, "modelValue"), n = U(e, "placeholder"), d = ref(null);
|
|
894
|
+
function m(i) {
|
|
895
|
+
a.value = i;
|
|
892
896
|
}
|
|
893
|
-
const f = (
|
|
894
|
-
const r =
|
|
897
|
+
const f = (i) => {
|
|
898
|
+
const r = i.target.querySelector("input");
|
|
895
899
|
r && r.focus();
|
|
896
|
-
}, g = (
|
|
897
|
-
const r =
|
|
900
|
+
}, g = (i) => {
|
|
901
|
+
const r = i.target;
|
|
898
902
|
m(r.value);
|
|
899
903
|
};
|
|
900
|
-
watch(n, (
|
|
901
|
-
x =
|
|
904
|
+
watch(n, (i) => {
|
|
905
|
+
x = i;
|
|
902
906
|
});
|
|
903
907
|
let x = n.value;
|
|
904
|
-
const
|
|
908
|
+
const I = () => {
|
|
905
909
|
w("rounded-b-none"), x = "", t("focusInput");
|
|
906
910
|
}, F = () => {
|
|
907
911
|
x = n.value, w("");
|
|
908
912
|
}, E = () => {
|
|
909
913
|
d.value, d.value && d.value.blur(), t("pressEsc");
|
|
910
914
|
}, j = ref("");
|
|
911
|
-
function w(
|
|
912
|
-
j.value =
|
|
915
|
+
function w(i) {
|
|
916
|
+
j.value = i;
|
|
913
917
|
}
|
|
914
|
-
return (
|
|
918
|
+
return (i, r) => (s(), p("div", {
|
|
915
919
|
class: "w-full h-full flex justify-center my-2",
|
|
916
920
|
style: { cursor: "text" },
|
|
917
921
|
onClick: r[1] || (r[1] = (y) => f(y))
|
|
918
922
|
}, [
|
|
919
|
-
h(
|
|
923
|
+
h(i.$slots, "prepend"),
|
|
920
924
|
v("div", {
|
|
921
|
-
class: O([c(j),
|
|
925
|
+
class: O([c(j), i.rounded, "w-full h-full text-field-style flex flex-row items-center"]),
|
|
922
926
|
style: { padding: "0px 2px" }
|
|
923
927
|
}, [
|
|
924
|
-
|
|
925
|
-
h(
|
|
926
|
-
h(
|
|
928
|
+
i.prefix ? (s(), p("div", yt, $(i.prefix), 1)) : b("", !0),
|
|
929
|
+
h(i.$slots, "prepend-inner"),
|
|
930
|
+
h(i.$slots, "default", {}, () => [
|
|
927
931
|
v("input", {
|
|
928
932
|
ref_key: "inputField",
|
|
929
933
|
ref: d,
|
|
930
|
-
type:
|
|
931
|
-
value:
|
|
934
|
+
type: i.type,
|
|
935
|
+
value: a.value,
|
|
932
936
|
autocomplete: "off",
|
|
933
937
|
class: "h-full text-center w-full bg-transparent focus:border-none focus:outline-none input-opacity",
|
|
934
938
|
style: { padding: "4px 0px" },
|
|
935
939
|
placeholder: c(x),
|
|
936
940
|
onInput: r[0] || (r[0] = (y) => g(y)),
|
|
937
941
|
onKeydown: ee(E, ["escape"]),
|
|
938
|
-
onFocus:
|
|
942
|
+
onFocus: I,
|
|
939
943
|
onBlur: F
|
|
940
|
-
}, null, 40,
|
|
944
|
+
}, null, 40, pt)
|
|
941
945
|
]),
|
|
942
|
-
h(
|
|
943
|
-
|
|
946
|
+
h(i.$slots, "append-inner"),
|
|
947
|
+
i.suffix ? (s(), p("div", mt, $(i.suffix), 1)) : b("", !0)
|
|
944
948
|
], 2),
|
|
945
|
-
h(
|
|
949
|
+
h(i.$slots, "append")
|
|
946
950
|
]));
|
|
947
951
|
}
|
|
948
|
-
},
|
|
952
|
+
}, vt = { class: "bg-appbar h-10 flex flex-row items-center py-2 px-2" }, ht = {
|
|
949
953
|
__name: "KunToolbar",
|
|
950
954
|
props: {
|
|
951
955
|
density: {
|
|
@@ -959,9 +963,9 @@ const st = /* @__PURE__ */ R(at, [["render", ot]]), rt = {
|
|
|
959
963
|
},
|
|
960
964
|
setup(e) {
|
|
961
965
|
return (o, t) => {
|
|
962
|
-
const
|
|
963
|
-
return s(), p("div",
|
|
964
|
-
e.title ? (s(), P(
|
|
966
|
+
const a = A("KunToolbarTitle");
|
|
967
|
+
return s(), p("div", vt, [
|
|
968
|
+
e.title ? (s(), P(a, {
|
|
965
969
|
key: 0,
|
|
966
970
|
title: e.title
|
|
967
971
|
}, null, 8, ["title"])) : b("", !0),
|
|
@@ -970,37 +974,37 @@ const st = /* @__PURE__ */ R(at, [["render", ot]]), rt = {
|
|
|
970
974
|
};
|
|
971
975
|
}
|
|
972
976
|
}, Z = {
|
|
973
|
-
KunAlert:
|
|
974
|
-
KunAppbar:
|
|
975
|
-
KunAutocomplete:
|
|
976
|
-
KunBtn:
|
|
977
|
-
KunBudge:
|
|
978
|
-
KunCard:
|
|
979
|
-
KunCardText:
|
|
980
|
-
KunCurrency:
|
|
981
|
-
KunIcon:
|
|
982
|
-
KunList:
|
|
983
|
-
KunSpacer:
|
|
984
|
-
KunTextField:
|
|
985
|
-
KunToolbar:
|
|
977
|
+
KunAlert: he,
|
|
978
|
+
KunAppbar: Ke,
|
|
979
|
+
KunAutocomplete: Oe,
|
|
980
|
+
KunBtn: Ve,
|
|
981
|
+
KunBudge: Le,
|
|
982
|
+
KunCard: He,
|
|
983
|
+
KunCardText: Ze,
|
|
984
|
+
KunCurrency: ut,
|
|
985
|
+
KunIcon: at,
|
|
986
|
+
KunList: st,
|
|
987
|
+
KunSpacer: dt,
|
|
988
|
+
KunTextField: gt,
|
|
989
|
+
KunToolbar: ht
|
|
986
990
|
};
|
|
987
|
-
function
|
|
991
|
+
function St(e) {
|
|
988
992
|
for (const o in Z)
|
|
989
993
|
e.component(o, Z[o]);
|
|
990
994
|
}
|
|
991
995
|
export {
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
996
|
+
he as KunAlert,
|
|
997
|
+
Ke as KunAppbar,
|
|
998
|
+
Oe as KunAutocomplete,
|
|
999
|
+
Ve as KunBtn,
|
|
1000
|
+
Le as KunBudge,
|
|
1001
|
+
He as KunCard,
|
|
1002
|
+
Ze as KunCardText,
|
|
1003
|
+
ut as KunCurrency,
|
|
1004
|
+
at as KunIcon,
|
|
1005
|
+
st as KunList,
|
|
1006
|
+
dt as KunSpacer,
|
|
1007
|
+
gt as KunTextField,
|
|
1008
|
+
ht as KunToolbar,
|
|
1009
|
+
St as install
|
|
1006
1010
|
};
|
package/dist/kun-ui.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(m,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(m=typeof globalThis<"u"?globalThis:m||self,e(m.KunUI={},m.Vue))})(this,function(m,e){"use strict";const Z={class:"h-svh top-0 left-0 bg-grey-900 w-full overflow-y-auto opacity-90",style:{position:"fixed","z-index":"2500"}},v={class:"rounded-lg px-16 py-14"},ee={class:"flex justify-center py-4"},te={class:"rounded-full bg-red-200 p-6"},ne={class:"text-center flex flex-col justify-center items-center bg-red-500 rounded-lg p-4"},le={key:0,class:"my-4 text-center text-3xl font-semibold"},oe={class:"text-xl font-normal"},F={__name:"KunAlert",props:{modelValue:{type:Boolean,default:!1},title:{type:String,default:"Congratulation !!"},message:{type:String,default:"Your order have been taken and is being attended to"}},emits:["update:modelValue"],setup(t,{emit:c}){return(n,a)=>{const l=e.resolveComponent("KunIcon");return e.openBlock(),e.createElementBlock("div",Z,[e.createElementVNode("div",v,[e.createElementVNode("div",ee,[e.createElementVNode("div",te,[e.createVNode(l,{icon:"exclamation",size:"text-9xl"})])]),e.createElementVNode("div",ne,[t.title?(e.openBlock(),e.createElementBlock("div",le,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",oe,e.toDisplayString(t.message),1)])])])}}},re={class:"flex-1"},ae={class:"flex items-center"},ie={class:"flex-1"},ce={class:"w-full flex justify-end"},M={__name:"KunAppbar",props:{density:{type:String,default:""},bgColor:{type:String,default:"bg-appbar"},title:{type:String,default:""}},setup(t){return(c,n)=>{const a=e.resolveComponent("KunAppbarTitle");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex py-1 px-2 h-14 items-center",[t.bgColor]])},[e.createElementVNode("div",re,[e.createElementVNode("div",ae,[e.renderSlot(c.$slots,"appbarButton"),e.renderSlot(c.$slots,"prepend")])]),t.title?(e.openBlock(),e.createBlock(a,{key:0,title:t.title},null,8,["title"])):e.createCommentVNode("",!0),e.createElementVNode("div",ie,[e.createElementVNode("div",ce,[e.renderSlot(c.$slots,"append")])])],2)}}},se={label:{type:String},itemValue:{type:String,default:""},itemTitle:{type:String,default:""},itemText:{type:String,default:""},itemSubtitle:{type:String,default:""},returnObject:{type:Boolean,default:!1},searchableKeys:{type:Array,default:[]},focusOnSelect:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},clearOnSelect:{type:Boolean,default:!1},clearSearchOnSelect:{type:Boolean,default:!0},closeOnSelect:{type:Boolean,default:!0},startEmtpy:{type:Boolean,default:!1},placeholderText:{type:String,default:"Seleccionar"},textNoItems:{type:String,default:"No hay elementos"},hasCreateItem:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},required:{type:Boolean,default:!1},maxHeight:{default:500},density:{type:String,default:"comfortable"},hideDetails:{type:Boolean,default:!0},hasIcons:{type:Boolean,default:!0},bgItemListColor:{type:String,default:"bg-transparent"},selectedColor:{type:String,default:"bg-primary"},attach:{type:Boolean,default:!1}};function b(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function V(t){return Array.isArray(t)}function ue(t,c,n,a){const l=e.ref(null),u=e.ref(null),p=e.ref(null),d=e.ref(!1),y=e.ref(""),g=e.computed(()=>!t.searchableKeys.length),k=e.computed(()=>t.clearOnSelect);e.computed(()=>t.clearSearchOnSelect),e.computed(()=>t.focusOnSelect);const N=e.computed(()=>t.closeOnSelect);function _(){V(n.value)&&(n.value.length?l.value=a.value.filter(o=>b(o)?n.value.some(r=>r[t.itemTitle].includes(o[t.itemTitle])):n.value.some(r=>r.includes(o))):l.value=[]),(b(n.value)&&Object.keys(n.value).length||typeof n.value=="number"&&n.value||typeof n.value=="string"&&n.value||typeof n.value=="boolean")&&(l.value=a.value.find(o=>b(o)?t.returnObject?t.itemValue?o[t.itemValue]===n.value[t.itemValue]:o[t.itemTitle]===n.value[t.itemTitle]:o[t.itemValue]===n.value:o===n.value))}const K=e.computed(()=>l.value?V(l.value)?l.value.length?s(l.value,t.itemTitle,"hasDefault"):t.placeholderText:b(l.value)?s(l.value,t.itemTitle,"hasDefault"):l.value.toString():a.value.length?t.placeholderText:t.textNoItems),C=e.computed(()=>t.startEmtpy&&y.value.length<3?[]:a.value.filter(r=>{if(b(r)){const I=Object.values(r).filter(w=>{if(!b(w)&&!V(w))return w}),x=[r].reduce((w,He)=>t.searchableKeys.map(Ue=>He[Ue]),[]),X=g.value?I:x;return X?X.some(w=>w?w.toString().toLowerCase().includes(y.value.toLowerCase()):""):y.value?r==y.value:r}return r.toString().toLowerCase().includes(y.value.toLowerCase())}).slice(0,currentBatchStep.value)),i=e.computed(()=>t.itemText.includes(",")?t.itemText.split(","):t.itemText);function s(o,r,I){if(b(o)){if(r)return V(r)?r.map(x=>o[x]??"No definido").join(" - "):r.includes(",")?r.split(",").map(x=>o[x]).join(" - "):!t.returnObject&&typeof o[r]=="number"||o[r]?o[r].toString():"";if(I)return Object.values(o)[0]}return V(o)?t.returnObject?o.map(x=>x[r]).join(" - "):o.map(x=>x).join(" - "):I&&typeof o!="number"&&o.includes(",")?o.split(","):o}function f(o){let r=o[0];if(!t.multiple)l.value=o[0],t.returnObject&&(n.value=r),!t.returnObject&&b(r)&&(t.itemValue?n.value=r[t.itemValue]:n.value=Object.values(r)[0]),b(r)||(n.value=r),d.value=!1;else if(l.value||(l.value=[]),B(r))h(r),n.value=l.value;else{if(t.returnObject&&l.value.push(r),!t.returnObject&&b(r))if(t.itemValue)l.value.push(r[t.itemValue]);else{n.value=l.value.push(Object.values(r)[0]);return}n.value=l.value}k.value&&T(),u.value.focus()}function B(o){return l.value===null?!1:l.value.some(r=>t.returnObject?r[t.itemValue]===o[t.itemValue]:r===o[t.itemValue])}function h(o){if(t.returnObject){let r=l.value.find(x=>x[t.itemValue]===o[t.itemValue]),I=l.value.indexOf(r);l.value.splice(I,1)}else{let r=l.value.indexOf(o[t.itemValue]);l.value.splice(r,1)}}function S(o){o.key!=="Tab"&&(d.value=!0)}function O(o){k.value&&(d.value=!1)}function j(){d.value=!0,p.value&&p.value.focus()}function A(){d.value=!1,c("createItem")}function z(o){let r=l.value.indexOf(o);l.value.splice(r,1),n.value=l.value}function T(){y.value="",V(n.value)&&(l.value=[]),b(n.value)&&(l.value={}),typeof n.value=="number"&&n.value&&(l.value=0),typeof n.value=="string"&&n.value&&(l.value=""),typeof n.value=="boolean"&&(l.value=!1),n.value=l.value}function E(o){if(!o.disabledItem)return!1;if(o.disabledItem)return!0}return{selectedItem:l,textFieldRef:u,listRef:p,menuModel:d,search:y,isCloseOnSelect:N,isClearOnSelect:k,setSelectedItemValue:_,placeholder:K,filteredItems:C,textArr:i,itemToString:s,getSelectedItem:f,openMenu:S,closeMenu:O,focusOnMenu:j,createItem:A,removeItem:z,clearSelection:T,isDisabled:E}}const $=(t,c)=>{const n=t.__vccOpts||t;for(const[a,l]of c)n[a]=l;return n},de={class:"relative"},fe=["close-on-content-click","max-height"],me={class:"w-full px-2 py-1"},D=$({__name:"KunAutocomplete",props:e.mergeModels(se,{modelValue:{default:null},modelModifiers:{},items:{default:[],type:Array},itemsModifiers:{}}),emits:e.mergeModels(["createItem"],["update:modelValue","update:items"]),setup(t,{emit:c}){const n=t;ref(0);const a=e.useModel(t,"modelValue"),l=e.useModel(t,"items"),u=c,{selectedItem:p,textFieldRef:d,menuModel:y,search:g,isCloseOnSelect:k,setSelectedItemValue:N,placeholder:_,openMenu:K,closeMenu:C,focusOnMenu:i,createItem:s,clearSelection:f}=ue(n,u,a,l);watchEffect(()=>{isObject(a.value)&&!isNotEmpty(a.value)&&(p.value={}),isArray(a.value)&&!isNotEmpty(a.value)&&(p.value=[]),a.value===null&&(p.value=null),N()});function B(h){g.value="",a.value=h,C()}return(h,S)=>{const O=e.resolveComponent("KunIcon"),j=e.resolveComponent("KunTextField"),A=e.resolveComponent("KunBtn"),z=e.resolveComponent("KunListItem"),T=e.resolveComponent("KunVirtualScroller");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(y)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed opacity-10 w-svw inset-0 h-svh",onClick:S[0]||(S[0]=E=>y.value=!1)})):e.createCommentVNode("",!0),e.createElementVNode("div",de,[e.createVNode(j,{modelValue:e.unref(g),"onUpdate:modelValue":S[2]||(S[2]=E=>e.isRef(g)?g.value=E:null),ref_key:"textFieldRef",ref:d,placeholder:h.isArray(e.unref(p))&&e.unref(p).length?"":e.unref(_),onKeyup:e.withKeys(e.unref(i),["down"]),onClickInput:e.unref(K),onPressEsc:e.unref(C),onChange:S[3]||(S[3]=E=>console.log("change")),onFocusInput:e.unref(i)},e.createSlots({_:2},[h.hasIcons?{name:"append-inner",fn:e.withCtx(()=>[h.clearable&&e.unref(p)?(e.openBlock(),e.createBlock(O,{key:0,onClick:e.unref(f),size:"text-xl",color:"text-error",icon:"close",class:e.normalizeClass(["mr-1",h.isNotEmpty(e.unref(p))?"cursor-pointer":"cursor-default"]),disabled:!h.isNotEmpty(e.unref(p))},null,8,["onClick","class","disabled"])):e.createCommentVNode("",!0),e.createVNode(O,{color:"text-accent-button",size:"text-xl",class:"cursor-pointer",icon:e.unref(y)?"menuUp":"menuDown",onClick:S[1]||(S[1]=E=>y.value=!e.unref(y))},null,8,["icon"]),h.required?(e.openBlock(),e.createBlock(O,{key:1,color:"text-red-900",size:"text-lg",class:"mb-3",icon:"asterisk"})):e.createCommentVNode("",!0)]),key:"0"}:void 0]),1032,["modelValue","placeholder","onKeyup","onClickInput","onPressEsc","onFocusInput"]),e.withDirectives(e.createElementVNode("div",{class:"absolute h-fit left-0 w-full z-50 bg-surface rounded-b border border-field-border-focus ring-1 focus:ring-field-ring-focus","close-on-content-click":e.unref(k),"max-height":h.maxHeight},[e.createVNode(T,{items:l.value,search:e.unref(g),searchBy:"name",maxHeight:250},e.createSlots({default:e.withCtx(({item:E,itemKey:o})=>[e.createVNode(z,{item:E,itemKey:o,title:"name",cursor:"cursor-pointer",onSelect:B},null,8,["item","itemKey"])]),_:2},[h.hasCreateItem?{name:"topButton",fn:e.withCtx(()=>[e.createElementVNode("div",me,[e.createVNode(A,{onClick:e.unref(s),class:"w-full rounded-md bg-accent-button",size:"xs"},{default:e.withCtx(()=>S[4]||(S[4]=[e.createTextVNode("Crear item")])),_:1},8,["onClick"])])]),key:"0"}:void 0]),1032,["items","search"])],8,fe),[[e.vShow,e.unref(y)]])])],64)}}},[["__scopeId","data-v-f93d09ad"]]),pe=["disabled"],ye="px-2 py-2 text-xs",ge="px-1 py-1 text-sm",he="px-2 py-2 text-sm",Se="px-3 py-3 text-sm",be="px-3 py-3 text-base",R={__name:"KunBtn",props:{size:{type:String,default:"md"},width:{type:String,default:"w-24"},textColor:{type:String,default:"text-white"},text:{type:String,default:null},fontWeight:{type:String,default:"font-medium"},bgColor:{type:String,default:"bg-button"},bgColorHover:{type:String,default:"hover:opacity-90"},bgColorFocus:{type:String,default:"focus:opacity-100"},focusRing:{type:String,default:"focus:ring-1"},focusOutline:{type:String,default:"focus:outline-none"},focusRingColor:{type:String,default:"focus:ring-blue-300"},rounded:{type:String,default:"rounded-lg"},textAlign:{type:String,default:"text-center"},disabled:{type:Boolean,default:!1}},setup(t){const c=n=>{switch(n){case"xs":return ye;case"sm":return ge;case"md":return he;case"lg":return Se;case"xl":return be}};return(n,a)=>(e.openBlock(),e.createElementBlock("button",{type:"button",class:e.normalizeClass(["flex justify-center align-center items-center",[t.width,c(t.size),t.textColor,t.fontWeight,t.bgColor,t.bgColorHover,t.bgColorFocus,t.focusRing,t.focusOutline,t.focusRingColor,t.rounded,t.textAlign,t.disabled?"opacity-50 cursor-not-allowed":"hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-offset-2"]]),disabled:t.disabled},[e.renderSlot(n.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.text),1)])],10,pe))}},xe={props:{text:{type:String,default:""},bgColor:{type:String,default:"bg-button"},textColor:{type:String,default:"text-on-color"},textSize:{type:String,default:"text-xs"},fontWeight:{type:String,default:"font-medium"},rounded:{type:String,default:"rounded-2xl"},cursor:{type:String,default:"cursor-default"}}};function ke(t,c,n,a,l,u){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex px-2.5 py-1.5",[n.bgColor,n.textColor,n.textSize,n.fontWeight,n.rounded,n.cursor]])},e.toDisplayString(n.text),3)}const L=$(xe,[["render",ke]]),Ce={props:{title:{type:String},subtitle:{type:String},text:{type:String},bgColor:{type:String,default:"bg-surface"},rounded:{type:[String|Number|Boolean],default:void 0},variant:{type:String,default:"elevated"},height:{type:[Number,String],default:"h-full"},width:{type:[Number,String],default:"w-full"},to:{type:String,default:void 0}}},Be=["to"];function Ke(t,c,n,a,l,u){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex flex-col",[n.rounded,n.variant,n.height,n.width,n.bgColor]]),to:n.to},[e.renderSlot(t.$slots,"default")],10,Be)}const P=$(Ce,[["render",Ke]]),Ee={props:{title:{type:String},subtitle:{type:String},text:{type:String},bgColor:{type:String,default:"bg-appbar"},variant:{type:String,default:"elevated"},height:{type:[Number,String],default:"h-fit"},width:{type:[Number,String],default:"w-full"},classBase:{type:String,default:"text-center rounded-t-lg"}}},Ne={key:0,class:"flex flex-row uppercase w-full py-2"},_e={class:"w-full"},we={key:1},Ve={key:2};function $e(t,c,n,a,l,u){return e.renderSlot(t.$slots,"default",{},()=>[e.createElementVNode("div",{class:e.normalizeClass([n.classBase,n.variant,n.height,n.width,n.bgColor])},[n.title?(e.openBlock(),e.createElementBlock("div",Ne,[e.renderSlot(t.$slots,"prepend-title"),e.createElementVNode("span",_e,e.toDisplayString(n.title),1),e.renderSlot(t.$slots,"append-title")])):e.createCommentVNode("",!0),n.subtitle?(e.openBlock(),e.createElementBlock("span",we,e.toDisplayString(n.subtitle),1)):e.createCommentVNode("",!0),n.text?(e.openBlock(),e.createElementBlock("span",Ve,e.toDisplayString(n.text),1)):e.createCommentVNode("",!0)],2)])}const q=$(Ee,[["render",$e]]),Ie={class:"flex flex-row items-center",style:{padding:"2px 2px","max-width":"200px"}},Oe={key:0,class:"mr-1"},Te=["placeholder","value"],je={key:1},W={__name:"KunCurrency",props:{currency:{type:Object,default:()=>({name:"Peso Argentino",name:"ARS",simbol:"$"})},hideCurrency:{type:Boolean,default:!1},locale:{type:String,default:"ar-ES"},precision:{type:Number,default:2},modelValue:{default:null},placeholder:{type:String,default:"0.00"},prefix:{type:String,default:"$"},suffix:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:c}){const n=t,a=c;function l(s){u.value=s,a("update:modelValue",s)}const u=ref(n.modelValue);let p=null,d=null;onMounted(()=>{p=document.getElementById("hide"),d=document.getElementById("txt"),d.addEventListener("input",y),y()});function y(){p.textContent=d.value,d.style.width=6+p.offsetWidth+"px"}const g=s=>{const f=s.target.querySelector("input");f&&f.focus()},k=ref(null),N=s=>{const f=s.target,B=f.value;f.value=B.replace(/\D/g,""),l(f.value)};let _=n.placeholder;const K=()=>{i("")},C=()=>{i(n.placeholder)},i=s=>{document.getElementById("txt").setAttribute("placeholder",s)};return(s,f)=>(e.openBlock(),e.createElementBlock("div",{class:"w-full h-full flex justify-center",style:{cursor:"text"},onClick:f[1]||(f[1]=B=>g(B))},[e.createElementVNode("div",Ie,[t.prefix?(e.openBlock(),e.createElementBlock("div",Oe,e.toDisplayString(t.prefix),1)):e.createCommentVNode("",!0),f[2]||(f[2]=e.createElementVNode("span",{id:"hide"},null,-1)),e.createElementVNode("input",{id:"txt",ref_key:"inputField",ref:k,type:"number",class:"text-field-style",onFocus:K,onBlur:C,placeholder:e.unref(_),onInput:f[0]||(f[0]=B=>N(B)),value:e.unref(u),autocomplete:"off"},null,40,Te),t.suffix?(e.openBlock(),e.createElementBlock("div",je,e.toDisplayString(t.suffix),1)):e.createCommentVNode("",!0)])]))}},H={__name:"KunIcon",props:{icon:{type:[String,Object,Function],required:!0},aliases:{type:Object,default:()=>({})},size:{type:String,default:"text-xs"},color:{type:String,default:"text-font-color"},disabled:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:c}){const n=t,a=c;function l(d){n.disabled||a("click",d)}const u=e.computed(()=>{if(typeof n.icon=="string"&&n.icon.startsWith("$")){const d=n.icon.slice(1);return n.aliases[d]||""}return n.icon}),p=e.computed(()=>typeof u.value=="function"||typeof u.value=="object"&&u.value!==null);return(d,y)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass([t.color,t.size,t.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"]),onClick:l},[d.$slots.default?e.renderSlot(d.$slots,"default",{key:0}):p.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.value),{key:1})):(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass(u.value)},null,2))],2))}},Ae={};function ze(t,c){return null}const U=$(Ae,[["render",ze]]),Fe={props:{height:{type:[Number,String],default:"100%"},width:{type:[Number,String],default:"100%"}}};function Me(t,c,n,a,l,u){return e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle({height:n.height,width:n.width})},null,4)}const Y=$(Fe,[["render",Me]]),De={type:{type:String,default:"text"},locale:{type:String,default:"ar-ES"},precision:{type:Number,default:2},prefix:{type:String,default:""},suffix:{type:String,default:""},resize:{type:Boolean,default:!1},rounded:{type:String,default:"rounded"}},Re={key:0},Le=["type","value","placeholder"],Pe={key:1},G={__name:"KunTextField",props:e.mergeModels(De,{modelValue:{},modelModifiers:{},placeholder:{},placeholderModifiers:{}}),emits:e.mergeModels(["update:modelValue","focusInput","blurInput","pressEsc","clickInput"],["update:modelValue","update:placeholder"]),setup(t,{emit:c}){const n=c,a=e.useModel(t,"modelValue"),l=e.useModel(t,"placeholder"),u=ref(null);function p(i){a.value=i}const d=i=>{const s=i.target.querySelector("input");s&&s.focus()},y=i=>{const s=i.target;p(s.value)};watch(l,i=>{g=i});let g=l.value;const k=()=>{C("rounded-b-none"),g="",n("focusInput")},N=()=>{g=l.value,C("")},_=()=>{u.value,u.value&&u.value.blur(),n("pressEsc")},K=ref("");function C(i){K.value=i}return(i,s)=>(e.openBlock(),e.createElementBlock("div",{class:"w-full h-full flex justify-center my-2",style:{cursor:"text"},onClick:s[1]||(s[1]=f=>d(f))},[e.renderSlot(i.$slots,"prepend"),e.createElementVNode("div",{class:e.normalizeClass([e.unref(K),i.rounded,"w-full h-full text-field-style flex flex-row items-center"]),style:{padding:"0px 2px"}},[i.prefix?(e.openBlock(),e.createElementBlock("div",Re,e.toDisplayString(i.prefix),1)):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"prepend-inner"),e.renderSlot(i.$slots,"default",{},()=>[e.createElementVNode("input",{ref_key:"inputField",ref:u,type:i.type,value:a.value,autocomplete:"off",class:"h-full text-center w-full bg-transparent focus:border-none focus:outline-none input-opacity",style:{padding:"4px 0px"},placeholder:e.unref(g),onInput:s[0]||(s[0]=f=>y(f)),onKeydown:e.withKeys(_,["escape"]),onFocus:k,onBlur:N},null,40,Le)]),e.renderSlot(i.$slots,"append-inner"),i.suffix?(e.openBlock(),e.createElementBlock("div",Pe,e.toDisplayString(i.suffix),1)):e.createCommentVNode("",!0)],2),e.renderSlot(i.$slots,"append")]))}},qe={class:"bg-appbar h-10 flex flex-row items-center py-2 px-2"},J={__name:"KunToolbar",props:{density:{type:String,default:""},title:{type:String,default:""}},setup(t){return(c,n)=>{const a=e.resolveComponent("KunToolbarTitle");return e.openBlock(),e.createElementBlock("div",qe,[t.title?(e.openBlock(),e.createBlock(a,{key:0,title:t.title},null,8,["title"])):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"default",{density:t.density})])}}},Q={KunAlert:F,KunAppbar:M,KunAutocomplete:D,KunBtn:R,KunBudge:L,KunCard:P,KunCardText:q,KunCurrency:W,KunIcon:H,KunList:U,KunSpacer:Y,KunTextField:G,KunToolbar:J};function We(t){for(const c in Q)t.component(c,Q[c])}m.KunAlert=F,m.KunAppbar=M,m.KunAutocomplete=D,m.KunBtn=R,m.KunBudge=L,m.KunCard=P,m.KunCardText=q,m.KunCurrency=W,m.KunIcon=H,m.KunList=U,m.KunSpacer=Y,m.KunTextField=G,m.KunToolbar=J,m.install=We,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(m,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(m=typeof globalThis<"u"?globalThis:m||self,e(m.KunUI={},m.Vue))})(this,function(m,e){"use strict";const Z={class:"h-svh top-0 left-0 bg-grey-900 w-full overflow-y-auto opacity-90",style:{position:"fixed","z-index":"2500"}},v={class:"rounded-lg px-16 py-14"},ee={class:"flex justify-center py-4"},te={class:"rounded-full bg-red-200 p-6"},ne={class:"text-center flex flex-col justify-center items-center bg-red-500 rounded-lg p-4"},le={key:0,class:"my-4 text-center text-3xl font-semibold"},oe={class:"text-xl font-normal"},F={__name:"KunAlert",props:{modelValue:{type:Boolean,default:!1},title:{type:String,default:"Congratulation !!"},message:{type:String,default:"Your order have been taken and is being attended to"}},emits:["update:modelValue"],setup(t,{emit:c}){return(n,a)=>{const l=e.resolveComponent("KunIcon");return e.openBlock(),e.createElementBlock("div",Z,[e.createElementVNode("div",v,[e.createElementVNode("div",ee,[e.createElementVNode("div",te,[e.createVNode(l,{icon:"exclamation",size:"text-9xl"})])]),e.createElementVNode("div",ne,[t.title?(e.openBlock(),e.createElementBlock("div",le,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",oe,e.toDisplayString(t.message),1)])])])}}},re={class:"flex-1"},ae={class:"flex items-center"},ie={class:"flex-1"},ce={class:"w-full flex justify-end"},M={__name:"KunAppbar",props:{density:{type:String,default:""},bgColor:{type:String,default:"bg-appbar"},title:{type:String,default:""}},setup(t){return(c,n)=>{const a=e.resolveComponent("KunAppbarTitle");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex py-1 px-2 h-14 items-center",[t.bgColor]])},[e.createElementVNode("div",re,[e.createElementVNode("div",ae,[e.renderSlot(c.$slots,"appbarButton"),e.renderSlot(c.$slots,"prepend")])]),t.title?(e.openBlock(),e.createBlock(a,{key:0,title:t.title},null,8,["title"])):e.createCommentVNode("",!0),e.createElementVNode("div",ie,[e.createElementVNode("div",ce,[e.renderSlot(c.$slots,"append")])])],2)}}},se={label:{type:String},itemValue:{type:String,default:""},itemTitle:{type:String,default:""},itemText:{type:String,default:""},itemSubtitle:{type:String,default:""},returnObject:{type:Boolean,default:!1},searchableKeys:{type:Array,default:[]},focusOnSelect:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},clearOnSelect:{type:Boolean,default:!1},clearSearchOnSelect:{type:Boolean,default:!0},closeOnSelect:{type:Boolean,default:!0},startEmtpy:{type:Boolean,default:!1},placeholderText:{type:String,default:"Seleccionar"},textNoItems:{type:String,default:"No hay elementos"},hasCreateItem:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},required:{type:Boolean,default:!1},maxHeight:{default:500},density:{type:String,default:"comfortable"},hideDetails:{type:Boolean,default:!0},hasIcons:{type:Boolean,default:!0},bgItemListColor:{type:String,default:"bg-transparent"},selectedColor:{type:String,default:"bg-primary"},attach:{type:Boolean,default:!1}};function S(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function V(t){return Array.isArray(t)}function ue(t,c,n,a){const l=e.ref(null),u=e.ref(null),p=e.ref(null),d=e.ref(!1),y=e.ref(""),g=e.computed(()=>!t.searchableKeys.length),k=e.computed(()=>t.clearOnSelect);e.computed(()=>t.clearSearchOnSelect),e.computed(()=>t.focusOnSelect);const N=e.computed(()=>t.closeOnSelect);function _(){V(n.value)&&(n.value.length?l.value=a.value.filter(o=>S(o)?n.value.some(r=>r[t.itemTitle].includes(o[t.itemTitle])):n.value.some(r=>r.includes(o))):l.value=[]),(S(n.value)&&Object.keys(n.value).length||typeof n.value=="number"&&n.value||typeof n.value=="string"&&n.value||typeof n.value=="boolean")&&(l.value=a.value.find(o=>S(o)?t.returnObject?t.itemValue?o[t.itemValue]===n.value[t.itemValue]:o[t.itemTitle]===n.value[t.itemTitle]:o[t.itemValue]===n.value:o===n.value))}const K=e.computed(()=>l.value?V(l.value)?l.value.length?s(l.value,t.itemTitle,"hasDefault"):t.placeholderText:S(l.value)?s(l.value,t.itemTitle,"hasDefault"):l.value.toString():a.value.length?t.placeholderText:t.textNoItems),C=e.computed(()=>t.startEmtpy&&y.value.length<3?[]:a.value.filter(r=>{if(S(r)){const I=Object.values(r).filter(w=>{if(!S(w)&&!V(w))return w}),b=[r].reduce((w,Ye)=>t.searchableKeys.map(Ge=>Ye[Ge]),[]),X=g.value?I:b;return X?X.some(w=>w?w.toString().toLowerCase().includes(y.value.toLowerCase()):""):y.value?r==y.value:r}return r.toString().toLowerCase().includes(y.value.toLowerCase())}).slice(0,currentBatchStep.value)),i=e.computed(()=>t.itemText.includes(",")?t.itemText.split(","):t.itemText);function s(o,r,I){if(S(o)){if(r)return V(r)?r.map(b=>o[b]??"No definido").join(" - "):r.includes(",")?r.split(",").map(b=>o[b]).join(" - "):!t.returnObject&&typeof o[r]=="number"||o[r]?o[r].toString():"";if(I)return Object.values(o)[0]}return V(o)?t.returnObject?o.map(b=>b[r]).join(" - "):o.map(b=>b).join(" - "):I&&typeof o!="number"&&o.includes(",")?o.split(","):o}function f(o){let r=o[0];if(!t.multiple)l.value=o[0],t.returnObject&&(n.value=r),!t.returnObject&&S(r)&&(t.itemValue?n.value=r[t.itemValue]:n.value=Object.values(r)[0]),S(r)||(n.value=r),d.value=!1;else if(l.value||(l.value=[]),B(r))h(r),n.value=l.value;else{if(t.returnObject&&l.value.push(r),!t.returnObject&&S(r))if(t.itemValue)l.value.push(r[t.itemValue]);else{n.value=l.value.push(Object.values(r)[0]);return}n.value=l.value}k.value&&T(),u.value.focus()}function B(o){return l.value===null?!1:l.value.some(r=>t.returnObject?r[t.itemValue]===o[t.itemValue]:r===o[t.itemValue])}function h(o){if(t.returnObject){let r=l.value.find(b=>b[t.itemValue]===o[t.itemValue]),I=l.value.indexOf(r);l.value.splice(I,1)}else{let r=l.value.indexOf(o[t.itemValue]);l.value.splice(r,1)}}function x(o){o.key!=="Tab"&&(d.value=!0)}function O(o){k.value&&(d.value=!1)}function j(){d.value=!0,p.value&&p.value.focus()}function A(){d.value=!1,c("createItem")}function z(o){let r=l.value.indexOf(o);l.value.splice(r,1),n.value=l.value}function T(){y.value="",V(n.value)&&(l.value=[]),S(n.value)&&(l.value={}),typeof n.value=="number"&&n.value&&(l.value=0),typeof n.value=="string"&&n.value&&(l.value=""),typeof n.value=="boolean"&&(l.value=!1),n.value=l.value}function E(o){if(!o.disabledItem)return!1;if(o.disabledItem)return!0}return{selectedItem:l,textFieldRef:u,listRef:p,menuModel:d,search:y,isCloseOnSelect:N,isClearOnSelect:k,setSelectedItemValue:_,placeholder:K,filteredItems:C,textArr:i,itemToString:s,getSelectedItem:f,openMenu:x,closeMenu:O,focusOnMenu:j,createItem:A,removeItem:z,clearSelection:T,isDisabled:E}}const $=(t,c)=>{const n=t.__vccOpts||t;for(const[a,l]of c)n[a]=l;return n},de={class:"relative"},fe=["close-on-content-click","max-height"],me={class:"w-full px-2 py-1"},D=$({__name:"KunAutocomplete",props:e.mergeModels(se,{modelValue:{default:null},modelModifiers:{},items:{default:[],type:Array},itemsModifiers:{}}),emits:e.mergeModels(["createItem"],["update:modelValue","update:items"]),setup(t,{emit:c}){const n=t;e.ref(0);const a=e.useModel(t,"modelValue"),l=e.useModel(t,"items"),u=c,{selectedItem:p,textFieldRef:d,menuModel:y,search:g,isCloseOnSelect:k,setSelectedItemValue:N,placeholder:_,openMenu:K,closeMenu:C,focusOnMenu:i,createItem:s,clearSelection:f}=ue(n,u,a,l);e.watchEffect(()=>{isObject(a.value)&&!isNotEmpty(a.value)&&(p.value={}),isArray(a.value)&&!isNotEmpty(a.value)&&(p.value=[]),a.value===null&&(p.value=null),N()});function B(h){g.value="",a.value=h,C()}return(h,x)=>{const O=e.resolveComponent("KunIcon"),j=e.resolveComponent("KunTextField"),A=e.resolveComponent("KunBtn"),z=e.resolveComponent("KunListItem"),T=e.resolveComponent("KunVirtualScroller");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(y)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed opacity-10 w-svw inset-0 h-svh",onClick:x[0]||(x[0]=E=>y.value=!1)})):e.createCommentVNode("",!0),e.createElementVNode("div",de,[e.createVNode(j,{modelValue:e.unref(g),"onUpdate:modelValue":x[2]||(x[2]=E=>e.isRef(g)?g.value=E:null),ref_key:"textFieldRef",ref:d,placeholder:h.isArray(e.unref(p))&&e.unref(p).length?"":e.unref(_),onKeyup:e.withKeys(e.unref(i),["down"]),onClickInput:e.unref(K),onPressEsc:e.unref(C),onChange:x[3]||(x[3]=E=>console.log("change")),onFocusInput:e.unref(i)},e.createSlots({_:2},[h.hasIcons?{name:"append-inner",fn:e.withCtx(()=>[h.clearable&&e.unref(p)?(e.openBlock(),e.createBlock(O,{key:0,onClick:e.unref(f),size:"text-xl",color:"text-error",icon:"close",class:e.normalizeClass(["mr-1",h.isNotEmpty(e.unref(p))?"cursor-pointer":"cursor-default"]),disabled:!h.isNotEmpty(e.unref(p))},null,8,["onClick","class","disabled"])):e.createCommentVNode("",!0),e.createVNode(O,{color:"text-accent-button",size:"text-xl",class:"cursor-pointer",icon:e.unref(y)?"menuUp":"menuDown",onClick:x[1]||(x[1]=E=>y.value=!e.unref(y))},null,8,["icon"]),h.required?(e.openBlock(),e.createBlock(O,{key:1,color:"text-red-900",size:"text-lg",class:"mb-3",icon:"asterisk"})):e.createCommentVNode("",!0)]),key:"0"}:void 0]),1032,["modelValue","placeholder","onKeyup","onClickInput","onPressEsc","onFocusInput"]),e.withDirectives(e.createElementVNode("div",{class:"absolute h-fit left-0 w-full z-50 bg-surface rounded-b border border-field-border-focus ring-1 focus:ring-field-ring-focus","close-on-content-click":e.unref(k),"max-height":h.maxHeight},[e.createVNode(T,{items:l.value,search:e.unref(g),searchBy:"name",maxHeight:250},e.createSlots({default:e.withCtx(({item:E,itemKey:o})=>[e.createVNode(z,{item:E,itemKey:o,title:"name",cursor:"cursor-pointer",onSelect:B},null,8,["item","itemKey"])]),_:2},[h.hasCreateItem?{name:"topButton",fn:e.withCtx(()=>[e.createElementVNode("div",me,[e.createVNode(A,{onClick:e.unref(s),class:"w-full rounded-md bg-accent-button",size:"xs"},{default:e.withCtx(()=>x[4]||(x[4]=[e.createTextVNode("Crear item")])),_:1},8,["onClick"])])]),key:"0"}:void 0]),1032,["items","search"])],8,fe),[[e.vShow,e.unref(y)]])])],64)}}},[["__scopeId","data-v-c3a2b846"]]),pe=["disabled"],ye="px-1 py-1 text-xs",ge="px-2 py-2 text-xs",he="px-1 py-1 text-sm",xe="px-2 py-2 text-sm",Se="px-3 py-3 text-sm",be="px-3 py-3 text-base",ke="px-4 py-4 text-base",R={__name:"KunBtn",props:{size:{type:String,default:"md"},width:{type:String,default:"w-24"},textColor:{type:String,default:"text-white"},text:{type:String,default:null},fontWeight:{type:String,default:"font-medium"},bgColor:{type:String,default:"bg-button"},bgColorHover:{type:String,default:"hover:opacity-90"},bgColorFocus:{type:String,default:"focus:opacity-100"},focusRing:{type:String,default:"focus:ring-1"},focusOutline:{type:String,default:"focus:outline-none"},focusRingColor:{type:String,default:"focus:ring-blue-300"},rounded:{type:String,default:"rounded-lg"},textAlign:{type:String,default:"text-center"},disabled:{type:Boolean,default:!1}},setup(t){const c=n=>{switch(n){case"xxs":return ye;case"xs":return ge;case"sm":return he;case"md":return xe;case"lg":return Se;case"xl":return be;case"xxl":return ke}};return(n,a)=>(e.openBlock(),e.createElementBlock("button",{type:"button",class:e.normalizeClass(["flex justify-center align-center items-center break-keep",[t.width,c(t.size),t.textColor,t.fontWeight,t.bgColor,t.bgColorHover,t.bgColorFocus,t.focusRing,t.focusOutline,t.focusRingColor,t.rounded,t.textAlign,t.disabled?"opacity-50 cursor-not-allowed":"hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-offset-2"]]),disabled:t.disabled},[e.renderSlot(n.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.text),1)])],10,pe))}},Ce={props:{text:{type:String,default:""},bgColor:{type:String,default:"bg-button"},textColor:{type:String,default:"text-on-color"},textSize:{type:String,default:"text-xs"},fontWeight:{type:String,default:"font-medium"},rounded:{type:String,default:"rounded-2xl"},cursor:{type:String,default:"cursor-default"}}};function Be(t,c,n,a,l,u){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex px-2.5 py-1.5",[n.bgColor,n.textColor,n.textSize,n.fontWeight,n.rounded,n.cursor]])},e.toDisplayString(n.text),3)}const L=$(Ce,[["render",Be]]),Ke={props:{title:{type:String},subtitle:{type:String},text:{type:String},bgColor:{type:String,default:"bg-surface"},rounded:{type:[String|Number|Boolean],default:void 0},variant:{type:String,default:"elevated"},height:{type:[Number,String],default:"h-full"},width:{type:[Number,String],default:"w-full"},to:{type:String,default:void 0}}},Ee=["to"];function Ne(t,c,n,a,l,u){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex flex-col",[n.rounded,n.variant,n.height,n.width,n.bgColor]]),to:n.to},[e.renderSlot(t.$slots,"default")],10,Ee)}const P=$(Ke,[["render",Ne]]),_e={props:{title:{type:String},subtitle:{type:String},text:{type:String},bgColor:{type:String,default:"bg-appbar"},variant:{type:String,default:"elevated"},height:{type:[Number,String],default:"h-fit"},width:{type:[Number,String],default:"w-full"},classBase:{type:String,default:"text-center rounded-t-lg"}}},we={key:0,class:"flex flex-row uppercase w-full py-2"},Ve={class:"w-full"},$e={key:1},Ie={key:2};function Oe(t,c,n,a,l,u){return e.renderSlot(t.$slots,"default",{},()=>[e.createElementVNode("div",{class:e.normalizeClass([n.classBase,n.variant,n.height,n.width,n.bgColor])},[n.title?(e.openBlock(),e.createElementBlock("div",we,[e.renderSlot(t.$slots,"prepend-title"),e.createElementVNode("span",Ve,e.toDisplayString(n.title),1),e.renderSlot(t.$slots,"append-title")])):e.createCommentVNode("",!0),n.subtitle?(e.openBlock(),e.createElementBlock("span",$e,e.toDisplayString(n.subtitle),1)):e.createCommentVNode("",!0),n.text?(e.openBlock(),e.createElementBlock("span",Ie,e.toDisplayString(n.text),1)):e.createCommentVNode("",!0)],2)])}const q=$(_e,[["render",Oe]]),Te={class:"flex flex-row items-center",style:{padding:"2px 2px","max-width":"200px"}},je={key:0,class:"mr-1"},Ae=["placeholder","value"],ze={key:1},W={__name:"KunCurrency",props:{currency:{type:Object,default:()=>({name:"Peso Argentino",name:"ARS",simbol:"$"})},hideCurrency:{type:Boolean,default:!1},locale:{type:String,default:"ar-ES"},precision:{type:Number,default:2},modelValue:{default:null},placeholder:{type:String,default:"0.00"},prefix:{type:String,default:"$"},suffix:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:c}){const n=t,a=c;function l(s){u.value=s,a("update:modelValue",s)}const u=ref(n.modelValue);let p=null,d=null;onMounted(()=>{p=document.getElementById("hide"),d=document.getElementById("txt"),d.addEventListener("input",y),y()});function y(){p.textContent=d.value,d.style.width=6+p.offsetWidth+"px"}const g=s=>{const f=s.target.querySelector("input");f&&f.focus()},k=ref(null),N=s=>{const f=s.target,B=f.value;f.value=B.replace(/\D/g,""),l(f.value)};let _=n.placeholder;const K=()=>{i("")},C=()=>{i(n.placeholder)},i=s=>{document.getElementById("txt").setAttribute("placeholder",s)};return(s,f)=>(e.openBlock(),e.createElementBlock("div",{class:"w-full h-full flex justify-center",style:{cursor:"text"},onClick:f[1]||(f[1]=B=>g(B))},[e.createElementVNode("div",Te,[t.prefix?(e.openBlock(),e.createElementBlock("div",je,e.toDisplayString(t.prefix),1)):e.createCommentVNode("",!0),f[2]||(f[2]=e.createElementVNode("span",{id:"hide"},null,-1)),e.createElementVNode("input",{id:"txt",ref_key:"inputField",ref:k,type:"number",class:"text-field-style",onFocus:K,onBlur:C,placeholder:e.unref(_),onInput:f[0]||(f[0]=B=>N(B)),value:e.unref(u),autocomplete:"off"},null,40,Ae),t.suffix?(e.openBlock(),e.createElementBlock("div",ze,e.toDisplayString(t.suffix),1)):e.createCommentVNode("",!0)])]))}},H={__name:"KunIcon",props:{icon:{type:[String,Object,Function],required:!0},aliases:{type:Object,default:()=>({})},size:{type:String,default:"text-xs"},color:{type:String,default:"text-font-color"},disabled:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:c}){const n=t,a=c;function l(d){n.disabled||a("click",d)}const u=e.computed(()=>{if(typeof n.icon=="string"&&n.icon.startsWith("$")){const d=n.icon.slice(1);return n.aliases[d]||""}return n.icon}),p=e.computed(()=>typeof u.value=="function"||typeof u.value=="object"&&u.value!==null);return(d,y)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass([t.color,t.size,t.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"]),onClick:l},[d.$slots.default?e.renderSlot(d.$slots,"default",{key:0}):p.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.value),{key:1})):(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass(u.value)},null,2))],2))}},Fe={};function Me(t,c){return null}const U=$(Fe,[["render",Me]]),De={props:{height:{type:[Number,String],default:"100%"},width:{type:[Number,String],default:"100%"}}};function Re(t,c,n,a,l,u){return e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle({height:n.height,width:n.width})},null,4)}const Y=$(De,[["render",Re]]),Le={type:{type:String,default:"text"},locale:{type:String,default:"ar-ES"},precision:{type:Number,default:2},prefix:{type:String,default:""},suffix:{type:String,default:""},resize:{type:Boolean,default:!1},rounded:{type:String,default:"rounded"}},Pe={key:0},qe=["type","value","placeholder"],We={key:1},G={__name:"KunTextField",props:e.mergeModels(Le,{modelValue:{},modelModifiers:{},placeholder:{},placeholderModifiers:{}}),emits:e.mergeModels(["update:modelValue","focusInput","blurInput","pressEsc","clickInput"],["update:modelValue","update:placeholder"]),setup(t,{emit:c}){const n=c,a=e.useModel(t,"modelValue"),l=e.useModel(t,"placeholder"),u=ref(null);function p(i){a.value=i}const d=i=>{const s=i.target.querySelector("input");s&&s.focus()},y=i=>{const s=i.target;p(s.value)};watch(l,i=>{g=i});let g=l.value;const k=()=>{C("rounded-b-none"),g="",n("focusInput")},N=()=>{g=l.value,C("")},_=()=>{u.value,u.value&&u.value.blur(),n("pressEsc")},K=ref("");function C(i){K.value=i}return(i,s)=>(e.openBlock(),e.createElementBlock("div",{class:"w-full h-full flex justify-center my-2",style:{cursor:"text"},onClick:s[1]||(s[1]=f=>d(f))},[e.renderSlot(i.$slots,"prepend"),e.createElementVNode("div",{class:e.normalizeClass([e.unref(K),i.rounded,"w-full h-full text-field-style flex flex-row items-center"]),style:{padding:"0px 2px"}},[i.prefix?(e.openBlock(),e.createElementBlock("div",Pe,e.toDisplayString(i.prefix),1)):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"prepend-inner"),e.renderSlot(i.$slots,"default",{},()=>[e.createElementVNode("input",{ref_key:"inputField",ref:u,type:i.type,value:a.value,autocomplete:"off",class:"h-full text-center w-full bg-transparent focus:border-none focus:outline-none input-opacity",style:{padding:"4px 0px"},placeholder:e.unref(g),onInput:s[0]||(s[0]=f=>y(f)),onKeydown:e.withKeys(_,["escape"]),onFocus:k,onBlur:N},null,40,qe)]),e.renderSlot(i.$slots,"append-inner"),i.suffix?(e.openBlock(),e.createElementBlock("div",We,e.toDisplayString(i.suffix),1)):e.createCommentVNode("",!0)],2),e.renderSlot(i.$slots,"append")]))}},He={class:"bg-appbar h-10 flex flex-row items-center py-2 px-2"},J={__name:"KunToolbar",props:{density:{type:String,default:""},title:{type:String,default:""}},setup(t){return(c,n)=>{const a=e.resolveComponent("KunToolbarTitle");return e.openBlock(),e.createElementBlock("div",He,[t.title?(e.openBlock(),e.createBlock(a,{key:0,title:t.title},null,8,["title"])):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"default",{density:t.density})])}}},Q={KunAlert:F,KunAppbar:M,KunAutocomplete:D,KunBtn:R,KunBudge:L,KunCard:P,KunCardText:q,KunCurrency:W,KunIcon:H,KunList:U,KunSpacer:Y,KunTextField:G,KunToolbar:J};function Ue(t){for(const c in Q)t.component(c,Q[c])}m.KunAlert=F,m.KunAppbar=M,m.KunAutocomplete=D,m.KunBtn=R,m.KunBudge=L,m.KunCard=P,m.KunCardText=q,m.KunCurrency=W,m.KunIcon=H,m.KunList=U,m.KunSpacer=Y,m.KunTextField=G,m.KunToolbar=J,m.install=Ue,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|