adverich-kun-ui 0.1.7 → 0.1.9

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.
@@ -0,0 +1 @@
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,18 +1,499 @@
1
- import { computed as n, createElementBlock as o, openBlock as s, normalizeClass as i, renderSlot as u, createTextVNode as r, toDisplayString as c } from "vue";
2
- const d = ["aria-label", "disabled"], f = {
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 I, 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
+ class: "h-svh top-0 left-0 bg-grey-900 w-full overflow-y-auto opacity-90",
4
+ style: { position: "fixed", "z-index": "2500" }
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
+ key: 0,
7
+ class: "my-4 text-center text-3xl font-semibold"
8
+ }, ve = { class: "text-xl font-normal" }, he = {
9
+ __name: "KunAlert",
10
+ props: {
11
+ modelValue: {
12
+ type: Boolean,
13
+ default: !1
14
+ },
15
+ title: {
16
+ type: String,
17
+ default: "Congratulation !!"
18
+ },
19
+ message: {
20
+ type: String,
21
+ default: "Your order have been taken and is being attended to"
22
+ }
23
+ },
24
+ emits: ["update:modelValue"],
25
+ setup(e, { emit: o }) {
26
+ return (t, a) => {
27
+ const n = A("KunIcon");
28
+ return s(), p("div", de, [
29
+ v("div", fe, [
30
+ v("div", ye, [
31
+ v("div", pe, [
32
+ V(n, {
33
+ icon: "exclamation",
34
+ size: "text-9xl"
35
+ })
36
+ ])
37
+ ]),
38
+ v("div", me, [
39
+ e.title ? (s(), p("div", ge, $(e.title), 1)) : b("", !0),
40
+ v("div", ve, $(e.message), 1)
41
+ ])
42
+ ])
43
+ ]);
44
+ };
45
+ }
46
+ }, xe = { class: "flex-1" }, be = { class: "flex items-center" }, Se = { class: "flex-1" }, Ce = { class: "w-full flex justify-end" }, Ke = {
47
+ __name: "KunAppbar",
48
+ props: {
49
+ density: {
50
+ type: String,
51
+ default: ""
52
+ },
53
+ bgColor: {
54
+ type: String,
55
+ default: "bg-appbar"
56
+ },
57
+ title: {
58
+ type: String,
59
+ default: ""
60
+ }
61
+ },
62
+ setup(e) {
63
+ return (o, t) => {
64
+ const a = A("KunAppbarTitle");
65
+ return s(), p("div", {
66
+ class: O(["flex py-1 px-2 h-14 items-center", [e.bgColor]])
67
+ }, [
68
+ v("div", xe, [
69
+ v("div", be, [
70
+ h(o.$slots, "appbarButton"),
71
+ h(o.$slots, "prepend")
72
+ ])
73
+ ]),
74
+ e.title ? (s(), P(a, {
75
+ key: 0,
76
+ title: e.title
77
+ }, null, 8, ["title"])) : b("", !0),
78
+ v("div", Se, [
79
+ v("div", Ce, [
80
+ h(o.$slots, "append")
81
+ ])
82
+ ])
83
+ ], 2);
84
+ };
85
+ }
86
+ }, _e = {
87
+ label: {
88
+ type: String
89
+ },
90
+ itemValue: {
91
+ type: String,
92
+ default: ""
93
+ },
94
+ itemTitle: {
95
+ type: String,
96
+ default: ""
97
+ },
98
+ itemText: {
99
+ type: String,
100
+ default: ""
101
+ },
102
+ itemSubtitle: {
103
+ type: String,
104
+ default: ""
105
+ },
106
+ returnObject: {
107
+ type: Boolean,
108
+ default: !1
109
+ },
110
+ searchableKeys: {
111
+ type: Array,
112
+ default: []
113
+ },
114
+ focusOnSelect: {
115
+ type: Boolean,
116
+ default: !1
117
+ },
118
+ clearable: {
119
+ type: Boolean,
120
+ default: !1
121
+ },
122
+ clearOnSelect: {
123
+ type: Boolean,
124
+ default: !1
125
+ },
126
+ clearSearchOnSelect: {
127
+ type: Boolean,
128
+ default: !0
129
+ },
130
+ closeOnSelect: {
131
+ type: Boolean,
132
+ default: !0
133
+ },
134
+ startEmtpy: {
135
+ type: Boolean,
136
+ default: !1
137
+ },
138
+ placeholderText: {
139
+ type: String,
140
+ default: "Seleccionar"
141
+ },
142
+ textNoItems: {
143
+ type: String,
144
+ default: "No hay elementos"
145
+ },
146
+ hasCreateItem: {
147
+ type: Boolean,
148
+ default: !1
149
+ },
150
+ multiple: {
151
+ type: Boolean,
152
+ default: !1
153
+ },
154
+ required: {
155
+ type: Boolean,
156
+ default: !1
157
+ },
158
+ // ***** STYLE ***** //
159
+ maxHeight: {
160
+ default: 500
161
+ },
162
+ density: {
163
+ type: String,
164
+ default: "comfortable"
165
+ },
166
+ hideDetails: {
167
+ type: Boolean,
168
+ default: !0
169
+ },
170
+ hasIcons: {
171
+ type: Boolean,
172
+ default: !0
173
+ },
174
+ bgItemListColor: {
175
+ type: String,
176
+ default: "bg-transparent"
177
+ },
178
+ selectedColor: {
179
+ type: String,
180
+ default: "bg-primary"
181
+ },
182
+ attach: {
183
+ type: Boolean,
184
+ default: !1
185
+ }
186
+ };
187
+ function _(e) {
188
+ return e !== null && typeof e == "object" && !Array.isArray(e);
189
+ }
190
+ function M(e) {
191
+ return Array.isArray(e);
192
+ }
193
+ function $e(e, o, t, a) {
194
+ const n = R(null), d = R(null), m = R(null), f = R(!1), g = R(""), x = I(() => !e.searchableKeys.length), k = I(() => e.clearOnSelect);
195
+ I(() => e.clearSearchOnSelect), I(() => e.focusOnSelect);
196
+ const F = I(() => e.closeOnSelect);
197
+ function E() {
198
+ M(t.value) && (t.value.length ? n.value = a.value.filter(
199
+ (l) => _(l) ? t.value.some(
200
+ (u) => u[e.itemTitle].includes(l[e.itemTitle])
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 = a.value.find(
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
+ ));
205
+ }
206
+ const j = I(() => 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 = I(() => e.startEmtpy && g.value.length < 3 ? [] : a.value.filter((u) => {
207
+ if (_(u)) {
208
+ const z = Object.values(u).filter((N) => {
209
+ if (!_(N) && !M(N))
210
+ return N;
211
+ }), K = [u].reduce((N, ne) => e.searchableKeys.map((le) => ne[le]), []), Q = x.value ? z : K;
212
+ return Q ? Q.some(
213
+ (N) => N ? N.toString().toLowerCase().includes(g.value.toLowerCase()) : ""
214
+ ) : g.value ? u == g.value : u;
215
+ }
216
+ return u.toString().toLowerCase().includes(g.value.toLowerCase());
217
+ }).slice(0, currentBatchStep.value)), i = I(() => e.itemText.includes(",") ? e.itemText.split(",") : e.itemText);
218
+ function r(l, u, z) {
219
+ if (_(l)) {
220
+ if (u)
221
+ return M(u) ? u.map((K) => l[K] ?? "No definido").join(" - ") : u.includes(",") ? u.split(",").map((K) => l[K]).join(" - ") : !e.returnObject && typeof l[u] == "number" || l[u] ? l[u].toString() : "";
222
+ if (z)
223
+ return Object.values(l)[0];
224
+ }
225
+ return M(l) ? e.returnObject ? l.map((K) => K[u]).join(" - ") : l.map((K) => K).join(" - ") : z && typeof l != "number" && l.includes(",") ? l.split(",") : l;
226
+ }
227
+ function y(l) {
228
+ let u = l[0];
229
+ if (!e.multiple)
230
+ n.value = l[0], e.returnObject && (t.value = u), !e.returnObject && _(u) && (e.itemValue ? t.value = u[e.itemValue] : t.value = Object.values(u)[0]), _(u) || (t.value = u), f.value = !1;
231
+ else if (n.value || (n.value = []), B(u))
232
+ S(u), t.value = n.value;
233
+ else {
234
+ if (e.returnObject && n.value.push(u), !e.returnObject && _(u))
235
+ if (e.itemValue)
236
+ n.value.push(u[e.itemValue]);
237
+ else {
238
+ t.value = n.value.push(Object.values(u)[0]);
239
+ return;
240
+ }
241
+ t.value = n.value;
242
+ }
243
+ k.value && W(), d.value.focus();
244
+ }
245
+ function B(l) {
246
+ return n.value === null ? !1 : n.value.some(
247
+ (u) => e.returnObject ? u[e.itemValue] === l[e.itemValue] : u === l[e.itemValue]
248
+ );
249
+ }
250
+ function S(l) {
251
+ if (e.returnObject) {
252
+ let u = n.value.find(
253
+ (K) => K[e.itemValue] === l[e.itemValue]
254
+ ), z = n.value.indexOf(u);
255
+ n.value.splice(z, 1);
256
+ } else {
257
+ let u = n.value.indexOf(l[e.itemValue]);
258
+ n.value.splice(u, 1);
259
+ }
260
+ }
261
+ function C(l) {
262
+ l.key !== "Tab" && (f.value = !0);
263
+ }
264
+ function L(l) {
265
+ k.value && (f.value = !1);
266
+ }
267
+ function Y() {
268
+ f.value = !0, m.value && m.value.focus();
269
+ }
270
+ function G() {
271
+ f.value = !1, o("createItem");
272
+ }
273
+ function J(l) {
274
+ let u = n.value.indexOf(l);
275
+ n.value.splice(u, 1), t.value = n.value;
276
+ }
277
+ function W() {
278
+ g.value = "", M(t.value) && (n.value = []), _(t.value) && (n.value = {}), typeof t.value == "number" && t.value && (n.value = 0), typeof t.value == "string" && t.value && (n.value = ""), typeof t.value == "boolean" && (n.value = !1), t.value = n.value;
279
+ }
280
+ function T(l) {
281
+ if (!l.disabledItem) return !1;
282
+ if (l.disabledItem) return !0;
283
+ }
284
+ return {
285
+ selectedItem: n,
286
+ textFieldRef: d,
287
+ listRef: m,
288
+ menuModel: f,
289
+ search: g,
290
+ isCloseOnSelect: F,
291
+ isClearOnSelect: k,
292
+ setSelectedItemValue: E,
293
+ placeholder: j,
294
+ filteredItems: w,
295
+ textArr: i,
296
+ itemToString: r,
297
+ getSelectedItem: y,
298
+ openMenu: C,
299
+ closeMenu: L,
300
+ focusOnMenu: Y,
301
+ createItem: G,
302
+ removeItem: J,
303
+ clearSelection: W,
304
+ isDisabled: T
305
+ };
306
+ }
307
+ const D = (e, o) => {
308
+ const t = e.__vccOpts || e;
309
+ for (const [a, n] of o)
310
+ t[a] = n;
311
+ return t;
312
+ }, Ie = { class: "relative" }, ke = ["close-on-content-click", "max-height"], we = { class: "w-full px-2 py-1" }, Be = {
313
+ __name: "KunAutocomplete",
314
+ props: /* @__PURE__ */ H(_e, {
315
+ modelValue: { default: null },
316
+ modelModifiers: {},
317
+ items: { default: [], type: Array },
318
+ itemsModifiers: {}
319
+ }),
320
+ emits: /* @__PURE__ */ H(["createItem"], ["update:modelValue", "update:items"]),
321
+ setup(e, { emit: o }) {
322
+ const t = e;
323
+ R(0);
324
+ const a = U(e, "modelValue"), n = U(e, "items"), d = o, {
325
+ selectedItem: m,
326
+ textFieldRef: f,
327
+ menuModel: g,
328
+ search: x,
329
+ isCloseOnSelect: k,
330
+ setSelectedItemValue: F,
331
+ placeholder: E,
332
+ openMenu: j,
333
+ closeMenu: w,
334
+ focusOnMenu: i,
335
+ createItem: r,
336
+ clearSelection: y
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
+ });
341
+ function B(S) {
342
+ x.value = "", a.value = S, w();
343
+ }
344
+ return (S, C) => {
345
+ const L = A("KunIcon"), Y = A("KunTextField"), G = A("KunBtn"), J = A("KunListItem"), W = A("KunVirtualScroller");
346
+ return s(), p(ae, null, [
347
+ c(g) ? (s(), p("div", {
348
+ key: 0,
349
+ class: "fixed opacity-10 w-svw inset-0 h-svh",
350
+ onClick: C[0] || (C[0] = (T) => g.value = !1)
351
+ })) : b("", !0),
352
+ v("div", Ie, [
353
+ V(Y, {
354
+ modelValue: c(x),
355
+ "onUpdate:modelValue": C[2] || (C[2] = (T) => oe(x) ? x.value = T : null),
356
+ ref_key: "textFieldRef",
357
+ ref: f,
358
+ placeholder: S.isArray(c(m)) && c(m).length ? "" : c(E),
359
+ onKeyup: ee(c(i), ["down"]),
360
+ onClickInput: c(j),
361
+ onPressEsc: c(w),
362
+ onChange: C[3] || (C[3] = (T) => console.log("change")),
363
+ onFocusInput: c(i)
364
+ }, X({ _: 2 }, [
365
+ S.hasIcons ? {
366
+ name: "append-inner",
367
+ fn: q(() => [
368
+ S.clearable && c(m) ? (s(), P(L, {
369
+ key: 0,
370
+ onClick: c(y),
371
+ size: "text-xl",
372
+ color: "text-error",
373
+ icon: "close",
374
+ class: O(["mr-1", S.isNotEmpty(c(m)) ? "cursor-pointer" : "cursor-default"]),
375
+ disabled: !S.isNotEmpty(c(m))
376
+ }, null, 8, ["onClick", "class", "disabled"])) : b("", !0),
377
+ V(L, {
378
+ color: "text-accent-button",
379
+ size: "text-xl",
380
+ class: "cursor-pointer",
381
+ icon: c(g) ? "menuUp" : "menuDown",
382
+ onClick: C[1] || (C[1] = (T) => g.value = !c(g))
383
+ }, null, 8, ["icon"]),
384
+ S.required ? (s(), P(L, {
385
+ key: 1,
386
+ color: "text-red-900",
387
+ size: "text-lg",
388
+ class: "mb-3",
389
+ icon: "asterisk"
390
+ })) : b("", !0)
391
+ ]),
392
+ key: "0"
393
+ } : void 0
394
+ ]), 1032, ["modelValue", "placeholder", "onKeyup", "onClickInput", "onPressEsc", "onFocusInput"]),
395
+ ie(v("div", {
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(k),
398
+ "max-height": S.maxHeight
399
+ }, [
400
+ V(W, {
401
+ items: n.value,
402
+ search: c(x),
403
+ searchBy: "name",
404
+ maxHeight: 250
405
+ }, X({
406
+ default: q(({ item: T, itemKey: l }) => [
407
+ V(J, {
408
+ item: T,
409
+ itemKey: l,
410
+ title: "name",
411
+ cursor: "cursor-pointer",
412
+ onSelect: B
413
+ }, null, 8, ["item", "itemKey"])
414
+ ]),
415
+ _: 2
416
+ }, [
417
+ S.hasCreateItem ? {
418
+ name: "topButton",
419
+ fn: q(() => [
420
+ v("div", we, [
421
+ V(G, {
422
+ onClick: c(r),
423
+ class: "w-full rounded-md bg-accent-button",
424
+ size: "xs"
425
+ }, {
426
+ default: q(() => C[4] || (C[4] = [
427
+ te("Crear item")
428
+ ])),
429
+ _: 1
430
+ }, 8, ["onClick"])
431
+ ])
432
+ ]),
433
+ key: "0"
434
+ } : void 0
435
+ ]), 1032, ["items", "search"])
436
+ ], 8, ke), [
437
+ [se, c(g)]
438
+ ])
439
+ ])
440
+ ], 64);
441
+ };
442
+ }
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 = {
3
444
  __name: "KunBtn",
4
445
  props: {
446
+ size: {
447
+ type: String,
448
+ default: "md"
449
+ },
450
+ width: {
451
+ type: String,
452
+ default: "w-24"
453
+ },
454
+ textColor: {
455
+ type: String,
456
+ default: "text-white"
457
+ },
5
458
  text: {
6
459
  type: String,
7
460
  default: null
8
461
  },
9
- class: {
462
+ fontWeight: {
10
463
  type: String,
11
- default: "px-4 py-2 text-sm font-medium bg-blue-500 text-white rounded-md hover:bg-blue-600 focus:ring-blue-300"
464
+ default: "font-medium"
12
465
  },
13
- ariaLabel: {
466
+ bgColor: {
14
467
  type: String,
15
- default: null
468
+ default: "bg-button"
469
+ },
470
+ bgColorHover: {
471
+ type: String,
472
+ default: "hover:opacity-90"
473
+ },
474
+ bgColorFocus: {
475
+ type: String,
476
+ default: "focus:opacity-100"
477
+ },
478
+ focusRing: {
479
+ type: String,
480
+ default: "focus:ring-1"
481
+ },
482
+ focusOutline: {
483
+ type: String,
484
+ default: "focus:outline-none"
485
+ },
486
+ focusRingColor: {
487
+ type: String,
488
+ default: "focus:ring-blue-300"
489
+ },
490
+ rounded: {
491
+ type: String,
492
+ default: "rounded-lg"
493
+ },
494
+ textAlign: {
495
+ type: String,
496
+ default: "text-center"
16
497
  },
17
498
  disabled: {
18
499
  type: Boolean,
@@ -20,24 +501,510 @@ const d = ["aria-label", "disabled"], f = {
20
501
  }
21
502
  },
22
503
  setup(e) {
23
- const t = e, a = n(() => t.class);
24
- return (l, b) => (s(), o("button", {
504
+ const o = (t) => {
505
+ switch (t) {
506
+ case "xxs":
507
+ return Te;
508
+ case "xs":
509
+ return Ae;
510
+ case "sm":
511
+ return Fe;
512
+ case "md":
513
+ return Ee;
514
+ case "lg":
515
+ return Ne;
516
+ case "xl":
517
+ return ze;
518
+ case "xxl":
519
+ return Me;
520
+ }
521
+ };
522
+ return (t, a) => (s(), p("button", {
25
523
  type: "button",
26
- class: i(["flex justify-center items-center transition-all duration-200", [a.value, e.disabled ? "opacity-50 cursor-not-allowed" : "hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-offset-2"]]),
27
- "aria-label": e.ariaLabel,
524
+ class: O(["flex justify-center align-center items-center", [
525
+ e.width,
526
+ o(e.size),
527
+ e.textColor,
528
+ e.fontWeight,
529
+ e.bgColor,
530
+ e.bgColorHover,
531
+ e.bgColorFocus,
532
+ e.focusRing,
533
+ e.focusOutline,
534
+ e.focusRingColor,
535
+ e.rounded,
536
+ e.textAlign,
537
+ e.disabled ? "opacity-50 cursor-not-allowed" : "hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-offset-2"
538
+ ]]),
28
539
  disabled: e.disabled
29
540
  }, [
30
- u(l.$slots, "default", {}, () => [
31
- r(c(e.text), 1)
541
+ h(t.$slots, "default", {}, () => [
542
+ te($(e.text), 1)
32
543
  ])
33
- ], 10, d));
544
+ ], 10, je));
34
545
  }
35
- }, p = {
36
- install(e) {
37
- e.component("KunBtn", f);
546
+ }, Re = {
547
+ props: {
548
+ text: {
549
+ type: String,
550
+ default: ""
551
+ },
552
+ bgColor: {
553
+ type: String,
554
+ default: "bg-button"
555
+ },
556
+ textColor: {
557
+ type: String,
558
+ default: "text-on-color"
559
+ },
560
+ textSize: {
561
+ type: String,
562
+ default: "text-xs"
563
+ },
564
+ fontWeight: {
565
+ type: String,
566
+ default: "font-medium"
567
+ },
568
+ rounded: {
569
+ type: String,
570
+ default: "rounded-2xl"
571
+ },
572
+ cursor: {
573
+ type: String,
574
+ default: "cursor-default"
575
+ }
576
+ }
577
+ };
578
+ function De(e, o, t, a, n, d) {
579
+ return s(), p("div", {
580
+ class: O(["flex px-2.5 py-1.5", [t.bgColor, t.textColor, t.textSize, t.fontWeight, t.rounded, t.cursor]])
581
+ }, $(t.text), 3);
582
+ }
583
+ const Le = /* @__PURE__ */ D(Re, [["render", De]]), Pe = {
584
+ props: {
585
+ title: {
586
+ type: String
587
+ },
588
+ subtitle: {
589
+ type: String
590
+ },
591
+ text: {
592
+ type: String
593
+ },
594
+ bgColor: {
595
+ type: String,
596
+ default: "bg-surface"
597
+ },
598
+ rounded: {
599
+ type: [String | Number | Boolean],
600
+ default: void 0
601
+ },
602
+ variant: {
603
+ type: String,
604
+ default: "elevated"
605
+ },
606
+ height: {
607
+ type: [Number, String],
608
+ default: "h-full"
609
+ // Valor por defecto de la altura en píxeles
610
+ },
611
+ width: {
612
+ type: [Number, String],
613
+ default: "w-full"
614
+ // Valor por defecto del ancho
615
+ },
616
+ to: {
617
+ type: String,
618
+ default: void 0
619
+ }
620
+ }
621
+ }, We = ["to"];
622
+ function qe(e, o, t, a, n, d) {
623
+ return s(), p("div", {
624
+ class: O(["flex flex-col", [t.rounded, t.variant, t.height, t.width, t.bgColor]]),
625
+ to: t.to
626
+ }, [
627
+ h(e.$slots, "default")
628
+ ], 10, We);
629
+ }
630
+ const He = /* @__PURE__ */ D(Pe, [["render", qe]]), Ue = {
631
+ props: {
632
+ title: {
633
+ type: String
634
+ },
635
+ subtitle: {
636
+ type: String
637
+ },
638
+ text: {
639
+ type: String
640
+ },
641
+ bgColor: {
642
+ type: String,
643
+ default: "bg-appbar"
644
+ },
645
+ variant: {
646
+ type: String,
647
+ default: "elevated"
648
+ },
649
+ height: {
650
+ type: [Number, String],
651
+ default: "h-fit"
652
+ // Valor por defecto de la altura en píxeles
653
+ },
654
+ width: {
655
+ type: [Number, String],
656
+ default: "w-full"
657
+ // Valor por defecto del ancho
658
+ },
659
+ classBase: {
660
+ type: String,
661
+ default: "text-center rounded-t-lg"
662
+ }
663
+ }
664
+ }, Ye = {
665
+ key: 0,
666
+ class: "flex flex-row uppercase w-full py-2"
667
+ }, Ge = { class: "w-full" }, Je = { key: 1 }, Qe = { key: 2 };
668
+ function Xe(e, o, t, a, n, d) {
669
+ return h(e.$slots, "default", {}, () => [
670
+ v("div", {
671
+ class: O([t.classBase, t.variant, t.height, t.width, t.bgColor])
672
+ }, [
673
+ t.title ? (s(), p("div", Ye, [
674
+ h(e.$slots, "prepend-title"),
675
+ v("span", Ge, $(t.title), 1),
676
+ h(e.$slots, "append-title")
677
+ ])) : b("", !0),
678
+ t.subtitle ? (s(), p("span", Je, $(t.subtitle), 1)) : b("", !0),
679
+ t.text ? (s(), p("span", Qe, $(t.text), 1)) : b("", !0)
680
+ ], 2)
681
+ ]);
682
+ }
683
+ const Ze = /* @__PURE__ */ D(Ue, [["render", Xe]]), et = {
684
+ class: "flex flex-row items-center",
685
+ style: { padding: "2px 2px", "max-width": "200px" }
686
+ }, tt = {
687
+ key: 0,
688
+ class: "mr-1"
689
+ }, nt = ["placeholder", "value"], lt = { key: 1 }, ut = {
690
+ __name: "KunCurrency",
691
+ props: {
692
+ currency: {
693
+ type: Object,
694
+ default: () => ({
695
+ name: "Peso Argentino",
696
+ name: "ARS",
697
+ simbol: "$"
698
+ })
699
+ },
700
+ hideCurrency: {
701
+ type: Boolean,
702
+ default: !1
703
+ },
704
+ locale: {
705
+ type: String,
706
+ default: "ar-ES"
707
+ },
708
+ precision: {
709
+ type: Number,
710
+ default: 2
711
+ },
712
+ modelValue: {
713
+ default: null
714
+ },
715
+ placeholder: {
716
+ type: String,
717
+ default: "0.00"
718
+ },
719
+ prefix: {
720
+ type: String,
721
+ default: "$"
722
+ },
723
+ suffix: {
724
+ type: String,
725
+ default: ""
726
+ }
727
+ },
728
+ emits: ["update:modelValue"],
729
+ setup(e, { emit: o }) {
730
+ const t = e, a = o;
731
+ function n(r) {
732
+ d.value = r, a("update:modelValue", r);
733
+ }
734
+ const d = ref(t.modelValue);
735
+ let m = null, f = null;
736
+ onMounted(() => {
737
+ m = document.getElementById("hide"), f = document.getElementById("txt"), f.addEventListener("input", g), g();
738
+ });
739
+ function g() {
740
+ m.textContent = f.value, f.style.width = 6 + m.offsetWidth + "px";
741
+ }
742
+ const x = (r) => {
743
+ const y = r.target.querySelector("input");
744
+ y && y.focus();
745
+ }, k = ref(null), F = (r) => {
746
+ const y = r.target, B = y.value;
747
+ y.value = B.replace(/\D/g, ""), n(y.value);
748
+ };
749
+ let E = t.placeholder;
750
+ const j = () => {
751
+ i("");
752
+ }, w = () => {
753
+ i(t.placeholder);
754
+ }, i = (r) => {
755
+ document.getElementById("txt").setAttribute("placeholder", r);
756
+ };
757
+ return (r, y) => (s(), p("div", {
758
+ class: "w-full h-full flex justify-center",
759
+ style: { cursor: "text" },
760
+ onClick: y[1] || (y[1] = (B) => x(B))
761
+ }, [
762
+ v("div", et, [
763
+ e.prefix ? (s(), p("div", tt, $(e.prefix), 1)) : b("", !0),
764
+ y[2] || (y[2] = v("span", { id: "hide" }, null, -1)),
765
+ v("input", {
766
+ id: "txt",
767
+ ref_key: "inputField",
768
+ ref: k,
769
+ type: "number",
770
+ class: "text-field-style",
771
+ onFocus: j,
772
+ onBlur: w,
773
+ placeholder: c(E),
774
+ onInput: y[0] || (y[0] = (B) => F(B)),
775
+ value: c(d),
776
+ autocomplete: "off"
777
+ }, null, 40, nt),
778
+ e.suffix ? (s(), p("div", lt, $(e.suffix), 1)) : b("", !0)
779
+ ])
780
+ ]));
781
+ }
782
+ }, at = {
783
+ __name: "KunIcon",
784
+ props: {
785
+ icon: {
786
+ type: [String, Object, Function],
787
+ required: !0
788
+ },
789
+ aliases: {
790
+ type: Object,
791
+ default: () => ({})
792
+ },
793
+ size: {
794
+ type: String,
795
+ default: "text-xs"
796
+ },
797
+ color: {
798
+ type: String,
799
+ default: "text-font-color"
800
+ },
801
+ disabled: {
802
+ type: Boolean,
803
+ default: !1
804
+ }
805
+ },
806
+ emits: ["click"],
807
+ setup(e, { emit: o }) {
808
+ const t = e, a = o;
809
+ function n(f) {
810
+ t.disabled || a("click", f);
811
+ }
812
+ const d = I(() => {
813
+ if (typeof t.icon == "string" && t.icon.startsWith("$")) {
814
+ const f = t.icon.slice(1);
815
+ return t.aliases[f] || "";
816
+ }
817
+ return t.icon;
818
+ }), m = I(
819
+ () => typeof d.value == "function" || typeof d.value == "object" && d.value !== null
820
+ );
821
+ return (f, g) => (s(), p("span", {
822
+ class: O([e.color, e.size, e.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"]),
823
+ onClick: n
824
+ }, [
825
+ f.$slots.default ? h(f.$slots, "default", { key: 0 }) : m.value ? (s(), P(re(d.value), { key: 1 })) : (s(), p("span", {
826
+ key: 2,
827
+ class: O(d.value)
828
+ }, null, 2))
829
+ ], 2));
830
+ }
831
+ }, it = {};
832
+ function ot(e, o) {
833
+ return null;
834
+ }
835
+ const st = /* @__PURE__ */ D(it, [["render", ot]]), rt = {
836
+ props: {
837
+ height: {
838
+ type: [Number, String],
839
+ default: "100%"
840
+ // Valor por defecto de la altura en píxeles
841
+ },
842
+ width: {
843
+ type: [Number, String],
844
+ default: "100%"
845
+ // Valor por defecto del ancho
846
+ }
847
+ }
848
+ };
849
+ function ct(e, o, t, a, n, d) {
850
+ return s(), p("div", {
851
+ style: ce({ height: t.height, width: t.width })
852
+ }, null, 4);
853
+ }
854
+ const dt = /* @__PURE__ */ D(rt, [["render", ct]]), ft = {
855
+ type: {
856
+ type: String,
857
+ default: "text"
858
+ },
859
+ locale: {
860
+ type: String,
861
+ default: "ar-ES"
862
+ },
863
+ precision: {
864
+ type: Number,
865
+ default: 2
866
+ },
867
+ prefix: {
868
+ type: String,
869
+ default: ""
870
+ },
871
+ suffix: {
872
+ type: String,
873
+ default: ""
874
+ },
875
+ resize: {
876
+ type: Boolean,
877
+ default: !1
878
+ },
879
+ rounded: {
880
+ type: String,
881
+ default: "rounded"
882
+ }
883
+ }, yt = { key: 0 }, pt = ["type", "value", "placeholder"], mt = { key: 1 }, gt = {
884
+ __name: "KunTextField",
885
+ props: /* @__PURE__ */ H(ft, {
886
+ modelValue: {},
887
+ modelModifiers: {},
888
+ placeholder: {},
889
+ placeholderModifiers: {}
890
+ }),
891
+ emits: /* @__PURE__ */ H(["update:modelValue", "focusInput", "blurInput", "pressEsc", "clickInput"], ["update:modelValue", "update:placeholder"]),
892
+ setup(e, { emit: o }) {
893
+ const t = o, a = U(e, "modelValue"), n = U(e, "placeholder"), d = ref(null);
894
+ function m(i) {
895
+ a.value = i;
896
+ }
897
+ const f = (i) => {
898
+ const r = i.target.querySelector("input");
899
+ r && r.focus();
900
+ }, g = (i) => {
901
+ const r = i.target;
902
+ m(r.value);
903
+ };
904
+ watch(n, (i) => {
905
+ x = i;
906
+ });
907
+ let x = n.value;
908
+ const k = () => {
909
+ w("rounded-b-none"), x = "", t("focusInput");
910
+ }, F = () => {
911
+ x = n.value, w("");
912
+ }, E = () => {
913
+ d.value, d.value && d.value.blur(), t("pressEsc");
914
+ }, j = ref("");
915
+ function w(i) {
916
+ j.value = i;
917
+ }
918
+ return (i, r) => (s(), p("div", {
919
+ class: "w-full h-full flex justify-center my-2",
920
+ style: { cursor: "text" },
921
+ onClick: r[1] || (r[1] = (y) => f(y))
922
+ }, [
923
+ h(i.$slots, "prepend"),
924
+ v("div", {
925
+ class: O([c(j), i.rounded, "w-full h-full text-field-style flex flex-row items-center"]),
926
+ style: { padding: "0px 2px" }
927
+ }, [
928
+ i.prefix ? (s(), p("div", yt, $(i.prefix), 1)) : b("", !0),
929
+ h(i.$slots, "prepend-inner"),
930
+ h(i.$slots, "default", {}, () => [
931
+ v("input", {
932
+ ref_key: "inputField",
933
+ ref: d,
934
+ type: i.type,
935
+ value: a.value,
936
+ autocomplete: "off",
937
+ class: "h-full text-center w-full bg-transparent focus:border-none focus:outline-none input-opacity",
938
+ style: { padding: "4px 0px" },
939
+ placeholder: c(x),
940
+ onInput: r[0] || (r[0] = (y) => g(y)),
941
+ onKeydown: ee(E, ["escape"]),
942
+ onFocus: k,
943
+ onBlur: F
944
+ }, null, 40, pt)
945
+ ]),
946
+ h(i.$slots, "append-inner"),
947
+ i.suffix ? (s(), p("div", mt, $(i.suffix), 1)) : b("", !0)
948
+ ], 2),
949
+ h(i.$slots, "append")
950
+ ]));
951
+ }
952
+ }, vt = { class: "bg-appbar h-10 flex flex-row items-center py-2 px-2" }, ht = {
953
+ __name: "KunToolbar",
954
+ props: {
955
+ density: {
956
+ type: String,
957
+ default: ""
958
+ },
959
+ title: {
960
+ type: String,
961
+ default: ""
962
+ }
963
+ },
964
+ setup(e) {
965
+ return (o, t) => {
966
+ const a = A("KunToolbarTitle");
967
+ return s(), p("div", vt, [
968
+ e.title ? (s(), P(a, {
969
+ key: 0,
970
+ title: e.title
971
+ }, null, 8, ["title"])) : b("", !0),
972
+ h(o.$slots, "default", { density: e.density })
973
+ ]);
974
+ };
38
975
  }
976
+ }, Z = {
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
39
990
  };
991
+ function St(e) {
992
+ for (const o in Z)
993
+ e.component(o, Z[o]);
994
+ }
40
995
  export {
41
- f as KunBtn,
42
- p as default
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
43
1010
  };
@@ -1 +1 @@
1
- (function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.KunUI={},t.Vue))})(this,function(t,e){"use strict";const o=["aria-label","disabled"],l={__name:"KunBtn",props:{text:{type:String,default:null},class:{type:String,default:"px-4 py-2 text-sm font-medium bg-blue-500 text-white rounded-md hover:bg-blue-600 focus:ring-blue-300"},ariaLabel:{type:String,default:null},disabled:{type:Boolean,default:!1}},setup(n){const a=n,s=e.computed(()=>a.class);return(u,d)=>(e.openBlock(),e.createElementBlock("button",{type:"button",class:e.normalizeClass(["flex justify-center items-center transition-all duration-200",[s.value,n.disabled?"opacity-50 cursor-not-allowed":"hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-offset-2"]]),"aria-label":n.ariaLabel,disabled:n.disabled},[e.renderSlot(u.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(n.text),1)])],10,o))}},i={install(n){n.component("KunBtn",l)}};t.KunBtn=l,t.default=i,Object.defineProperties(t,{__esModule:{value:!0},[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",[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"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/kun-ui.umd.js",