adverich-kun-ui 0.1.460 → 0.1.462

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