adverich-kun-ui 0.1.350 → 0.1.352

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