adverich-kun-ui 0.1.353 → 0.1.354

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,40 +1,43 @@
1
- import { mergeModels as R, useModel as $, onMounted as ae, ref as B, watch as ie, createElementBlock as w, openBlock as i, createVNode as a, unref as t, isRef as F, createSlots as re, withCtx as n, createCommentVNode as k, Fragment as se, renderList as ue, createBlock as d, createElementVNode as de, createTextVNode as v, toDisplayString as V, normalizeClass as ce, withModifiers as me } from "vue";
1
+ import { mergeModels as A, useModel as R, onMounted as ie, ref as $, watch as ae, createElementBlock as v, openBlock as a, createVNode as i, unref as t, isRef as B, createSlots as re, withCtx as n, createCommentVNode as k, 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";
2
2
  import { icons as m } from "../../../../icons/index.js";
3
- import { isNotEmpty as fe, isArray as T } from "../../../../utils/utils.js";
3
+ import { isNotEmpty as fe, isArray as F } from "../../../../utils/utils.js";
4
4
  import pe from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
5
5
  import he from "../../../KunList/src/components/KunList.vue.js";
6
- import I from "../../../KunListItem/src/components/KunListItem.vue.js";
6
+ import T from "../../../KunListItem/src/components/KunListItem.vue.js";
7
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";
8
+ import ve from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
9
+ import ke from "../../../KunMenu/src/components/KunMenu.vue.js";
10
10
  import { useAutocomplete as ye } from "../composables/useAutocomplete.js";
11
11
  import { KunAutocompleteProps as be } from "../composables/KunAutocompleteProps.js";
12
12
  import ge from "../../../KunTextField/src/components/KunTextField.vue.js";
13
13
  import Ce from "../../../KunBtn/src/components/KunBtn.vue.js";
14
14
  import we from "../../../KunChip/src/components/KunChip.vue.js";
15
- import y from "../../../KunIcon/src/components/KunIcon.vue.js";
15
+ import b from "../../../KunIcon/src/components/KunIcon.vue.js";
16
16
  const Ve = {
17
17
  key: 0,
18
18
  class: "flex justify-center align-center"
19
- }, Ie = { class: "flex justify-center align-center" }, Le = {
19
+ }, Ie = { class: "flex justify-center align-center" }, Se = {
20
+ key: 0,
21
+ class: "p-2"
22
+ }, Ue = {
20
23
  __name: "KunAutocomplete",
21
- props: /* @__PURE__ */ R(be, {
24
+ props: /* @__PURE__ */ A(be, {
22
25
  modelValue: { default: null },
23
26
  modelModifiers: {},
24
27
  items: { default: [], type: Array, required: !0 },
25
28
  itemsModifiers: {}
26
29
  }),
27
- emits: /* @__PURE__ */ R(["update:modelValue", "selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
28
- setup(b, { emit: E }) {
29
- const r = $(b, "modelValue"), S = $(b, "items"), u = b, f = E, {
30
- textFieldRef: g,
31
- listRef: D,
30
+ emits: /* @__PURE__ */ A(["update:modelValue", "selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
31
+ setup(g, { emit: E }) {
32
+ const r = R(g, "modelValue"), I = R(g, "items"), u = g, f = E, {
33
+ textFieldRef: C,
34
+ listRef: S,
32
35
  menuModel: s,
33
- search: c,
36
+ search: d,
34
37
  removeItem: N,
35
38
  clearSelection: L,
36
39
  lightReset: U,
37
- openMenu: C,
40
+ openMenu: w,
38
41
  closeMenu: H,
39
42
  toggleMenu: O,
40
43
  onMenuKeydown: j,
@@ -44,13 +47,13 @@ const Ve = {
44
47
  isAlphanumeric: G,
45
48
  createItem: J,
46
49
  checkDisabled: Q,
47
- itemToString: K,
50
+ itemToString: D,
48
51
  placeholder: X
49
- } = ye(u, f, r, S);
50
- ae(() => {
51
- u.focusOnRender && g.value.focus();
52
+ } = ye(u, f, r, I);
53
+ ie(() => {
54
+ u.focusOnRender && C.value.focus();
52
55
  });
53
- const M = B(null), p = B(""), _ = (e) => {
56
+ const K = $(null), p = $(""), M = (e) => {
54
57
  for (const o of u.rules) {
55
58
  const l = o(e);
56
59
  if (l !== !0)
@@ -58,12 +61,12 @@ const Ve = {
58
61
  }
59
62
  return p.value = "", f("validation", !0), !0;
60
63
  };
61
- ie(() => r.value, (e, o) => {
62
- fe(u.rules) && _(e);
64
+ ae(() => r.value, (e, o) => {
65
+ fe(u.rules) && M(e);
63
66
  });
64
67
  function Y() {
65
68
  var e;
66
- s.value = !1, (e = g.value.inputField) == null || e.focus();
69
+ s.value = !1, (e = C.value.inputField) == null || e.focus();
67
70
  }
68
71
  function Z(e) {
69
72
  var l, h;
@@ -72,28 +75,28 @@ const Ve = {
72
75
  H();
73
76
  return;
74
77
  }
75
- (G(o) || o === "Backspace") && C(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), s.value || C(), (h = (l = D.value) == null ? void 0 : l.focusWithKey) == null || h.call(l, o));
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));
76
79
  }
77
80
  function ee(e) {
78
- f("search", c);
81
+ f("search", d);
79
82
  }
80
83
  function le() {
81
- _(r);
84
+ M(r);
82
85
  }
83
86
  function te(e) {
84
87
  j(e);
85
88
  }
86
89
  function oe() {
87
90
  }
88
- return (e, o) => (i(), w("div", {
91
+ return (e, o) => (a(), v("div", {
89
92
  class: "w-full h-fit",
90
93
  ref_key: "parentRef",
91
- ref: M
94
+ ref: K
92
95
  }, [
93
- a(ge, {
94
- modelValue: t(c),
96
+ i(ge, {
97
+ modelValue: t(d),
95
98
  "onUpdate:modelValue": [
96
- o[1] || (o[1] = (l) => F(c) ? c.value = l : null),
99
+ o[1] || (o[1] = (l) => B(d) ? d.value = l : null),
97
100
  ee
98
101
  ],
99
102
  label: e.label,
@@ -101,28 +104,28 @@ const Ve = {
101
104
  "hide-details": e.hideDetails,
102
105
  density: e.density,
103
106
  ref_key: "textFieldRef",
104
- ref: g,
107
+ ref: C,
105
108
  autocomplete: "off",
106
109
  onFocusInput: le,
107
110
  onHandleClick: t(O),
108
111
  rounded: t(s) ? "rounded-t" : "rounded",
109
112
  onBlur: oe,
110
113
  onKeyDown: Z,
111
- placeholder: u.multiple && t(T)(r.value) && r.value.length ? "" : t(X),
114
+ placeholder: u.multiple && t(F)(r.value) && r.value.length ? "" : t(X),
112
115
  error: !!p.value,
113
116
  "error-messages": p.value
114
117
  }, re({
115
118
  default: n(() => [
116
- t(T)(r.value) ? (i(), w("div", Ve, [
117
- (i(!0), w(se, null, ue(r.value, (l) => (i(), d(we, {
119
+ t(F)(r.value) ? (a(), v("div", Ve, [
120
+ (a(!0), v(se, null, ue(r.value, (l) => (a(), c(we, {
118
121
  key: l.id ?? l.name,
119
122
  size: "small",
120
123
  class: "ml-1"
121
124
  }, {
122
125
  default: n(() => [
123
126
  de("div", Ie, [
124
- v(V(t(W)(l, e.itemTitle)) + " ", 1),
125
- a(y, {
127
+ y(V(t(W)(l, e.itemTitle)) + " ", 1),
128
+ i(b, {
126
129
  color: "error",
127
130
  icon: t(m).close,
128
131
  size: "small",
@@ -134,14 +137,14 @@ const Ve = {
134
137
  _: 2
135
138
  }, 1024))), 128))
136
139
  ])) : k("", !0),
137
- a(ve, {
140
+ i(ke, {
138
141
  transition: "fade",
139
142
  "onClick:outside": t(U),
140
143
  modelValue: t(s),
141
- "onUpdate:modelValue": o[0] || (o[0] = (l) => F(s) ? s.value = l : null),
144
+ "onUpdate:modelValue": o[0] || (o[0] = (l) => B(s) ? s.value = l : null),
142
145
  activator: "parent",
143
146
  "z-index": e.zIndex,
144
- "parent-ref": M.value,
147
+ "parent-ref": K.value,
145
148
  location: "bottom",
146
149
  origin: "bottom left",
147
150
  onHandleEscape: Y,
@@ -151,32 +154,29 @@ const Ve = {
151
154
  "hide-details": e.hideDetails
152
155
  }, {
153
156
  default: n(() => [
154
- a(he, {
157
+ i(he, {
155
158
  "onClick:select": t(q),
156
159
  ref_key: "listRef",
157
- ref: D,
160
+ ref: S,
158
161
  onKeyDown: te,
159
162
  selectable: !0
160
163
  }, {
161
164
  default: n(() => [
162
- e.hasCreateItem ? (i(), d(I, { key: 0 }, {
163
- default: n(() => [
164
- a(Ce, {
165
- onClick: t(J),
166
- bgColor: e.btnCreateBg,
167
- class: ce(e.btnCreateClass)
168
- }, {
169
- default: n(() => [
170
- v(V(e.btnCreateText), 1)
171
- ]),
172
- _: 1
173
- }, 8, ["onClick", "bgColor", "class"])
174
- ]),
175
- _: 1
176
- })) : k("", !0),
177
- a(pe, {
178
- items: S.value,
179
- search: t(c),
165
+ e.hasCreateItem ? (a(), v("div", Se, [
166
+ i(Ce, {
167
+ onClick: t(J),
168
+ bgColor: e.btnCreateBg,
169
+ class: ce(e.btnCreateClass)
170
+ }, {
171
+ default: n(() => [
172
+ y(V(e.btnCreateText), 1)
173
+ ]),
174
+ _: 1
175
+ }, 8, ["onClick", "bgColor", "class"])
176
+ ])) : k("", !0),
177
+ i(pe, {
178
+ items: I.value,
179
+ search: t(d),
180
180
  "searchable-keys": u.searchableKeys,
181
181
  virtual: !1,
182
182
  "items-per-intersection": 10,
@@ -184,39 +184,39 @@ const Ve = {
184
184
  "item-height": 48
185
185
  }, {
186
186
  default: n(({ item: l, index: h, empty: ne }) => {
187
- var z, A;
187
+ var _, z;
188
188
  return [
189
- !ne && l ? (i(), d(I, {
189
+ !ne && l ? (a(), c(T, {
190
190
  value: l,
191
- key: ((z = l.id) == null ? void 0 : z.toString()) ?? l.name,
191
+ key: ((_ = l.id) == null ? void 0 : _.toString()) ?? l.name,
192
192
  disabled: t(Q)(l),
193
193
  "bg-items": e.bgItemListColor,
194
194
  "hover-bg": e.hoverItemListColor,
195
195
  activeClass: e.selectedItemListColor,
196
196
  density: e.density,
197
- id: ((A = l.id) == null ? void 0 : A.toString()) ?? l.name,
197
+ id: ((z = l.id) == null ? void 0 : z.toString()) ?? l.name,
198
198
  selectable: !0
199
199
  }, {
200
200
  default: n(() => [
201
- a(x, { class: "text-wrap" }, {
201
+ i(x, { class: "text-wrap" }, {
202
202
  default: n(() => [
203
- v(V(t(K)(l, e.itemTitle ?? t(P), "hasDefault")), 1)
203
+ y(V(t(D)(l, e.itemTitle ?? t(P), "hasDefault")), 1)
204
204
  ]),
205
205
  _: 2
206
206
  }, 1024),
207
- a(ke, {
208
- text: e.itemSubtitle ? t(K)(l, e.itemSubtitle) : ""
207
+ i(ve, {
208
+ text: e.itemSubtitle ? t(D)(l, e.itemSubtitle) : ""
209
209
  }, null, 8, ["text"])
210
210
  ]),
211
211
  _: 2
212
- }, 1032, ["value", "disabled", "bg-items", "hover-bg", "activeClass", "density", "id"])) : (i(), d(I, {
212
+ }, 1032, ["value", "disabled", "bg-items", "hover-bg", "activeClass", "density", "id"])) : (a(), c(T, {
213
213
  key: 1,
214
214
  disabled: ""
215
215
  }, {
216
216
  default: n(() => [
217
- a(x, { class: "text-center w-full text-gray-500" }, {
217
+ i(x, { class: "text-center w-full text-gray-500" }, {
218
218
  default: n(() => o[2] || (o[2] = [
219
- v(" No hay elementos disponibles ")
219
+ y(" No hay elementos disponibles ")
220
220
  ])),
221
221
  _: 1,
222
222
  __: [2]
@@ -240,7 +240,7 @@ const Ve = {
240
240
  e.hasIcons ? {
241
241
  name: "append-inner",
242
242
  fn: n(() => [
243
- e.clearable && r.value ? (i(), d(y, {
243
+ e.clearable && r.value ? (a(), c(b, {
244
244
  key: 0,
245
245
  onClick: t(L),
246
246
  size: "small",
@@ -248,14 +248,14 @@ const Ve = {
248
248
  icon: t(m).close,
249
249
  class: "mr-1 mt-1"
250
250
  }, null, 8, ["onClick", "icon"])) : k("", !0),
251
- a(y, {
251
+ i(b, {
252
252
  color: "teal-darken-1",
253
253
  size: "large",
254
254
  class: "cursor-pointer",
255
255
  icon: t(s) ? t(m).menuUpOutline : t(m).menuDownOutline,
256
- onClick: me(t(C), ["stop"])
256
+ onClick: me(t(w), ["stop"])
257
257
  }, null, 8, ["icon", "onClick"]),
258
- e.required ? (i(), d(y, {
258
+ e.required ? (a(), c(b, {
259
259
  key: 1,
260
260
  color: "teal-darken-1",
261
261
  size: "x-small",
@@ -270,5 +270,5 @@ const Ve = {
270
270
  }
271
271
  };
272
272
  export {
273
- Le as default
273
+ Ue as default
274
274
  };
@@ -1,12 +1,12 @@
1
1
  import { ref as o, computed as M, watch as H, nextTick as F } from "vue";
2
- import { isArray as g, isObject as b, fullCopy as L } from "../../../../utils/utils.js";
2
+ import { isArray as j, isObject as b, fullCopy as L } from "../../../../utils/utils.js";
3
3
  function U(t, h, c, s) {
4
- const l = o(null), d = o(null), j = o(null), f = o(!1), v = o(""), N = (e, n) => n.split(".").reduce((u, r) => u && u[r] !== void 0 ? u[r] : null, e), V = M(() => l.value ? g(l.value) ? l.value.length ? x(l.value, t.itemTitle, "hasDefault") : t.placeholderText : b(l.value) ? x(l.value, t.itemTitle, "hasDefault") : l.value.toString() : s.value.length ? t.placeholderText : t.textNoItems), B = M(() => t.itemText.includes(",") ? t.itemText.split(",") : t.itemText);
4
+ const l = o(null), d = o(null), y = o(null), f = o(!1), v = o(""), N = (e, n) => n.split(".").reduce((u, r) => u && u[r] !== void 0 ? u[r] : null, e), V = M(() => l.value ? j(l.value) ? l.value.length ? x(l.value, t.itemTitle, "hasDefault") : t.placeholderText : b(l.value) ? x(l.value, t.itemTitle, "hasDefault") : l.value.toString() : s.value.length ? t.placeholderText : t.textNoItems), B = M(() => t.itemText.includes(",") ? t.itemText.split(",") : t.itemText);
5
5
  function x(e, n, u) {
6
6
  var r;
7
7
  if (b(e)) {
8
8
  if (n) {
9
- if (g(n))
9
+ if (j(n))
10
10
  return n.map((i) => e[i] ?? "No definido").join(" - ");
11
11
  if (n.includes(","))
12
12
  return n.split(",").map((i) => e[i]).join(" - ");
@@ -22,15 +22,15 @@ function U(t, h, c, s) {
22
22
  if (u)
23
23
  return Object.values(e)[0];
24
24
  }
25
- return g(e) ? t.returnObject ? e.map((i) => i[n]).join(" - ") : e.map((i) => i).join(" - ") : u && typeof e != "number" ? e.includes(",") ? e.split(",") : e : ((r = e == null ? void 0 : e.toString) == null ? void 0 : r.call(e)) ?? "";
25
+ return j(e) ? t.returnObject ? e.map((i) => i[n]).join(" - ") : e.map((i) => i).join(" - ") : u && typeof e != "number" ? e.includes(",") ? e.split(",") : e : ((r = e == null ? void 0 : e.toString) == null ? void 0 : r.call(e)) ?? "";
26
26
  }
27
27
  function R(e) {
28
28
  try {
29
29
  let n = null;
30
30
  if (l.value = L(e), !t.multiple)
31
- t.returnObject ? n = e : b(e) ? t.itemValue ? n = e[t.itemValue] : n = Object.values(e)[0] : n = e, f.value = !1;
32
- else if (y(e))
33
- e && S(e);
31
+ t.returnObject ? n = e : b(e) ? t.itemValue ? n = e[t.itemValue] : n = Object.values(e)[0] : n = e, f.value = !1, g();
32
+ else if (S(e))
33
+ e && T(e);
34
34
  else {
35
35
  const u = t.returnObject ? e : b(e) ? t.itemValue ? e[t.itemValue] : Object.values(e)[0] : e;
36
36
  n = [...c.value || [], u];
@@ -40,7 +40,7 @@ function U(t, h, c, s) {
40
40
  console.log(n);
41
41
  } finally {
42
42
  F(() => {
43
- T();
43
+ I();
44
44
  });
45
45
  }
46
46
  }
@@ -57,12 +57,12 @@ function U(t, h, c, s) {
57
57
  (u) => typeof u == "object" ? u[t.itemValue] === e : u === e
58
58
  ) ?? e;
59
59
  }
60
- function y(e) {
60
+ function S(e) {
61
61
  return c.value === null ? !1 : e ? c.value.some(
62
62
  (n) => t.returnObject ? n[t.itemValue] === e[t.itemValue] : n === e[t.itemValue]
63
63
  ) : !0;
64
64
  }
65
- function S(e) {
65
+ function T(e) {
66
66
  let n = c.value;
67
67
  if (t.returnObject) {
68
68
  const u = n.find(
@@ -74,10 +74,10 @@ function U(t, h, c, s) {
74
74
  n.splice(u, 1);
75
75
  }
76
76
  }
77
- function T(e) {
78
- t.clearSearchOnSelect && (v.value = ""), t.clearOnSelect && w(), t.focusOnSelect && k();
77
+ function I(e) {
78
+ t.clearSearchOnSelect && (v.value = ""), t.clearOnSelect && w(), t.focusOnSelect && g();
79
79
  }
80
- function I() {
80
+ function A() {
81
81
  f.value || (f.value = !0);
82
82
  }
83
83
  function D() {
@@ -86,18 +86,18 @@ function U(t, h, c, s) {
86
86
  function J() {
87
87
  f.value = !f.value;
88
88
  }
89
- function A(e) {
89
+ function k(e) {
90
90
  return e.length === 1 && e.match(/\w/);
91
91
  }
92
- function k() {
92
+ function g() {
93
93
  d.value.inputField.focus();
94
94
  }
95
95
  function K() {
96
- f.value = !0, j.value && d.value.$el.focus();
96
+ f.value = !0, y.value && d.value.$el.focus();
97
97
  }
98
98
  function $(e) {
99
99
  const n = e.key;
100
- (A(n) || n === "Backspace") && (I(), k(), F(() => {
100
+ (k(n) || n === "Backspace") && (A(), g(), F(() => {
101
101
  var r;
102
102
  const u = (r = d.value) == null ? void 0 : r.inputField;
103
103
  if (u) {
@@ -122,7 +122,7 @@ function U(t, h, c, s) {
122
122
  return {
123
123
  selectedItem: l,
124
124
  textFieldRef: d,
125
- listRef: j,
125
+ listRef: y,
126
126
  menuModel: f,
127
127
  search: v,
128
128
  getItemText: N,
@@ -130,10 +130,10 @@ function U(t, h, c, s) {
130
130
  textArr: B,
131
131
  itemToString: x,
132
132
  getSelectedItem: R,
133
- checkIfValueExist: y,
134
- removeFromArray: S,
135
- lightReset: T,
136
- openMenu: I,
133
+ checkIfValueExist: S,
134
+ removeFromArray: T,
135
+ lightReset: I,
136
+ openMenu: A,
137
137
  closeMenu: D,
138
138
  toggleMenu: J,
139
139
  focusOnMenu: K,
@@ -142,7 +142,7 @@ function U(t, h, c, s) {
142
142
  removeItem: z,
143
143
  clearSelection: w,
144
144
  checkDisabled: G,
145
- isAlphanumeric: A
145
+ isAlphanumeric: k
146
146
  };
147
147
  }
148
148
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.353",
3
+ "version": "0.1.354",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",