adverich-kun-ui 0.1.68 → 0.1.69

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,24 +1,24 @@
1
- import { mergeModels as R, useModel as E, onMounted as oe, ref as U, watch as ne, createBlock as d, openBlock as i, unref as e, isRef as z, createSlots as re, withCtx as r, createElementBlock as L, createCommentVNode as g, createVNode as a, Fragment as ie, renderList as ae, createElementVNode as se, createTextVNode as b, toDisplayString as V, normalizeClass as ue } from "vue";
1
+ import { mergeModels as R, useModel as B, onMounted as ne, ref as E, watch as re, createBlock as c, openBlock as i, unref as e, isRef as L, createSlots as ie, withCtx as r, createElementBlock as U, createCommentVNode as h, createVNode as a, Fragment as ae, renderList as se, createElementVNode as ue, createTextVNode as b, toDisplayString as V, normalizeClass as de } from "vue";
2
2
  import { icons as p } from "../../../../icons/index.js";
3
- import { isNotEmpty as ce, isArray as B } from "../../../../utils/utils.js";
4
- import de from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
5
- import me from "../../../KunList/src/components/KunList.vue.js";
3
+ import { isNotEmpty as ce, isArray as z } 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
6
  import F from "../../../KunListItem/src/components/KunListItem.vue.js";
7
- import fe from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
8
- import pe from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
9
- import ye from "../../../kunMenu/src/components/kunMenu.vue.js";
10
- import { useAutocomplete as ve } from "../composables/useAutocomplete.js";
11
- import { KunAutocompleteProps as ke } from "../composables/KunAutocompleteProps.js";
7
+ import pe from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
8
+ import ye from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
9
+ import ve from "../../../kunMenu/src/components/kunMenu.vue.js";
10
+ import { useAutocomplete as ke } from "../composables/useAutocomplete.js";
11
+ import { KunAutocompleteProps as he } from "../composables/KunAutocompleteProps.js";
12
12
  import ge from "../../../KunTextField/src/components/KunTextField.vue.js";
13
- import he from "../../../KunBtn/src/components/KunBtn.vue.js";
14
- import Ce from "../../../KunChip/src/components/KunChip.vue.js";
15
- import h from "../../../KunIcon/src/components/KunIcon.vue.js";
16
- const be = {
13
+ import Ce from "../../../KunBtn/src/components/KunBtn.vue.js";
14
+ import be from "../../../KunChip/src/components/KunChip.vue.js";
15
+ import g from "../../../KunIcon/src/components/KunIcon.vue.js";
16
+ const Ve = {
17
17
  key: 0,
18
18
  class: "flex justify-center align-center"
19
- }, Ve = { class: "flex justify-center align-center" }, Be = {
19
+ }, $e = { class: "flex justify-center align-center" }, Fe = {
20
20
  __name: "KunAutocomplete",
21
- props: /* @__PURE__ */ R(ke, {
21
+ props: /* @__PURE__ */ R(he, {
22
22
  modelValue: { default: null },
23
23
  modelModifiers: {},
24
24
  items: { default: [], type: Array, required: !0 },
@@ -26,33 +26,33 @@ const be = {
26
26
  }),
27
27
  emits: /* @__PURE__ */ R(["createItem", "validation", "search"], ["update:modelValue", "update:items"]),
28
28
  setup(C, { emit: N }) {
29
- const s = E(C, "modelValue"), $ = E(C, "items"), n = C, y = N, {
29
+ const s = B(C, "modelValue"), $ = B(C, "items"), n = C, y = N, {
30
30
  selectedItem: m,
31
31
  textFieldRef: u,
32
32
  listRef: v,
33
- menuModel: c,
33
+ menuModel: d,
34
34
  search: f,
35
35
  removeItem: T,
36
36
  clearSelection: H,
37
- lightReset: x,
37
+ lightReset: S,
38
38
  openMenu: O,
39
- onMenuKeydown: S,
39
+ onMenuKeydown: w,
40
40
  getSelectedItem: P,
41
41
  textArr: j,
42
42
  getItemText: q,
43
43
  createItem: W,
44
44
  checkDisabled: G,
45
- itemToString: w,
46
- placeholder: _,
45
+ itemToString: x,
46
+ placeholder: I,
47
47
  hasCreateItem: J
48
- } = ve(n, y, s, $);
49
- oe(() => {
48
+ } = ke(n, y, s, $);
49
+ ne(() => {
50
50
  Y(), n.focusOnRender && u.value.focus();
51
51
  });
52
52
  function Q(t) {
53
- return s.value === null || s.value === void 0 ? n.bgItemListColor : n.multiple ? s.value.find((o) => o[n.itemValue] === t[n.itemValue]) ? n.selectedColor : n.bgItemListColor : _.value === t[n.itemTitle] ? n.selectedColor : n.bgItemListColor;
53
+ return s.value === null || s.value === void 0 ? n.bgItemListColor : n.multiple ? s.value.find((o) => o[n.itemValue] === t[n.itemValue]) ? n.selectedColor : n.bgItemListColor : I.value === t[n.itemTitle] ? n.selectedColor : n.bgItemListColor;
54
54
  }
55
- const k = U(""), I = (t) => {
55
+ const k = E(""), _ = (t) => {
56
56
  for (const o of n.rules) {
57
57
  const l = o(t);
58
58
  if (l !== !0)
@@ -60,16 +60,16 @@ const be = {
60
60
  }
61
61
  return k.value = "", y("validation", !0), !0;
62
62
  };
63
- ne(() => s.value, (t, o) => {
64
- ce(n.rules) && I(t);
63
+ re(() => s.value, (t, o) => {
64
+ ce(n.rules) && _(t);
65
65
  });
66
66
  function K() {
67
- c.value = !1, u.value.$el.focus();
67
+ d.value = !1, u.value.$el.focus();
68
68
  }
69
69
  function X(t) {
70
70
  y("search", f);
71
71
  }
72
- const M = U({});
72
+ const M = E({});
73
73
  function Y() {
74
74
  if (u.value) {
75
75
  const t = u.value.$el.getBoundingClientRect();
@@ -85,7 +85,7 @@ const be = {
85
85
  }
86
86
  }
87
87
  function Z() {
88
- I(s), c.value = !0;
88
+ _(s);
89
89
  }
90
90
  function ee(t) {
91
91
  const o = t.key;
@@ -98,20 +98,23 @@ const be = {
98
98
  v.value.focusWithKey(o);
99
99
  return;
100
100
  }
101
- S(t);
101
+ w(t);
102
102
  }
103
103
  function te(t) {
104
- S(t);
104
+ w(t);
105
105
  }
106
- return (t, o) => (i(), d(ge, {
106
+ function le() {
107
+ d.value = !1;
108
+ }
109
+ return (t, o) => (i(), c(ge, {
107
110
  modelValue: e(f),
108
111
  "onUpdate:modelValue": [
109
- o[3] || (o[3] = (l) => z(f) ? f.value = l : null),
112
+ o[3] || (o[3] = (l) => L(f) ? f.value = l : null),
110
113
  X
111
114
  ],
112
115
  label: t.label,
113
116
  dirty: "",
114
- "hide-details": !0,
117
+ "hide-details": t.hideDetails,
115
118
  density: t.density,
116
119
  ref_key: "textFieldRef",
117
120
  ref: u,
@@ -119,37 +122,38 @@ const be = {
119
122
  onKeyDown: ee,
120
123
  onFocusInput: Z,
121
124
  onHandleClick: e(O),
122
- placeholder: e(B)(e(m)) && e(m).length ? "" : e(_),
125
+ onBlurInput: le,
126
+ placeholder: e(z)(e(m)) && e(m).length ? "" : e(I),
123
127
  error: !!k.value,
124
128
  "error-messages": k.value
125
- }, re({
129
+ }, ie({
126
130
  default: r(() => [
127
- e(B)(e(m)) ? (i(), L("div", be, [
128
- (i(!0), L(ie, null, ae(e(m), (l) => (i(), d(Ce, {
131
+ e(z)(e(m)) ? (i(), U("div", Ve, [
132
+ (i(!0), U(ae, null, se(e(m), (l) => (i(), c(be, {
129
133
  key: l.id ?? l.name,
130
134
  size: "small",
131
135
  class: "ml-1"
132
136
  }, {
133
137
  default: r(() => [
134
- se("div", Ve, [
138
+ ue("div", $e, [
135
139
  b(V(e(q)(l, t.itemTitle)) + " ", 1),
136
- a(h, {
140
+ a(g, {
137
141
  color: "error",
138
142
  icon: e(p).close,
139
143
  size: "small",
140
144
  class: "ml-1",
141
- onClick: (le) => e(T)(l)
145
+ onClick: (oe) => e(T)(l)
142
146
  }, null, 8, ["icon", "onClick"])
143
147
  ])
144
148
  ]),
145
149
  _: 2
146
150
  }, 1024))), 128))
147
- ])) : g("", !0),
148
- a(ye, {
151
+ ])) : h("", !0),
152
+ a(ve, {
149
153
  transition: "fade",
150
- "onClick:outside": o[1] || (o[1] = (l) => e(x)()),
151
- modelValue: e(c),
152
- "onUpdate:modelValue": o[2] || (o[2] = (l) => z(c) ? c.value = l : null),
154
+ "onClick:outside": o[1] || (o[1] = (l) => e(S)()),
155
+ modelValue: e(d),
156
+ "onUpdate:modelValue": o[2] || (o[2] = (l) => L(d) ? d.value = l : null),
153
157
  activator: "parent",
154
158
  "text-field-ref": e(u),
155
159
  onHandleEscape: K,
@@ -158,17 +162,17 @@ const be = {
158
162
  menuPositionStyle: M.value
159
163
  }, {
160
164
  default: r(() => [
161
- a(me, {
165
+ a(fe, {
162
166
  "onUpdate:selected": e(P),
163
- "onClick:select": o[0] || (o[0] = (l) => e(x)()),
167
+ "onClick:select": o[0] || (o[0] = (l) => e(S)()),
164
168
  ref_key: "listRef",
165
169
  ref: v,
166
170
  onKeyDown: te
167
171
  }, {
168
172
  default: r(() => [
169
- e(J) ? (i(), d(F, { key: 0 }, {
173
+ e(J) ? (i(), c(F, { key: 0 }, {
170
174
  default: r(() => [
171
- a(he, {
175
+ a(Ce, {
172
176
  onClick: e(W),
173
177
  class: "w-full",
174
178
  color: "bg-green-400"
@@ -181,36 +185,36 @@ const be = {
181
185
  }, 8, ["onClick"])
182
186
  ]),
183
187
  _: 1
184
- })) : g("", !0),
185
- a(de, {
188
+ })) : h("", !0),
189
+ a(me, {
186
190
  items: $.value,
187
191
  search: e(f),
188
192
  "searchable-keys": n.searchableKeys,
189
193
  "items-per-intersection": 10,
190
- enabled: e(c),
194
+ enabled: e(d),
191
195
  virtual: !1,
192
196
  "item-height": 48
193
197
  }, {
194
- default: r(({ item: l, index: le }) => {
195
- var A, D;
198
+ default: r(({ item: l, index: oe }) => {
199
+ var D, A;
196
200
  return [
197
- (i(), d(F, {
201
+ (i(), c(F, {
198
202
  value: l,
199
- key: ((A = l.id) == null ? void 0 : A.toString()) ?? l.name,
203
+ key: ((D = l.id) == null ? void 0 : D.toString()) ?? l.name,
200
204
  disabled: e(G)(l),
201
- class: ue(Q(l)),
205
+ class: de(Q(l)),
202
206
  density: t.density,
203
- id: ((D = l.id) == null ? void 0 : D.toString()) ?? l.name
207
+ id: ((A = l.id) == null ? void 0 : A.toString()) ?? l.name
204
208
  }, {
205
209
  default: r(() => [
206
- a(fe, { class: "text-wrap" }, {
210
+ a(pe, { class: "text-wrap" }, {
207
211
  default: r(() => [
208
- b(V(e(w)(l, e(j), "hasDefault")), 1)
212
+ b(V(e(x)(l, e(j), "hasDefault")), 1)
209
213
  ]),
210
214
  _: 2
211
215
  }, 1024),
212
- a(pe, {
213
- textContent: V(t.itemSubtitle ? e(w)(l, t.itemSubtitle) : "")
216
+ a(ye, {
217
+ textContent: V(t.itemSubtitle ? e(x)(l, t.itemSubtitle) : "")
214
218
  }, null, 8, ["textContent"])
215
219
  ]),
216
220
  _: 2
@@ -231,33 +235,33 @@ const be = {
231
235
  t.hasIcons ? {
232
236
  name: "append-inner",
233
237
  fn: r(() => [
234
- t.clearable && e(m) ? (i(), d(h, {
238
+ t.clearable && e(m) ? (i(), c(g, {
235
239
  key: 0,
236
240
  onClick: e(H),
237
241
  size: "small",
238
242
  color: "error",
239
243
  icon: e(p).close,
240
244
  class: "mr-1 mt-1"
241
- }, null, 8, ["onClick", "icon"])) : g("", !0),
242
- a(h, {
245
+ }, null, 8, ["onClick", "icon"])) : h("", !0),
246
+ a(g, {
243
247
  color: "teal-darken-1",
244
248
  size: "large",
245
249
  class: "cursor-pointer",
246
250
  icon: e(v) ? e(p).menuUpOutline : e(p).menuDownOutline
247
251
  }, null, 8, ["icon"]),
248
- t.required ? (i(), d(h, {
252
+ t.required ? (i(), c(g, {
249
253
  key: 1,
250
254
  color: "teal-darken-1",
251
255
  size: "x-small",
252
256
  class: "mb-4",
253
257
  icon: e(p).asterisk
254
- }, null, 8, ["icon"])) : g("", !0)
258
+ }, null, 8, ["icon"])) : h("", !0)
255
259
  ]),
256
260
  key: "0"
257
261
  } : void 0
258
- ]), 1032, ["modelValue", "label", "density", "onHandleClick", "placeholder", "error", "error-messages"]));
262
+ ]), 1032, ["modelValue", "label", "hide-details", "density", "onHandleClick", "placeholder", "error", "error-messages"]));
259
263
  }
260
264
  };
261
265
  export {
262
- Be as default
266
+ Fe as default
263
267
  };
@@ -83,7 +83,7 @@ function W(u, C, l, h, G) {
83
83
  u.clearSearchOnSelect && (c.value = ""), u.focusOnSelect && j();
84
84
  }
85
85
  function m() {
86
- v.value || (v.value = !0);
86
+ v.value = !v.value;
87
87
  }
88
88
  function A(e) {
89
89
  return e.length === 1 && e.match(/\w/);
@@ -88,7 +88,7 @@ const H = { class: "w-full flex flex-col relative" }, q = {
88
88
  readonly: e.readonly,
89
89
  maxlength: e.maxlength,
90
90
  autocomplete: "off",
91
- class: "w-full h-full bg-transparent focus:outline-none p-2",
91
+ class: "w-full h-full bg-transparent focus:outline-none p-3",
92
92
  "aria-invalid": t(u) ? "true" : "false",
93
93
  "aria-describedby": t(u) ? `error-${p}` : null,
94
94
  onInput: l[0] || (l[0] = (...n) => t(k) && t(k)(...n)),
@@ -1,7 +1,7 @@
1
- import { ref as n, inject as V, computed as x, watch as g, onUnmounted as E } from "vue";
1
+ import { ref as n, inject as V, computed as x, watch as F, onUnmounted as E } from "vue";
2
2
  import { debounce as T } from "../../../../utils/utils.js";
3
- function M(u, r) {
4
- const t = n(u.modelValue), o = n(!1), l = n(""), a = n(!1), F = n(null), s = n(!1), d = V("registerField", null), v = V("unregisterField", null), h = x(() => u.error || !!l.value && a.value || u.errorMessage), c = async () => {
3
+ function P(u, r) {
4
+ const t = n(u.modelValue), o = n(!1), l = n(""), a = n(!1), g = n(null), s = n(!1), d = V("registerField", null), v = V("unregisterField", null), h = x(() => u.error || !!l.value && a.value || !0), c = async () => {
5
5
  for (const e of u.rules) {
6
6
  const m = await Promise.resolve(e(t.value));
7
7
  if (m !== !0) return m;
@@ -11,9 +11,9 @@ function M(u, r) {
11
11
  const e = await c();
12
12
  l.value = e === !0 ? "" : e;
13
13
  }, u.debounce ?? 300);
14
- g(() => u.modelValue, (e) => {
14
+ F(() => u.modelValue, (e) => {
15
15
  e !== t.value && (s.value = !0, t.value = e);
16
- }), g(t, () => {
16
+ }), F(t, () => {
17
17
  if (s.value) {
18
18
  s.value = !1;
19
19
  return;
@@ -43,7 +43,7 @@ function M(u, r) {
43
43
  return d && d({ validate: i }), E(() => {
44
44
  v && v({ validate: i });
45
45
  }), {
46
- inputField: F,
46
+ inputField: g,
47
47
  inputValue: t,
48
48
  inputFocused: o,
49
49
  validationError: l,
@@ -58,5 +58,5 @@ function M(u, r) {
58
58
  };
59
59
  }
60
60
  export {
61
- M as default
61
+ P as default
62
62
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.68",
3
+ "version": "0.1.69",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",