adverich-kun-ui 0.1.358 → 0.1.359

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,43 +1,39 @@
1
- import { mergeModels as A, useModel as R, onMounted as ie, ref as $, watch as re, createElementBlock as k, openBlock as r, createVNode as i, unref as t, isRef as B, createSlots as ae, withCtx as n, createCommentVNode as v, Fragment as se, renderList as ue, createBlock as c, createElementVNode as de, createTextVNode as y, toDisplayString as V, normalizeClass as ce, withModifiers as me } from "vue";
1
+ import { mergeModels as _, useModel as x, onMounted as ne, ref as A, watch as ie, createElementBlock as C, openBlock as s, createVNode as i, unref as t, isRef as z, createSlots as ae, withCtx as n, createCommentVNode as w, Fragment as re, renderList as se, createBlock as c, createElementVNode as ue, createTextVNode as V, toDisplayString as $, withModifiers as de } from "vue";
2
2
  import { icons as m } from "../../../../icons/index.js";
3
- import { isNotEmpty as fe, isArray as F } from "../../../../utils/utils.js";
4
- import pe from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
5
- import he from "../../../KunList/src/components/KunList.vue.js";
6
- import T from "../../../KunListItem/src/components/KunListItem.vue.js";
7
- import x from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
8
- import ke from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
9
- import ve from "../../../KunMenu/src/components/KunMenu.vue.js";
10
- import { useAutocomplete as ye } from "../composables/useAutocomplete.js";
11
- import { KunAutocompleteProps as be } from "../composables/KunAutocompleteProps.js";
12
- import ge from "../../../KunTextField/src/components/KunTextField.vue.js";
13
- import Ce from "../../../KunBtn/src/components/KunBtn.vue.js";
14
- import we from "../../../KunChip/src/components/KunChip.vue.js";
15
- import b from "../../../KunIcon/src/components/KunIcon.vue.js";
16
- const Ve = {
3
+ import { isNotEmpty as ce, isArray as F } from "../../../../utils/utils.js";
4
+ import me from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
5
+ import fe from "../../../KunList/src/components/KunList.vue.js";
6
+ import B from "../../../KunListItem/src/components/KunListItem.vue.js";
7
+ import E from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
8
+ import pe from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
9
+ import he from "../../../KunMenu/src/components/KunMenu.vue.js";
10
+ import { useAutocomplete as ve } from "../composables/useAutocomplete.js";
11
+ import { KunAutocompleteProps as ye } from "../composables/KunAutocompleteProps.js";
12
+ import ke from "../../../KunTextField/src/components/KunTextField.vue.js";
13
+ import ge from "../../../KunChip/src/components/KunChip.vue.js";
14
+ import v from "../../../KunIcon/src/components/KunIcon.vue.js";
15
+ const be = {
17
16
  key: 0,
18
17
  class: "flex justify-center align-center"
19
- }, Ie = { class: "flex justify-center align-center" }, Se = {
20
- key: 0,
21
- class: "sticky top-0 z-10 p-2 border-b"
22
- }, Ue = {
18
+ }, Ce = { class: "flex justify-center align-center" }, Be = {
23
19
  __name: "KunAutocomplete",
24
- props: /* @__PURE__ */ A(be, {
20
+ props: /* @__PURE__ */ _(ye, {
25
21
  modelValue: { default: null },
26
22
  modelModifiers: {},
27
23
  items: { default: [], type: Array, required: !0 },
28
24
  itemsModifiers: {}
29
25
  }),
30
- emits: /* @__PURE__ */ A(["update:modelValue", "selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
31
- setup(g, { emit: E }) {
32
- const a = R(g, "modelValue"), I = R(g, "items"), u = g, f = E, {
33
- textFieldRef: C,
34
- listRef: S,
35
- menuModel: s,
26
+ emits: /* @__PURE__ */ _(["update:modelValue", "selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
27
+ setup(y, { emit: N }) {
28
+ const a = x(y, "modelValue"), I = x(y, "items"), u = y, f = N, {
29
+ textFieldRef: k,
30
+ listRef: g,
31
+ menuModel: r,
36
32
  search: d,
37
- removeItem: N,
33
+ removeItem: T,
38
34
  clearSelection: L,
39
35
  lightReset: U,
40
- openMenu: w,
36
+ openMenu: b,
41
37
  closeMenu: H,
42
38
  toggleMenu: O,
43
39
  onMenuKeydown: j,
@@ -45,15 +41,14 @@ const Ve = {
45
41
  textArr: P,
46
42
  getItemText: W,
47
43
  isAlphanumeric: G,
48
- createItem: J,
49
- checkDisabled: Q,
50
- itemToString: D,
51
- placeholder: X
52
- } = ye(u, f, a, I);
53
- ie(() => {
54
- u.focusOnRender && C.value.focus();
44
+ checkDisabled: J,
45
+ itemToString: S,
46
+ placeholder: Q
47
+ } = ve(u, f, a, I);
48
+ ne(() => {
49
+ u.focusOnRender && k.value.focus();
55
50
  });
56
- const K = $(null), p = $(""), M = (e) => {
51
+ const D = A(null), p = A(""), K = (e) => {
57
52
  for (const o of u.rules) {
58
53
  const l = o(e);
59
54
  if (l !== !0)
@@ -61,162 +56,150 @@ const Ve = {
61
56
  }
62
57
  return p.value = "", f("validation", !0), !0;
63
58
  };
64
- re(() => a.value, (e, o) => {
65
- fe(u.rules) && M(e);
59
+ ie(() => a.value, (e, o) => {
60
+ ce(u.rules) && K(e);
66
61
  });
67
- function Y() {
62
+ function X() {
68
63
  var e;
69
- s.value = !1, (e = C.value.inputField) == null || e.focus();
64
+ r.value = !1, (e = k.value.inputField) == null || e.focus();
70
65
  }
71
- function Z(e) {
66
+ function Y(e) {
72
67
  var l, h;
73
68
  const o = e.key;
74
69
  if (o === "Tab" || o === "Shift") {
75
70
  H();
76
71
  return;
77
72
  }
78
- (G(o) || o === "Backspace") && w(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), s.value || w(), (h = (l = S.value) == null ? void 0 : l.focusWithKey) == null || h.call(l, o));
73
+ (G(o) || o === "Backspace") && b(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), r.value || b(), console.log("listRef.value", g.value), (h = (l = g.value) == null ? void 0 : l.focusWithKey) == null || h.call(l, o));
79
74
  }
80
- function ee(e) {
75
+ function Z(e) {
81
76
  f("search", d);
82
77
  }
83
- function le() {
84
- M(a);
78
+ function ee() {
79
+ K(a);
85
80
  }
86
- function te(e) {
81
+ function le(e) {
87
82
  j(e);
88
83
  }
89
- function oe() {
84
+ function te() {
90
85
  }
91
- return (e, o) => (r(), k("div", {
86
+ return (e, o) => (s(), C("div", {
92
87
  class: "w-full h-fit",
93
88
  ref_key: "parentRef",
94
- ref: K
89
+ ref: D
95
90
  }, [
96
- i(ge, {
91
+ i(ke, {
97
92
  modelValue: t(d),
98
93
  "onUpdate:modelValue": [
99
- o[1] || (o[1] = (l) => B(d) ? d.value = l : null),
100
- ee
94
+ o[1] || (o[1] = (l) => z(d) ? d.value = l : null),
95
+ Z
101
96
  ],
102
97
  label: e.label,
103
98
  dirty: "",
104
99
  "hide-details": e.hideDetails,
105
100
  density: e.density,
106
101
  ref_key: "textFieldRef",
107
- ref: C,
102
+ ref: k,
108
103
  autocomplete: "off",
109
- onFocusInput: le,
104
+ onFocusInput: ee,
110
105
  onHandleClick: t(O),
111
- rounded: t(s) ? "rounded-t" : "rounded",
112
- onBlur: oe,
113
- onKeyDown: Z,
114
- placeholder: u.multiple && t(F)(a.value) && a.value.length ? "" : t(X),
106
+ rounded: t(r) ? "rounded-t" : "rounded",
107
+ onBlur: te,
108
+ onKeyDown: Y,
109
+ placeholder: u.multiple && t(F)(a.value) && a.value.length ? "" : t(Q),
115
110
  error: !!p.value,
116
111
  "error-messages": p.value
117
112
  }, ae({
118
113
  default: n(() => [
119
- t(F)(a.value) ? (r(), k("div", Ve, [
120
- (r(!0), k(se, null, ue(a.value, (l) => (r(), c(we, {
114
+ t(F)(a.value) ? (s(), C("div", be, [
115
+ (s(!0), C(re, null, se(a.value, (l) => (s(), c(ge, {
121
116
  key: l.id ?? l.name,
122
117
  size: "small",
123
118
  class: "ml-1"
124
119
  }, {
125
120
  default: n(() => [
126
- de("div", Ie, [
127
- y(V(t(W)(l, e.itemTitle)) + " ", 1),
128
- i(b, {
121
+ ue("div", Ce, [
122
+ V($(t(W)(l, e.itemTitle)) + " ", 1),
123
+ i(v, {
129
124
  color: "error",
130
125
  icon: t(m).close,
131
126
  size: "small",
132
127
  class: "ml-1",
133
- onClick: (h) => t(N)(l)
128
+ onClick: (h) => t(T)(l)
134
129
  }, null, 8, ["icon", "onClick"])
135
130
  ])
136
131
  ]),
137
132
  _: 2
138
133
  }, 1024))), 128))
139
- ])) : v("", !0),
140
- i(ve, {
134
+ ])) : w("", !0),
135
+ i(he, {
141
136
  transition: "fade",
142
137
  "onClick:outside": t(U),
143
- modelValue: t(s),
144
- "onUpdate:modelValue": o[0] || (o[0] = (l) => B(s) ? s.value = l : null),
138
+ modelValue: t(r),
139
+ "onUpdate:modelValue": o[0] || (o[0] = (l) => z(r) ? r.value = l : null),
145
140
  activator: "parent",
146
141
  "z-index": e.zIndex,
147
- "parent-ref": K.value,
142
+ "parent-ref": D.value,
148
143
  location: "bottom",
149
144
  origin: "bottom left",
150
- onHandleEscape: Y,
145
+ onHandleEscape: X,
151
146
  "close-on-content-click": e.closeOnSelect,
152
147
  width: "w-full",
153
148
  "max-height": e.maxHeight,
154
149
  "hide-details": e.hideDetails
155
150
  }, {
156
151
  default: n(() => [
157
- e.hasCreateItem ? (r(), k("div", Se, [
158
- i(Ce, {
159
- onClick: t(J),
160
- bgColor: e.btnCreateBg,
161
- class: ce(e.btnCreateClass)
162
- }, {
163
- default: n(() => [
164
- y(V(e.btnCreateText), 1)
165
- ]),
166
- _: 1
167
- }, 8, ["onClick", "bgColor", "class"])
168
- ])) : v("", !0),
169
- i(he, {
152
+ i(fe, {
170
153
  "onClick:select": t(q),
171
154
  ref_key: "listRef",
172
- ref: S,
173
- onKeyDown: te,
155
+ ref: g,
156
+ onKeyDown: le,
174
157
  selectable: !0
175
158
  }, {
176
159
  default: n(() => [
177
- i(pe, {
160
+ i(me, {
178
161
  items: I.value,
179
162
  search: t(d),
180
163
  "searchable-keys": u.searchableKeys,
181
164
  virtual: !1,
182
165
  "items-per-intersection": 10,
183
- enabled: t(s),
166
+ enabled: t(r),
184
167
  "item-height": 48
185
168
  }, {
186
- default: n(({ item: l, index: h, empty: ne }) => {
187
- var _, z;
169
+ default: n(({ item: l, index: h, empty: oe }) => {
170
+ var M, R;
188
171
  return [
189
- !ne && l ? (r(), c(T, {
172
+ !oe && l ? (s(), c(B, {
190
173
  value: l,
191
- key: ((_ = l.id) == null ? void 0 : _.toString()) ?? l.name,
192
- disabled: t(Q)(l),
174
+ key: ((M = l.id) == null ? void 0 : M.toString()) ?? l.name,
175
+ disabled: t(J)(l),
193
176
  "bg-items": e.bgItemListColor,
194
177
  "hover-bg": e.hoverItemListColor,
195
178
  activeClass: e.selectedItemListColor,
196
179
  density: e.density,
197
- id: ((z = l.id) == null ? void 0 : z.toString()) ?? l.name,
180
+ id: ((R = l.id) == null ? void 0 : R.toString()) ?? l.name,
198
181
  selectable: !0
199
182
  }, {
200
183
  default: n(() => [
201
- i(x, { class: "text-wrap" }, {
184
+ i(E, { class: "text-wrap" }, {
202
185
  default: n(() => [
203
- y(V(t(D)(l, e.itemTitle ?? t(P), "hasDefault")), 1)
186
+ V($(t(S)(l, e.itemTitle ?? t(P), "hasDefault")), 1)
204
187
  ]),
205
188
  _: 2
206
189
  }, 1024),
207
- i(ke, {
208
- text: e.itemSubtitle ? t(D)(l, e.itemSubtitle) : ""
190
+ i(pe, {
191
+ text: e.itemSubtitle ? t(S)(l, e.itemSubtitle) : ""
209
192
  }, null, 8, ["text"])
210
193
  ]),
211
194
  _: 2
212
- }, 1032, ["value", "disabled", "bg-items", "hover-bg", "activeClass", "density", "id"])) : (r(), c(T, {
195
+ }, 1032, ["value", "disabled", "bg-items", "hover-bg", "activeClass", "density", "id"])) : (s(), c(B, {
213
196
  key: 1,
214
197
  disabled: ""
215
198
  }, {
216
199
  default: n(() => [
217
- i(x, { class: "text-center w-full text-gray-500" }, {
200
+ i(E, { class: "text-center w-full text-gray-500" }, {
218
201
  default: n(() => o[2] || (o[2] = [
219
- y(" No hay elementos disponibles ")
202
+ V(" No hay elementos disponibles ")
220
203
  ])),
221
204
  _: 1,
222
205
  __: [2]
@@ -240,28 +223,28 @@ const Ve = {
240
223
  e.hasIcons ? {
241
224
  name: "append-inner",
242
225
  fn: n(() => [
243
- e.clearable && a.value ? (r(), c(b, {
226
+ e.clearable && a.value ? (s(), c(v, {
244
227
  key: 0,
245
228
  onClick: t(L),
246
229
  size: "small",
247
230
  color: "error",
248
231
  icon: t(m).close,
249
232
  class: "mr-1 mt-1"
250
- }, null, 8, ["onClick", "icon"])) : v("", !0),
251
- i(b, {
233
+ }, null, 8, ["onClick", "icon"])) : w("", !0),
234
+ i(v, {
252
235
  color: "teal-darken-1",
253
236
  size: "large",
254
237
  class: "cursor-pointer",
255
- icon: t(s) ? t(m).menuUpOutline : t(m).menuDownOutline,
256
- onClick: me(t(w), ["stop"])
238
+ icon: t(r) ? t(m).menuUpOutline : t(m).menuDownOutline,
239
+ onClick: de(t(b), ["stop"])
257
240
  }, null, 8, ["icon", "onClick"]),
258
- e.required ? (r(), c(b, {
241
+ e.required ? (s(), c(v, {
259
242
  key: 1,
260
243
  color: "teal-darken-1",
261
244
  size: "x-small",
262
245
  class: "mb-4",
263
246
  icon: t(m).asterisk
264
- }, null, 8, ["icon"])) : v("", !0)
247
+ }, null, 8, ["icon"])) : w("", !0)
265
248
  ]),
266
249
  key: "0"
267
250
  } : void 0
@@ -270,5 +253,5 @@ const Ve = {
270
253
  }
271
254
  };
272
255
  export {
273
- Ue as default
256
+ Be as default
274
257
  };
@@ -1,7 +1,7 @@
1
- import { mergeModels as g, ref as w, useModel as D, provide as p, computed as B, createElementBlock as M, openBlock as S, mergeProps as I, withModifiers as E, renderSlot as L } from "vue";
1
+ import { mergeModels as m, ref as v, useModel as D, provide as p, computed as B, onUpdated as C, createElementBlock as I, openBlock as M, mergeProps as S, withModifiers as E, renderSlot as L } from "vue";
2
2
  const R = {
3
3
  __name: "KunList",
4
- props: /* @__PURE__ */ g({
4
+ props: /* @__PURE__ */ m({
5
5
  nav: Boolean,
6
6
  sub: Boolean,
7
7
  dense: Boolean,
@@ -20,33 +20,39 @@ const R = {
20
20
  },
21
21
  selectedModifiers: {}
22
22
  }),
23
- emits: /* @__PURE__ */ g(["keyDown", "click:select", "update:selected"], ["update:selected"]),
24
- setup(o, { expose: b, emit: y }) {
25
- const u = o, a = y, f = w(null), c = w([]), s = D(o, "selected");
23
+ emits: /* @__PURE__ */ m(["keyDown", "click:select", "update:selected"], ["update:selected"]),
24
+ setup(o, { expose: w, emit: b }) {
25
+ const d = o, a = b, f = v(null), r = v([]), i = D(o, "selected");
26
26
  p("registerListItemRef", (e) => {
27
- e && !c.value.includes(e) && c.value.push(e);
27
+ e ? (console.log(e), e.isConnected && !r.value.includes(e) && (r.value.push(e), r.value.sort((t, n) => {
28
+ const s = t.id ?? "", l = n.id ?? "";
29
+ return s.localeCompare(l, void 0, { numeric: !0, sensitivity: "base" });
30
+ }))) : r.value = r.value.filter((t) => t && t.isConnected);
28
31
  });
29
- const m = B(() => u.selectable && u.selectionMode === "multiple");
30
- function v(e) {
31
- if (!(!u.selectable || e == null))
32
- if (m.value) {
33
- const t = s.value.includes(e);
34
- s.value = t ? s.value.filter((n) => n !== e) : [...s.value, e];
32
+ const g = B(() => d.selectable && d.selectionMode === "multiple");
33
+ function y(e) {
34
+ if (!(!d.selectable || e == null))
35
+ if (g.value) {
36
+ const t = i.value.includes(e);
37
+ i.value = t ? i.value.filter((n) => n !== e) : [...i.value, e];
35
38
  } else
36
- s.value = e;
39
+ i.value = e;
37
40
  }
41
+ C(() => {
42
+ r.value = r.value.filter((e) => e && e.isConnected);
43
+ });
38
44
  function k(e) {
39
45
  var t, n;
40
- return !u.selectable || e == null ? !1 : m.value ? (n = (t = s.value) == null ? void 0 : t.includes) == null ? void 0 : n.call(t, e) : s.value === e;
46
+ return !d.selectable || e == null ? !1 : g.value ? (n = (t = i.value) == null ? void 0 : t.includes) == null ? void 0 : n.call(t, e) : i.value === e;
41
47
  }
42
48
  p("kunListContext", {
43
- toggleItem: v,
49
+ toggleItem: y,
44
50
  isSelected: k
45
51
  });
46
52
  function A(e) {
47
- var r;
53
+ var s;
48
54
  a("keyDown", e);
49
- const t = e.key, n = c.value.filter(Boolean);
55
+ const t = e.key, n = r.value.filter((l) => l && l.isConnected);
50
56
  if (!(!n.length || !["ArrowUp", "ArrowDown", "Enter"].includes(t))) {
51
57
  if (t === "Enter") {
52
58
  const l = document.activeElement;
@@ -55,26 +61,26 @@ const R = {
55
61
  }
56
62
  if (t === "ArrowUp" || t === "ArrowDown") {
57
63
  e.preventDefault();
58
- const l = n.findIndex((x) => x === document.activeElement);
59
- let d = -1;
60
- l === -1 ? d = t === "ArrowDown" ? 0 : n.length - 1 : t === "ArrowDown" ? d = (l + 1) % n.length : t === "ArrowUp" && (d = (l - 1 + n.length) % n.length);
61
- const i = n[d];
62
- (r = i == null ? void 0 : i.focus) == null || r.call(i);
64
+ const l = n.findIndex((h) => h === document.activeElement);
65
+ let u = -1;
66
+ l === -1 ? (console.log(1), u = t === "ArrowDown" ? 0 : n.length - 1) : t === "ArrowDown" ? (console.log(2), u = (l + 1) % n.length) : t === "ArrowUp" && (console.log(3), u = (l - 1 + n.length) % n.length), console.log(`currentIndex: ${u}`);
67
+ const c = n[u];
68
+ (s = c == null ? void 0 : c.focus) == null || s.call(c);
63
69
  return;
64
70
  }
65
71
  }
66
72
  }
67
- function h(e = "ArrowDown") {
73
+ function x(e = "ArrowDown") {
68
74
  var l;
69
- const t = c.value.filter(Boolean);
75
+ const t = r.value.filter(Boolean);
70
76
  if (!t.length) return;
71
- const n = e === "ArrowDown" ? 0 : t.length - 1, r = t[n];
72
- (l = r == null ? void 0 : r.focus) == null || l.call(r);
77
+ const n = e === "ArrowDown" ? 0 : t.length - 1, s = t[n];
78
+ (l = s == null ? void 0 : s.focus) == null || l.call(s);
73
79
  }
74
- return b({ focusWithKey: h, focus: () => {
80
+ return w({ focusWithKey: x, focus: () => {
75
81
  var e, t;
76
82
  return (t = (e = f.value) == null ? void 0 : e.focus) == null ? void 0 : t.call(e);
77
- } }), (e, t) => (S(), M("ul", I({
83
+ } }), (e, t) => (M(), I("ul", S({
78
84
  ref_key: "ulRef",
79
85
  ref: f,
80
86
  role: "list",
@@ -1,19 +1,19 @@
1
- import { useAttrs as q, computed as r, ref as H, inject as R, onMounted as J, onBeforeUnmount as Q, createBlock as u, openBlock as a, unref as T, withCtx as B, resolveDynamicComponent as v, mergeProps as h, withKeys as L, withModifiers as N, createElementVNode as C, createElementBlock as n, createCommentVNode as s, renderSlot as c, normalizeClass as i, toDisplayString as I } from "vue";
2
- import P from "../../../KunIcon/src/components/KunIcon.vue.js";
3
- import { RouterLink as W } from "vue-router";
4
- const X = { class: "flex w-full items-center" }, Y = {
1
+ import { useAttrs as H, computed as r, ref as J, inject as R, getCurrentInstance as Q, onMounted as T, onBeforeUnmount as W, createBlock as o, openBlock as l, unref as X, withCtx as $, resolveDynamicComponent as v, mergeProps as h, withKeys as L, withModifiers as P, createElementVNode as C, createElementBlock as a, createCommentVNode as s, renderSlot as c, normalizeClass as i, toDisplayString as I } from "vue";
2
+ import M from "../../../KunIcon/src/components/KunIcon.vue.js";
3
+ import { RouterLink as Y } from "vue-router";
4
+ const Z = { class: "flex w-full items-center" }, _ = {
5
5
  key: 0,
6
6
  class: "shrink-0 flex items-center gap-2 me-2"
7
- }, Z = ["src"], _ = {
7
+ }, ee = ["src"], te = {
8
8
  key: 1,
9
9
  class: "shrink-0 flex items-center gap-2 ms-3"
10
- }, ee = ["src"], te = { class: "flex w-full items-center" }, le = {
10
+ }, ne = ["src"], le = { class: "flex w-full items-center" }, ae = {
11
11
  key: 0,
12
12
  class: "shrink-0 flex items-center gap-2 me-2"
13
- }, ae = ["src"], ne = {
13
+ }, se = ["src"], re = {
14
14
  key: 1,
15
15
  class: "shrink-0 flex items-center gap-2 ms-3"
16
- }, se = ["src"], re = "w-full flex transition duration-150 ease-in-out", oe = {
16
+ }, ie = ["src"], de = "w-full flex transition duration-150 ease-in-out", fe = {
17
17
  __name: "KunListItem",
18
18
  props: {
19
19
  value: [String, Number, Boolean, Object, Array, null],
@@ -46,31 +46,35 @@ const X = { class: "flex w-full items-center" }, Y = {
46
46
  titleClass: { type: String, default: "font-medium" },
47
47
  subtitle: [String, Number, Boolean],
48
48
  subtitleClass: { type: String, default: "text-sm text-slate-800 dark:text-slate-200" },
49
- containerClass: { type: [String, Array, Object], default: "" }
49
+ containerClass: { type: [String, Array, Object], default: "" },
50
+ id: [String, Number]
50
51
  },
51
52
  emits: ["click"],
52
53
  setup(e, { emit: D }) {
53
- const $ = q(), x = r(() => $.class), j = r(() => {
54
- const { class: l, ...m } = $;
54
+ const B = H(), x = r(() => B.class), j = r(() => {
55
+ const { class: n, ...m } = B;
55
56
  return m;
56
- }), t = e, G = D, f = H(null), y = R("registerListItemRef", null), o = R("kunListContext", null);
57
- J(() => {
58
- y && f.value && y(f.value);
59
- }), Q(() => {
60
- y && y(null);
57
+ }), t = e, G = D, f = J(null), g = R("registerListItemRef", null), u = R("kunListContext", null), E = r(() => {
58
+ var n;
59
+ return t.id ? t.id : `kun-list-item-${((n = Q()) == null ? void 0 : n.uid) ?? Math.random().toString(36).slice(2, 7)}`;
61
60
  });
62
- const g = (l) => typeof l == "object" || typeof l == "function", E = r(() => !!(t.prependIcon || t.prependAvatar)), K = r(() => !!(t.appendIcon || t.appendAvatar)), S = r(() => {
63
- var l;
64
- return ((l = o == null ? void 0 : o.isSelected) == null ? void 0 : l.call(o, t.value)) ?? !1;
65
- }), w = r(() => t.active), M = r(() => !!t.to);
66
- function b(l, m = null) {
61
+ T(() => {
62
+ g && f.value && g(f.value);
63
+ }), W(() => {
64
+ g && g(null);
65
+ });
66
+ const y = (n) => typeof n == "object" || typeof n == "function", K = r(() => !!(t.prependIcon || t.prependAvatar)), N = r(() => !!(t.appendIcon || t.appendAvatar)), S = r(() => {
67
+ var n;
68
+ return ((n = u == null ? void 0 : u.isSelected) == null ? void 0 : n.call(u, t.value)) ?? !1;
69
+ }), w = r(() => t.active), V = r(() => !!t.to);
70
+ function b(n, m = null) {
67
71
  var p, k;
68
72
  if (t.disabled) return;
69
- G("click", l);
73
+ G("click", n);
70
74
  const d = ((p = f.value) == null ? void 0 : p.$el) ?? f.value;
71
- d != null && d.dispatchEvent && d.dispatchEvent(new CustomEvent("select", { detail: t.value, bubbles: !0 })), o && t.selectable && t.value !== null && ((k = o.toggleItem) == null || k.call(o, t.value), d != null && d.dispatchEvent && d.dispatchEvent(new CustomEvent("selected", { detail: t.value, bubbles: !0 }))), m && m(l);
75
+ d != null && d.dispatchEvent && d.dispatchEvent(new CustomEvent("select", { detail: t.value, bubbles: !0 })), u && t.selectable && t.value !== null && ((k = u.toggleItem) == null || k.call(u, t.value), d != null && d.dispatchEvent && d.dispatchEvent(new CustomEvent("selected", { detail: t.value, bubbles: !0 }))), m && m(n);
72
76
  }
73
- const V = r(() => {
77
+ const z = r(() => {
74
78
  switch (t.variant) {
75
79
  case "outlined":
76
80
  return "border border-gray-300 dark:border-gray-700";
@@ -85,7 +89,7 @@ const X = { class: "flex w-full items-center" }, Y = {
85
89
  default:
86
90
  return "";
87
91
  }
88
- }), z = r(() => {
92
+ }), F = r(() => {
89
93
  switch (t.density) {
90
94
  case "comfortable":
91
95
  return "py-2";
@@ -94,12 +98,12 @@ const X = { class: "flex w-full items-center" }, Y = {
94
98
  default:
95
99
  return "py-3";
96
100
  }
97
- }), F = r(() => t.tile ? "rounded-none" : t.rounded === !0 ? "rounded-md" : t.rounded === !1 ? "" : `rounded-${t.rounded}`), U = r(() => t.ripple ? "relative overflow-hidden" : ""), O = r(() => [
98
- re,
99
- V.value,
101
+ }), U = r(() => t.tile ? "rounded-none" : t.rounded === !0 ? "rounded-md" : t.rounded === !1 ? "" : `rounded-${t.rounded}`), q = r(() => t.ripple ? "relative overflow-hidden" : ""), O = r(() => [
102
+ de,
100
103
  z.value,
101
104
  F.value,
102
105
  U.value,
106
+ q.value,
103
107
  t.textColor,
104
108
  t.itemPosition,
105
109
  t.bgItems,
@@ -111,14 +115,15 @@ const X = { class: "flex w-full items-center" }, Y = {
111
115
  },
112
116
  t.containerClass
113
117
  ]);
114
- return (l, m) => M.value ? (a(), u(T(W), {
118
+ return (n, m) => V.value ? (l(), o(X(Y), {
115
119
  key: 0,
116
120
  to: e.to,
117
121
  replace: e.replace,
118
122
  custom: !0
119
123
  }, {
120
- default: B(({ href: d, navigate: p, isActive: k }) => [
121
- (a(), u(v(e.tag), h({
124
+ default: $(({ href: d, navigate: p, isActive: k }) => [
125
+ (l(), o(v(e.tag), h({
126
+ id: E.value,
122
127
  ref_key: "liRef",
123
128
  ref: f,
124
129
  href: d,
@@ -128,20 +133,20 @@ const X = { class: "flex w-full items-center" }, Y = {
128
133
  tabindex: "-1",
129
134
  class: O.value,
130
135
  onClick: (A) => b(A, p),
131
- onKeydown: L(N((A) => b(A, p), ["prevent"]), ["enter"])
132
- }, l.$attrs), {
133
- default: B(() => [
134
- C("div", X, [
135
- E.value || l.$slots.prepend ? (a(), n("div", Y, [
136
- c(l.$slots, "prepend", {}, () => [
137
- e.prependAvatar ? (a(), n("img", {
136
+ onKeydown: L(P((A) => b(A, p), ["prevent"]), ["enter"])
137
+ }, n.$attrs), {
138
+ default: $(() => [
139
+ C("div", Z, [
140
+ K.value || n.$slots.prepend ? (l(), a("div", _, [
141
+ c(n.$slots, "prepend", {}, () => [
142
+ e.prependAvatar ? (l(), a("img", {
138
143
  key: 0,
139
144
  src: e.prependAvatar,
140
145
  class: i(["rounded-full", e.prependClass])
141
- }, null, 10, Z)) : g(e.prependIcon) ? (a(), u(v(e.prependIcon), {
146
+ }, null, 10, ee)) : y(e.prependIcon) ? (l(), o(v(e.prependIcon), {
142
147
  key: 1,
143
148
  class: i(e.prependClass)
144
- }, null, 8, ["class"])) : typeof e.prependIcon == "string" ? (a(), u(P, {
149
+ }, null, 8, ["class"])) : typeof e.prependIcon == "string" ? (l(), o(M, {
145
150
  key: 2,
146
151
  icon: e.prependIcon,
147
152
  class: i(e.prependClass)
@@ -151,32 +156,32 @@ const X = { class: "flex w-full items-center" }, Y = {
151
156
  C("div", h({
152
157
  class: ["flex flex-col min-w-0 flex-1", x.value]
153
158
  }, j.value), [
154
- c(l.$slots, "default", {}, () => [
155
- c(l.$slots, "title", {}, () => [
156
- e.title ? (a(), n("div", {
159
+ c(n.$slots, "default", {}, () => [
160
+ c(n.$slots, "title", {}, () => [
161
+ e.title ? (l(), a("div", {
157
162
  key: 0,
158
163
  class: i(["truncate", e.titleClass])
159
164
  }, I(e.title), 3)) : s("", !0)
160
165
  ]),
161
- c(l.$slots, "subtitle", {}, () => [
162
- e.subtitle ? (a(), n("div", {
166
+ c(n.$slots, "subtitle", {}, () => [
167
+ e.subtitle ? (l(), a("div", {
163
168
  key: 0,
164
169
  class: i(["truncate", e.subtitleClass])
165
170
  }, I(e.subtitle), 3)) : s("", !0)
166
171
  ])
167
172
  ])
168
173
  ], 16),
169
- K.value ? (a(), n("div", _, [
170
- c(l.$slots, "append", {}, () => [
171
- e.appendAvatar ? (a(), n("img", {
174
+ N.value ? (l(), a("div", te, [
175
+ c(n.$slots, "append", {}, () => [
176
+ e.appendAvatar ? (l(), a("img", {
172
177
  key: 0,
173
178
  src: e.appendAvatar,
174
179
  class: "w-8 h-8 rounded-full"
175
- }, null, 8, ee)) : s("", !0),
176
- g(e.appendIcon) ? (a(), u(v(e.appendIcon), {
180
+ }, null, 8, ne)) : s("", !0),
181
+ y(e.appendIcon) ? (l(), o(v(e.appendIcon), {
177
182
  key: 1,
178
183
  class: "w-5 h-5"
179
- })) : e.appendIcon ? (a(), n("i", {
184
+ })) : e.appendIcon ? (l(), a("i", {
180
185
  key: 2,
181
186
  class: i([e.appendClass, "text-xl leading-none"])
182
187
  }, null, 2)) : s("", !0)
@@ -185,11 +190,12 @@ const X = { class: "flex w-full items-center" }, Y = {
185
190
  ])
186
191
  ]),
187
192
  _: 2
188
- }, 1040, ["href", "aria-selected", "aria-disabled", "class", "onClick", "onKeydown"]))
193
+ }, 1040, ["id", "href", "aria-selected", "aria-disabled", "class", "onClick", "onKeydown"]))
189
194
  ]),
190
195
  _: 3
191
- }, 8, ["to", "replace"])) : (a(), u(v(e.tag), h({
196
+ }, 8, ["to", "replace"])) : (l(), o(v(e.tag), h({
192
197
  key: 1,
198
+ id: E.value,
193
199
  ref_key: "liRef",
194
200
  ref: f,
195
201
  role: "option",
@@ -198,20 +204,20 @@ const X = { class: "flex w-full items-center" }, Y = {
198
204
  tabindex: "-1",
199
205
  class: [O.value],
200
206
  onClick: b,
201
- onKeydown: L(N(b, ["prevent"]), ["enter"])
202
- }, l.$attrs), {
203
- default: B(() => [
204
- C("div", te, [
205
- E.value || l.$slots.prepend ? (a(), n("div", le, [
206
- c(l.$slots, "prepend", {}, () => [
207
- e.prependAvatar ? (a(), n("img", {
207
+ onKeydown: L(P(b, ["prevent"]), ["enter"])
208
+ }, n.$attrs), {
209
+ default: $(() => [
210
+ C("div", le, [
211
+ K.value || n.$slots.prepend ? (l(), a("div", ae, [
212
+ c(n.$slots, "prepend", {}, () => [
213
+ e.prependAvatar ? (l(), a("img", {
208
214
  key: 0,
209
215
  src: e.prependAvatar,
210
216
  class: i(["rounded-full", e.prependClass])
211
- }, null, 10, ae)) : g(e.prependIcon) ? (a(), u(v(e.prependIcon), {
217
+ }, null, 10, se)) : y(e.prependIcon) ? (l(), o(v(e.prependIcon), {
212
218
  key: 1,
213
219
  class: i(e.prependClass)
214
- }, null, 8, ["class"])) : typeof e.prependIcon == "string" ? (a(), u(P, {
220
+ }, null, 8, ["class"])) : typeof e.prependIcon == "string" ? (l(), o(M, {
215
221
  key: 2,
216
222
  icon: e.prependIcon,
217
223
  class: i(e.prependClass)
@@ -221,32 +227,32 @@ const X = { class: "flex w-full items-center" }, Y = {
221
227
  C("div", h({
222
228
  class: ["flex flex-col min-w-0 flex-1", x.value]
223
229
  }, j.value), [
224
- c(l.$slots, "default", {}, () => [
225
- c(l.$slots, "title", {}, () => [
226
- e.title ? (a(), n("div", {
230
+ c(n.$slots, "default", {}, () => [
231
+ c(n.$slots, "title", {}, () => [
232
+ e.title ? (l(), a("div", {
227
233
  key: 0,
228
234
  class: i(["truncate", e.titleClass])
229
235
  }, I(e.title), 3)) : s("", !0)
230
236
  ]),
231
- c(l.$slots, "subtitle", {}, () => [
232
- e.subtitle ? (a(), n("div", {
237
+ c(n.$slots, "subtitle", {}, () => [
238
+ e.subtitle ? (l(), a("div", {
233
239
  key: 0,
234
240
  class: i(["truncate", e.subtitleClass])
235
241
  }, I(e.subtitle), 3)) : s("", !0)
236
242
  ])
237
243
  ])
238
244
  ], 16),
239
- K.value ? (a(), n("div", ne, [
240
- c(l.$slots, "append", {}, () => [
241
- e.appendAvatar ? (a(), n("img", {
245
+ N.value ? (l(), a("div", re, [
246
+ c(n.$slots, "append", {}, () => [
247
+ e.appendAvatar ? (l(), a("img", {
242
248
  key: 0,
243
249
  src: e.appendAvatar,
244
250
  class: "w-8 h-8 rounded-full"
245
- }, null, 8, se)) : s("", !0),
246
- g(e.appendIcon) ? (a(), u(v(e.appendIcon), {
251
+ }, null, 8, ie)) : s("", !0),
252
+ y(e.appendIcon) ? (l(), o(v(e.appendIcon), {
247
253
  key: 1,
248
254
  class: "w-5 h-5"
249
- })) : e.appendIcon ? (a(), n("i", {
255
+ })) : e.appendIcon ? (l(), a("i", {
250
256
  key: 2,
251
257
  class: i([e.appendIcon, "text-xl leading-none"])
252
258
  }, null, 2)) : s("", !0)
@@ -255,9 +261,9 @@ const X = { class: "flex w-full items-center" }, Y = {
255
261
  ])
256
262
  ]),
257
263
  _: 3
258
- }, 16, ["aria-selected", "aria-disabled", "class", "onKeydown"]));
264
+ }, 16, ["id", "aria-selected", "aria-disabled", "class", "onKeydown"]));
259
265
  }
260
266
  };
261
267
  export {
262
- oe as default
268
+ fe as default
263
269
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.358",
3
+ "version": "0.1.359",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",