adverich-kun-ui 0.1.5 → 0.1.8

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-f93d09ad]::-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 L, computed as I, mergeModels as H, useModel as U, Fragment as ue, unref as c, withDirectives as ie, withKeys as ee, isRef as ae, createSlots as X, withCtx as q, createTextVNode as te, vShow as oe, resolveDynamicComponent as se, normalizeStyle as re } from "vue";
2
+ const ce = {
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
+ }, de = { class: "rounded-lg px-16 py-14" }, fe = { class: "flex justify-center py-4" }, ye = { class: "rounded-full bg-red-200 p-6" }, pe = { class: "text-center flex flex-col justify-center items-center bg-red-500 rounded-lg p-4" }, me = {
6
+ key: 0,
7
+ class: "my-4 text-center text-3xl font-semibold"
8
+ }, ge = { class: "text-xl font-normal" }, ve = {
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, i) => {
27
+ const n = A("KunIcon");
28
+ return s(), p("div", ce, [
29
+ v("div", de, [
30
+ v("div", fe, [
31
+ v("div", ye, [
32
+ V(n, {
33
+ icon: "exclamation",
34
+ size: "text-9xl"
35
+ })
36
+ ])
37
+ ]),
38
+ v("div", pe, [
39
+ e.title ? (s(), p("div", me, $(e.title), 1)) : b("", !0),
40
+ v("div", ge, $(e.message), 1)
41
+ ])
42
+ ])
43
+ ]);
44
+ };
45
+ }
46
+ }, he = { class: "flex-1" }, xe = { class: "flex items-center" }, be = { class: "flex-1" }, Se = { class: "w-full flex justify-end" }, Ce = {
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 i = 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", he, [
69
+ v("div", xe, [
70
+ h(o.$slots, "appbarButton"),
71
+ h(o.$slots, "prepend")
72
+ ])
73
+ ]),
74
+ e.title ? (s(), P(i, {
75
+ key: 0,
76
+ title: e.title
77
+ }, null, 8, ["title"])) : b("", !0),
78
+ v("div", be, [
79
+ v("div", Se, [
80
+ h(o.$slots, "append")
81
+ ])
82
+ ])
83
+ ], 2);
84
+ };
85
+ }
86
+ }, Ke = {
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, i) {
194
+ const n = L(null), d = L(null), m = L(null), f = L(!1), g = L(""), 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 = i.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 = i.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() : i.value.length ? e.placeholderText : e.textNoItems), w = I(() => e.startEmtpy && g.value.length < 3 ? [] : i.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)), a = 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 D(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: a,
296
+ itemToString: r,
297
+ getSelectedItem: y,
298
+ openMenu: C,
299
+ closeMenu: D,
300
+ focusOnMenu: Y,
301
+ createItem: G,
302
+ removeItem: J,
303
+ clearSelection: W,
304
+ isDisabled: T
305
+ };
306
+ }
307
+ const R = (e, o) => {
308
+ const t = e.__vccOpts || e;
309
+ for (const [i, n] of o)
310
+ t[i] = n;
311
+ return t;
312
+ }, $e = { class: "relative" }, Ie = ["close-on-content-click", "max-height"], ke = { class: "w-full px-2 py-1" }, we = {
313
+ __name: "KunAutocomplete",
314
+ props: /* @__PURE__ */ H(Ke, {
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
+ ref(0);
324
+ const i = 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: a,
335
+ createItem: r,
336
+ clearSelection: y
337
+ } = _e(t, d, i, n);
338
+ watchEffect(() => {
339
+ isObject(i.value) && !isNotEmpty(i.value) && (m.value = {}), isArray(i.value) && !isNotEmpty(i.value) && (m.value = []), i.value === null && (m.value = null), F();
340
+ });
341
+ function B(S) {
342
+ x.value = "", i.value = S, w();
343
+ }
344
+ return (S, C) => {
345
+ const D = A("KunIcon"), Y = A("KunTextField"), G = A("KunBtn"), J = A("KunListItem"), W = A("KunVirtualScroller");
346
+ return s(), p(ue, 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", $e, [
353
+ V(Y, {
354
+ modelValue: c(x),
355
+ "onUpdate:modelValue": C[2] || (C[2] = (T) => ae(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(a), ["down"]),
360
+ onClickInput: c(j),
361
+ onPressEsc: c(w),
362
+ onChange: C[3] || (C[3] = (T) => console.log("change")),
363
+ onFocusInput: c(a)
364
+ }, X({ _: 2 }, [
365
+ S.hasIcons ? {
366
+ name: "append-inner",
367
+ fn: q(() => [
368
+ S.clearable && c(m) ? (s(), P(D, {
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(D, {
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(D, {
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", ke, [
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, Ie), [
437
+ [oe, c(g)]
438
+ ])
439
+ ])
440
+ ], 64);
441
+ };
442
+ }
443
+ }, Be = /* @__PURE__ */ R(we, [["__scopeId", "data-v-f93d09ad"]]), Oe = ["disabled"], je = "px-2 py-2 text-xs", Te = "px-1 py-1 text-sm", Ae = "px-2 py-2 text-sm", Fe = "px-3 py-3 text-sm", Ee = "px-3 py-3 text-base", Ne = {
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,506 @@ 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 "xs":
507
+ return je;
508
+ case "sm":
509
+ return Te;
510
+ case "md":
511
+ return Ae;
512
+ case "lg":
513
+ return Fe;
514
+ case "xl":
515
+ return Ee;
516
+ }
517
+ };
518
+ return (t, i) => (s(), p("button", {
25
519
  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,
520
+ class: O(["flex justify-center align-center items-center", [
521
+ e.width,
522
+ o(e.size),
523
+ e.textColor,
524
+ e.fontWeight,
525
+ e.bgColor,
526
+ e.bgColorHover,
527
+ e.bgColorFocus,
528
+ e.focusRing,
529
+ e.focusOutline,
530
+ e.focusRingColor,
531
+ e.rounded,
532
+ e.textAlign,
533
+ e.disabled ? "opacity-50 cursor-not-allowed" : "hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-offset-2"
534
+ ]]),
28
535
  disabled: e.disabled
29
536
  }, [
30
- u(l.$slots, "default", {}, () => [
31
- r(c(e.text), 1)
537
+ h(t.$slots, "default", {}, () => [
538
+ te($(e.text), 1)
32
539
  ])
33
- ], 10, d));
540
+ ], 10, Oe));
34
541
  }
35
- }, p = {
36
- install(e) {
37
- e.component("KunBtn", f);
542
+ }, ze = {
543
+ props: {
544
+ text: {
545
+ type: String,
546
+ default: ""
547
+ },
548
+ bgColor: {
549
+ type: String,
550
+ default: "bg-button"
551
+ },
552
+ textColor: {
553
+ type: String,
554
+ default: "text-on-color"
555
+ },
556
+ textSize: {
557
+ type: String,
558
+ default: "text-xs"
559
+ },
560
+ fontWeight: {
561
+ type: String,
562
+ default: "font-medium"
563
+ },
564
+ rounded: {
565
+ type: String,
566
+ default: "rounded-2xl"
567
+ },
568
+ cursor: {
569
+ type: String,
570
+ default: "cursor-default"
571
+ }
572
+ }
573
+ };
574
+ function Me(e, o, t, i, n, d) {
575
+ return s(), p("div", {
576
+ class: O(["flex px-2.5 py-1.5", [t.bgColor, t.textColor, t.textSize, t.fontWeight, t.rounded, t.cursor]])
577
+ }, $(t.text), 3);
578
+ }
579
+ const Ve = /* @__PURE__ */ R(ze, [["render", Me]]), Re = {
580
+ props: {
581
+ title: {
582
+ type: String
583
+ },
584
+ subtitle: {
585
+ type: String
586
+ },
587
+ text: {
588
+ type: String
589
+ },
590
+ bgColor: {
591
+ type: String,
592
+ default: "bg-surface"
593
+ },
594
+ rounded: {
595
+ type: [String | Number | Boolean],
596
+ default: void 0
597
+ },
598
+ variant: {
599
+ type: String,
600
+ default: "elevated"
601
+ },
602
+ height: {
603
+ type: [Number, String],
604
+ default: "h-full"
605
+ // Valor por defecto de la altura en píxeles
606
+ },
607
+ width: {
608
+ type: [Number, String],
609
+ default: "w-full"
610
+ // Valor por defecto del ancho
611
+ },
612
+ to: {
613
+ type: String,
614
+ default: void 0
615
+ }
616
+ }
617
+ }, De = ["to"];
618
+ function Le(e, o, t, i, n, d) {
619
+ return s(), p("div", {
620
+ class: O(["flex flex-col", [t.rounded, t.variant, t.height, t.width, t.bgColor]]),
621
+ to: t.to
622
+ }, [
623
+ h(e.$slots, "default")
624
+ ], 10, De);
625
+ }
626
+ const Pe = /* @__PURE__ */ R(Re, [["render", Le]]), We = {
627
+ props: {
628
+ title: {
629
+ type: String
630
+ },
631
+ subtitle: {
632
+ type: String
633
+ },
634
+ text: {
635
+ type: String
636
+ },
637
+ bgColor: {
638
+ type: String,
639
+ default: "bg-appbar"
640
+ },
641
+ variant: {
642
+ type: String,
643
+ default: "elevated"
644
+ },
645
+ height: {
646
+ type: [Number, String],
647
+ default: "h-fit"
648
+ // Valor por defecto de la altura en píxeles
649
+ },
650
+ width: {
651
+ type: [Number, String],
652
+ default: "w-full"
653
+ // Valor por defecto del ancho
654
+ },
655
+ classBase: {
656
+ type: String,
657
+ default: "text-center rounded-t-lg"
658
+ }
659
+ }
660
+ }, qe = {
661
+ key: 0,
662
+ class: "flex flex-row uppercase w-full py-2"
663
+ }, He = { class: "w-full" }, Ue = { key: 1 }, Ye = { key: 2 };
664
+ function Ge(e, o, t, i, n, d) {
665
+ return h(e.$slots, "default", {}, () => [
666
+ v("div", {
667
+ class: O([t.classBase, t.variant, t.height, t.width, t.bgColor])
668
+ }, [
669
+ t.title ? (s(), p("div", qe, [
670
+ h(e.$slots, "prepend-title"),
671
+ v("span", He, $(t.title), 1),
672
+ h(e.$slots, "append-title")
673
+ ])) : b("", !0),
674
+ t.subtitle ? (s(), p("span", Ue, $(t.subtitle), 1)) : b("", !0),
675
+ t.text ? (s(), p("span", Ye, $(t.text), 1)) : b("", !0)
676
+ ], 2)
677
+ ]);
678
+ }
679
+ const Je = /* @__PURE__ */ R(We, [["render", Ge]]), Qe = {
680
+ class: "flex flex-row items-center",
681
+ style: { padding: "2px 2px", "max-width": "200px" }
682
+ }, Xe = {
683
+ key: 0,
684
+ class: "mr-1"
685
+ }, Ze = ["placeholder", "value"], et = { key: 1 }, tt = {
686
+ __name: "KunCurrency",
687
+ props: {
688
+ currency: {
689
+ type: Object,
690
+ default: () => ({
691
+ name: "Peso Argentino",
692
+ name: "ARS",
693
+ simbol: "$"
694
+ })
695
+ },
696
+ hideCurrency: {
697
+ type: Boolean,
698
+ default: !1
699
+ },
700
+ locale: {
701
+ type: String,
702
+ default: "ar-ES"
703
+ },
704
+ precision: {
705
+ type: Number,
706
+ default: 2
707
+ },
708
+ modelValue: {
709
+ default: null
710
+ },
711
+ placeholder: {
712
+ type: String,
713
+ default: "0.00"
714
+ },
715
+ prefix: {
716
+ type: String,
717
+ default: "$"
718
+ },
719
+ suffix: {
720
+ type: String,
721
+ default: ""
722
+ }
723
+ },
724
+ emits: ["update:modelValue"],
725
+ setup(e, { emit: o }) {
726
+ const t = e, i = o;
727
+ function n(r) {
728
+ d.value = r, i("update:modelValue", r);
729
+ }
730
+ const d = ref(t.modelValue);
731
+ let m = null, f = null;
732
+ onMounted(() => {
733
+ m = document.getElementById("hide"), f = document.getElementById("txt"), f.addEventListener("input", g), g();
734
+ });
735
+ function g() {
736
+ m.textContent = f.value, f.style.width = 6 + m.offsetWidth + "px";
737
+ }
738
+ const x = (r) => {
739
+ const y = r.target.querySelector("input");
740
+ y && y.focus();
741
+ }, k = ref(null), F = (r) => {
742
+ const y = r.target, B = y.value;
743
+ y.value = B.replace(/\D/g, ""), n(y.value);
744
+ };
745
+ let E = t.placeholder;
746
+ const j = () => {
747
+ a("");
748
+ }, w = () => {
749
+ a(t.placeholder);
750
+ }, a = (r) => {
751
+ document.getElementById("txt").setAttribute("placeholder", r);
752
+ };
753
+ return (r, y) => (s(), p("div", {
754
+ class: "w-full h-full flex justify-center",
755
+ style: { cursor: "text" },
756
+ onClick: y[1] || (y[1] = (B) => x(B))
757
+ }, [
758
+ v("div", Qe, [
759
+ e.prefix ? (s(), p("div", Xe, $(e.prefix), 1)) : b("", !0),
760
+ y[2] || (y[2] = v("span", { id: "hide" }, null, -1)),
761
+ v("input", {
762
+ id: "txt",
763
+ ref_key: "inputField",
764
+ ref: k,
765
+ type: "number",
766
+ class: "text-field-style",
767
+ onFocus: j,
768
+ onBlur: w,
769
+ placeholder: c(E),
770
+ onInput: y[0] || (y[0] = (B) => F(B)),
771
+ value: c(d),
772
+ autocomplete: "off"
773
+ }, null, 40, Ze),
774
+ e.suffix ? (s(), p("div", et, $(e.suffix), 1)) : b("", !0)
775
+ ])
776
+ ]));
777
+ }
778
+ }, nt = {
779
+ __name: "KunIcon",
780
+ props: {
781
+ icon: {
782
+ type: [String, Object, Function],
783
+ required: !0
784
+ },
785
+ aliases: {
786
+ type: Object,
787
+ default: () => ({})
788
+ },
789
+ size: {
790
+ type: String,
791
+ default: "text-xs"
792
+ },
793
+ color: {
794
+ type: String,
795
+ default: "text-font-color"
796
+ },
797
+ disabled: {
798
+ type: Boolean,
799
+ default: !1
800
+ }
801
+ },
802
+ emits: ["click"],
803
+ setup(e, { emit: o }) {
804
+ const t = e, i = o;
805
+ function n(f) {
806
+ t.disabled || i("click", f);
807
+ }
808
+ const d = I(() => {
809
+ if (typeof t.icon == "string" && t.icon.startsWith("$")) {
810
+ const f = t.icon.slice(1);
811
+ return t.aliases[f] || "";
812
+ }
813
+ return t.icon;
814
+ }), m = I(
815
+ () => typeof d.value == "function" || typeof d.value == "object" && d.value !== null
816
+ );
817
+ return (f, g) => (s(), p("span", {
818
+ class: O([e.color, e.size, e.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"]),
819
+ onClick: n
820
+ }, [
821
+ f.$slots.default ? h(f.$slots, "default", { key: 0 }) : m.value ? (s(), P(se(d.value), { key: 1 })) : (s(), p("span", {
822
+ key: 2,
823
+ class: O(d.value)
824
+ }, null, 2))
825
+ ], 2));
826
+ }
827
+ }, lt = {};
828
+ function ut(e, o) {
829
+ return null;
830
+ }
831
+ const it = /* @__PURE__ */ R(lt, [["render", ut]]), at = {
832
+ props: {
833
+ height: {
834
+ type: [Number, String],
835
+ default: "100%"
836
+ // Valor por defecto de la altura en píxeles
837
+ },
838
+ width: {
839
+ type: [Number, String],
840
+ default: "100%"
841
+ // Valor por defecto del ancho
842
+ }
843
+ }
844
+ };
845
+ function ot(e, o, t, i, n, d) {
846
+ return s(), p("div", {
847
+ style: re({ height: t.height, width: t.width })
848
+ }, null, 4);
849
+ }
850
+ const st = /* @__PURE__ */ R(at, [["render", ot]]), rt = {
851
+ type: {
852
+ type: String,
853
+ default: "text"
854
+ },
855
+ locale: {
856
+ type: String,
857
+ default: "ar-ES"
858
+ },
859
+ precision: {
860
+ type: Number,
861
+ default: 2
862
+ },
863
+ prefix: {
864
+ type: String,
865
+ default: ""
866
+ },
867
+ suffix: {
868
+ type: String,
869
+ default: ""
870
+ },
871
+ resize: {
872
+ type: Boolean,
873
+ default: !1
874
+ },
875
+ rounded: {
876
+ type: String,
877
+ default: "rounded"
878
+ }
879
+ }, ct = { key: 0 }, dt = ["type", "value", "placeholder"], ft = { key: 1 }, yt = {
880
+ __name: "KunTextField",
881
+ props: /* @__PURE__ */ H(rt, {
882
+ modelValue: {},
883
+ modelModifiers: {},
884
+ placeholder: {},
885
+ placeholderModifiers: {}
886
+ }),
887
+ emits: /* @__PURE__ */ H(["update:modelValue", "focusInput", "blurInput", "pressEsc", "clickInput"], ["update:modelValue", "update:placeholder"]),
888
+ setup(e, { emit: o }) {
889
+ const t = o, i = U(e, "modelValue"), n = U(e, "placeholder"), d = ref(null);
890
+ function m(a) {
891
+ i.value = a;
892
+ }
893
+ const f = (a) => {
894
+ const r = a.target.querySelector("input");
895
+ r && r.focus();
896
+ }, g = (a) => {
897
+ const r = a.target;
898
+ m(r.value);
899
+ };
900
+ watch(n, (a) => {
901
+ x = a;
902
+ });
903
+ let x = n.value;
904
+ const k = () => {
905
+ w("rounded-b-none"), x = "", t("focusInput");
906
+ }, F = () => {
907
+ x = n.value, w("");
908
+ }, E = () => {
909
+ d.value, d.value && d.value.blur(), t("pressEsc");
910
+ }, j = ref("");
911
+ function w(a) {
912
+ j.value = a;
913
+ }
914
+ return (a, r) => (s(), p("div", {
915
+ class: "w-full h-full flex justify-center my-2",
916
+ style: { cursor: "text" },
917
+ onClick: r[1] || (r[1] = (y) => f(y))
918
+ }, [
919
+ h(a.$slots, "prepend"),
920
+ v("div", {
921
+ class: O([c(j), a.rounded, "w-full h-full text-field-style flex flex-row items-center"]),
922
+ style: { padding: "0px 2px" }
923
+ }, [
924
+ a.prefix ? (s(), p("div", ct, $(a.prefix), 1)) : b("", !0),
925
+ h(a.$slots, "prepend-inner"),
926
+ h(a.$slots, "default", {}, () => [
927
+ v("input", {
928
+ ref_key: "inputField",
929
+ ref: d,
930
+ type: a.type,
931
+ value: i.value,
932
+ autocomplete: "off",
933
+ class: "h-full text-center w-full bg-transparent focus:border-none focus:outline-none input-opacity",
934
+ style: { padding: "4px 0px" },
935
+ placeholder: c(x),
936
+ onInput: r[0] || (r[0] = (y) => g(y)),
937
+ onKeydown: ee(E, ["escape"]),
938
+ onFocus: k,
939
+ onBlur: F
940
+ }, null, 40, dt)
941
+ ]),
942
+ h(a.$slots, "append-inner"),
943
+ a.suffix ? (s(), p("div", ft, $(a.suffix), 1)) : b("", !0)
944
+ ], 2),
945
+ h(a.$slots, "append")
946
+ ]));
947
+ }
948
+ }, pt = { class: "bg-appbar h-10 flex flex-row items-center py-2 px-2" }, mt = {
949
+ __name: "KunToolbar",
950
+ props: {
951
+ density: {
952
+ type: String,
953
+ default: ""
954
+ },
955
+ title: {
956
+ type: String,
957
+ default: ""
958
+ }
959
+ },
960
+ setup(e) {
961
+ return (o, t) => {
962
+ const i = A("KunToolbarTitle");
963
+ return s(), p("div", pt, [
964
+ e.title ? (s(), P(i, {
965
+ key: 0,
966
+ title: e.title
967
+ }, null, 8, ["title"])) : b("", !0),
968
+ h(o.$slots, "default", { density: e.density })
969
+ ]);
970
+ };
38
971
  }
972
+ }, Z = {
973
+ KunAlert: ve,
974
+ KunAppbar: Ce,
975
+ KunAutocomplete: Be,
976
+ KunBtn: Ne,
977
+ KunBudge: Ve,
978
+ KunCard: Pe,
979
+ KunCardText: Je,
980
+ KunCurrency: tt,
981
+ KunIcon: nt,
982
+ KunList: it,
983
+ KunSpacer: st,
984
+ KunTextField: yt,
985
+ KunToolbar: mt
39
986
  };
987
+ function ht(e) {
988
+ for (const o in Z)
989
+ e.component(o, Z[o]);
990
+ }
40
991
  export {
41
- f as Button,
42
- p as default
992
+ ve as KunAlert,
993
+ Ce as KunAppbar,
994
+ Be as KunAutocomplete,
995
+ Ne as KunBtn,
996
+ Ve as KunBudge,
997
+ Pe as KunCard,
998
+ Je as KunCardText,
999
+ tt as KunCurrency,
1000
+ nt as KunIcon,
1001
+ it as KunList,
1002
+ st as KunSpacer,
1003
+ yt as KunTextField,
1004
+ mt as KunToolbar,
1005
+ ht as install
43
1006
  };
@@ -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.Button=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 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"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.5",
3
+ "version": "0.1.8",
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",
@@ -8,22 +8,24 @@
8
8
  "files": [
9
9
  "dist"
10
10
  ],
11
- "dependencies": {
12
- "vue": "^3.5.13"
11
+ "scripts": {
12
+ "dev": "vite",
13
+ "build": "vite build",
14
+ "preview": "vite preview"
13
15
  },
14
16
  "devDependencies": {
15
- "@tailwindcss/postcss": "^4.0.10",
17
+ "@tailwindcss/vite": "^4.1.6",
16
18
  "@vitejs/plugin-vue": "^5.2.1",
17
19
  "autoprefixer": "^10.4.20",
18
- "postcss": "^8.5.3",
19
20
  "prettier": "^3.5.3",
20
21
  "prettier-plugin-tailwindcss": "^0.6.11",
21
- "tailwindcss": "^4.0.10",
22
- "vite": "^6.2.0"
22
+ "vite": "^6.2.4"
23
23
  },
24
24
  "peerDependencies": {
25
- "vue": "^3.0.0",
26
- "tailwindcss": "^4.0.0"
25
+ "@iconify/json": "^2.2.337",
26
+ "@iconify/tailwind": "^1.2.0",
27
+ "tailwindcss": "^4.1.6",
28
+ "vue": "^3.5.13"
27
29
  },
28
30
  "keywords": [
29
31
  "vue",
@@ -36,9 +38,16 @@
36
38
  "type": "git",
37
39
  "url": "https://github.com/adverich/KunUi.git"
38
40
  },
39
- "scripts": {
40
- "dev": "vite",
41
- "build": "vite build",
42
- "preview": "vite preview"
43
- }
44
- }
41
+ "exports": {
42
+ ".": {
43
+ "import": "./dist/kun-ui.es.js",
44
+ "require": "./dist/kun-ui.umd.js"
45
+ }
46
+ },
47
+ "engines": {
48
+ "node": ">=18.0.0"
49
+ },
50
+ "sideEffects": [
51
+ "*.css"
52
+ ]
53
+ }