adverich-kun-ui 0.1.491 → 0.1.492

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,246 +1,243 @@
1
- import { mergeModels as $, useModel as x, onMounted as se, ref as z, watch as ue, nextTick as A, createElementBlock as y, openBlock as u, createVNode as i, unref as o, withKeys as de, withModifiers as E, isRef as _, createSlots as ce, withCtx as n, createCommentVNode as g, normalizeClass as fe, createTextVNode as b, toDisplayString as V, createBlock as v, Fragment as me, renderList as pe, createElementVNode as ve } from "vue";
1
+ import { mergeModels as x, useModel as z, onMounted as ie, ref as A, watch as se, nextTick as ue, createElementBlock as g, openBlock as d, createVNode as i, unref as o, withKeys as de, isRef as E, createSlots as ce, withCtx as r, createCommentVNode as b, normalizeClass as me, createTextVNode as C, toDisplayString as D, createBlock as v, Fragment as fe, renderList as pe, createElementVNode as ve, withModifiers as ke } from "vue";
2
2
  import { icons as k } from "../../../../icons/index.js";
3
- import { isNotEmpty as O, isArray as R } from "../../../../utils/utils.js";
4
- import ke from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
5
- import he from "../../../KunList/src/components/KunList.vue.js";
6
- import B from "../../../KunListItem/src/components/KunListItem.vue.js";
7
- import F from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
8
- import ye from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
9
- import ge from "../../../KunMenu/src/components/KunMenu.vue.js";
10
- import { useAutocomplete as be } from "../composables/useAutocomplete.js";
11
- import { KunAutocompleteProps as Ce } from "../composables/KunAutocompleteProps.js";
12
- import we from "../../../KunTextField/src/components/KunTextField.vue.js";
13
- import Se from "../../../KunBtn/src/components/KunBtn.vue.js";
14
- import Ve from "../../../KunChip/src/components/KunChip.vue.js";
15
- import C from "../../../KunIcon/src/components/KunIcon.vue.js";
16
- const De = {
3
+ import { isNotEmpty as _, isArray as R } from "../../../../utils/utils.js";
4
+ import he from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
5
+ import ye from "../../../KunList/src/components/KunList.vue.js";
6
+ import O from "../../../KunListItem/src/components/KunListItem.vue.js";
7
+ import B from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
8
+ import ge from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
9
+ import be from "../../../KunMenu/src/components/KunMenu.vue.js";
10
+ import { useAutocomplete as Ce } from "../composables/useAutocomplete.js";
11
+ import { KunAutocompleteProps as we } from "../composables/KunAutocompleteProps.js";
12
+ import Se from "../../../KunTextField/src/components/KunTextField.vue.js";
13
+ import Ve from "../../../KunBtn/src/components/KunBtn.vue.js";
14
+ import De from "../../../KunChip/src/components/KunChip.vue.js";
15
+ import w from "../../../KunIcon/src/components/KunIcon.vue.js";
16
+ const Ie = {
17
17
  key: 0,
18
18
  class: "flex flex-nowrap items-center space-x-1 min-w-3xs max-w-full overflow-x-auto overflow-y-hidden"
19
- }, Ie = { class: "flex items-center" }, Ke = {
19
+ }, Le = { class: "flex items-center" }, Ke = {
20
20
  key: 0,
21
21
  class: "sticky top-0 z-10 p-2 border-b bg-select-background"
22
- }, je = {
22
+ }, He = {
23
23
  __name: "KunAutocomplete",
24
- props: /* @__PURE__ */ $(Ce, {
24
+ props: /* @__PURE__ */ x(we, {
25
25
  modelValue: { default: null },
26
26
  modelModifiers: {},
27
27
  items: { default: [], type: Array, required: !0 },
28
28
  itemsModifiers: {}
29
29
  }),
30
- emits: /* @__PURE__ */ $(["update:modelValue", "selectedItem", "createItem", "validation", "search", "keyDown", "keyDownEnter"], ["update:modelValue", "update:items"]),
31
- setup(w, { expose: T, emit: N }) {
32
- const s = x(w, "modelValue"), m = x(w, "items"), r = w, c = N, {
33
- textFieldRef: p,
34
- listRef: D,
35
- menuModel: d,
30
+ emits: /* @__PURE__ */ x(["update:modelValue", "selectedItem", "createItem", "validation", "search", "keyDown", "keyDownEnter"], ["update:modelValue", "update:items"]),
31
+ setup(S, { expose: F, emit: T }) {
32
+ const s = z(S, "modelValue"), p = z(S, "items"), u = S, m = T, {
33
+ textFieldRef: h,
34
+ listRef: I,
35
+ menuModel: c,
36
36
  search: a,
37
- removeItem: U,
38
- clearSelection: j,
39
- lightReset: H,
40
- openMenu: S,
41
- closeMenu: q,
42
- toggleMenu: P,
43
- onMenuKeydown: W,
44
- getSelectedItem: I,
45
- textArr: G,
46
- getArrayText: J,
47
- isAlphanumeric: Q,
48
- createItem: X,
49
- checkDisabled: Y,
37
+ removeItem: N,
38
+ clearSelection: U,
39
+ lightReset: j,
40
+ openMenu: V,
41
+ closeMenu: H,
42
+ toggleMenu: q,
43
+ onMenuKeydown: P,
44
+ getSelectedItem: L,
45
+ textArr: W,
46
+ getArrayText: G,
47
+ isAlphanumeric: J,
48
+ createItem: Q,
49
+ checkDisabled: X,
50
50
  itemToString: K,
51
- placeholder: Z
52
- } = be(r, c, s, m);
53
- se(() => {
54
- r.focusOnRender && p.value.focus();
51
+ placeholder: Y
52
+ } = Ce(u, m, s, p);
53
+ ie(() => {
54
+ u.focusOnRender && h.value.focus();
55
55
  });
56
- const L = z(null), h = z(""), M = (e) => {
57
- for (const l of r.rules) {
58
- const t = l(e);
56
+ const M = A(null), y = A(""), $ = (l) => {
57
+ for (const n of u.rules) {
58
+ const t = n(l);
59
59
  if (t !== !0)
60
- return h.value = t, c("validation", !1), !1;
60
+ return y.value = t, m("validation", !1), !1;
61
61
  }
62
- return h.value = "", c("validation", !0), !0;
62
+ return y.value = "", m("validation", !0), !0;
63
63
  };
64
- ue(() => s.value, (e, l) => {
65
- O(r.rules) && M(e);
64
+ se(() => s.value, (l, n) => {
65
+ _(u.rules) && $(l);
66
66
  });
67
- function ee() {
68
- var e;
69
- d.value = !1, (e = p.value.inputField) == null || e.focus();
67
+ function Z() {
68
+ var l;
69
+ c.value = !1, (l = h.value.inputField) == null || l.focus();
70
70
  }
71
- function le(e) {
71
+ function ee(l) {
72
72
  var t, f;
73
- const l = e.key;
74
- if (l === "Tab" || l === "Shift" || l === "Escape") {
75
- q(), c("keyDown", l);
73
+ const n = l.key;
74
+ if (n === "Tab" || n === "Shift" || n === "Escape") {
75
+ H(), m("keyDown", n);
76
76
  return;
77
77
  }
78
- (Q(l) || l === "Backspace") && S(), ["ArrowUp", "ArrowDown"].includes(l) && (e.preventDefault(), d.value || S(), (f = (t = D.value) == null ? void 0 : t.focusWithKey) == null || f.call(t, l));
78
+ (J(n) || n === "Backspace") && V(), ["ArrowUp", "ArrowDown"].includes(n) && (l.preventDefault(), c.value || V(), (f = (t = I.value) == null ? void 0 : t.focusWithKey) == null || f.call(t, n));
79
79
  }
80
- function te(e) {
81
- c("search", a);
80
+ function le(l) {
81
+ m("search", a);
82
82
  }
83
- function oe() {
84
- M(s);
83
+ function te() {
84
+ $(s);
85
85
  }
86
- function ne(e) {
87
- W(e);
86
+ function oe(l) {
87
+ P(l);
88
88
  }
89
- function re() {
89
+ function ne() {
90
90
  }
91
- function ae() {
91
+ function re() {
92
92
  if (!a.value) return;
93
- let e = null;
94
- r.returnObject ? e = m.value.find(
95
- (l) => Object.values(l).some(
93
+ let l = null;
94
+ u.returnObject ? l = p.value.find(
95
+ (n) => Object.values(n).some(
96
96
  (t) => String(t).toLowerCase() === String(a.value).toLowerCase()
97
97
  )
98
- ) : r.itemValue ? e = m.value.find(
99
- (l) => String(l[r.itemValue]).toLowerCase() === String(a.value).toLowerCase()
100
- ) : e = m.value.find(
101
- (l) => typeof l == "object" ? Object.values(l).some((t) => String(t).toLowerCase() === String(a.value).toLowerCase()) : String(l).toLowerCase() === String(a.value).toLowerCase()
102
- ), e && (I(e), r.focusOnSelect && A(() => {
103
- var l;
104
- (l = p.value) == null || l.focus();
105
- })), c("keyDownEnter");
98
+ ) : u.itemValue ? l = p.value.find(
99
+ (n) => String(n[u.itemValue]).toLowerCase() === String(a.value).toLowerCase()
100
+ ) : l = p.value.find(
101
+ (n) => typeof n == "object" ? Object.values(n).some((t) => String(t).toLowerCase() === String(a.value).toLowerCase()) : String(n).toLowerCase() === String(a.value).toLowerCase()
102
+ ), l && L(l), m("keyDownEnter", e);
106
103
  }
107
- return T({
108
- focus: () => A(() => {
109
- var e;
110
- return (e = p.value) == null ? void 0 : e.focus();
104
+ return F({
105
+ focus: () => ue(() => {
106
+ var l;
107
+ return (l = h.value) == null ? void 0 : l.focus();
111
108
  })
112
- }), (e, l) => (u(), y("div", {
109
+ }), (l, n) => (d(), g("div", {
113
110
  class: "w-full h-fit",
114
111
  ref_key: "parentRef",
115
- ref: L
112
+ ref: M
116
113
  }, [
117
- i(we, {
114
+ i(Se, {
118
115
  modelValue: o(a),
119
116
  "onUpdate:modelValue": [
120
- l[1] || (l[1] = (t) => _(a) ? a.value = t : null),
121
- te
117
+ n[1] || (n[1] = (t) => E(a) ? a.value = t : null),
118
+ le
122
119
  ],
123
- label: e.label,
120
+ label: l.label,
124
121
  dirty: "",
125
- "hide-details": e.hideDetails,
126
- density: e.density,
122
+ "hide-details": l.hideDetails,
123
+ density: l.density,
127
124
  ref_key: "textFieldRef",
128
- ref: p,
125
+ ref: h,
129
126
  autocomplete: "off",
130
- onFocusInput: oe,
131
- onHandleClick: o(P),
132
- rounded: o(d) ? "rounded-t" : "rounded",
133
- onBlur: re,
127
+ onFocusInput: te,
128
+ onHandleClick: o(q),
129
+ rounded: o(c) ? "rounded-t" : "rounded",
130
+ onBlur: ne,
134
131
  onKeyDown: [
135
- le,
136
- de(E(ae, ["prevent"]), ["enter"])
132
+ ee,
133
+ de(re, ["enter"])
137
134
  ],
138
- placeholder: r.multiple && o(R)(s.value) && s.value.length ? "" : o(Z),
139
- error: !!h.value,
140
- "error-messages": h.value
135
+ placeholder: u.multiple && o(R)(s.value) && s.value.length ? "" : o(Y),
136
+ error: !!y.value,
137
+ "error-messages": y.value
141
138
  }, ce({
142
- "prepend-input-content": n(() => [
143
- o(R)(s.value) && o(O)(s.value) ? (u(), y("div", De, [
144
- (u(!0), y(me, null, pe(s.value, (t) => (u(), v(Ve, {
139
+ "prepend-input-content": r(() => [
140
+ o(R)(s.value) && o(_)(s.value) ? (d(), g("div", Ie, [
141
+ (d(!0), g(fe, null, pe(s.value, (t) => (d(), v(De, {
145
142
  key: t.id ?? t.name,
146
143
  size: "small",
147
144
  variant: "pill"
148
145
  }, {
149
- default: n(() => [
150
- ve("div", Ie, [
151
- b(V(o(J)(t)) + " ", 1),
152
- i(C, {
146
+ default: r(() => [
147
+ ve("div", Le, [
148
+ C(D(o(G)(t)) + " ", 1),
149
+ i(w, {
153
150
  color: "error",
154
151
  icon: o(k).close,
155
152
  size: "small",
156
153
  class: "ml-1",
157
- onClick: (f) => o(U)(t)
154
+ onClick: (f) => o(N)(t)
158
155
  }, null, 8, ["icon", "onClick"])
159
156
  ])
160
157
  ]),
161
158
  _: 2
162
159
  }, 1024))), 128))
163
- ])) : g("", !0)
160
+ ])) : b("", !0)
164
161
  ]),
165
- default: n(() => [
166
- i(ge, {
162
+ default: r(() => [
163
+ i(be, {
167
164
  transition: "fade",
168
- "onClick:outside": o(H),
169
- modelValue: o(d),
170
- "onUpdate:modelValue": l[0] || (l[0] = (t) => _(d) ? d.value = t : null),
165
+ "onClick:outside": o(j),
166
+ modelValue: o(c),
167
+ "onUpdate:modelValue": n[0] || (n[0] = (t) => E(c) ? c.value = t : null),
171
168
  activator: "parent",
172
- "z-index": e.zIndex,
173
- "parent-ref": L.value,
174
- origin: e.menuOrigin,
175
- onHandleEscape: ee,
176
- bgColor: e.bgMenuColor,
177
- "close-on-content-click": e.closeOnSelect,
169
+ "z-index": l.zIndex,
170
+ "parent-ref": M.value,
171
+ origin: l.menuOrigin,
172
+ onHandleEscape: Z,
173
+ bgColor: l.bgMenuColor,
174
+ "close-on-content-click": l.closeOnSelect,
178
175
  width: "w-full",
179
- "max-height": e.maxHeight,
180
- "hide-details": e.hideDetails
176
+ "max-height": l.maxHeight,
177
+ "hide-details": l.hideDetails
181
178
  }, {
182
- default: n(() => [
183
- e.hasCreateItem ? (u(), y("div", Ke, [
184
- i(Se, {
185
- onClick: o(X),
186
- bgColor: e.btnCreateBg,
187
- class: fe(e.btnCreateClass)
179
+ default: r(() => [
180
+ l.hasCreateItem ? (d(), g("div", Ke, [
181
+ i(Ve, {
182
+ onClick: o(Q),
183
+ bgColor: l.btnCreateBg,
184
+ class: me(l.btnCreateClass)
188
185
  }, {
189
- default: n(() => [
190
- b(V(e.btnCreateText), 1)
186
+ default: r(() => [
187
+ C(D(l.btnCreateText), 1)
191
188
  ]),
192
189
  _: 1
193
190
  }, 8, ["onClick", "bgColor", "class"])
194
- ])) : g("", !0),
195
- i(he, {
196
- "onClick:select": o(I),
191
+ ])) : b("", !0),
192
+ i(ye, {
193
+ "onClick:select": o(L),
197
194
  ref_key: "listRef",
198
- ref: D,
199
- onKeyDown: ne,
195
+ ref: I,
196
+ onKeyDown: oe,
200
197
  selectable: !0
201
198
  }, {
202
- default: n(() => [
203
- i(ke, {
204
- items: m.value,
199
+ default: r(() => [
200
+ i(he, {
201
+ items: p.value,
205
202
  search: o(a),
206
- "searchable-keys": r.searchableKeys,
203
+ "searchable-keys": u.searchableKeys,
207
204
  virtual: !1,
208
205
  "items-per-intersection": 10,
209
- enabled: o(d),
206
+ enabled: o(c),
210
207
  "item-height": 48
211
208
  }, {
212
- default: n(({ item: t, index: f, empty: ie }) => [
213
- !ie && t != null ? (u(), v(B, {
209
+ default: r(({ item: t, index: f, empty: ae }) => [
210
+ !ae && t != null ? (d(), v(O, {
214
211
  value: t,
215
212
  key: `kun-list-${f + 1}`,
216
213
  id: `kun-item-${f + 1}`,
217
- disabled: o(Y)(t),
218
- "bg-items": e.bgItemListColor,
219
- "hover-bg": e.hoverItemListColor,
220
- activeClass: e.selectedItemListColor,
221
- density: e.density,
214
+ disabled: o(X)(t),
215
+ "bg-items": l.bgItemListColor,
216
+ "hover-bg": l.hoverItemListColor,
217
+ activeClass: l.selectedItemListColor,
218
+ density: l.density,
222
219
  selectable: !0
223
220
  }, {
224
- default: n(() => [
225
- i(F, { class: "text-wrap" }, {
226
- default: n(() => [
227
- b(V(o(K)(t, e.itemTitle ?? o(G), "hasDefault")), 1)
221
+ default: r(() => [
222
+ i(B, { class: "text-wrap" }, {
223
+ default: r(() => [
224
+ C(D(o(K)(t, l.itemTitle ?? o(W), "hasDefault")), 1)
228
225
  ]),
229
226
  _: 2
230
227
  }, 1024),
231
- i(ye, {
232
- text: e.itemSubtitle ? o(K)(t, e.itemSubtitle) : ""
228
+ i(ge, {
229
+ text: l.itemSubtitle ? o(K)(t, l.itemSubtitle) : ""
233
230
  }, null, 8, ["text"])
234
231
  ]),
235
232
  _: 2
236
- }, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (u(), v(B, {
233
+ }, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (d(), v(O, {
237
234
  key: 1,
238
235
  disabled: ""
239
236
  }, {
240
- default: n(() => [
241
- i(F, { class: "text-center w-full text-gray-500" }, {
242
- default: n(() => l[2] || (l[2] = [
243
- b(" No hay elementos disponibles ")
237
+ default: r(() => [
238
+ i(B, { class: "text-center w-full text-gray-500" }, {
239
+ default: r(() => n[2] || (n[2] = [
240
+ C(" No hay elementos disponibles ")
244
241
  ])),
245
242
  _: 1,
246
243
  __: [2]
@@ -260,38 +257,38 @@ const De = {
260
257
  ]),
261
258
  _: 2
262
259
  }, [
263
- e.hasIcons ? {
260
+ l.hasIcons ? {
264
261
  name: "append-inner",
265
- fn: n(() => [
266
- e.clearable && s.value ? (u(), v(C, {
262
+ fn: r(() => [
263
+ l.clearable && s.value ? (d(), v(w, {
267
264
  key: 0,
268
- onClick: o(j),
265
+ onClick: o(U),
269
266
  size: "small",
270
267
  color: "error",
271
268
  icon: o(k).close,
272
269
  class: "mr-1 mt-1"
273
- }, null, 8, ["onClick", "icon"])) : g("", !0),
274
- i(C, {
270
+ }, null, 8, ["onClick", "icon"])) : b("", !0),
271
+ i(w, {
275
272
  color: "teal-darken-1",
276
273
  size: "large",
277
274
  class: "cursor-pointer",
278
- icon: o(d) ? o(k).menuUpOutline : o(k).menuDownOutline,
279
- onClick: E(o(S), ["stop"])
275
+ icon: o(c) ? o(k).menuUpOutline : o(k).menuDownOutline,
276
+ onClick: ke(o(V), ["stop"])
280
277
  }, null, 8, ["icon", "onClick"]),
281
- e.required ? (u(), v(C, {
278
+ l.required ? (d(), v(w, {
282
279
  key: 1,
283
280
  color: "teal-darken-1",
284
281
  size: "x-small",
285
282
  class: "mb-4",
286
283
  icon: o(k).asterisk
287
- }, null, 8, ["icon"])) : g("", !0)
284
+ }, null, 8, ["icon"])) : b("", !0)
288
285
  ]),
289
286
  key: "0"
290
287
  } : void 0
291
- ]), 1032, ["modelValue", "label", "hide-details", "density", "onHandleClick", "rounded", "onKeyDown", "placeholder", "error", "error-messages"])
288
+ ]), 1032, ["modelValue", "label", "hide-details", "density", "onHandleClick", "rounded", "placeholder", "error", "error-messages"])
292
289
  ], 512));
293
290
  }
294
291
  };
295
292
  export {
296
- je as default
293
+ He as default
297
294
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.491",
3
+ "version": "0.1.492",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",